author | Florian Pose <fp@igh-essen.com> |
Wed, 02 Jul 2008 14:41:29 +0000 | |
changeset 1084 | 1c0edf99def0 |
parent 583 | 172d42146930 |
permissions | -rw-r--r-- |
583
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1 |
/* |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2 |
* forcedeth: Ethernet driver for NVIDIA nForce media access controllers. |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3 |
* |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4 |
* Note: This driver is a cleanroom reimplementation based on reverse |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5 |
* engineered documentation written by Carl-Daniel Hailfinger |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6 |
* and Andrew de Quincey. It's neither supported nor endorsed |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7 |
* by NVIDIA Corp. Use at your own risk. |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8 |
* |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
9 |
* NVIDIA, nForce and other NVIDIA marks are trademarks or registered |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
10 |
* trademarks of NVIDIA Corporation in the United States and other |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
11 |
* countries. |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
12 |
* |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
13 |
* Copyright (C) 2003,4,5 Manfred Spraul |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
14 |
* Copyright (C) 2004 Andrew de Quincey (wol support) |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
15 |
* Copyright (C) 2004 Carl-Daniel Hailfinger (invalid MAC handling, insane |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
16 |
* IRQ rate fixes, bigendian fixes, cleanups, verification) |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
17 |
* Copyright (c) 2004 NVIDIA Corporation |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
18 |
* |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
19 |
* This program is free software; you can redistribute it and/or modify |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
20 |
* it under the terms of the GNU General Public License as published by |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
21 |
* the Free Software Foundation; either version 2 of the License, or |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
22 |
* (at your option) any later version. |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
23 |
* |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
24 |
* This program is distributed in the hope that it will be useful, |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
25 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
26 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
27 |
* GNU General Public License for more details. |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
28 |
* |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
29 |
* You should have received a copy of the GNU General Public License |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
30 |
* along with this program; if not, write to the Free Software |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
31 |
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
32 |
* |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
33 |
* Changelog: |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
34 |
* 0.01: 05 Oct 2003: First release that compiles without warnings. |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
35 |
* 0.02: 05 Oct 2003: Fix bug for nv_drain_tx: do not try to free NULL skbs. |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
36 |
* Check all PCI BARs for the register window. |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
37 |
* udelay added to mii_rw. |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
38 |
* 0.03: 06 Oct 2003: Initialize dev->irq. |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
39 |
* 0.04: 07 Oct 2003: Initialize np->lock, reduce handled irqs, add printks. |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
40 |
* 0.05: 09 Oct 2003: printk removed again, irq status print tx_timeout. |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
41 |
* 0.06: 10 Oct 2003: MAC Address read updated, pff flag generation updated, |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
42 |
* irq mask updated |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
43 |
* 0.07: 14 Oct 2003: Further irq mask updates. |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
44 |
* 0.08: 20 Oct 2003: rx_desc.Length initialization added, nv_alloc_rx refill |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
45 |
* added into irq handler, NULL check for drain_ring. |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
46 |
* 0.09: 20 Oct 2003: Basic link speed irq implementation. Only handle the |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
47 |
* requested interrupt sources. |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
48 |
* 0.10: 20 Oct 2003: First cleanup for release. |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
49 |
* 0.11: 21 Oct 2003: hexdump for tx added, rx buffer sizes increased. |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
50 |
* MAC Address init fix, set_multicast cleanup. |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
51 |
* 0.12: 23 Oct 2003: Cleanups for release. |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
52 |
* 0.13: 25 Oct 2003: Limit for concurrent tx packets increased to 10. |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
53 |
* Set link speed correctly. start rx before starting |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
54 |
* tx (nv_start_rx sets the link speed). |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
55 |
* 0.14: 25 Oct 2003: Nic dependant irq mask. |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
56 |
* 0.15: 08 Nov 2003: fix smp deadlock with set_multicast_list during |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
57 |
* open. |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
58 |
* 0.16: 15 Nov 2003: include file cleanup for ppc64, rx buffer size |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
59 |
* increased to 1628 bytes. |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
60 |
* 0.17: 16 Nov 2003: undo rx buffer size increase. Substract 1 from |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
61 |
* the tx length. |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
62 |
* 0.18: 17 Nov 2003: fix oops due to late initialization of dev_stats |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
63 |
* 0.19: 29 Nov 2003: Handle RxNoBuf, detect & handle invalid mac |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
64 |
* addresses, really stop rx if already running |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
65 |
* in nv_start_rx, clean up a bit. |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
66 |
* 0.20: 07 Dec 2003: alloc fixes |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
67 |
* 0.21: 12 Jan 2004: additional alloc fix, nic polling fix. |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
68 |
* 0.22: 19 Jan 2004: reprogram timer to a sane rate, avoid lockup |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
69 |
* on close. |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
70 |
* 0.23: 26 Jan 2004: various small cleanups |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
71 |
* 0.24: 27 Feb 2004: make driver even less anonymous in backtraces |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
72 |
* 0.25: 09 Mar 2004: wol support |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
73 |
* 0.26: 03 Jun 2004: netdriver specific annotation, sparse-related fixes |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
74 |
* 0.27: 19 Jun 2004: Gigabit support, new descriptor rings, |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
75 |
* added CK804/MCP04 device IDs, code fixes |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
76 |
* for registers, link status and other minor fixes. |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
77 |
* 0.28: 21 Jun 2004: Big cleanup, making driver mostly endian safe |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
78 |
* 0.29: 31 Aug 2004: Add backup timer for link change notification. |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
79 |
* 0.30: 25 Sep 2004: rx checksum support for nf 250 Gb. Add rx reset |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
80 |
* into nv_close, otherwise reenabling for wol can |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
81 |
* cause DMA to kfree'd memory. |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
82 |
* 0.31: 14 Nov 2004: ethtool support for getting/setting link |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
83 |
* capabilities. |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
84 |
* 0.32: 16 Apr 2005: RX_ERROR4 handling added. |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
85 |
* 0.33: 16 May 2005: Support for MCP51 added. |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
86 |
* 0.34: 18 Jun 2005: Add DEV_NEED_LINKTIMER to all nForce nics. |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
87 |
* 0.35: 26 Jun 2005: Support for MCP55 added. |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
88 |
* 0.36: 28 Jun 2005: Add jumbo frame support. |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
89 |
* 0.37: 10 Jul 2005: Additional ethtool support, cleanup of pci id list |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
90 |
* 0.38: 16 Jul 2005: tx irq rewrite: Use global flags instead of |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
91 |
* per-packet flags. |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
92 |
* 0.39: 18 Jul 2005: Add 64bit descriptor support. |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
93 |
* 0.40: 19 Jul 2005: Add support for mac address change. |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
94 |
* 0.41: 30 Jul 2005: Write back original MAC in nv_close instead |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
95 |
* of nv_remove |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
96 |
* 0.42: 06 Aug 2005: Fix lack of link speed initialization |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
97 |
* in the second (and later) nv_open call |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
98 |
* 0.43: 10 Aug 2005: Add support for tx checksum. |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
99 |
* 0.44: 20 Aug 2005: Add support for scatter gather and segmentation. |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
100 |
* 0.45: 18 Sep 2005: Remove nv_stop/start_rx from every link check |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
101 |
* 0.46: 20 Oct 2005: Add irq optimization modes. |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
102 |
* 0.47: 26 Oct 2005: Add phyaddr 0 in phy scan. |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
103 |
* 0.48: 24 Dec 2005: Disable TSO, bugfix for pci_map_single |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
104 |
* 0.49: 10 Dec 2005: Fix tso for large buffers. |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
105 |
* 0.50: 20 Jan 2006: Add 8021pq tagging support. |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
106 |
* 0.51: 20 Jan 2006: Add 64bit consistent memory allocation for rings. |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
107 |
* 0.52: 20 Jan 2006: Add MSI/MSIX support. |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
108 |
* 0.53: 19 Mar 2006: Fix init from low power mode and add hw reset. |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
109 |
* 0.54: 21 Mar 2006: Fix spin locks for multi irqs and cleanup. |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
110 |
* 0.55: 22 Mar 2006: Add flow control (pause frame). |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
111 |
* 0.56: 22 Mar 2006: Additional ethtool config and moduleparam support. |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
112 |
* 0.57: 14 May 2006: Mac address set in probe/remove and order corrections. |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
113 |
* |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
114 |
* Known bugs: |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
115 |
* We suspect that on some hardware no TX done interrupts are generated. |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
116 |
* This means recovery from netif_stop_queue only happens if the hw timer |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
117 |
* interrupt fires (100 times/second, configurable with NVREG_POLL_DEFAULT) |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
118 |
* and the timer is active in the IRQMask, or if a rx packet arrives by chance. |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
119 |
* If your hardware reliably generates tx done interrupts, then you can remove |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
120 |
* DEV_NEED_TIMERIRQ from the driver_data flags. |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
121 |
* DEV_NEED_TIMERIRQ will not harm you on sane hardware, only generating a few |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
122 |
* superfluous timer interrupts from the nic. |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
123 |
*/ |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
124 |
#ifdef CONFIG_FORCEDETH_NAPI |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
125 |
#define DRIVERNAPI "-NAPI" |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
126 |
#else |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
127 |
#define DRIVERNAPI |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
128 |
#endif |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
129 |
#define FORCEDETH_VERSION "0.57" |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
130 |
#define DRV_NAME "forcedeth" |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
131 |
|
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
132 |
#include <linux/module.h> |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
133 |
#include <linux/types.h> |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
134 |
#include <linux/pci.h> |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
135 |
#include <linux/interrupt.h> |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
136 |
#include <linux/netdevice.h> |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
137 |
#include <linux/etherdevice.h> |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
138 |
#include <linux/delay.h> |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
139 |
#include <linux/spinlock.h> |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
140 |
#include <linux/ethtool.h> |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
141 |
#include <linux/timer.h> |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
142 |
#include <linux/skbuff.h> |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
143 |
#include <linux/mii.h> |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
144 |
#include <linux/random.h> |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
145 |
#include <linux/init.h> |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
146 |
#include <linux/if_vlan.h> |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
147 |
#include <linux/dma-mapping.h> |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
148 |
|
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
149 |
#include <asm/irq.h> |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
150 |
#include <asm/io.h> |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
151 |
#include <asm/uaccess.h> |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
152 |
#include <asm/system.h> |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
153 |
|
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
154 |
#if 0 |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
155 |
#define dprintk printk |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
156 |
#else |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
157 |
#define dprintk(x...) do { } while (0) |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
158 |
#endif |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
159 |
|
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
160 |
|
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
161 |
/* |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
162 |
* Hardware access: |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
163 |
*/ |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
164 |
|
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
165 |
#define DEV_NEED_TIMERIRQ 0x0001 /* set the timer irq flag in the irq mask */ |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
166 |
#define DEV_NEED_LINKTIMER 0x0002 /* poll link settings. Relies on the timer irq */ |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
167 |
#define DEV_HAS_LARGEDESC 0x0004 /* device supports jumbo frames and needs packet format 2 */ |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
168 |
#define DEV_HAS_HIGH_DMA 0x0008 /* device supports 64bit dma */ |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
169 |
#define DEV_HAS_CHECKSUM 0x0010 /* device supports tx and rx checksum offloads */ |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
170 |
#define DEV_HAS_VLAN 0x0020 /* device supports vlan tagging and striping */ |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
171 |
#define DEV_HAS_MSI 0x0040 /* device supports MSI */ |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
172 |
#define DEV_HAS_MSI_X 0x0080 /* device supports MSI-X */ |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
173 |
#define DEV_HAS_POWER_CNTRL 0x0100 /* device supports power savings */ |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
174 |
#define DEV_HAS_PAUSEFRAME_TX 0x0200 /* device supports tx pause frames */ |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
175 |
#define DEV_HAS_STATISTICS 0x0400 /* device supports hw statistics */ |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
176 |
#define DEV_HAS_TEST_EXTENDED 0x0800 /* device supports extended diagnostic test */ |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
177 |
|
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
178 |
enum { |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
179 |
NvRegIrqStatus = 0x000, |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
180 |
#define NVREG_IRQSTAT_MIIEVENT 0x040 |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
181 |
#define NVREG_IRQSTAT_MASK 0x1ff |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
182 |
NvRegIrqMask = 0x004, |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
183 |
#define NVREG_IRQ_RX_ERROR 0x0001 |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
184 |
#define NVREG_IRQ_RX 0x0002 |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
185 |
#define NVREG_IRQ_RX_NOBUF 0x0004 |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
186 |
#define NVREG_IRQ_TX_ERR 0x0008 |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
187 |
#define NVREG_IRQ_TX_OK 0x0010 |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
188 |
#define NVREG_IRQ_TIMER 0x0020 |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
189 |
#define NVREG_IRQ_LINK 0x0040 |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
190 |
#define NVREG_IRQ_RX_FORCED 0x0080 |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
191 |
#define NVREG_IRQ_TX_FORCED 0x0100 |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
192 |
#define NVREG_IRQMASK_THROUGHPUT 0x00df |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
193 |
#define NVREG_IRQMASK_CPU 0x0040 |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
194 |
#define NVREG_IRQ_TX_ALL (NVREG_IRQ_TX_ERR|NVREG_IRQ_TX_OK|NVREG_IRQ_TX_FORCED) |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
195 |
#define NVREG_IRQ_RX_ALL (NVREG_IRQ_RX_ERROR|NVREG_IRQ_RX|NVREG_IRQ_RX_NOBUF|NVREG_IRQ_RX_FORCED) |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
196 |
#define NVREG_IRQ_OTHER (NVREG_IRQ_TIMER|NVREG_IRQ_LINK) |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
197 |
|
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
198 |
#define NVREG_IRQ_UNKNOWN (~(NVREG_IRQ_RX_ERROR|NVREG_IRQ_RX|NVREG_IRQ_RX_NOBUF|NVREG_IRQ_TX_ERR| \ |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
199 |
NVREG_IRQ_TX_OK|NVREG_IRQ_TIMER|NVREG_IRQ_LINK|NVREG_IRQ_RX_FORCED| \ |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
200 |
NVREG_IRQ_TX_FORCED)) |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
201 |
|
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
202 |
NvRegUnknownSetupReg6 = 0x008, |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
203 |
#define NVREG_UNKSETUP6_VAL 3 |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
204 |
|
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
205 |
/* |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
206 |
* NVREG_POLL_DEFAULT is the interval length of the timer source on the nic |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
207 |
* NVREG_POLL_DEFAULT=97 would result in an interval length of 1 ms |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
208 |
*/ |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
209 |
NvRegPollingInterval = 0x00c, |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
210 |
#define NVREG_POLL_DEFAULT_THROUGHPUT 970 |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
211 |
#define NVREG_POLL_DEFAULT_CPU 13 |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
212 |
NvRegMSIMap0 = 0x020, |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
213 |
NvRegMSIMap1 = 0x024, |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
214 |
NvRegMSIIrqMask = 0x030, |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
215 |
#define NVREG_MSI_VECTOR_0_ENABLED 0x01 |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
216 |
NvRegMisc1 = 0x080, |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
217 |
#define NVREG_MISC1_PAUSE_TX 0x01 |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
218 |
#define NVREG_MISC1_HD 0x02 |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
219 |
#define NVREG_MISC1_FORCE 0x3b0f3c |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
220 |
|
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
221 |
NvRegMacReset = 0x3c, |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
222 |
#define NVREG_MAC_RESET_ASSERT 0x0F3 |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
223 |
NvRegTransmitterControl = 0x084, |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
224 |
#define NVREG_XMITCTL_START 0x01 |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
225 |
NvRegTransmitterStatus = 0x088, |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
226 |
#define NVREG_XMITSTAT_BUSY 0x01 |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
227 |
|
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
228 |
NvRegPacketFilterFlags = 0x8c, |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
229 |
#define NVREG_PFF_PAUSE_RX 0x08 |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
230 |
#define NVREG_PFF_ALWAYS 0x7F0000 |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
231 |
#define NVREG_PFF_PROMISC 0x80 |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
232 |
#define NVREG_PFF_MYADDR 0x20 |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
233 |
#define NVREG_PFF_LOOPBACK 0x10 |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
234 |
|
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
235 |
NvRegOffloadConfig = 0x90, |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
236 |
#define NVREG_OFFLOAD_HOMEPHY 0x601 |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
237 |
#define NVREG_OFFLOAD_NORMAL RX_NIC_BUFSIZE |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
238 |
NvRegReceiverControl = 0x094, |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
239 |
#define NVREG_RCVCTL_START 0x01 |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
240 |
NvRegReceiverStatus = 0x98, |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
241 |
#define NVREG_RCVSTAT_BUSY 0x01 |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
242 |
|
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
243 |
NvRegRandomSeed = 0x9c, |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
244 |
#define NVREG_RNDSEED_MASK 0x00ff |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
245 |
#define NVREG_RNDSEED_FORCE 0x7f00 |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
246 |
#define NVREG_RNDSEED_FORCE2 0x2d00 |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
247 |
#define NVREG_RNDSEED_FORCE3 0x7400 |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
248 |
|
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
249 |
NvRegTxDeferral = 0xA0, |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
250 |
#define NVREG_TX_DEFERRAL_DEFAULT 0x15050f |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
251 |
#define NVREG_TX_DEFERRAL_RGMII_10_100 0x16070f |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
252 |
#define NVREG_TX_DEFERRAL_RGMII_1000 0x14050f |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
253 |
NvRegRxDeferral = 0xA4, |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
254 |
#define NVREG_RX_DEFERRAL_DEFAULT 0x16 |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
255 |
NvRegMacAddrA = 0xA8, |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
256 |
NvRegMacAddrB = 0xAC, |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
257 |
NvRegMulticastAddrA = 0xB0, |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
258 |
#define NVREG_MCASTADDRA_FORCE 0x01 |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
259 |
NvRegMulticastAddrB = 0xB4, |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
260 |
NvRegMulticastMaskA = 0xB8, |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
261 |
NvRegMulticastMaskB = 0xBC, |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
262 |
|
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
263 |
NvRegPhyInterface = 0xC0, |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
264 |
#define PHY_RGMII 0x10000000 |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
265 |
|
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
266 |
NvRegTxRingPhysAddr = 0x100, |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
267 |
NvRegRxRingPhysAddr = 0x104, |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
268 |
NvRegRingSizes = 0x108, |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
269 |
#define NVREG_RINGSZ_TXSHIFT 0 |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
270 |
#define NVREG_RINGSZ_RXSHIFT 16 |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
271 |
NvRegTransmitPoll = 0x10c, |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
272 |
#define NVREG_TRANSMITPOLL_MAC_ADDR_REV 0x00008000 |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
273 |
NvRegLinkSpeed = 0x110, |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
274 |
#define NVREG_LINKSPEED_FORCE 0x10000 |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
275 |
#define NVREG_LINKSPEED_10 1000 |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
276 |
#define NVREG_LINKSPEED_100 100 |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
277 |
#define NVREG_LINKSPEED_1000 50 |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
278 |
#define NVREG_LINKSPEED_MASK (0xFFF) |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
279 |
NvRegUnknownSetupReg5 = 0x130, |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
280 |
#define NVREG_UNKSETUP5_BIT31 (1<<31) |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
281 |
NvRegTxWatermark = 0x13c, |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
282 |
#define NVREG_TX_WM_DESC1_DEFAULT 0x0200010 |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
283 |
#define NVREG_TX_WM_DESC2_3_DEFAULT 0x1e08000 |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
284 |
#define NVREG_TX_WM_DESC2_3_1000 0xfe08000 |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
285 |
NvRegTxRxControl = 0x144, |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
286 |
#define NVREG_TXRXCTL_KICK 0x0001 |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
287 |
#define NVREG_TXRXCTL_BIT1 0x0002 |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
288 |
#define NVREG_TXRXCTL_BIT2 0x0004 |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
289 |
#define NVREG_TXRXCTL_IDLE 0x0008 |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
290 |
#define NVREG_TXRXCTL_RESET 0x0010 |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
291 |
#define NVREG_TXRXCTL_RXCHECK 0x0400 |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
292 |
#define NVREG_TXRXCTL_DESC_1 0 |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
293 |
#define NVREG_TXRXCTL_DESC_2 0x02100 |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
294 |
#define NVREG_TXRXCTL_DESC_3 0x02200 |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
295 |
#define NVREG_TXRXCTL_VLANSTRIP 0x00040 |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
296 |
#define NVREG_TXRXCTL_VLANINS 0x00080 |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
297 |
NvRegTxRingPhysAddrHigh = 0x148, |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
298 |
NvRegRxRingPhysAddrHigh = 0x14C, |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
299 |
NvRegTxPauseFrame = 0x170, |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
300 |
#define NVREG_TX_PAUSEFRAME_DISABLE 0x1ff0080 |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
301 |
#define NVREG_TX_PAUSEFRAME_ENABLE 0x0c00030 |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
302 |
NvRegMIIStatus = 0x180, |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
303 |
#define NVREG_MIISTAT_ERROR 0x0001 |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
304 |
#define NVREG_MIISTAT_LINKCHANGE 0x0008 |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
305 |
#define NVREG_MIISTAT_MASK 0x000f |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
306 |
#define NVREG_MIISTAT_MASK2 0x000f |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
307 |
NvRegUnknownSetupReg4 = 0x184, |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
308 |
#define NVREG_UNKSETUP4_VAL 8 |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
309 |
|
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
310 |
NvRegAdapterControl = 0x188, |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
311 |
#define NVREG_ADAPTCTL_START 0x02 |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
312 |
#define NVREG_ADAPTCTL_LINKUP 0x04 |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
313 |
#define NVREG_ADAPTCTL_PHYVALID 0x40000 |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
314 |
#define NVREG_ADAPTCTL_RUNNING 0x100000 |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
315 |
#define NVREG_ADAPTCTL_PHYSHIFT 24 |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
316 |
NvRegMIISpeed = 0x18c, |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
317 |
#define NVREG_MIISPEED_BIT8 (1<<8) |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
318 |
#define NVREG_MIIDELAY 5 |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
319 |
NvRegMIIControl = 0x190, |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
320 |
#define NVREG_MIICTL_INUSE 0x08000 |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
321 |
#define NVREG_MIICTL_WRITE 0x00400 |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
322 |
#define NVREG_MIICTL_ADDRSHIFT 5 |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
323 |
NvRegMIIData = 0x194, |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
324 |
NvRegWakeUpFlags = 0x200, |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
325 |
#define NVREG_WAKEUPFLAGS_VAL 0x7770 |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
326 |
#define NVREG_WAKEUPFLAGS_BUSYSHIFT 24 |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
327 |
#define NVREG_WAKEUPFLAGS_ENABLESHIFT 16 |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
328 |
#define NVREG_WAKEUPFLAGS_D3SHIFT 12 |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
329 |
#define NVREG_WAKEUPFLAGS_D2SHIFT 8 |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
330 |
#define NVREG_WAKEUPFLAGS_D1SHIFT 4 |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
331 |
#define NVREG_WAKEUPFLAGS_D0SHIFT 0 |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
332 |
#define NVREG_WAKEUPFLAGS_ACCEPT_MAGPAT 0x01 |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
333 |
#define NVREG_WAKEUPFLAGS_ACCEPT_WAKEUPPAT 0x02 |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
334 |
#define NVREG_WAKEUPFLAGS_ACCEPT_LINKCHANGE 0x04 |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
335 |
#define NVREG_WAKEUPFLAGS_ENABLE 0x1111 |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
336 |
|
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
337 |
NvRegPatternCRC = 0x204, |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
338 |
NvRegPatternMask = 0x208, |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
339 |
NvRegPowerCap = 0x268, |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
340 |
#define NVREG_POWERCAP_D3SUPP (1<<30) |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
341 |
#define NVREG_POWERCAP_D2SUPP (1<<26) |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
342 |
#define NVREG_POWERCAP_D1SUPP (1<<25) |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
343 |
NvRegPowerState = 0x26c, |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
344 |
#define NVREG_POWERSTATE_POWEREDUP 0x8000 |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
345 |
#define NVREG_POWERSTATE_VALID 0x0100 |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
346 |
#define NVREG_POWERSTATE_MASK 0x0003 |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
347 |
#define NVREG_POWERSTATE_D0 0x0000 |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
348 |
#define NVREG_POWERSTATE_D1 0x0001 |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
349 |
#define NVREG_POWERSTATE_D2 0x0002 |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
350 |
#define NVREG_POWERSTATE_D3 0x0003 |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
351 |
NvRegTxCnt = 0x280, |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
352 |
NvRegTxZeroReXmt = 0x284, |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
353 |
NvRegTxOneReXmt = 0x288, |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
354 |
NvRegTxManyReXmt = 0x28c, |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
355 |
NvRegTxLateCol = 0x290, |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
356 |
NvRegTxUnderflow = 0x294, |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
357 |
NvRegTxLossCarrier = 0x298, |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
358 |
NvRegTxExcessDef = 0x29c, |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
359 |
NvRegTxRetryErr = 0x2a0, |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
360 |
NvRegRxFrameErr = 0x2a4, |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
361 |
NvRegRxExtraByte = 0x2a8, |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
362 |
NvRegRxLateCol = 0x2ac, |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
363 |
NvRegRxRunt = 0x2b0, |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
364 |
NvRegRxFrameTooLong = 0x2b4, |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
365 |
NvRegRxOverflow = 0x2b8, |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
366 |
NvRegRxFCSErr = 0x2bc, |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
367 |
NvRegRxFrameAlignErr = 0x2c0, |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
368 |
NvRegRxLenErr = 0x2c4, |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
369 |
NvRegRxUnicast = 0x2c8, |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
370 |
NvRegRxMulticast = 0x2cc, |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
371 |
NvRegRxBroadcast = 0x2d0, |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
372 |
NvRegTxDef = 0x2d4, |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
373 |
NvRegTxFrame = 0x2d8, |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
374 |
NvRegRxCnt = 0x2dc, |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
375 |
NvRegTxPause = 0x2e0, |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
376 |
NvRegRxPause = 0x2e4, |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
377 |
NvRegRxDropFrame = 0x2e8, |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
378 |
NvRegVlanControl = 0x300, |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
379 |
#define NVREG_VLANCONTROL_ENABLE 0x2000 |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
380 |
NvRegMSIXMap0 = 0x3e0, |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
381 |
NvRegMSIXMap1 = 0x3e4, |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
382 |
NvRegMSIXIrqStatus = 0x3f0, |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
383 |
|
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
384 |
NvRegPowerState2 = 0x600, |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
385 |
#define NVREG_POWERSTATE2_POWERUP_MASK 0x0F11 |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
386 |
#define NVREG_POWERSTATE2_POWERUP_REV_A3 0x0001 |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
387 |
}; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
388 |
|
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
389 |
/* Big endian: should work, but is untested */ |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
390 |
struct ring_desc { |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
391 |
__le32 buf; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
392 |
__le32 flaglen; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
393 |
}; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
394 |
|
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
395 |
struct ring_desc_ex { |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
396 |
__le32 bufhigh; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
397 |
__le32 buflow; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
398 |
__le32 txvlan; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
399 |
__le32 flaglen; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
400 |
}; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
401 |
|
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
402 |
union ring_type { |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
403 |
struct ring_desc* orig; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
404 |
struct ring_desc_ex* ex; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
405 |
}; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
406 |
|
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
407 |
#define FLAG_MASK_V1 0xffff0000 |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
408 |
#define FLAG_MASK_V2 0xffffc000 |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
409 |
#define LEN_MASK_V1 (0xffffffff ^ FLAG_MASK_V1) |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
410 |
#define LEN_MASK_V2 (0xffffffff ^ FLAG_MASK_V2) |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
411 |
|
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
412 |
#define NV_TX_LASTPACKET (1<<16) |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
413 |
#define NV_TX_RETRYERROR (1<<19) |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
414 |
#define NV_TX_FORCED_INTERRUPT (1<<24) |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
415 |
#define NV_TX_DEFERRED (1<<26) |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
416 |
#define NV_TX_CARRIERLOST (1<<27) |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
417 |
#define NV_TX_LATECOLLISION (1<<28) |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
418 |
#define NV_TX_UNDERFLOW (1<<29) |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
419 |
#define NV_TX_ERROR (1<<30) |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
420 |
#define NV_TX_VALID (1<<31) |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
421 |
|
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
422 |
#define NV_TX2_LASTPACKET (1<<29) |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
423 |
#define NV_TX2_RETRYERROR (1<<18) |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
424 |
#define NV_TX2_FORCED_INTERRUPT (1<<30) |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
425 |
#define NV_TX2_DEFERRED (1<<25) |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
426 |
#define NV_TX2_CARRIERLOST (1<<26) |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
427 |
#define NV_TX2_LATECOLLISION (1<<27) |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
428 |
#define NV_TX2_UNDERFLOW (1<<28) |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
429 |
/* error and valid are the same for both */ |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
430 |
#define NV_TX2_ERROR (1<<30) |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
431 |
#define NV_TX2_VALID (1<<31) |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
432 |
#define NV_TX2_TSO (1<<28) |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
433 |
#define NV_TX2_TSO_SHIFT 14 |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
434 |
#define NV_TX2_TSO_MAX_SHIFT 14 |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
435 |
#define NV_TX2_TSO_MAX_SIZE (1<<NV_TX2_TSO_MAX_SHIFT) |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
436 |
#define NV_TX2_CHECKSUM_L3 (1<<27) |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
437 |
#define NV_TX2_CHECKSUM_L4 (1<<26) |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
438 |
|
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
439 |
#define NV_TX3_VLAN_TAG_PRESENT (1<<18) |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
440 |
|
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
441 |
#define NV_RX_DESCRIPTORVALID (1<<16) |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
442 |
#define NV_RX_MISSEDFRAME (1<<17) |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
443 |
#define NV_RX_SUBSTRACT1 (1<<18) |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
444 |
#define NV_RX_ERROR1 (1<<23) |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
445 |
#define NV_RX_ERROR2 (1<<24) |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
446 |
#define NV_RX_ERROR3 (1<<25) |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
447 |
#define NV_RX_ERROR4 (1<<26) |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
448 |
#define NV_RX_CRCERR (1<<27) |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
449 |
#define NV_RX_OVERFLOW (1<<28) |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
450 |
#define NV_RX_FRAMINGERR (1<<29) |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
451 |
#define NV_RX_ERROR (1<<30) |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
452 |
#define NV_RX_AVAIL (1<<31) |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
453 |
|
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
454 |
#define NV_RX2_CHECKSUMMASK (0x1C000000) |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
455 |
#define NV_RX2_CHECKSUMOK1 (0x10000000) |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
456 |
#define NV_RX2_CHECKSUMOK2 (0x14000000) |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
457 |
#define NV_RX2_CHECKSUMOK3 (0x18000000) |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
458 |
#define NV_RX2_DESCRIPTORVALID (1<<29) |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
459 |
#define NV_RX2_SUBSTRACT1 (1<<25) |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
460 |
#define NV_RX2_ERROR1 (1<<18) |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
461 |
#define NV_RX2_ERROR2 (1<<19) |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
462 |
#define NV_RX2_ERROR3 (1<<20) |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
463 |
#define NV_RX2_ERROR4 (1<<21) |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
464 |
#define NV_RX2_CRCERR (1<<22) |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
465 |
#define NV_RX2_OVERFLOW (1<<23) |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
466 |
#define NV_RX2_FRAMINGERR (1<<24) |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
467 |
/* error and avail are the same for both */ |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
468 |
#define NV_RX2_ERROR (1<<30) |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
469 |
#define NV_RX2_AVAIL (1<<31) |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
470 |
|
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
471 |
#define NV_RX3_VLAN_TAG_PRESENT (1<<16) |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
472 |
#define NV_RX3_VLAN_TAG_MASK (0x0000FFFF) |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
473 |
|
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
474 |
/* Miscelaneous hardware related defines: */ |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
475 |
#define NV_PCI_REGSZ_VER1 0x270 |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
476 |
#define NV_PCI_REGSZ_VER2 0x604 |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
477 |
|
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
478 |
/* various timeout delays: all in usec */ |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
479 |
#define NV_TXRX_RESET_DELAY 4 |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
480 |
#define NV_TXSTOP_DELAY1 10 |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
481 |
#define NV_TXSTOP_DELAY1MAX 500000 |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
482 |
#define NV_TXSTOP_DELAY2 100 |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
483 |
#define NV_RXSTOP_DELAY1 10 |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
484 |
#define NV_RXSTOP_DELAY1MAX 500000 |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
485 |
#define NV_RXSTOP_DELAY2 100 |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
486 |
#define NV_SETUP5_DELAY 5 |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
487 |
#define NV_SETUP5_DELAYMAX 50000 |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
488 |
#define NV_POWERUP_DELAY 5 |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
489 |
#define NV_POWERUP_DELAYMAX 5000 |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
490 |
#define NV_MIIBUSY_DELAY 50 |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
491 |
#define NV_MIIPHY_DELAY 10 |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
492 |
#define NV_MIIPHY_DELAYMAX 10000 |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
493 |
#define NV_MAC_RESET_DELAY 64 |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
494 |
|
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
495 |
#define NV_WAKEUPPATTERNS 5 |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
496 |
#define NV_WAKEUPMASKENTRIES 4 |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
497 |
|
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
498 |
/* General driver defaults */ |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
499 |
#define NV_WATCHDOG_TIMEO (5*HZ) |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
500 |
|
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
501 |
#define RX_RING_DEFAULT 128 |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
502 |
#define TX_RING_DEFAULT 256 |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
503 |
#define RX_RING_MIN 128 |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
504 |
#define TX_RING_MIN 64 |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
505 |
#define RING_MAX_DESC_VER_1 1024 |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
506 |
#define RING_MAX_DESC_VER_2_3 16384 |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
507 |
/* |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
508 |
* Difference between the get and put pointers for the tx ring. |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
509 |
* This is used to throttle the amount of data outstanding in the |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
510 |
* tx ring. |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
511 |
*/ |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
512 |
#define TX_LIMIT_DIFFERENCE 1 |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
513 |
|
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
514 |
/* rx/tx mac addr + type + vlan + align + slack*/ |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
515 |
#define NV_RX_HEADERS (64) |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
516 |
/* even more slack. */ |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
517 |
#define NV_RX_ALLOC_PAD (64) |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
518 |
|
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
519 |
/* maximum mtu size */ |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
520 |
#define NV_PKTLIMIT_1 ETH_DATA_LEN /* hard limit not known */ |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
521 |
#define NV_PKTLIMIT_2 9100 /* Actual limit according to NVidia: 9202 */ |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
522 |
|
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
523 |
#define OOM_REFILL (1+HZ/20) |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
524 |
#define POLL_WAIT (1+HZ/100) |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
525 |
#define LINK_TIMEOUT (3*HZ) |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
526 |
#define STATS_INTERVAL (10*HZ) |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
527 |
|
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
528 |
/* |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
529 |
* desc_ver values: |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
530 |
* The nic supports three different descriptor types: |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
531 |
* - DESC_VER_1: Original |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
532 |
* - DESC_VER_2: support for jumbo frames. |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
533 |
* - DESC_VER_3: 64-bit format. |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
534 |
*/ |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
535 |
#define DESC_VER_1 1 |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
536 |
#define DESC_VER_2 2 |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
537 |
#define DESC_VER_3 3 |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
538 |
|
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
539 |
/* PHY defines */ |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
540 |
#define PHY_OUI_MARVELL 0x5043 |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
541 |
#define PHY_OUI_CICADA 0x03f1 |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
542 |
#define PHYID1_OUI_MASK 0x03ff |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
543 |
#define PHYID1_OUI_SHFT 6 |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
544 |
#define PHYID2_OUI_MASK 0xfc00 |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
545 |
#define PHYID2_OUI_SHFT 10 |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
546 |
#define PHYID2_MODEL_MASK 0x03f0 |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
547 |
#define PHY_MODEL_MARVELL_E3016 0x220 |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
548 |
#define PHY_MARVELL_E3016_INITMASK 0x0300 |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
549 |
#define PHY_INIT1 0x0f000 |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
550 |
#define PHY_INIT2 0x0e00 |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
551 |
#define PHY_INIT3 0x01000 |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
552 |
#define PHY_INIT4 0x0200 |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
553 |
#define PHY_INIT5 0x0004 |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
554 |
#define PHY_INIT6 0x02000 |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
555 |
#define PHY_GIGABIT 0x0100 |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
556 |
|
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
557 |
#define PHY_TIMEOUT 0x1 |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
558 |
#define PHY_ERROR 0x2 |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
559 |
|
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
560 |
#define PHY_100 0x1 |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
561 |
#define PHY_1000 0x2 |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
562 |
#define PHY_HALF 0x100 |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
563 |
|
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
564 |
#define NV_PAUSEFRAME_RX_CAPABLE 0x0001 |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
565 |
#define NV_PAUSEFRAME_TX_CAPABLE 0x0002 |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
566 |
#define NV_PAUSEFRAME_RX_ENABLE 0x0004 |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
567 |
#define NV_PAUSEFRAME_TX_ENABLE 0x0008 |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
568 |
#define NV_PAUSEFRAME_RX_REQ 0x0010 |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
569 |
#define NV_PAUSEFRAME_TX_REQ 0x0020 |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
570 |
#define NV_PAUSEFRAME_AUTONEG 0x0040 |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
571 |
|
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
572 |
/* MSI/MSI-X defines */ |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
573 |
#define NV_MSI_X_MAX_VECTORS 8 |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
574 |
#define NV_MSI_X_VECTORS_MASK 0x000f |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
575 |
#define NV_MSI_CAPABLE 0x0010 |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
576 |
#define NV_MSI_X_CAPABLE 0x0020 |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
577 |
#define NV_MSI_ENABLED 0x0040 |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
578 |
#define NV_MSI_X_ENABLED 0x0080 |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
579 |
|
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
580 |
#define NV_MSI_X_VECTOR_ALL 0x0 |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
581 |
#define NV_MSI_X_VECTOR_RX 0x0 |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
582 |
#define NV_MSI_X_VECTOR_TX 0x1 |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
583 |
#define NV_MSI_X_VECTOR_OTHER 0x2 |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
584 |
|
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
585 |
/* statistics */ |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
586 |
struct nv_ethtool_str { |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
587 |
char name[ETH_GSTRING_LEN]; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
588 |
}; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
589 |
|
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
590 |
static const struct nv_ethtool_str nv_estats_str[] = { |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
591 |
{ "tx_bytes" }, |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
592 |
{ "tx_zero_rexmt" }, |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
593 |
{ "tx_one_rexmt" }, |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
594 |
{ "tx_many_rexmt" }, |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
595 |
{ "tx_late_collision" }, |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
596 |
{ "tx_fifo_errors" }, |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
597 |
{ "tx_carrier_errors" }, |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
598 |
{ "tx_excess_deferral" }, |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
599 |
{ "tx_retry_error" }, |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
600 |
{ "tx_deferral" }, |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
601 |
{ "tx_packets" }, |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
602 |
{ "tx_pause" }, |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
603 |
{ "rx_frame_error" }, |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
604 |
{ "rx_extra_byte" }, |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
605 |
{ "rx_late_collision" }, |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
606 |
{ "rx_runt" }, |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
607 |
{ "rx_frame_too_long" }, |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
608 |
{ "rx_over_errors" }, |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
609 |
{ "rx_crc_errors" }, |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
610 |
{ "rx_frame_align_error" }, |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
611 |
{ "rx_length_error" }, |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
612 |
{ "rx_unicast" }, |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
613 |
{ "rx_multicast" }, |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
614 |
{ "rx_broadcast" }, |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
615 |
{ "rx_bytes" }, |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
616 |
{ "rx_pause" }, |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
617 |
{ "rx_drop_frame" }, |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
618 |
{ "rx_packets" }, |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
619 |
{ "rx_errors_total" } |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
620 |
}; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
621 |
|
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
622 |
struct nv_ethtool_stats { |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
623 |
u64 tx_bytes; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
624 |
u64 tx_zero_rexmt; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
625 |
u64 tx_one_rexmt; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
626 |
u64 tx_many_rexmt; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
627 |
u64 tx_late_collision; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
628 |
u64 tx_fifo_errors; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
629 |
u64 tx_carrier_errors; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
630 |
u64 tx_excess_deferral; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
631 |
u64 tx_retry_error; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
632 |
u64 tx_deferral; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
633 |
u64 tx_packets; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
634 |
u64 tx_pause; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
635 |
u64 rx_frame_error; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
636 |
u64 rx_extra_byte; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
637 |
u64 rx_late_collision; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
638 |
u64 rx_runt; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
639 |
u64 rx_frame_too_long; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
640 |
u64 rx_over_errors; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
641 |
u64 rx_crc_errors; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
642 |
u64 rx_frame_align_error; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
643 |
u64 rx_length_error; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
644 |
u64 rx_unicast; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
645 |
u64 rx_multicast; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
646 |
u64 rx_broadcast; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
647 |
u64 rx_bytes; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
648 |
u64 rx_pause; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
649 |
u64 rx_drop_frame; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
650 |
u64 rx_packets; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
651 |
u64 rx_errors_total; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
652 |
}; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
653 |
|
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
654 |
/* diagnostics */ |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
655 |
#define NV_TEST_COUNT_BASE 3 |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
656 |
#define NV_TEST_COUNT_EXTENDED 4 |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
657 |
|
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
658 |
static const struct nv_ethtool_str nv_etests_str[] = { |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
659 |
{ "link (online/offline)" }, |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
660 |
{ "register (offline) " }, |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
661 |
{ "interrupt (offline) " }, |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
662 |
{ "loopback (offline) " } |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
663 |
}; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
664 |
|
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
665 |
struct register_test { |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
666 |
__le32 reg; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
667 |
__le32 mask; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
668 |
}; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
669 |
|
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
670 |
static const struct register_test nv_registers_test[] = { |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
671 |
{ NvRegUnknownSetupReg6, 0x01 }, |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
672 |
{ NvRegMisc1, 0x03c }, |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
673 |
{ NvRegOffloadConfig, 0x03ff }, |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
674 |
{ NvRegMulticastAddrA, 0xffffffff }, |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
675 |
{ NvRegTxWatermark, 0x0ff }, |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
676 |
{ NvRegWakeUpFlags, 0x07777 }, |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
677 |
{ 0,0 } |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
678 |
}; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
679 |
|
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
680 |
/* |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
681 |
* SMP locking: |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
682 |
* All hardware access under dev->priv->lock, except the performance |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
683 |
* critical parts: |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
684 |
* - rx is (pseudo-) lockless: it relies on the single-threading provided |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
685 |
* by the arch code for interrupts. |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
686 |
* - tx setup is lockless: it relies on netif_tx_lock. Actual submission |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
687 |
* needs dev->priv->lock :-( |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
688 |
* - set_multicast_list: preparation lockless, relies on netif_tx_lock. |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
689 |
*/ |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
690 |
|
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
691 |
/* in dev: base, irq */ |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
692 |
struct fe_priv { |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
693 |
spinlock_t lock; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
694 |
|
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
695 |
/* General data: |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
696 |
* Locking: spin_lock(&np->lock); */ |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
697 |
struct net_device_stats stats; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
698 |
struct nv_ethtool_stats estats; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
699 |
int in_shutdown; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
700 |
u32 linkspeed; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
701 |
int duplex; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
702 |
int autoneg; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
703 |
int fixed_mode; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
704 |
int phyaddr; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
705 |
int wolenabled; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
706 |
unsigned int phy_oui; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
707 |
unsigned int phy_model; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
708 |
u16 gigabit; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
709 |
int intr_test; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
710 |
|
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
711 |
/* General data: RO fields */ |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
712 |
dma_addr_t ring_addr; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
713 |
struct pci_dev *pci_dev; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
714 |
u32 orig_mac[2]; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
715 |
u32 irqmask; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
716 |
u32 desc_ver; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
717 |
u32 txrxctl_bits; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
718 |
u32 vlanctl_bits; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
719 |
u32 driver_data; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
720 |
u32 register_size; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
721 |
int rx_csum; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
722 |
|
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
723 |
void __iomem *base; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
724 |
|
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
725 |
/* rx specific fields. |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
726 |
* Locking: Within irq hander or disable_irq+spin_lock(&np->lock); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
727 |
*/ |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
728 |
union ring_type rx_ring; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
729 |
unsigned int cur_rx, refill_rx; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
730 |
struct sk_buff **rx_skbuff; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
731 |
dma_addr_t *rx_dma; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
732 |
unsigned int rx_buf_sz; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
733 |
unsigned int pkt_limit; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
734 |
struct timer_list oom_kick; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
735 |
struct timer_list nic_poll; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
736 |
struct timer_list stats_poll; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
737 |
u32 nic_poll_irq; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
738 |
int rx_ring_size; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
739 |
|
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
740 |
/* media detection workaround. |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
741 |
* Locking: Within irq hander or disable_irq+spin_lock(&np->lock); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
742 |
*/ |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
743 |
int need_linktimer; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
744 |
unsigned long link_timeout; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
745 |
/* |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
746 |
* tx specific fields. |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
747 |
*/ |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
748 |
union ring_type tx_ring; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
749 |
unsigned int next_tx, nic_tx; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
750 |
struct sk_buff **tx_skbuff; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
751 |
dma_addr_t *tx_dma; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
752 |
unsigned int *tx_dma_len; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
753 |
u32 tx_flags; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
754 |
int tx_ring_size; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
755 |
int tx_limit_start; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
756 |
int tx_limit_stop; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
757 |
|
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
758 |
/* vlan fields */ |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
759 |
struct vlan_group *vlangrp; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
760 |
|
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
761 |
/* msi/msi-x fields */ |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
762 |
u32 msi_flags; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
763 |
struct msix_entry msi_x_entry[NV_MSI_X_MAX_VECTORS]; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
764 |
|
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
765 |
/* flow control */ |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
766 |
u32 pause_flags; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
767 |
}; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
768 |
|
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
769 |
/* |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
770 |
* Maximum number of loops until we assume that a bit in the irq mask |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
771 |
* is stuck. Overridable with module param. |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
772 |
*/ |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
773 |
static int max_interrupt_work = 5; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
774 |
|
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
775 |
/* |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
776 |
* Optimization can be either throuput mode or cpu mode |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
777 |
* |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
778 |
* Throughput Mode: Every tx and rx packet will generate an interrupt. |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
779 |
* CPU Mode: Interrupts are controlled by a timer. |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
780 |
*/ |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
781 |
enum { |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
782 |
NV_OPTIMIZATION_MODE_THROUGHPUT, |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
783 |
NV_OPTIMIZATION_MODE_CPU |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
784 |
}; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
785 |
static int optimization_mode = NV_OPTIMIZATION_MODE_THROUGHPUT; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
786 |
|
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
787 |
/* |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
788 |
* Poll interval for timer irq |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
789 |
* |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
790 |
* This interval determines how frequent an interrupt is generated. |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
791 |
* The is value is determined by [(time_in_micro_secs * 100) / (2^10)] |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
792 |
* Min = 0, and Max = 65535 |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
793 |
*/ |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
794 |
static int poll_interval = -1; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
795 |
|
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
796 |
/* |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
797 |
* MSI interrupts |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
798 |
*/ |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
799 |
enum { |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
800 |
NV_MSI_INT_DISABLED, |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
801 |
NV_MSI_INT_ENABLED |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
802 |
}; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
803 |
static int msi = NV_MSI_INT_ENABLED; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
804 |
|
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
805 |
/* |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
806 |
* MSIX interrupts |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
807 |
*/ |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
808 |
enum { |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
809 |
NV_MSIX_INT_DISABLED, |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
810 |
NV_MSIX_INT_ENABLED |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
811 |
}; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
812 |
static int msix = NV_MSIX_INT_ENABLED; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
813 |
|
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
814 |
/* |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
815 |
* DMA 64bit |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
816 |
*/ |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
817 |
enum { |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
818 |
NV_DMA_64BIT_DISABLED, |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
819 |
NV_DMA_64BIT_ENABLED |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
820 |
}; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
821 |
static int dma_64bit = NV_DMA_64BIT_ENABLED; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
822 |
|
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
823 |
static inline struct fe_priv *get_nvpriv(struct net_device *dev) |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
824 |
{ |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
825 |
return netdev_priv(dev); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
826 |
} |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
827 |
|
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
828 |
static inline u8 __iomem *get_hwbase(struct net_device *dev) |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
829 |
{ |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
830 |
return ((struct fe_priv *)netdev_priv(dev))->base; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
831 |
} |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
832 |
|
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
833 |
static inline void pci_push(u8 __iomem *base) |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
834 |
{ |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
835 |
/* force out pending posted writes */ |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
836 |
readl(base); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
837 |
} |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
838 |
|
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
839 |
static inline u32 nv_descr_getlength(struct ring_desc *prd, u32 v) |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
840 |
{ |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
841 |
return le32_to_cpu(prd->flaglen) |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
842 |
& ((v == DESC_VER_1) ? LEN_MASK_V1 : LEN_MASK_V2); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
843 |
} |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
844 |
|
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
845 |
static inline u32 nv_descr_getlength_ex(struct ring_desc_ex *prd, u32 v) |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
846 |
{ |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
847 |
return le32_to_cpu(prd->flaglen) & LEN_MASK_V2; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
848 |
} |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
849 |
|
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
850 |
static int reg_delay(struct net_device *dev, int offset, u32 mask, u32 target, |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
851 |
int delay, int delaymax, const char *msg) |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
852 |
{ |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
853 |
u8 __iomem *base = get_hwbase(dev); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
854 |
|
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
855 |
pci_push(base); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
856 |
do { |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
857 |
udelay(delay); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
858 |
delaymax -= delay; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
859 |
if (delaymax < 0) { |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
860 |
if (msg) |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
861 |
printk(msg); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
862 |
return 1; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
863 |
} |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
864 |
} while ((readl(base + offset) & mask) != target); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
865 |
return 0; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
866 |
} |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
867 |
|
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
868 |
#define NV_SETUP_RX_RING 0x01 |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
869 |
#define NV_SETUP_TX_RING 0x02 |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
870 |
|
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
871 |
static void setup_hw_rings(struct net_device *dev, int rxtx_flags) |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
872 |
{ |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
873 |
struct fe_priv *np = get_nvpriv(dev); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
874 |
u8 __iomem *base = get_hwbase(dev); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
875 |
|
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
876 |
if (np->desc_ver == DESC_VER_1 || np->desc_ver == DESC_VER_2) { |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
877 |
if (rxtx_flags & NV_SETUP_RX_RING) { |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
878 |
writel((u32) cpu_to_le64(np->ring_addr), base + NvRegRxRingPhysAddr); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
879 |
} |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
880 |
if (rxtx_flags & NV_SETUP_TX_RING) { |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
881 |
writel((u32) cpu_to_le64(np->ring_addr + np->rx_ring_size*sizeof(struct ring_desc)), base + NvRegTxRingPhysAddr); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
882 |
} |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
883 |
} else { |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
884 |
if (rxtx_flags & NV_SETUP_RX_RING) { |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
885 |
writel((u32) cpu_to_le64(np->ring_addr), base + NvRegRxRingPhysAddr); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
886 |
writel((u32) (cpu_to_le64(np->ring_addr) >> 32), base + NvRegRxRingPhysAddrHigh); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
887 |
} |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
888 |
if (rxtx_flags & NV_SETUP_TX_RING) { |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
889 |
writel((u32) cpu_to_le64(np->ring_addr + np->rx_ring_size*sizeof(struct ring_desc_ex)), base + NvRegTxRingPhysAddr); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
890 |
writel((u32) (cpu_to_le64(np->ring_addr + np->rx_ring_size*sizeof(struct ring_desc_ex)) >> 32), base + NvRegTxRingPhysAddrHigh); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
891 |
} |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
892 |
} |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
893 |
} |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
894 |
|
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
895 |
static void free_rings(struct net_device *dev) |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
896 |
{ |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
897 |
struct fe_priv *np = get_nvpriv(dev); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
898 |
|
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
899 |
if (np->desc_ver == DESC_VER_1 || np->desc_ver == DESC_VER_2) { |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
900 |
if (np->rx_ring.orig) |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
901 |
pci_free_consistent(np->pci_dev, sizeof(struct ring_desc) * (np->rx_ring_size + np->tx_ring_size), |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
902 |
np->rx_ring.orig, np->ring_addr); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
903 |
} else { |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
904 |
if (np->rx_ring.ex) |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
905 |
pci_free_consistent(np->pci_dev, sizeof(struct ring_desc_ex) * (np->rx_ring_size + np->tx_ring_size), |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
906 |
np->rx_ring.ex, np->ring_addr); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
907 |
} |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
908 |
if (np->rx_skbuff) |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
909 |
kfree(np->rx_skbuff); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
910 |
if (np->rx_dma) |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
911 |
kfree(np->rx_dma); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
912 |
if (np->tx_skbuff) |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
913 |
kfree(np->tx_skbuff); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
914 |
if (np->tx_dma) |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
915 |
kfree(np->tx_dma); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
916 |
if (np->tx_dma_len) |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
917 |
kfree(np->tx_dma_len); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
918 |
} |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
919 |
|
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
920 |
static int using_multi_irqs(struct net_device *dev) |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
921 |
{ |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
922 |
struct fe_priv *np = get_nvpriv(dev); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
923 |
|
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
924 |
if (!(np->msi_flags & NV_MSI_X_ENABLED) || |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
925 |
((np->msi_flags & NV_MSI_X_ENABLED) && |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
926 |
((np->msi_flags & NV_MSI_X_VECTORS_MASK) == 0x1))) |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
927 |
return 0; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
928 |
else |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
929 |
return 1; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
930 |
} |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
931 |
|
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
932 |
static void nv_enable_irq(struct net_device *dev) |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
933 |
{ |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
934 |
struct fe_priv *np = get_nvpriv(dev); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
935 |
|
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
936 |
if (!using_multi_irqs(dev)) { |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
937 |
if (np->msi_flags & NV_MSI_X_ENABLED) |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
938 |
enable_irq(np->msi_x_entry[NV_MSI_X_VECTOR_ALL].vector); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
939 |
else |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
940 |
enable_irq(dev->irq); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
941 |
} else { |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
942 |
enable_irq(np->msi_x_entry[NV_MSI_X_VECTOR_RX].vector); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
943 |
enable_irq(np->msi_x_entry[NV_MSI_X_VECTOR_TX].vector); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
944 |
enable_irq(np->msi_x_entry[NV_MSI_X_VECTOR_OTHER].vector); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
945 |
} |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
946 |
} |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
947 |
|
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
948 |
static void nv_disable_irq(struct net_device *dev) |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
949 |
{ |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
950 |
struct fe_priv *np = get_nvpriv(dev); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
951 |
|
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
952 |
if (!using_multi_irqs(dev)) { |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
953 |
if (np->msi_flags & NV_MSI_X_ENABLED) |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
954 |
disable_irq(np->msi_x_entry[NV_MSI_X_VECTOR_ALL].vector); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
955 |
else |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
956 |
disable_irq(dev->irq); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
957 |
} else { |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
958 |
disable_irq(np->msi_x_entry[NV_MSI_X_VECTOR_RX].vector); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
959 |
disable_irq(np->msi_x_entry[NV_MSI_X_VECTOR_TX].vector); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
960 |
disable_irq(np->msi_x_entry[NV_MSI_X_VECTOR_OTHER].vector); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
961 |
} |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
962 |
} |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
963 |
|
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
964 |
/* In MSIX mode, a write to irqmask behaves as XOR */ |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
965 |
static void nv_enable_hw_interrupts(struct net_device *dev, u32 mask) |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
966 |
{ |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
967 |
u8 __iomem *base = get_hwbase(dev); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
968 |
|
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
969 |
writel(mask, base + NvRegIrqMask); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
970 |
} |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
971 |
|
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
972 |
static void nv_disable_hw_interrupts(struct net_device *dev, u32 mask) |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
973 |
{ |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
974 |
struct fe_priv *np = get_nvpriv(dev); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
975 |
u8 __iomem *base = get_hwbase(dev); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
976 |
|
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
977 |
if (np->msi_flags & NV_MSI_X_ENABLED) { |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
978 |
writel(mask, base + NvRegIrqMask); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
979 |
} else { |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
980 |
if (np->msi_flags & NV_MSI_ENABLED) |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
981 |
writel(0, base + NvRegMSIIrqMask); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
982 |
writel(0, base + NvRegIrqMask); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
983 |
} |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
984 |
} |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
985 |
|
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
986 |
#define MII_READ (-1) |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
987 |
/* mii_rw: read/write a register on the PHY. |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
988 |
* |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
989 |
* Caller must guarantee serialization |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
990 |
*/ |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
991 |
static int mii_rw(struct net_device *dev, int addr, int miireg, int value) |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
992 |
{ |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
993 |
u8 __iomem *base = get_hwbase(dev); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
994 |
u32 reg; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
995 |
int retval; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
996 |
|
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
997 |
writel(NVREG_MIISTAT_MASK, base + NvRegMIIStatus); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
998 |
|
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
999 |
reg = readl(base + NvRegMIIControl); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1000 |
if (reg & NVREG_MIICTL_INUSE) { |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1001 |
writel(NVREG_MIICTL_INUSE, base + NvRegMIIControl); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1002 |
udelay(NV_MIIBUSY_DELAY); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1003 |
} |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1004 |
|
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1005 |
reg = (addr << NVREG_MIICTL_ADDRSHIFT) | miireg; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1006 |
if (value != MII_READ) { |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1007 |
writel(value, base + NvRegMIIData); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1008 |
reg |= NVREG_MIICTL_WRITE; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1009 |
} |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1010 |
writel(reg, base + NvRegMIIControl); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1011 |
|
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1012 |
if (reg_delay(dev, NvRegMIIControl, NVREG_MIICTL_INUSE, 0, |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1013 |
NV_MIIPHY_DELAY, NV_MIIPHY_DELAYMAX, NULL)) { |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1014 |
dprintk(KERN_DEBUG "%s: mii_rw of reg %d at PHY %d timed out.\n", |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1015 |
dev->name, miireg, addr); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1016 |
retval = -1; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1017 |
} else if (value != MII_READ) { |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1018 |
/* it was a write operation - fewer failures are detectable */ |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1019 |
dprintk(KERN_DEBUG "%s: mii_rw wrote 0x%x to reg %d at PHY %d\n", |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1020 |
dev->name, value, miireg, addr); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1021 |
retval = 0; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1022 |
} else if (readl(base + NvRegMIIStatus) & NVREG_MIISTAT_ERROR) { |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1023 |
dprintk(KERN_DEBUG "%s: mii_rw of reg %d at PHY %d failed.\n", |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1024 |
dev->name, miireg, addr); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1025 |
retval = -1; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1026 |
} else { |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1027 |
retval = readl(base + NvRegMIIData); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1028 |
dprintk(KERN_DEBUG "%s: mii_rw read from reg %d at PHY %d: 0x%x.\n", |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1029 |
dev->name, miireg, addr, retval); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1030 |
} |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1031 |
|
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1032 |
return retval; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1033 |
} |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1034 |
|
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1035 |
static int phy_reset(struct net_device *dev, u32 bmcr_setup) |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1036 |
{ |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1037 |
struct fe_priv *np = netdev_priv(dev); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1038 |
u32 miicontrol; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1039 |
unsigned int tries = 0; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1040 |
|
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1041 |
miicontrol = BMCR_RESET | bmcr_setup; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1042 |
if (mii_rw(dev, np->phyaddr, MII_BMCR, miicontrol)) { |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1043 |
return -1; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1044 |
} |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1045 |
|
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1046 |
/* wait for 500ms */ |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1047 |
msleep(500); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1048 |
|
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1049 |
/* must wait till reset is deasserted */ |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1050 |
while (miicontrol & BMCR_RESET) { |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1051 |
msleep(10); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1052 |
miicontrol = mii_rw(dev, np->phyaddr, MII_BMCR, MII_READ); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1053 |
/* FIXME: 100 tries seem excessive */ |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1054 |
if (tries++ > 100) |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1055 |
return -1; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1056 |
} |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1057 |
return 0; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1058 |
} |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1059 |
|
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1060 |
static int phy_init(struct net_device *dev) |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1061 |
{ |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1062 |
struct fe_priv *np = get_nvpriv(dev); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1063 |
u8 __iomem *base = get_hwbase(dev); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1064 |
u32 phyinterface, phy_reserved, mii_status, mii_control, mii_control_1000,reg; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1065 |
|
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1066 |
/* phy errata for E3016 phy */ |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1067 |
if (np->phy_model == PHY_MODEL_MARVELL_E3016) { |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1068 |
reg = mii_rw(dev, np->phyaddr, MII_NCONFIG, MII_READ); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1069 |
reg &= ~PHY_MARVELL_E3016_INITMASK; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1070 |
if (mii_rw(dev, np->phyaddr, MII_NCONFIG, reg)) { |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1071 |
printk(KERN_INFO "%s: phy write to errata reg failed.\n", pci_name(np->pci_dev)); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1072 |
return PHY_ERROR; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1073 |
} |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1074 |
} |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1075 |
|
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1076 |
/* set advertise register */ |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1077 |
reg = mii_rw(dev, np->phyaddr, MII_ADVERTISE, MII_READ); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1078 |
reg |= (ADVERTISE_10HALF|ADVERTISE_10FULL|ADVERTISE_100HALF|ADVERTISE_100FULL|ADVERTISE_PAUSE_ASYM|ADVERTISE_PAUSE_CAP); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1079 |
if (mii_rw(dev, np->phyaddr, MII_ADVERTISE, reg)) { |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1080 |
printk(KERN_INFO "%s: phy write to advertise failed.\n", pci_name(np->pci_dev)); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1081 |
return PHY_ERROR; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1082 |
} |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1083 |
|
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1084 |
/* get phy interface type */ |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1085 |
phyinterface = readl(base + NvRegPhyInterface); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1086 |
|
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1087 |
/* see if gigabit phy */ |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1088 |
mii_status = mii_rw(dev, np->phyaddr, MII_BMSR, MII_READ); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1089 |
if (mii_status & PHY_GIGABIT) { |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1090 |
np->gigabit = PHY_GIGABIT; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1091 |
mii_control_1000 = mii_rw(dev, np->phyaddr, MII_CTRL1000, MII_READ); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1092 |
mii_control_1000 &= ~ADVERTISE_1000HALF; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1093 |
if (phyinterface & PHY_RGMII) |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1094 |
mii_control_1000 |= ADVERTISE_1000FULL; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1095 |
else |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1096 |
mii_control_1000 &= ~ADVERTISE_1000FULL; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1097 |
|
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1098 |
if (mii_rw(dev, np->phyaddr, MII_CTRL1000, mii_control_1000)) { |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1099 |
printk(KERN_INFO "%s: phy init failed.\n", pci_name(np->pci_dev)); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1100 |
return PHY_ERROR; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1101 |
} |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1102 |
} |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1103 |
else |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1104 |
np->gigabit = 0; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1105 |
|
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1106 |
mii_control = mii_rw(dev, np->phyaddr, MII_BMCR, MII_READ); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1107 |
mii_control |= BMCR_ANENABLE; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1108 |
|
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1109 |
/* reset the phy |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1110 |
* (certain phys need bmcr to be setup with reset) |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1111 |
*/ |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1112 |
if (phy_reset(dev, mii_control)) { |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1113 |
printk(KERN_INFO "%s: phy reset failed\n", pci_name(np->pci_dev)); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1114 |
return PHY_ERROR; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1115 |
} |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1116 |
|
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1117 |
/* phy vendor specific configuration */ |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1118 |
if ((np->phy_oui == PHY_OUI_CICADA) && (phyinterface & PHY_RGMII) ) { |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1119 |
phy_reserved = mii_rw(dev, np->phyaddr, MII_RESV1, MII_READ); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1120 |
phy_reserved &= ~(PHY_INIT1 | PHY_INIT2); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1121 |
phy_reserved |= (PHY_INIT3 | PHY_INIT4); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1122 |
if (mii_rw(dev, np->phyaddr, MII_RESV1, phy_reserved)) { |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1123 |
printk(KERN_INFO "%s: phy init failed.\n", pci_name(np->pci_dev)); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1124 |
return PHY_ERROR; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1125 |
} |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1126 |
phy_reserved = mii_rw(dev, np->phyaddr, MII_NCONFIG, MII_READ); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1127 |
phy_reserved |= PHY_INIT5; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1128 |
if (mii_rw(dev, np->phyaddr, MII_NCONFIG, phy_reserved)) { |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1129 |
printk(KERN_INFO "%s: phy init failed.\n", pci_name(np->pci_dev)); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1130 |
return PHY_ERROR; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1131 |
} |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1132 |
} |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1133 |
if (np->phy_oui == PHY_OUI_CICADA) { |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1134 |
phy_reserved = mii_rw(dev, np->phyaddr, MII_SREVISION, MII_READ); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1135 |
phy_reserved |= PHY_INIT6; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1136 |
if (mii_rw(dev, np->phyaddr, MII_SREVISION, phy_reserved)) { |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1137 |
printk(KERN_INFO "%s: phy init failed.\n", pci_name(np->pci_dev)); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1138 |
return PHY_ERROR; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1139 |
} |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1140 |
} |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1141 |
/* some phys clear out pause advertisment on reset, set it back */ |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1142 |
mii_rw(dev, np->phyaddr, MII_ADVERTISE, reg); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1143 |
|
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1144 |
/* restart auto negotiation */ |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1145 |
mii_control = mii_rw(dev, np->phyaddr, MII_BMCR, MII_READ); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1146 |
mii_control |= (BMCR_ANRESTART | BMCR_ANENABLE); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1147 |
if (mii_rw(dev, np->phyaddr, MII_BMCR, mii_control)) { |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1148 |
return PHY_ERROR; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1149 |
} |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1150 |
|
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1151 |
return 0; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1152 |
} |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1153 |
|
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1154 |
static void nv_start_rx(struct net_device *dev) |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1155 |
{ |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1156 |
struct fe_priv *np = netdev_priv(dev); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1157 |
u8 __iomem *base = get_hwbase(dev); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1158 |
|
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1159 |
dprintk(KERN_DEBUG "%s: nv_start_rx\n", dev->name); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1160 |
/* Already running? Stop it. */ |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1161 |
if (readl(base + NvRegReceiverControl) & NVREG_RCVCTL_START) { |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1162 |
writel(0, base + NvRegReceiverControl); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1163 |
pci_push(base); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1164 |
} |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1165 |
writel(np->linkspeed, base + NvRegLinkSpeed); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1166 |
pci_push(base); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1167 |
writel(NVREG_RCVCTL_START, base + NvRegReceiverControl); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1168 |
dprintk(KERN_DEBUG "%s: nv_start_rx to duplex %d, speed 0x%08x.\n", |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1169 |
dev->name, np->duplex, np->linkspeed); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1170 |
pci_push(base); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1171 |
} |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1172 |
|
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1173 |
static void nv_stop_rx(struct net_device *dev) |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1174 |
{ |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1175 |
u8 __iomem *base = get_hwbase(dev); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1176 |
|
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1177 |
dprintk(KERN_DEBUG "%s: nv_stop_rx\n", dev->name); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1178 |
writel(0, base + NvRegReceiverControl); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1179 |
reg_delay(dev, NvRegReceiverStatus, NVREG_RCVSTAT_BUSY, 0, |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1180 |
NV_RXSTOP_DELAY1, NV_RXSTOP_DELAY1MAX, |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1181 |
KERN_INFO "nv_stop_rx: ReceiverStatus remained busy"); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1182 |
|
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1183 |
udelay(NV_RXSTOP_DELAY2); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1184 |
writel(0, base + NvRegLinkSpeed); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1185 |
} |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1186 |
|
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1187 |
static void nv_start_tx(struct net_device *dev) |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1188 |
{ |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1189 |
u8 __iomem *base = get_hwbase(dev); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1190 |
|
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1191 |
dprintk(KERN_DEBUG "%s: nv_start_tx\n", dev->name); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1192 |
writel(NVREG_XMITCTL_START, base + NvRegTransmitterControl); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1193 |
pci_push(base); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1194 |
} |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1195 |
|
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1196 |
static void nv_stop_tx(struct net_device *dev) |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1197 |
{ |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1198 |
u8 __iomem *base = get_hwbase(dev); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1199 |
|
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1200 |
dprintk(KERN_DEBUG "%s: nv_stop_tx\n", dev->name); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1201 |
writel(0, base + NvRegTransmitterControl); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1202 |
reg_delay(dev, NvRegTransmitterStatus, NVREG_XMITSTAT_BUSY, 0, |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1203 |
NV_TXSTOP_DELAY1, NV_TXSTOP_DELAY1MAX, |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1204 |
KERN_INFO "nv_stop_tx: TransmitterStatus remained busy"); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1205 |
|
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1206 |
udelay(NV_TXSTOP_DELAY2); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1207 |
writel(readl(base + NvRegTransmitPoll) & NVREG_TRANSMITPOLL_MAC_ADDR_REV, base + NvRegTransmitPoll); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1208 |
} |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1209 |
|
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1210 |
static void nv_txrx_reset(struct net_device *dev) |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1211 |
{ |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1212 |
struct fe_priv *np = netdev_priv(dev); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1213 |
u8 __iomem *base = get_hwbase(dev); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1214 |
|
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1215 |
dprintk(KERN_DEBUG "%s: nv_txrx_reset\n", dev->name); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1216 |
writel(NVREG_TXRXCTL_BIT2 | NVREG_TXRXCTL_RESET | np->txrxctl_bits, base + NvRegTxRxControl); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1217 |
pci_push(base); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1218 |
udelay(NV_TXRX_RESET_DELAY); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1219 |
writel(NVREG_TXRXCTL_BIT2 | np->txrxctl_bits, base + NvRegTxRxControl); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1220 |
pci_push(base); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1221 |
} |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1222 |
|
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1223 |
static void nv_mac_reset(struct net_device *dev) |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1224 |
{ |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1225 |
struct fe_priv *np = netdev_priv(dev); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1226 |
u8 __iomem *base = get_hwbase(dev); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1227 |
|
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1228 |
dprintk(KERN_DEBUG "%s: nv_mac_reset\n", dev->name); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1229 |
writel(NVREG_TXRXCTL_BIT2 | NVREG_TXRXCTL_RESET | np->txrxctl_bits, base + NvRegTxRxControl); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1230 |
pci_push(base); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1231 |
writel(NVREG_MAC_RESET_ASSERT, base + NvRegMacReset); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1232 |
pci_push(base); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1233 |
udelay(NV_MAC_RESET_DELAY); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1234 |
writel(0, base + NvRegMacReset); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1235 |
pci_push(base); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1236 |
udelay(NV_MAC_RESET_DELAY); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1237 |
writel(NVREG_TXRXCTL_BIT2 | np->txrxctl_bits, base + NvRegTxRxControl); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1238 |
pci_push(base); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1239 |
} |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1240 |
|
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1241 |
/* |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1242 |
* nv_get_stats: dev->get_stats function |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1243 |
* Get latest stats value from the nic. |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1244 |
* Called with read_lock(&dev_base_lock) held for read - |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1245 |
* only synchronized against unregister_netdevice. |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1246 |
*/ |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1247 |
static struct net_device_stats *nv_get_stats(struct net_device *dev) |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1248 |
{ |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1249 |
struct fe_priv *np = netdev_priv(dev); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1250 |
|
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1251 |
/* It seems that the nic always generates interrupts and doesn't |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1252 |
* accumulate errors internally. Thus the current values in np->stats |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1253 |
* are already up to date. |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1254 |
*/ |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1255 |
return &np->stats; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1256 |
} |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1257 |
|
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1258 |
/* |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1259 |
* nv_alloc_rx: fill rx ring entries. |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1260 |
* Return 1 if the allocations for the skbs failed and the |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1261 |
* rx engine is without Available descriptors |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1262 |
*/ |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1263 |
static int nv_alloc_rx(struct net_device *dev) |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1264 |
{ |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1265 |
struct fe_priv *np = netdev_priv(dev); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1266 |
unsigned int refill_rx = np->refill_rx; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1267 |
int nr; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1268 |
|
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1269 |
while (np->cur_rx != refill_rx) { |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1270 |
struct sk_buff *skb; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1271 |
|
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1272 |
nr = refill_rx % np->rx_ring_size; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1273 |
if (np->rx_skbuff[nr] == NULL) { |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1274 |
|
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1275 |
skb = dev_alloc_skb(np->rx_buf_sz + NV_RX_ALLOC_PAD); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1276 |
if (!skb) |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1277 |
break; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1278 |
|
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1279 |
skb->dev = dev; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1280 |
np->rx_skbuff[nr] = skb; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1281 |
} else { |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1282 |
skb = np->rx_skbuff[nr]; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1283 |
} |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1284 |
np->rx_dma[nr] = pci_map_single(np->pci_dev, skb->data, |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1285 |
skb->end-skb->data, PCI_DMA_FROMDEVICE); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1286 |
if (np->desc_ver == DESC_VER_1 || np->desc_ver == DESC_VER_2) { |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1287 |
np->rx_ring.orig[nr].buf = cpu_to_le32(np->rx_dma[nr]); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1288 |
wmb(); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1289 |
np->rx_ring.orig[nr].flaglen = cpu_to_le32(np->rx_buf_sz | NV_RX_AVAIL); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1290 |
} else { |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1291 |
np->rx_ring.ex[nr].bufhigh = cpu_to_le64(np->rx_dma[nr]) >> 32; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1292 |
np->rx_ring.ex[nr].buflow = cpu_to_le64(np->rx_dma[nr]) & 0x0FFFFFFFF; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1293 |
wmb(); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1294 |
np->rx_ring.ex[nr].flaglen = cpu_to_le32(np->rx_buf_sz | NV_RX2_AVAIL); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1295 |
} |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1296 |
dprintk(KERN_DEBUG "%s: nv_alloc_rx: Packet %d marked as Available\n", |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1297 |
dev->name, refill_rx); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1298 |
refill_rx++; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1299 |
} |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1300 |
np->refill_rx = refill_rx; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1301 |
if (np->cur_rx - refill_rx == np->rx_ring_size) |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1302 |
return 1; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1303 |
return 0; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1304 |
} |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1305 |
|
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1306 |
/* If rx bufs are exhausted called after 50ms to attempt to refresh */ |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1307 |
#ifdef CONFIG_FORCEDETH_NAPI |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1308 |
static void nv_do_rx_refill(unsigned long data) |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1309 |
{ |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1310 |
struct net_device *dev = (struct net_device *) data; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1311 |
|
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1312 |
/* Just reschedule NAPI rx processing */ |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1313 |
netif_rx_schedule(dev); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1314 |
} |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1315 |
#else |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1316 |
static void nv_do_rx_refill(unsigned long data) |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1317 |
{ |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1318 |
struct net_device *dev = (struct net_device *) data; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1319 |
struct fe_priv *np = netdev_priv(dev); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1320 |
|
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1321 |
if (!using_multi_irqs(dev)) { |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1322 |
if (np->msi_flags & NV_MSI_X_ENABLED) |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1323 |
disable_irq(np->msi_x_entry[NV_MSI_X_VECTOR_ALL].vector); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1324 |
else |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1325 |
disable_irq(dev->irq); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1326 |
} else { |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1327 |
disable_irq(np->msi_x_entry[NV_MSI_X_VECTOR_RX].vector); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1328 |
} |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1329 |
if (nv_alloc_rx(dev)) { |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1330 |
spin_lock_irq(&np->lock); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1331 |
if (!np->in_shutdown) |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1332 |
mod_timer(&np->oom_kick, jiffies + OOM_REFILL); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1333 |
spin_unlock_irq(&np->lock); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1334 |
} |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1335 |
if (!using_multi_irqs(dev)) { |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1336 |
if (np->msi_flags & NV_MSI_X_ENABLED) |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1337 |
enable_irq(np->msi_x_entry[NV_MSI_X_VECTOR_ALL].vector); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1338 |
else |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1339 |
enable_irq(dev->irq); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1340 |
} else { |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1341 |
enable_irq(np->msi_x_entry[NV_MSI_X_VECTOR_RX].vector); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1342 |
} |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1343 |
} |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1344 |
#endif |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1345 |
|
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1346 |
static void nv_init_rx(struct net_device *dev) |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1347 |
{ |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1348 |
struct fe_priv *np = netdev_priv(dev); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1349 |
int i; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1350 |
|
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1351 |
np->cur_rx = np->rx_ring_size; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1352 |
np->refill_rx = 0; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1353 |
for (i = 0; i < np->rx_ring_size; i++) |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1354 |
if (np->desc_ver == DESC_VER_1 || np->desc_ver == DESC_VER_2) |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1355 |
np->rx_ring.orig[i].flaglen = 0; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1356 |
else |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1357 |
np->rx_ring.ex[i].flaglen = 0; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1358 |
} |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1359 |
|
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1360 |
static void nv_init_tx(struct net_device *dev) |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1361 |
{ |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1362 |
struct fe_priv *np = netdev_priv(dev); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1363 |
int i; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1364 |
|
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1365 |
np->next_tx = np->nic_tx = 0; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1366 |
for (i = 0; i < np->tx_ring_size; i++) { |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1367 |
if (np->desc_ver == DESC_VER_1 || np->desc_ver == DESC_VER_2) |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1368 |
np->tx_ring.orig[i].flaglen = 0; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1369 |
else |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1370 |
np->tx_ring.ex[i].flaglen = 0; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1371 |
np->tx_skbuff[i] = NULL; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1372 |
np->tx_dma[i] = 0; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1373 |
} |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1374 |
} |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1375 |
|
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1376 |
static int nv_init_ring(struct net_device *dev) |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1377 |
{ |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1378 |
nv_init_tx(dev); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1379 |
nv_init_rx(dev); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1380 |
return nv_alloc_rx(dev); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1381 |
} |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1382 |
|
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1383 |
static int nv_release_txskb(struct net_device *dev, unsigned int skbnr) |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1384 |
{ |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1385 |
struct fe_priv *np = netdev_priv(dev); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1386 |
|
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1387 |
dprintk(KERN_INFO "%s: nv_release_txskb for skbnr %d\n", |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1388 |
dev->name, skbnr); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1389 |
|
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1390 |
if (np->tx_dma[skbnr]) { |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1391 |
pci_unmap_page(np->pci_dev, np->tx_dma[skbnr], |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1392 |
np->tx_dma_len[skbnr], |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1393 |
PCI_DMA_TODEVICE); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1394 |
np->tx_dma[skbnr] = 0; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1395 |
} |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1396 |
|
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1397 |
if (np->tx_skbuff[skbnr]) { |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1398 |
dev_kfree_skb_any(np->tx_skbuff[skbnr]); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1399 |
np->tx_skbuff[skbnr] = NULL; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1400 |
return 1; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1401 |
} else { |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1402 |
return 0; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1403 |
} |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1404 |
} |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1405 |
|
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1406 |
static void nv_drain_tx(struct net_device *dev) |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1407 |
{ |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1408 |
struct fe_priv *np = netdev_priv(dev); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1409 |
unsigned int i; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1410 |
|
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1411 |
for (i = 0; i < np->tx_ring_size; i++) { |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1412 |
if (np->desc_ver == DESC_VER_1 || np->desc_ver == DESC_VER_2) |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1413 |
np->tx_ring.orig[i].flaglen = 0; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1414 |
else |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1415 |
np->tx_ring.ex[i].flaglen = 0; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1416 |
if (nv_release_txskb(dev, i)) |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1417 |
np->stats.tx_dropped++; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1418 |
} |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1419 |
} |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1420 |
|
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1421 |
static void nv_drain_rx(struct net_device *dev) |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1422 |
{ |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1423 |
struct fe_priv *np = netdev_priv(dev); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1424 |
int i; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1425 |
for (i = 0; i < np->rx_ring_size; i++) { |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1426 |
if (np->desc_ver == DESC_VER_1 || np->desc_ver == DESC_VER_2) |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1427 |
np->rx_ring.orig[i].flaglen = 0; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1428 |
else |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1429 |
np->rx_ring.ex[i].flaglen = 0; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1430 |
wmb(); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1431 |
if (np->rx_skbuff[i]) { |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1432 |
pci_unmap_single(np->pci_dev, np->rx_dma[i], |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1433 |
np->rx_skbuff[i]->end-np->rx_skbuff[i]->data, |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1434 |
PCI_DMA_FROMDEVICE); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1435 |
dev_kfree_skb(np->rx_skbuff[i]); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1436 |
np->rx_skbuff[i] = NULL; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1437 |
} |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1438 |
} |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1439 |
} |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1440 |
|
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1441 |
static void drain_ring(struct net_device *dev) |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1442 |
{ |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1443 |
nv_drain_tx(dev); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1444 |
nv_drain_rx(dev); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1445 |
} |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1446 |
|
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1447 |
/* |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1448 |
* nv_start_xmit: dev->hard_start_xmit function |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1449 |
* Called with netif_tx_lock held. |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1450 |
*/ |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1451 |
static int nv_start_xmit(struct sk_buff *skb, struct net_device *dev) |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1452 |
{ |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1453 |
struct fe_priv *np = netdev_priv(dev); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1454 |
u32 tx_flags = 0; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1455 |
u32 tx_flags_extra = (np->desc_ver == DESC_VER_1 ? NV_TX_LASTPACKET : NV_TX2_LASTPACKET); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1456 |
unsigned int fragments = skb_shinfo(skb)->nr_frags; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1457 |
unsigned int nr = (np->next_tx - 1) % np->tx_ring_size; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1458 |
unsigned int start_nr = np->next_tx % np->tx_ring_size; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1459 |
unsigned int i; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1460 |
u32 offset = 0; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1461 |
u32 bcnt; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1462 |
u32 size = skb->len-skb->data_len; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1463 |
u32 entries = (size >> NV_TX2_TSO_MAX_SHIFT) + ((size & (NV_TX2_TSO_MAX_SIZE-1)) ? 1 : 0); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1464 |
u32 tx_flags_vlan = 0; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1465 |
|
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1466 |
/* add fragments to entries count */ |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1467 |
for (i = 0; i < fragments; i++) { |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1468 |
entries += (skb_shinfo(skb)->frags[i].size >> NV_TX2_TSO_MAX_SHIFT) + |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1469 |
((skb_shinfo(skb)->frags[i].size & (NV_TX2_TSO_MAX_SIZE-1)) ? 1 : 0); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1470 |
} |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1471 |
|
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1472 |
spin_lock_irq(&np->lock); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1473 |
|
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1474 |
if ((np->next_tx - np->nic_tx + entries - 1) > np->tx_limit_stop) { |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1475 |
spin_unlock_irq(&np->lock); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1476 |
netif_stop_queue(dev); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1477 |
return NETDEV_TX_BUSY; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1478 |
} |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1479 |
|
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1480 |
/* setup the header buffer */ |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1481 |
do { |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1482 |
bcnt = (size > NV_TX2_TSO_MAX_SIZE) ? NV_TX2_TSO_MAX_SIZE : size; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1483 |
nr = (nr + 1) % np->tx_ring_size; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1484 |
|
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1485 |
np->tx_dma[nr] = pci_map_single(np->pci_dev, skb->data + offset, bcnt, |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1486 |
PCI_DMA_TODEVICE); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1487 |
np->tx_dma_len[nr] = bcnt; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1488 |
|
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1489 |
if (np->desc_ver == DESC_VER_1 || np->desc_ver == DESC_VER_2) { |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1490 |
np->tx_ring.orig[nr].buf = cpu_to_le32(np->tx_dma[nr]); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1491 |
np->tx_ring.orig[nr].flaglen = cpu_to_le32((bcnt-1) | tx_flags); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1492 |
} else { |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1493 |
np->tx_ring.ex[nr].bufhigh = cpu_to_le64(np->tx_dma[nr]) >> 32; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1494 |
np->tx_ring.ex[nr].buflow = cpu_to_le64(np->tx_dma[nr]) & 0x0FFFFFFFF; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1495 |
np->tx_ring.ex[nr].flaglen = cpu_to_le32((bcnt-1) | tx_flags); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1496 |
} |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1497 |
tx_flags = np->tx_flags; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1498 |
offset += bcnt; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1499 |
size -= bcnt; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1500 |
} while (size); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1501 |
|
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1502 |
/* setup the fragments */ |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1503 |
for (i = 0; i < fragments; i++) { |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1504 |
skb_frag_t *frag = &skb_shinfo(skb)->frags[i]; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1505 |
u32 size = frag->size; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1506 |
offset = 0; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1507 |
|
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1508 |
do { |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1509 |
bcnt = (size > NV_TX2_TSO_MAX_SIZE) ? NV_TX2_TSO_MAX_SIZE : size; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1510 |
nr = (nr + 1) % np->tx_ring_size; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1511 |
|
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1512 |
np->tx_dma[nr] = pci_map_page(np->pci_dev, frag->page, frag->page_offset+offset, bcnt, |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1513 |
PCI_DMA_TODEVICE); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1514 |
np->tx_dma_len[nr] = bcnt; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1515 |
|
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1516 |
if (np->desc_ver == DESC_VER_1 || np->desc_ver == DESC_VER_2) { |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1517 |
np->tx_ring.orig[nr].buf = cpu_to_le32(np->tx_dma[nr]); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1518 |
np->tx_ring.orig[nr].flaglen = cpu_to_le32((bcnt-1) | tx_flags); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1519 |
} else { |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1520 |
np->tx_ring.ex[nr].bufhigh = cpu_to_le64(np->tx_dma[nr]) >> 32; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1521 |
np->tx_ring.ex[nr].buflow = cpu_to_le64(np->tx_dma[nr]) & 0x0FFFFFFFF; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1522 |
np->tx_ring.ex[nr].flaglen = cpu_to_le32((bcnt-1) | tx_flags); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1523 |
} |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1524 |
offset += bcnt; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1525 |
size -= bcnt; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1526 |
} while (size); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1527 |
} |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1528 |
|
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1529 |
/* set last fragment flag */ |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1530 |
if (np->desc_ver == DESC_VER_1 || np->desc_ver == DESC_VER_2) { |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1531 |
np->tx_ring.orig[nr].flaglen |= cpu_to_le32(tx_flags_extra); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1532 |
} else { |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1533 |
np->tx_ring.ex[nr].flaglen |= cpu_to_le32(tx_flags_extra); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1534 |
} |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1535 |
|
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1536 |
np->tx_skbuff[nr] = skb; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1537 |
|
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1538 |
#ifdef NETIF_F_TSO |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1539 |
if (skb_is_gso(skb)) |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1540 |
tx_flags_extra = NV_TX2_TSO | (skb_shinfo(skb)->gso_size << NV_TX2_TSO_SHIFT); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1541 |
else |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1542 |
#endif |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1543 |
tx_flags_extra = skb->ip_summed == CHECKSUM_PARTIAL ? |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1544 |
NV_TX2_CHECKSUM_L3 | NV_TX2_CHECKSUM_L4 : 0; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1545 |
|
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1546 |
/* vlan tag */ |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1547 |
if (np->vlangrp && vlan_tx_tag_present(skb)) { |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1548 |
tx_flags_vlan = NV_TX3_VLAN_TAG_PRESENT | vlan_tx_tag_get(skb); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1549 |
} |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1550 |
|
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1551 |
/* set tx flags */ |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1552 |
if (np->desc_ver == DESC_VER_1 || np->desc_ver == DESC_VER_2) { |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1553 |
np->tx_ring.orig[start_nr].flaglen |= cpu_to_le32(tx_flags | tx_flags_extra); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1554 |
} else { |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1555 |
np->tx_ring.ex[start_nr].txvlan = cpu_to_le32(tx_flags_vlan); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1556 |
np->tx_ring.ex[start_nr].flaglen |= cpu_to_le32(tx_flags | tx_flags_extra); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1557 |
} |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1558 |
|
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1559 |
dprintk(KERN_DEBUG "%s: nv_start_xmit: packet %d (entries %d) queued for transmission. tx_flags_extra: %x\n", |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1560 |
dev->name, np->next_tx, entries, tx_flags_extra); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1561 |
{ |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1562 |
int j; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1563 |
for (j=0; j<64; j++) { |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1564 |
if ((j%16) == 0) |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1565 |
dprintk("\n%03x:", j); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1566 |
dprintk(" %02x", ((unsigned char*)skb->data)[j]); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1567 |
} |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1568 |
dprintk("\n"); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1569 |
} |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1570 |
|
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1571 |
np->next_tx += entries; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1572 |
|
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1573 |
dev->trans_start = jiffies; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1574 |
spin_unlock_irq(&np->lock); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1575 |
writel(NVREG_TXRXCTL_KICK|np->txrxctl_bits, get_hwbase(dev) + NvRegTxRxControl); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1576 |
pci_push(get_hwbase(dev)); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1577 |
return NETDEV_TX_OK; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1578 |
} |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1579 |
|
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1580 |
/* |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1581 |
* nv_tx_done: check for completed packets, release the skbs. |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1582 |
* |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1583 |
* Caller must own np->lock. |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1584 |
*/ |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1585 |
static void nv_tx_done(struct net_device *dev) |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1586 |
{ |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1587 |
struct fe_priv *np = netdev_priv(dev); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1588 |
u32 flags; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1589 |
unsigned int i; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1590 |
struct sk_buff *skb; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1591 |
|
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1592 |
while (np->nic_tx != np->next_tx) { |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1593 |
i = np->nic_tx % np->tx_ring_size; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1594 |
|
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1595 |
if (np->desc_ver == DESC_VER_1 || np->desc_ver == DESC_VER_2) |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1596 |
flags = le32_to_cpu(np->tx_ring.orig[i].flaglen); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1597 |
else |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1598 |
flags = le32_to_cpu(np->tx_ring.ex[i].flaglen); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1599 |
|
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1600 |
dprintk(KERN_DEBUG "%s: nv_tx_done: looking at packet %d, flags 0x%x.\n", |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1601 |
dev->name, np->nic_tx, flags); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1602 |
if (flags & NV_TX_VALID) |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1603 |
break; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1604 |
if (np->desc_ver == DESC_VER_1) { |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1605 |
if (flags & NV_TX_LASTPACKET) { |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1606 |
skb = np->tx_skbuff[i]; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1607 |
if (flags & (NV_TX_RETRYERROR|NV_TX_CARRIERLOST|NV_TX_LATECOLLISION| |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1608 |
NV_TX_UNDERFLOW|NV_TX_ERROR)) { |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1609 |
if (flags & NV_TX_UNDERFLOW) |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1610 |
np->stats.tx_fifo_errors++; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1611 |
if (flags & NV_TX_CARRIERLOST) |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1612 |
np->stats.tx_carrier_errors++; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1613 |
np->stats.tx_errors++; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1614 |
} else { |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1615 |
np->stats.tx_packets++; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1616 |
np->stats.tx_bytes += skb->len; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1617 |
} |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1618 |
} |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1619 |
} else { |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1620 |
if (flags & NV_TX2_LASTPACKET) { |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1621 |
skb = np->tx_skbuff[i]; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1622 |
if (flags & (NV_TX2_RETRYERROR|NV_TX2_CARRIERLOST|NV_TX2_LATECOLLISION| |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1623 |
NV_TX2_UNDERFLOW|NV_TX2_ERROR)) { |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1624 |
if (flags & NV_TX2_UNDERFLOW) |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1625 |
np->stats.tx_fifo_errors++; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1626 |
if (flags & NV_TX2_CARRIERLOST) |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1627 |
np->stats.tx_carrier_errors++; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1628 |
np->stats.tx_errors++; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1629 |
} else { |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1630 |
np->stats.tx_packets++; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1631 |
np->stats.tx_bytes += skb->len; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1632 |
} |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1633 |
} |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1634 |
} |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1635 |
nv_release_txskb(dev, i); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1636 |
np->nic_tx++; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1637 |
} |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1638 |
if (np->next_tx - np->nic_tx < np->tx_limit_start) |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1639 |
netif_wake_queue(dev); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1640 |
} |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1641 |
|
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1642 |
/* |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1643 |
* nv_tx_timeout: dev->tx_timeout function |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1644 |
* Called with netif_tx_lock held. |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1645 |
*/ |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1646 |
static void nv_tx_timeout(struct net_device *dev) |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1647 |
{ |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1648 |
struct fe_priv *np = netdev_priv(dev); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1649 |
u8 __iomem *base = get_hwbase(dev); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1650 |
u32 status; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1651 |
|
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1652 |
if (np->msi_flags & NV_MSI_X_ENABLED) |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1653 |
status = readl(base + NvRegMSIXIrqStatus) & NVREG_IRQSTAT_MASK; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1654 |
else |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1655 |
status = readl(base + NvRegIrqStatus) & NVREG_IRQSTAT_MASK; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1656 |
|
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1657 |
printk(KERN_INFO "%s: Got tx_timeout. irq: %08x\n", dev->name, status); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1658 |
|
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1659 |
{ |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1660 |
int i; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1661 |
|
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1662 |
printk(KERN_INFO "%s: Ring at %lx: next %d nic %d\n", |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1663 |
dev->name, (unsigned long)np->ring_addr, |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1664 |
np->next_tx, np->nic_tx); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1665 |
printk(KERN_INFO "%s: Dumping tx registers\n", dev->name); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1666 |
for (i=0;i<=np->register_size;i+= 32) { |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1667 |
printk(KERN_INFO "%3x: %08x %08x %08x %08x %08x %08x %08x %08x\n", |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1668 |
i, |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1669 |
readl(base + i + 0), readl(base + i + 4), |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1670 |
readl(base + i + 8), readl(base + i + 12), |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1671 |
readl(base + i + 16), readl(base + i + 20), |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1672 |
readl(base + i + 24), readl(base + i + 28)); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1673 |
} |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1674 |
printk(KERN_INFO "%s: Dumping tx ring\n", dev->name); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1675 |
for (i=0;i<np->tx_ring_size;i+= 4) { |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1676 |
if (np->desc_ver == DESC_VER_1 || np->desc_ver == DESC_VER_2) { |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1677 |
printk(KERN_INFO "%03x: %08x %08x // %08x %08x // %08x %08x // %08x %08x\n", |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1678 |
i, |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1679 |
le32_to_cpu(np->tx_ring.orig[i].buf), |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1680 |
le32_to_cpu(np->tx_ring.orig[i].flaglen), |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1681 |
le32_to_cpu(np->tx_ring.orig[i+1].buf), |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1682 |
le32_to_cpu(np->tx_ring.orig[i+1].flaglen), |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1683 |
le32_to_cpu(np->tx_ring.orig[i+2].buf), |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1684 |
le32_to_cpu(np->tx_ring.orig[i+2].flaglen), |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1685 |
le32_to_cpu(np->tx_ring.orig[i+3].buf), |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1686 |
le32_to_cpu(np->tx_ring.orig[i+3].flaglen)); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1687 |
} else { |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1688 |
printk(KERN_INFO "%03x: %08x %08x %08x // %08x %08x %08x // %08x %08x %08x // %08x %08x %08x\n", |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1689 |
i, |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1690 |
le32_to_cpu(np->tx_ring.ex[i].bufhigh), |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1691 |
le32_to_cpu(np->tx_ring.ex[i].buflow), |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1692 |
le32_to_cpu(np->tx_ring.ex[i].flaglen), |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1693 |
le32_to_cpu(np->tx_ring.ex[i+1].bufhigh), |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1694 |
le32_to_cpu(np->tx_ring.ex[i+1].buflow), |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1695 |
le32_to_cpu(np->tx_ring.ex[i+1].flaglen), |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1696 |
le32_to_cpu(np->tx_ring.ex[i+2].bufhigh), |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1697 |
le32_to_cpu(np->tx_ring.ex[i+2].buflow), |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1698 |
le32_to_cpu(np->tx_ring.ex[i+2].flaglen), |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1699 |
le32_to_cpu(np->tx_ring.ex[i+3].bufhigh), |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1700 |
le32_to_cpu(np->tx_ring.ex[i+3].buflow), |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1701 |
le32_to_cpu(np->tx_ring.ex[i+3].flaglen)); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1702 |
} |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1703 |
} |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1704 |
} |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1705 |
|
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1706 |
spin_lock_irq(&np->lock); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1707 |
|
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1708 |
/* 1) stop tx engine */ |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1709 |
nv_stop_tx(dev); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1710 |
|
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1711 |
/* 2) check that the packets were not sent already: */ |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1712 |
nv_tx_done(dev); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1713 |
|
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1714 |
/* 3) if there are dead entries: clear everything */ |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1715 |
if (np->next_tx != np->nic_tx) { |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1716 |
printk(KERN_DEBUG "%s: tx_timeout: dead entries!\n", dev->name); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1717 |
nv_drain_tx(dev); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1718 |
np->next_tx = np->nic_tx = 0; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1719 |
setup_hw_rings(dev, NV_SETUP_TX_RING); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1720 |
netif_wake_queue(dev); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1721 |
} |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1722 |
|
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1723 |
/* 4) restart tx engine */ |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1724 |
nv_start_tx(dev); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1725 |
spin_unlock_irq(&np->lock); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1726 |
} |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1727 |
|
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1728 |
/* |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1729 |
* Called when the nic notices a mismatch between the actual data len on the |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1730 |
* wire and the len indicated in the 802 header |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1731 |
*/ |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1732 |
static int nv_getlen(struct net_device *dev, void *packet, int datalen) |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1733 |
{ |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1734 |
int hdrlen; /* length of the 802 header */ |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1735 |
int protolen; /* length as stored in the proto field */ |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1736 |
|
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1737 |
/* 1) calculate len according to header */ |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1738 |
if ( ((struct vlan_ethhdr *)packet)->h_vlan_proto == htons(ETH_P_8021Q)) { |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1739 |
protolen = ntohs( ((struct vlan_ethhdr *)packet)->h_vlan_encapsulated_proto ); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1740 |
hdrlen = VLAN_HLEN; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1741 |
} else { |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1742 |
protolen = ntohs( ((struct ethhdr *)packet)->h_proto); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1743 |
hdrlen = ETH_HLEN; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1744 |
} |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1745 |
dprintk(KERN_DEBUG "%s: nv_getlen: datalen %d, protolen %d, hdrlen %d\n", |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1746 |
dev->name, datalen, protolen, hdrlen); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1747 |
if (protolen > ETH_DATA_LEN) |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1748 |
return datalen; /* Value in proto field not a len, no checks possible */ |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1749 |
|
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1750 |
protolen += hdrlen; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1751 |
/* consistency checks: */ |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1752 |
if (datalen > ETH_ZLEN) { |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1753 |
if (datalen >= protolen) { |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1754 |
/* more data on wire than in 802 header, trim of |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1755 |
* additional data. |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1756 |
*/ |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1757 |
dprintk(KERN_DEBUG "%s: nv_getlen: accepting %d bytes.\n", |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1758 |
dev->name, protolen); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1759 |
return protolen; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1760 |
} else { |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1761 |
/* less data on wire than mentioned in header. |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1762 |
* Discard the packet. |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1763 |
*/ |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1764 |
dprintk(KERN_DEBUG "%s: nv_getlen: discarding long packet.\n", |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1765 |
dev->name); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1766 |
return -1; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1767 |
} |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1768 |
} else { |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1769 |
/* short packet. Accept only if 802 values are also short */ |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1770 |
if (protolen > ETH_ZLEN) { |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1771 |
dprintk(KERN_DEBUG "%s: nv_getlen: discarding short packet.\n", |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1772 |
dev->name); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1773 |
return -1; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1774 |
} |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1775 |
dprintk(KERN_DEBUG "%s: nv_getlen: accepting %d bytes.\n", |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1776 |
dev->name, datalen); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1777 |
return datalen; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1778 |
} |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1779 |
} |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1780 |
|
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1781 |
static int nv_rx_process(struct net_device *dev, int limit) |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1782 |
{ |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1783 |
struct fe_priv *np = netdev_priv(dev); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1784 |
u32 flags; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1785 |
u32 vlanflags = 0; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1786 |
int count; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1787 |
|
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1788 |
for (count = 0; count < limit; ++count) { |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1789 |
struct sk_buff *skb; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1790 |
int len; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1791 |
int i; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1792 |
if (np->cur_rx - np->refill_rx >= np->rx_ring_size) |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1793 |
break; /* we scanned the whole ring - do not continue */ |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1794 |
|
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1795 |
i = np->cur_rx % np->rx_ring_size; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1796 |
if (np->desc_ver == DESC_VER_1 || np->desc_ver == DESC_VER_2) { |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1797 |
flags = le32_to_cpu(np->rx_ring.orig[i].flaglen); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1798 |
len = nv_descr_getlength(&np->rx_ring.orig[i], np->desc_ver); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1799 |
} else { |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1800 |
flags = le32_to_cpu(np->rx_ring.ex[i].flaglen); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1801 |
len = nv_descr_getlength_ex(&np->rx_ring.ex[i], np->desc_ver); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1802 |
vlanflags = le32_to_cpu(np->rx_ring.ex[i].buflow); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1803 |
} |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1804 |
|
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1805 |
dprintk(KERN_DEBUG "%s: nv_rx_process: looking at packet %d, flags 0x%x.\n", |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1806 |
dev->name, np->cur_rx, flags); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1807 |
|
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1808 |
if (flags & NV_RX_AVAIL) |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1809 |
break; /* still owned by hardware, */ |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1810 |
|
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1811 |
/* |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1812 |
* the packet is for us - immediately tear down the pci mapping. |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1813 |
* TODO: check if a prefetch of the first cacheline improves |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1814 |
* the performance. |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1815 |
*/ |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1816 |
pci_unmap_single(np->pci_dev, np->rx_dma[i], |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1817 |
np->rx_skbuff[i]->end-np->rx_skbuff[i]->data, |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1818 |
PCI_DMA_FROMDEVICE); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1819 |
|
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1820 |
{ |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1821 |
int j; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1822 |
dprintk(KERN_DEBUG "Dumping packet (flags 0x%x).",flags); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1823 |
for (j=0; j<64; j++) { |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1824 |
if ((j%16) == 0) |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1825 |
dprintk("\n%03x:", j); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1826 |
dprintk(" %02x", ((unsigned char*)np->rx_skbuff[i]->data)[j]); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1827 |
} |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1828 |
dprintk("\n"); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1829 |
} |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1830 |
/* look at what we actually got: */ |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1831 |
if (np->desc_ver == DESC_VER_1) { |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1832 |
if (!(flags & NV_RX_DESCRIPTORVALID)) |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1833 |
goto next_pkt; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1834 |
|
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1835 |
if (flags & NV_RX_ERROR) { |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1836 |
if (flags & NV_RX_MISSEDFRAME) { |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1837 |
np->stats.rx_missed_errors++; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1838 |
np->stats.rx_errors++; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1839 |
goto next_pkt; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1840 |
} |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1841 |
if (flags & (NV_RX_ERROR1|NV_RX_ERROR2|NV_RX_ERROR3)) { |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1842 |
np->stats.rx_errors++; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1843 |
goto next_pkt; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1844 |
} |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1845 |
if (flags & NV_RX_CRCERR) { |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1846 |
np->stats.rx_crc_errors++; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1847 |
np->stats.rx_errors++; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1848 |
goto next_pkt; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1849 |
} |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1850 |
if (flags & NV_RX_OVERFLOW) { |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1851 |
np->stats.rx_over_errors++; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1852 |
np->stats.rx_errors++; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1853 |
goto next_pkt; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1854 |
} |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1855 |
if (flags & NV_RX_ERROR4) { |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1856 |
len = nv_getlen(dev, np->rx_skbuff[i]->data, len); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1857 |
if (len < 0) { |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1858 |
np->stats.rx_errors++; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1859 |
goto next_pkt; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1860 |
} |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1861 |
} |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1862 |
/* framing errors are soft errors. */ |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1863 |
if (flags & NV_RX_FRAMINGERR) { |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1864 |
if (flags & NV_RX_SUBSTRACT1) { |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1865 |
len--; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1866 |
} |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1867 |
} |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1868 |
} |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1869 |
} else { |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1870 |
if (!(flags & NV_RX2_DESCRIPTORVALID)) |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1871 |
goto next_pkt; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1872 |
|
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1873 |
if (flags & NV_RX2_ERROR) { |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1874 |
if (flags & (NV_RX2_ERROR1|NV_RX2_ERROR2|NV_RX2_ERROR3)) { |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1875 |
np->stats.rx_errors++; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1876 |
goto next_pkt; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1877 |
} |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1878 |
if (flags & NV_RX2_CRCERR) { |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1879 |
np->stats.rx_crc_errors++; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1880 |
np->stats.rx_errors++; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1881 |
goto next_pkt; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1882 |
} |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1883 |
if (flags & NV_RX2_OVERFLOW) { |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1884 |
np->stats.rx_over_errors++; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1885 |
np->stats.rx_errors++; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1886 |
goto next_pkt; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1887 |
} |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1888 |
if (flags & NV_RX2_ERROR4) { |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1889 |
len = nv_getlen(dev, np->rx_skbuff[i]->data, len); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1890 |
if (len < 0) { |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1891 |
np->stats.rx_errors++; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1892 |
goto next_pkt; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1893 |
} |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1894 |
} |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1895 |
/* framing errors are soft errors */ |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1896 |
if (flags & NV_RX2_FRAMINGERR) { |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1897 |
if (flags & NV_RX2_SUBSTRACT1) { |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1898 |
len--; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1899 |
} |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1900 |
} |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1901 |
} |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1902 |
if (np->rx_csum) { |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1903 |
flags &= NV_RX2_CHECKSUMMASK; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1904 |
if (flags == NV_RX2_CHECKSUMOK1 || |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1905 |
flags == NV_RX2_CHECKSUMOK2 || |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1906 |
flags == NV_RX2_CHECKSUMOK3) { |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1907 |
dprintk(KERN_DEBUG "%s: hw checksum hit!.\n", dev->name); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1908 |
np->rx_skbuff[i]->ip_summed = CHECKSUM_UNNECESSARY; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1909 |
} else { |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1910 |
dprintk(KERN_DEBUG "%s: hwchecksum miss!.\n", dev->name); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1911 |
} |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1912 |
} |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1913 |
} |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1914 |
/* got a valid packet - forward it to the network core */ |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1915 |
skb = np->rx_skbuff[i]; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1916 |
np->rx_skbuff[i] = NULL; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1917 |
|
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1918 |
skb_put(skb, len); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1919 |
skb->protocol = eth_type_trans(skb, dev); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1920 |
dprintk(KERN_DEBUG "%s: nv_rx_process: packet %d with %d bytes, proto %d accepted.\n", |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1921 |
dev->name, np->cur_rx, len, skb->protocol); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1922 |
#ifdef CONFIG_FORCEDETH_NAPI |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1923 |
if (np->vlangrp && (vlanflags & NV_RX3_VLAN_TAG_PRESENT)) |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1924 |
vlan_hwaccel_receive_skb(skb, np->vlangrp, |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1925 |
vlanflags & NV_RX3_VLAN_TAG_MASK); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1926 |
else |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1927 |
netif_receive_skb(skb); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1928 |
#else |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1929 |
if (np->vlangrp && (vlanflags & NV_RX3_VLAN_TAG_PRESENT)) |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1930 |
vlan_hwaccel_rx(skb, np->vlangrp, |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1931 |
vlanflags & NV_RX3_VLAN_TAG_MASK); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1932 |
else |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1933 |
netif_rx(skb); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1934 |
#endif |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1935 |
dev->last_rx = jiffies; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1936 |
np->stats.rx_packets++; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1937 |
np->stats.rx_bytes += len; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1938 |
next_pkt: |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1939 |
np->cur_rx++; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1940 |
} |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1941 |
|
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1942 |
return count; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1943 |
} |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1944 |
|
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1945 |
static void set_bufsize(struct net_device *dev) |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1946 |
{ |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1947 |
struct fe_priv *np = netdev_priv(dev); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1948 |
|
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1949 |
if (dev->mtu <= ETH_DATA_LEN) |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1950 |
np->rx_buf_sz = ETH_DATA_LEN + NV_RX_HEADERS; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1951 |
else |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1952 |
np->rx_buf_sz = dev->mtu + NV_RX_HEADERS; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1953 |
} |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1954 |
|
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1955 |
/* |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1956 |
* nv_change_mtu: dev->change_mtu function |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1957 |
* Called with dev_base_lock held for read. |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1958 |
*/ |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1959 |
static int nv_change_mtu(struct net_device *dev, int new_mtu) |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1960 |
{ |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1961 |
struct fe_priv *np = netdev_priv(dev); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1962 |
int old_mtu; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1963 |
|
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1964 |
if (new_mtu < 64 || new_mtu > np->pkt_limit) |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1965 |
return -EINVAL; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1966 |
|
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1967 |
old_mtu = dev->mtu; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1968 |
dev->mtu = new_mtu; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1969 |
|
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1970 |
/* return early if the buffer sizes will not change */ |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1971 |
if (old_mtu <= ETH_DATA_LEN && new_mtu <= ETH_DATA_LEN) |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1972 |
return 0; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1973 |
if (old_mtu == new_mtu) |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1974 |
return 0; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1975 |
|
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1976 |
/* synchronized against open : rtnl_lock() held by caller */ |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1977 |
if (netif_running(dev)) { |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1978 |
u8 __iomem *base = get_hwbase(dev); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1979 |
/* |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1980 |
* It seems that the nic preloads valid ring entries into an |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1981 |
* internal buffer. The procedure for flushing everything is |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1982 |
* guessed, there is probably a simpler approach. |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1983 |
* Changing the MTU is a rare event, it shouldn't matter. |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1984 |
*/ |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1985 |
nv_disable_irq(dev); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1986 |
netif_tx_lock_bh(dev); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1987 |
spin_lock(&np->lock); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1988 |
/* stop engines */ |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1989 |
nv_stop_rx(dev); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1990 |
nv_stop_tx(dev); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1991 |
nv_txrx_reset(dev); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1992 |
/* drain rx queue */ |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1993 |
nv_drain_rx(dev); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1994 |
nv_drain_tx(dev); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1995 |
/* reinit driver view of the rx queue */ |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1996 |
set_bufsize(dev); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1997 |
if (nv_init_ring(dev)) { |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1998 |
if (!np->in_shutdown) |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1999 |
mod_timer(&np->oom_kick, jiffies + OOM_REFILL); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2000 |
} |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2001 |
/* reinit nic view of the rx queue */ |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2002 |
writel(np->rx_buf_sz, base + NvRegOffloadConfig); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2003 |
setup_hw_rings(dev, NV_SETUP_RX_RING | NV_SETUP_TX_RING); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2004 |
writel( ((np->rx_ring_size-1) << NVREG_RINGSZ_RXSHIFT) + ((np->tx_ring_size-1) << NVREG_RINGSZ_TXSHIFT), |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2005 |
base + NvRegRingSizes); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2006 |
pci_push(base); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2007 |
writel(NVREG_TXRXCTL_KICK|np->txrxctl_bits, get_hwbase(dev) + NvRegTxRxControl); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2008 |
pci_push(base); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2009 |
|
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2010 |
/* restart rx engine */ |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2011 |
nv_start_rx(dev); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2012 |
nv_start_tx(dev); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2013 |
spin_unlock(&np->lock); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2014 |
netif_tx_unlock_bh(dev); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2015 |
nv_enable_irq(dev); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2016 |
} |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2017 |
return 0; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2018 |
} |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2019 |
|
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2020 |
static void nv_copy_mac_to_hw(struct net_device *dev) |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2021 |
{ |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2022 |
u8 __iomem *base = get_hwbase(dev); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2023 |
u32 mac[2]; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2024 |
|
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2025 |
mac[0] = (dev->dev_addr[0] << 0) + (dev->dev_addr[1] << 8) + |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2026 |
(dev->dev_addr[2] << 16) + (dev->dev_addr[3] << 24); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2027 |
mac[1] = (dev->dev_addr[4] << 0) + (dev->dev_addr[5] << 8); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2028 |
|
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2029 |
writel(mac[0], base + NvRegMacAddrA); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2030 |
writel(mac[1], base + NvRegMacAddrB); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2031 |
} |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2032 |
|
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2033 |
/* |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2034 |
* nv_set_mac_address: dev->set_mac_address function |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2035 |
* Called with rtnl_lock() held. |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2036 |
*/ |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2037 |
static int nv_set_mac_address(struct net_device *dev, void *addr) |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2038 |
{ |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2039 |
struct fe_priv *np = netdev_priv(dev); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2040 |
struct sockaddr *macaddr = (struct sockaddr*)addr; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2041 |
|
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2042 |
if (!is_valid_ether_addr(macaddr->sa_data)) |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2043 |
return -EADDRNOTAVAIL; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2044 |
|
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2045 |
/* synchronized against open : rtnl_lock() held by caller */ |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2046 |
memcpy(dev->dev_addr, macaddr->sa_data, ETH_ALEN); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2047 |
|
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2048 |
if (netif_running(dev)) { |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2049 |
netif_tx_lock_bh(dev); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2050 |
spin_lock_irq(&np->lock); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2051 |
|
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2052 |
/* stop rx engine */ |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2053 |
nv_stop_rx(dev); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2054 |
|
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2055 |
/* set mac address */ |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2056 |
nv_copy_mac_to_hw(dev); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2057 |
|
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2058 |
/* restart rx engine */ |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2059 |
nv_start_rx(dev); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2060 |
spin_unlock_irq(&np->lock); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2061 |
netif_tx_unlock_bh(dev); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2062 |
} else { |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2063 |
nv_copy_mac_to_hw(dev); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2064 |
} |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2065 |
return 0; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2066 |
} |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2067 |
|
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2068 |
/* |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2069 |
* nv_set_multicast: dev->set_multicast function |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2070 |
* Called with netif_tx_lock held. |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2071 |
*/ |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2072 |
static void nv_set_multicast(struct net_device *dev) |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2073 |
{ |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2074 |
struct fe_priv *np = netdev_priv(dev); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2075 |
u8 __iomem *base = get_hwbase(dev); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2076 |
u32 addr[2]; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2077 |
u32 mask[2]; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2078 |
u32 pff = readl(base + NvRegPacketFilterFlags) & NVREG_PFF_PAUSE_RX; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2079 |
|
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2080 |
memset(addr, 0, sizeof(addr)); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2081 |
memset(mask, 0, sizeof(mask)); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2082 |
|
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2083 |
if (dev->flags & IFF_PROMISC) { |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2084 |
pff |= NVREG_PFF_PROMISC; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2085 |
} else { |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2086 |
pff |= NVREG_PFF_MYADDR; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2087 |
|
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2088 |
if (dev->flags & IFF_ALLMULTI || dev->mc_list) { |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2089 |
u32 alwaysOff[2]; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2090 |
u32 alwaysOn[2]; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2091 |
|
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2092 |
alwaysOn[0] = alwaysOn[1] = alwaysOff[0] = alwaysOff[1] = 0xffffffff; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2093 |
if (dev->flags & IFF_ALLMULTI) { |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2094 |
alwaysOn[0] = alwaysOn[1] = alwaysOff[0] = alwaysOff[1] = 0; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2095 |
} else { |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2096 |
struct dev_mc_list *walk; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2097 |
|
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2098 |
walk = dev->mc_list; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2099 |
while (walk != NULL) { |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2100 |
u32 a, b; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2101 |
a = le32_to_cpu(*(u32 *) walk->dmi_addr); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2102 |
b = le16_to_cpu(*(u16 *) (&walk->dmi_addr[4])); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2103 |
alwaysOn[0] &= a; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2104 |
alwaysOff[0] &= ~a; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2105 |
alwaysOn[1] &= b; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2106 |
alwaysOff[1] &= ~b; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2107 |
walk = walk->next; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2108 |
} |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2109 |
} |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2110 |
addr[0] = alwaysOn[0]; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2111 |
addr[1] = alwaysOn[1]; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2112 |
mask[0] = alwaysOn[0] | alwaysOff[0]; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2113 |
mask[1] = alwaysOn[1] | alwaysOff[1]; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2114 |
} |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2115 |
} |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2116 |
addr[0] |= NVREG_MCASTADDRA_FORCE; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2117 |
pff |= NVREG_PFF_ALWAYS; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2118 |
spin_lock_irq(&np->lock); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2119 |
nv_stop_rx(dev); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2120 |
writel(addr[0], base + NvRegMulticastAddrA); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2121 |
writel(addr[1], base + NvRegMulticastAddrB); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2122 |
writel(mask[0], base + NvRegMulticastMaskA); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2123 |
writel(mask[1], base + NvRegMulticastMaskB); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2124 |
writel(pff, base + NvRegPacketFilterFlags); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2125 |
dprintk(KERN_INFO "%s: reconfiguration for multicast lists.\n", |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2126 |
dev->name); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2127 |
nv_start_rx(dev); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2128 |
spin_unlock_irq(&np->lock); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2129 |
} |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2130 |
|
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2131 |
static void nv_update_pause(struct net_device *dev, u32 pause_flags) |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2132 |
{ |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2133 |
struct fe_priv *np = netdev_priv(dev); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2134 |
u8 __iomem *base = get_hwbase(dev); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2135 |
|
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2136 |
np->pause_flags &= ~(NV_PAUSEFRAME_TX_ENABLE | NV_PAUSEFRAME_RX_ENABLE); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2137 |
|
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2138 |
if (np->pause_flags & NV_PAUSEFRAME_RX_CAPABLE) { |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2139 |
u32 pff = readl(base + NvRegPacketFilterFlags) & ~NVREG_PFF_PAUSE_RX; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2140 |
if (pause_flags & NV_PAUSEFRAME_RX_ENABLE) { |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2141 |
writel(pff|NVREG_PFF_PAUSE_RX, base + NvRegPacketFilterFlags); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2142 |
np->pause_flags |= NV_PAUSEFRAME_RX_ENABLE; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2143 |
} else { |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2144 |
writel(pff, base + NvRegPacketFilterFlags); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2145 |
} |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2146 |
} |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2147 |
if (np->pause_flags & NV_PAUSEFRAME_TX_CAPABLE) { |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2148 |
u32 regmisc = readl(base + NvRegMisc1) & ~NVREG_MISC1_PAUSE_TX; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2149 |
if (pause_flags & NV_PAUSEFRAME_TX_ENABLE) { |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2150 |
writel(NVREG_TX_PAUSEFRAME_ENABLE, base + NvRegTxPauseFrame); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2151 |
writel(regmisc|NVREG_MISC1_PAUSE_TX, base + NvRegMisc1); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2152 |
np->pause_flags |= NV_PAUSEFRAME_TX_ENABLE; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2153 |
} else { |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2154 |
writel(NVREG_TX_PAUSEFRAME_DISABLE, base + NvRegTxPauseFrame); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2155 |
writel(regmisc, base + NvRegMisc1); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2156 |
} |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2157 |
} |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2158 |
} |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2159 |
|
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2160 |
/** |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2161 |
* nv_update_linkspeed: Setup the MAC according to the link partner |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2162 |
* @dev: Network device to be configured |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2163 |
* |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2164 |
* The function queries the PHY and checks if there is a link partner. |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2165 |
* If yes, then it sets up the MAC accordingly. Otherwise, the MAC is |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2166 |
* set to 10 MBit HD. |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2167 |
* |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2168 |
* The function returns 0 if there is no link partner and 1 if there is |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2169 |
* a good link partner. |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2170 |
*/ |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2171 |
static int nv_update_linkspeed(struct net_device *dev) |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2172 |
{ |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2173 |
struct fe_priv *np = netdev_priv(dev); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2174 |
u8 __iomem *base = get_hwbase(dev); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2175 |
int adv = 0; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2176 |
int lpa = 0; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2177 |
int adv_lpa, adv_pause, lpa_pause; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2178 |
int newls = np->linkspeed; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2179 |
int newdup = np->duplex; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2180 |
int mii_status; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2181 |
int retval = 0; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2182 |
u32 control_1000, status_1000, phyreg, pause_flags, txreg; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2183 |
|
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2184 |
/* BMSR_LSTATUS is latched, read it twice: |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2185 |
* we want the current value. |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2186 |
*/ |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2187 |
mii_rw(dev, np->phyaddr, MII_BMSR, MII_READ); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2188 |
mii_status = mii_rw(dev, np->phyaddr, MII_BMSR, MII_READ); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2189 |
|
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2190 |
if (!(mii_status & BMSR_LSTATUS)) { |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2191 |
dprintk(KERN_DEBUG "%s: no link detected by phy - falling back to 10HD.\n", |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2192 |
dev->name); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2193 |
newls = NVREG_LINKSPEED_FORCE|NVREG_LINKSPEED_10; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2194 |
newdup = 0; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2195 |
retval = 0; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2196 |
goto set_speed; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2197 |
} |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2198 |
|
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2199 |
if (np->autoneg == 0) { |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2200 |
dprintk(KERN_DEBUG "%s: nv_update_linkspeed: autoneg off, PHY set to 0x%04x.\n", |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2201 |
dev->name, np->fixed_mode); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2202 |
if (np->fixed_mode & LPA_100FULL) { |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2203 |
newls = NVREG_LINKSPEED_FORCE|NVREG_LINKSPEED_100; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2204 |
newdup = 1; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2205 |
} else if (np->fixed_mode & LPA_100HALF) { |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2206 |
newls = NVREG_LINKSPEED_FORCE|NVREG_LINKSPEED_100; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2207 |
newdup = 0; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2208 |
} else if (np->fixed_mode & LPA_10FULL) { |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2209 |
newls = NVREG_LINKSPEED_FORCE|NVREG_LINKSPEED_10; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2210 |
newdup = 1; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2211 |
} else { |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2212 |
newls = NVREG_LINKSPEED_FORCE|NVREG_LINKSPEED_10; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2213 |
newdup = 0; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2214 |
} |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2215 |
retval = 1; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2216 |
goto set_speed; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2217 |
} |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2218 |
/* check auto negotiation is complete */ |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2219 |
if (!(mii_status & BMSR_ANEGCOMPLETE)) { |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2220 |
/* still in autonegotiation - configure nic for 10 MBit HD and wait. */ |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2221 |
newls = NVREG_LINKSPEED_FORCE|NVREG_LINKSPEED_10; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2222 |
newdup = 0; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2223 |
retval = 0; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2224 |
dprintk(KERN_DEBUG "%s: autoneg not completed - falling back to 10HD.\n", dev->name); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2225 |
goto set_speed; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2226 |
} |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2227 |
|
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2228 |
adv = mii_rw(dev, np->phyaddr, MII_ADVERTISE, MII_READ); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2229 |
lpa = mii_rw(dev, np->phyaddr, MII_LPA, MII_READ); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2230 |
dprintk(KERN_DEBUG "%s: nv_update_linkspeed: PHY advertises 0x%04x, lpa 0x%04x.\n", |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2231 |
dev->name, adv, lpa); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2232 |
|
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2233 |
retval = 1; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2234 |
if (np->gigabit == PHY_GIGABIT) { |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2235 |
control_1000 = mii_rw(dev, np->phyaddr, MII_CTRL1000, MII_READ); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2236 |
status_1000 = mii_rw(dev, np->phyaddr, MII_STAT1000, MII_READ); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2237 |
|
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2238 |
if ((control_1000 & ADVERTISE_1000FULL) && |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2239 |
(status_1000 & LPA_1000FULL)) { |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2240 |
dprintk(KERN_DEBUG "%s: nv_update_linkspeed: GBit ethernet detected.\n", |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2241 |
dev->name); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2242 |
newls = NVREG_LINKSPEED_FORCE|NVREG_LINKSPEED_1000; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2243 |
newdup = 1; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2244 |
goto set_speed; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2245 |
} |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2246 |
} |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2247 |
|
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2248 |
/* FIXME: handle parallel detection properly */ |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2249 |
adv_lpa = lpa & adv; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2250 |
if (adv_lpa & LPA_100FULL) { |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2251 |
newls = NVREG_LINKSPEED_FORCE|NVREG_LINKSPEED_100; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2252 |
newdup = 1; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2253 |
} else if (adv_lpa & LPA_100HALF) { |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2254 |
newls = NVREG_LINKSPEED_FORCE|NVREG_LINKSPEED_100; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2255 |
newdup = 0; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2256 |
} else if (adv_lpa & LPA_10FULL) { |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2257 |
newls = NVREG_LINKSPEED_FORCE|NVREG_LINKSPEED_10; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2258 |
newdup = 1; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2259 |
} else if (adv_lpa & LPA_10HALF) { |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2260 |
newls = NVREG_LINKSPEED_FORCE|NVREG_LINKSPEED_10; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2261 |
newdup = 0; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2262 |
} else { |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2263 |
dprintk(KERN_DEBUG "%s: bad ability %04x - falling back to 10HD.\n", dev->name, adv_lpa); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2264 |
newls = NVREG_LINKSPEED_FORCE|NVREG_LINKSPEED_10; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2265 |
newdup = 0; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2266 |
} |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2267 |
|
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2268 |
set_speed: |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2269 |
if (np->duplex == newdup && np->linkspeed == newls) |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2270 |
return retval; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2271 |
|
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2272 |
dprintk(KERN_INFO "%s: changing link setting from %d/%d to %d/%d.\n", |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2273 |
dev->name, np->linkspeed, np->duplex, newls, newdup); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2274 |
|
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2275 |
np->duplex = newdup; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2276 |
np->linkspeed = newls; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2277 |
|
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2278 |
if (np->gigabit == PHY_GIGABIT) { |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2279 |
phyreg = readl(base + NvRegRandomSeed); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2280 |
phyreg &= ~(0x3FF00); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2281 |
if ((np->linkspeed & 0xFFF) == NVREG_LINKSPEED_10) |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2282 |
phyreg |= NVREG_RNDSEED_FORCE3; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2283 |
else if ((np->linkspeed & 0xFFF) == NVREG_LINKSPEED_100) |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2284 |
phyreg |= NVREG_RNDSEED_FORCE2; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2285 |
else if ((np->linkspeed & 0xFFF) == NVREG_LINKSPEED_1000) |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2286 |
phyreg |= NVREG_RNDSEED_FORCE; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2287 |
writel(phyreg, base + NvRegRandomSeed); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2288 |
} |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2289 |
|
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2290 |
phyreg = readl(base + NvRegPhyInterface); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2291 |
phyreg &= ~(PHY_HALF|PHY_100|PHY_1000); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2292 |
if (np->duplex == 0) |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2293 |
phyreg |= PHY_HALF; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2294 |
if ((np->linkspeed & NVREG_LINKSPEED_MASK) == NVREG_LINKSPEED_100) |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2295 |
phyreg |= PHY_100; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2296 |
else if ((np->linkspeed & NVREG_LINKSPEED_MASK) == NVREG_LINKSPEED_1000) |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2297 |
phyreg |= PHY_1000; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2298 |
writel(phyreg, base + NvRegPhyInterface); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2299 |
|
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2300 |
if (phyreg & PHY_RGMII) { |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2301 |
if ((np->linkspeed & NVREG_LINKSPEED_MASK) == NVREG_LINKSPEED_1000) |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2302 |
txreg = NVREG_TX_DEFERRAL_RGMII_1000; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2303 |
else |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2304 |
txreg = NVREG_TX_DEFERRAL_RGMII_10_100; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2305 |
} else { |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2306 |
txreg = NVREG_TX_DEFERRAL_DEFAULT; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2307 |
} |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2308 |
writel(txreg, base + NvRegTxDeferral); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2309 |
|
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2310 |
if (np->desc_ver == DESC_VER_1) { |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2311 |
txreg = NVREG_TX_WM_DESC1_DEFAULT; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2312 |
} else { |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2313 |
if ((np->linkspeed & NVREG_LINKSPEED_MASK) == NVREG_LINKSPEED_1000) |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2314 |
txreg = NVREG_TX_WM_DESC2_3_1000; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2315 |
else |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2316 |
txreg = NVREG_TX_WM_DESC2_3_DEFAULT; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2317 |
} |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2318 |
writel(txreg, base + NvRegTxWatermark); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2319 |
|
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2320 |
writel(NVREG_MISC1_FORCE | ( np->duplex ? 0 : NVREG_MISC1_HD), |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2321 |
base + NvRegMisc1); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2322 |
pci_push(base); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2323 |
writel(np->linkspeed, base + NvRegLinkSpeed); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2324 |
pci_push(base); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2325 |
|
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2326 |
pause_flags = 0; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2327 |
/* setup pause frame */ |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2328 |
if (np->duplex != 0) { |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2329 |
if (np->autoneg && np->pause_flags & NV_PAUSEFRAME_AUTONEG) { |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2330 |
adv_pause = adv & (ADVERTISE_PAUSE_CAP| ADVERTISE_PAUSE_ASYM); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2331 |
lpa_pause = lpa & (LPA_PAUSE_CAP| LPA_PAUSE_ASYM); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2332 |
|
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2333 |
switch (adv_pause) { |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2334 |
case ADVERTISE_PAUSE_CAP: |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2335 |
if (lpa_pause & LPA_PAUSE_CAP) { |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2336 |
pause_flags |= NV_PAUSEFRAME_RX_ENABLE; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2337 |
if (np->pause_flags & NV_PAUSEFRAME_TX_REQ) |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2338 |
pause_flags |= NV_PAUSEFRAME_TX_ENABLE; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2339 |
} |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2340 |
break; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2341 |
case ADVERTISE_PAUSE_ASYM: |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2342 |
if (lpa_pause == (LPA_PAUSE_CAP| LPA_PAUSE_ASYM)) |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2343 |
{ |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2344 |
pause_flags |= NV_PAUSEFRAME_TX_ENABLE; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2345 |
} |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2346 |
break; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2347 |
case ADVERTISE_PAUSE_CAP| ADVERTISE_PAUSE_ASYM: |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2348 |
if (lpa_pause & LPA_PAUSE_CAP) |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2349 |
{ |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2350 |
pause_flags |= NV_PAUSEFRAME_RX_ENABLE; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2351 |
if (np->pause_flags & NV_PAUSEFRAME_TX_REQ) |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2352 |
pause_flags |= NV_PAUSEFRAME_TX_ENABLE; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2353 |
} |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2354 |
if (lpa_pause == LPA_PAUSE_ASYM) |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2355 |
{ |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2356 |
pause_flags |= NV_PAUSEFRAME_RX_ENABLE; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2357 |
} |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2358 |
break; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2359 |
} |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2360 |
} else { |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2361 |
pause_flags = np->pause_flags; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2362 |
} |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2363 |
} |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2364 |
nv_update_pause(dev, pause_flags); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2365 |
|
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2366 |
return retval; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2367 |
} |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2368 |
|
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2369 |
static void nv_linkchange(struct net_device *dev) |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2370 |
{ |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2371 |
if (nv_update_linkspeed(dev)) { |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2372 |
if (!netif_carrier_ok(dev)) { |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2373 |
netif_carrier_on(dev); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2374 |
printk(KERN_INFO "%s: link up.\n", dev->name); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2375 |
nv_start_rx(dev); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2376 |
} |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2377 |
} else { |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2378 |
if (netif_carrier_ok(dev)) { |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2379 |
netif_carrier_off(dev); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2380 |
printk(KERN_INFO "%s: link down.\n", dev->name); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2381 |
nv_stop_rx(dev); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2382 |
} |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2383 |
} |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2384 |
} |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2385 |
|
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2386 |
static void nv_link_irq(struct net_device *dev) |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2387 |
{ |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2388 |
u8 __iomem *base = get_hwbase(dev); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2389 |
u32 miistat; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2390 |
|
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2391 |
miistat = readl(base + NvRegMIIStatus); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2392 |
writel(NVREG_MIISTAT_MASK, base + NvRegMIIStatus); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2393 |
dprintk(KERN_INFO "%s: link change irq, status 0x%x.\n", dev->name, miistat); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2394 |
|
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2395 |
if (miistat & (NVREG_MIISTAT_LINKCHANGE)) |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2396 |
nv_linkchange(dev); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2397 |
dprintk(KERN_DEBUG "%s: link change notification done.\n", dev->name); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2398 |
} |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2399 |
|
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2400 |
static irqreturn_t nv_nic_irq(int foo, void *data) |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2401 |
{ |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2402 |
struct net_device *dev = (struct net_device *) data; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2403 |
struct fe_priv *np = netdev_priv(dev); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2404 |
u8 __iomem *base = get_hwbase(dev); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2405 |
u32 events; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2406 |
int i; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2407 |
|
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2408 |
dprintk(KERN_DEBUG "%s: nv_nic_irq\n", dev->name); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2409 |
|
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2410 |
for (i=0; ; i++) { |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2411 |
if (!(np->msi_flags & NV_MSI_X_ENABLED)) { |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2412 |
events = readl(base + NvRegIrqStatus) & NVREG_IRQSTAT_MASK; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2413 |
writel(NVREG_IRQSTAT_MASK, base + NvRegIrqStatus); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2414 |
} else { |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2415 |
events = readl(base + NvRegMSIXIrqStatus) & NVREG_IRQSTAT_MASK; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2416 |
writel(NVREG_IRQSTAT_MASK, base + NvRegMSIXIrqStatus); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2417 |
} |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2418 |
pci_push(base); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2419 |
dprintk(KERN_DEBUG "%s: irq: %08x\n", dev->name, events); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2420 |
if (!(events & np->irqmask)) |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2421 |
break; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2422 |
|
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2423 |
spin_lock(&np->lock); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2424 |
nv_tx_done(dev); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2425 |
spin_unlock(&np->lock); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2426 |
|
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2427 |
if (events & NVREG_IRQ_LINK) { |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2428 |
spin_lock(&np->lock); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2429 |
nv_link_irq(dev); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2430 |
spin_unlock(&np->lock); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2431 |
} |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2432 |
if (np->need_linktimer && time_after(jiffies, np->link_timeout)) { |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2433 |
spin_lock(&np->lock); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2434 |
nv_linkchange(dev); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2435 |
spin_unlock(&np->lock); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2436 |
np->link_timeout = jiffies + LINK_TIMEOUT; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2437 |
} |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2438 |
if (events & (NVREG_IRQ_TX_ERR)) { |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2439 |
dprintk(KERN_DEBUG "%s: received irq with events 0x%x. Probably TX fail.\n", |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2440 |
dev->name, events); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2441 |
} |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2442 |
if (events & (NVREG_IRQ_UNKNOWN)) { |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2443 |
printk(KERN_DEBUG "%s: received irq with unknown events 0x%x. Please report\n", |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2444 |
dev->name, events); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2445 |
} |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2446 |
#ifdef CONFIG_FORCEDETH_NAPI |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2447 |
if (events & NVREG_IRQ_RX_ALL) { |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2448 |
netif_rx_schedule(dev); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2449 |
|
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2450 |
/* Disable furthur receive irq's */ |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2451 |
spin_lock(&np->lock); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2452 |
np->irqmask &= ~NVREG_IRQ_RX_ALL; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2453 |
|
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2454 |
if (np->msi_flags & NV_MSI_X_ENABLED) |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2455 |
writel(NVREG_IRQ_RX_ALL, base + NvRegIrqMask); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2456 |
else |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2457 |
writel(np->irqmask, base + NvRegIrqMask); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2458 |
spin_unlock(&np->lock); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2459 |
} |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2460 |
#else |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2461 |
nv_rx_process(dev, dev->weight); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2462 |
if (nv_alloc_rx(dev)) { |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2463 |
spin_lock(&np->lock); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2464 |
if (!np->in_shutdown) |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2465 |
mod_timer(&np->oom_kick, jiffies + OOM_REFILL); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2466 |
spin_unlock(&np->lock); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2467 |
} |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2468 |
#endif |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2469 |
if (i > max_interrupt_work) { |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2470 |
spin_lock(&np->lock); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2471 |
/* disable interrupts on the nic */ |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2472 |
if (!(np->msi_flags & NV_MSI_X_ENABLED)) |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2473 |
writel(0, base + NvRegIrqMask); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2474 |
else |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2475 |
writel(np->irqmask, base + NvRegIrqMask); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2476 |
pci_push(base); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2477 |
|
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2478 |
if (!np->in_shutdown) { |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2479 |
np->nic_poll_irq = np->irqmask; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2480 |
mod_timer(&np->nic_poll, jiffies + POLL_WAIT); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2481 |
} |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2482 |
printk(KERN_DEBUG "%s: too many iterations (%d) in nv_nic_irq.\n", dev->name, i); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2483 |
spin_unlock(&np->lock); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2484 |
break; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2485 |
} |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2486 |
|
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2487 |
} |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2488 |
dprintk(KERN_DEBUG "%s: nv_nic_irq completed\n", dev->name); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2489 |
|
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2490 |
return IRQ_RETVAL(i); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2491 |
} |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2492 |
|
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2493 |
static irqreturn_t nv_nic_irq_tx(int foo, void *data) |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2494 |
{ |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2495 |
struct net_device *dev = (struct net_device *) data; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2496 |
struct fe_priv *np = netdev_priv(dev); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2497 |
u8 __iomem *base = get_hwbase(dev); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2498 |
u32 events; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2499 |
int i; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2500 |
unsigned long flags; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2501 |
|
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2502 |
dprintk(KERN_DEBUG "%s: nv_nic_irq_tx\n", dev->name); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2503 |
|
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2504 |
for (i=0; ; i++) { |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2505 |
events = readl(base + NvRegMSIXIrqStatus) & NVREG_IRQ_TX_ALL; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2506 |
writel(NVREG_IRQ_TX_ALL, base + NvRegMSIXIrqStatus); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2507 |
pci_push(base); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2508 |
dprintk(KERN_DEBUG "%s: tx irq: %08x\n", dev->name, events); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2509 |
if (!(events & np->irqmask)) |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2510 |
break; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2511 |
|
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2512 |
spin_lock_irqsave(&np->lock, flags); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2513 |
nv_tx_done(dev); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2514 |
spin_unlock_irqrestore(&np->lock, flags); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2515 |
|
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2516 |
if (events & (NVREG_IRQ_TX_ERR)) { |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2517 |
dprintk(KERN_DEBUG "%s: received irq with events 0x%x. Probably TX fail.\n", |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2518 |
dev->name, events); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2519 |
} |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2520 |
if (i > max_interrupt_work) { |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2521 |
spin_lock_irqsave(&np->lock, flags); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2522 |
/* disable interrupts on the nic */ |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2523 |
writel(NVREG_IRQ_TX_ALL, base + NvRegIrqMask); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2524 |
pci_push(base); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2525 |
|
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2526 |
if (!np->in_shutdown) { |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2527 |
np->nic_poll_irq |= NVREG_IRQ_TX_ALL; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2528 |
mod_timer(&np->nic_poll, jiffies + POLL_WAIT); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2529 |
} |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2530 |
printk(KERN_DEBUG "%s: too many iterations (%d) in nv_nic_irq_tx.\n", dev->name, i); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2531 |
spin_unlock_irqrestore(&np->lock, flags); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2532 |
break; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2533 |
} |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2534 |
|
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2535 |
} |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2536 |
dprintk(KERN_DEBUG "%s: nv_nic_irq_tx completed\n", dev->name); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2537 |
|
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2538 |
return IRQ_RETVAL(i); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2539 |
} |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2540 |
|
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2541 |
#ifdef CONFIG_FORCEDETH_NAPI |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2542 |
static int nv_napi_poll(struct net_device *dev, int *budget) |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2543 |
{ |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2544 |
int pkts, limit = min(*budget, dev->quota); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2545 |
struct fe_priv *np = netdev_priv(dev); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2546 |
u8 __iomem *base = get_hwbase(dev); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2547 |
|
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2548 |
pkts = nv_rx_process(dev, limit); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2549 |
|
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2550 |
if (nv_alloc_rx(dev)) { |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2551 |
spin_lock_irq(&np->lock); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2552 |
if (!np->in_shutdown) |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2553 |
mod_timer(&np->oom_kick, jiffies + OOM_REFILL); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2554 |
spin_unlock_irq(&np->lock); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2555 |
} |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2556 |
|
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2557 |
if (pkts < limit) { |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2558 |
/* all done, no more packets present */ |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2559 |
netif_rx_complete(dev); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2560 |
|
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2561 |
/* re-enable receive interrupts */ |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2562 |
spin_lock_irq(&np->lock); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2563 |
np->irqmask |= NVREG_IRQ_RX_ALL; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2564 |
if (np->msi_flags & NV_MSI_X_ENABLED) |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2565 |
writel(NVREG_IRQ_RX_ALL, base + NvRegIrqMask); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2566 |
else |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2567 |
writel(np->irqmask, base + NvRegIrqMask); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2568 |
spin_unlock_irq(&np->lock); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2569 |
return 0; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2570 |
} else { |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2571 |
/* used up our quantum, so reschedule */ |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2572 |
dev->quota -= pkts; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2573 |
*budget -= pkts; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2574 |
return 1; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2575 |
} |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2576 |
} |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2577 |
#endif |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2578 |
|
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2579 |
#ifdef CONFIG_FORCEDETH_NAPI |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2580 |
static irqreturn_t nv_nic_irq_rx(int foo, void *data) |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2581 |
{ |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2582 |
struct net_device *dev = (struct net_device *) data; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2583 |
u8 __iomem *base = get_hwbase(dev); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2584 |
u32 events; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2585 |
|
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2586 |
events = readl(base + NvRegMSIXIrqStatus) & NVREG_IRQ_RX_ALL; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2587 |
writel(NVREG_IRQ_RX_ALL, base + NvRegMSIXIrqStatus); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2588 |
|
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2589 |
if (events) { |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2590 |
netif_rx_schedule(dev); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2591 |
/* disable receive interrupts on the nic */ |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2592 |
writel(NVREG_IRQ_RX_ALL, base + NvRegIrqMask); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2593 |
pci_push(base); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2594 |
} |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2595 |
return IRQ_HANDLED; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2596 |
} |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2597 |
#else |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2598 |
static irqreturn_t nv_nic_irq_rx(int foo, void *data) |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2599 |
{ |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2600 |
struct net_device *dev = (struct net_device *) data; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2601 |
struct fe_priv *np = netdev_priv(dev); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2602 |
u8 __iomem *base = get_hwbase(dev); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2603 |
u32 events; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2604 |
int i; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2605 |
unsigned long flags; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2606 |
|
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2607 |
dprintk(KERN_DEBUG "%s: nv_nic_irq_rx\n", dev->name); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2608 |
|
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2609 |
for (i=0; ; i++) { |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2610 |
events = readl(base + NvRegMSIXIrqStatus) & NVREG_IRQ_RX_ALL; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2611 |
writel(NVREG_IRQ_RX_ALL, base + NvRegMSIXIrqStatus); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2612 |
pci_push(base); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2613 |
dprintk(KERN_DEBUG "%s: rx irq: %08x\n", dev->name, events); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2614 |
if (!(events & np->irqmask)) |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2615 |
break; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2616 |
|
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2617 |
nv_rx_process(dev, dev->weight); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2618 |
if (nv_alloc_rx(dev)) { |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2619 |
spin_lock_irqsave(&np->lock, flags); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2620 |
if (!np->in_shutdown) |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2621 |
mod_timer(&np->oom_kick, jiffies + OOM_REFILL); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2622 |
spin_unlock_irqrestore(&np->lock, flags); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2623 |
} |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2624 |
|
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2625 |
if (i > max_interrupt_work) { |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2626 |
spin_lock_irqsave(&np->lock, flags); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2627 |
/* disable interrupts on the nic */ |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2628 |
writel(NVREG_IRQ_RX_ALL, base + NvRegIrqMask); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2629 |
pci_push(base); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2630 |
|
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2631 |
if (!np->in_shutdown) { |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2632 |
np->nic_poll_irq |= NVREG_IRQ_RX_ALL; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2633 |
mod_timer(&np->nic_poll, jiffies + POLL_WAIT); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2634 |
} |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2635 |
printk(KERN_DEBUG "%s: too many iterations (%d) in nv_nic_irq_rx.\n", dev->name, i); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2636 |
spin_unlock_irqrestore(&np->lock, flags); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2637 |
break; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2638 |
} |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2639 |
} |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2640 |
dprintk(KERN_DEBUG "%s: nv_nic_irq_rx completed\n", dev->name); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2641 |
|
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2642 |
return IRQ_RETVAL(i); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2643 |
} |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2644 |
#endif |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2645 |
|
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2646 |
static irqreturn_t nv_nic_irq_other(int foo, void *data) |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2647 |
{ |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2648 |
struct net_device *dev = (struct net_device *) data; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2649 |
struct fe_priv *np = netdev_priv(dev); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2650 |
u8 __iomem *base = get_hwbase(dev); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2651 |
u32 events; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2652 |
int i; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2653 |
unsigned long flags; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2654 |
|
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2655 |
dprintk(KERN_DEBUG "%s: nv_nic_irq_other\n", dev->name); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2656 |
|
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2657 |
for (i=0; ; i++) { |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2658 |
events = readl(base + NvRegMSIXIrqStatus) & NVREG_IRQ_OTHER; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2659 |
writel(NVREG_IRQ_OTHER, base + NvRegMSIXIrqStatus); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2660 |
pci_push(base); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2661 |
dprintk(KERN_DEBUG "%s: irq: %08x\n", dev->name, events); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2662 |
if (!(events & np->irqmask)) |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2663 |
break; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2664 |
|
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2665 |
if (events & NVREG_IRQ_LINK) { |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2666 |
spin_lock_irqsave(&np->lock, flags); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2667 |
nv_link_irq(dev); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2668 |
spin_unlock_irqrestore(&np->lock, flags); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2669 |
} |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2670 |
if (np->need_linktimer && time_after(jiffies, np->link_timeout)) { |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2671 |
spin_lock_irqsave(&np->lock, flags); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2672 |
nv_linkchange(dev); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2673 |
spin_unlock_irqrestore(&np->lock, flags); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2674 |
np->link_timeout = jiffies + LINK_TIMEOUT; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2675 |
} |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2676 |
if (events & (NVREG_IRQ_UNKNOWN)) { |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2677 |
printk(KERN_DEBUG "%s: received irq with unknown events 0x%x. Please report\n", |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2678 |
dev->name, events); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2679 |
} |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2680 |
if (i > max_interrupt_work) { |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2681 |
spin_lock_irqsave(&np->lock, flags); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2682 |
/* disable interrupts on the nic */ |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2683 |
writel(NVREG_IRQ_OTHER, base + NvRegIrqMask); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2684 |
pci_push(base); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2685 |
|
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2686 |
if (!np->in_shutdown) { |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2687 |
np->nic_poll_irq |= NVREG_IRQ_OTHER; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2688 |
mod_timer(&np->nic_poll, jiffies + POLL_WAIT); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2689 |
} |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2690 |
printk(KERN_DEBUG "%s: too many iterations (%d) in nv_nic_irq_other.\n", dev->name, i); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2691 |
spin_unlock_irqrestore(&np->lock, flags); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2692 |
break; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2693 |
} |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2694 |
|
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2695 |
} |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2696 |
dprintk(KERN_DEBUG "%s: nv_nic_irq_other completed\n", dev->name); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2697 |
|
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2698 |
return IRQ_RETVAL(i); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2699 |
} |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2700 |
|
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2701 |
static irqreturn_t nv_nic_irq_test(int foo, void *data) |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2702 |
{ |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2703 |
struct net_device *dev = (struct net_device *) data; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2704 |
struct fe_priv *np = netdev_priv(dev); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2705 |
u8 __iomem *base = get_hwbase(dev); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2706 |
u32 events; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2707 |
|
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2708 |
dprintk(KERN_DEBUG "%s: nv_nic_irq_test\n", dev->name); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2709 |
|
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2710 |
if (!(np->msi_flags & NV_MSI_X_ENABLED)) { |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2711 |
events = readl(base + NvRegIrqStatus) & NVREG_IRQSTAT_MASK; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2712 |
writel(NVREG_IRQ_TIMER, base + NvRegIrqStatus); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2713 |
} else { |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2714 |
events = readl(base + NvRegMSIXIrqStatus) & NVREG_IRQSTAT_MASK; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2715 |
writel(NVREG_IRQ_TIMER, base + NvRegMSIXIrqStatus); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2716 |
} |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2717 |
pci_push(base); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2718 |
dprintk(KERN_DEBUG "%s: irq: %08x\n", dev->name, events); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2719 |
if (!(events & NVREG_IRQ_TIMER)) |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2720 |
return IRQ_RETVAL(0); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2721 |
|
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2722 |
spin_lock(&np->lock); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2723 |
np->intr_test = 1; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2724 |
spin_unlock(&np->lock); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2725 |
|
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2726 |
dprintk(KERN_DEBUG "%s: nv_nic_irq_test completed\n", dev->name); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2727 |
|
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2728 |
return IRQ_RETVAL(1); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2729 |
} |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2730 |
|
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2731 |
static void set_msix_vector_map(struct net_device *dev, u32 vector, u32 irqmask) |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2732 |
{ |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2733 |
u8 __iomem *base = get_hwbase(dev); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2734 |
int i; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2735 |
u32 msixmap = 0; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2736 |
|
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2737 |
/* Each interrupt bit can be mapped to a MSIX vector (4 bits). |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2738 |
* MSIXMap0 represents the first 8 interrupts and MSIXMap1 represents |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2739 |
* the remaining 8 interrupts. |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2740 |
*/ |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2741 |
for (i = 0; i < 8; i++) { |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2742 |
if ((irqmask >> i) & 0x1) { |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2743 |
msixmap |= vector << (i << 2); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2744 |
} |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2745 |
} |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2746 |
writel(readl(base + NvRegMSIXMap0) | msixmap, base + NvRegMSIXMap0); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2747 |
|
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2748 |
msixmap = 0; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2749 |
for (i = 0; i < 8; i++) { |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2750 |
if ((irqmask >> (i + 8)) & 0x1) { |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2751 |
msixmap |= vector << (i << 2); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2752 |
} |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2753 |
} |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2754 |
writel(readl(base + NvRegMSIXMap1) | msixmap, base + NvRegMSIXMap1); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2755 |
} |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2756 |
|
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2757 |
static int nv_request_irq(struct net_device *dev, int intr_test) |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2758 |
{ |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2759 |
struct fe_priv *np = get_nvpriv(dev); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2760 |
u8 __iomem *base = get_hwbase(dev); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2761 |
int ret = 1; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2762 |
int i; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2763 |
|
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2764 |
if (np->msi_flags & NV_MSI_X_CAPABLE) { |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2765 |
for (i = 0; i < (np->msi_flags & NV_MSI_X_VECTORS_MASK); i++) { |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2766 |
np->msi_x_entry[i].entry = i; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2767 |
} |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2768 |
if ((ret = pci_enable_msix(np->pci_dev, np->msi_x_entry, (np->msi_flags & NV_MSI_X_VECTORS_MASK))) == 0) { |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2769 |
np->msi_flags |= NV_MSI_X_ENABLED; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2770 |
if (optimization_mode == NV_OPTIMIZATION_MODE_THROUGHPUT && !intr_test) { |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2771 |
/* Request irq for rx handling */ |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2772 |
if (request_irq(np->msi_x_entry[NV_MSI_X_VECTOR_RX].vector, &nv_nic_irq_rx, IRQF_SHARED, dev->name, dev) != 0) { |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2773 |
printk(KERN_INFO "forcedeth: request_irq failed for rx %d\n", ret); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2774 |
pci_disable_msix(np->pci_dev); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2775 |
np->msi_flags &= ~NV_MSI_X_ENABLED; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2776 |
goto out_err; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2777 |
} |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2778 |
/* Request irq for tx handling */ |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2779 |
if (request_irq(np->msi_x_entry[NV_MSI_X_VECTOR_TX].vector, &nv_nic_irq_tx, IRQF_SHARED, dev->name, dev) != 0) { |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2780 |
printk(KERN_INFO "forcedeth: request_irq failed for tx %d\n", ret); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2781 |
pci_disable_msix(np->pci_dev); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2782 |
np->msi_flags &= ~NV_MSI_X_ENABLED; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2783 |
goto out_free_rx; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2784 |
} |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2785 |
/* Request irq for link and timer handling */ |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2786 |
if (request_irq(np->msi_x_entry[NV_MSI_X_VECTOR_OTHER].vector, &nv_nic_irq_other, IRQF_SHARED, dev->name, dev) != 0) { |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2787 |
printk(KERN_INFO "forcedeth: request_irq failed for link %d\n", ret); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2788 |
pci_disable_msix(np->pci_dev); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2789 |
np->msi_flags &= ~NV_MSI_X_ENABLED; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2790 |
goto out_free_tx; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2791 |
} |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2792 |
/* map interrupts to their respective vector */ |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2793 |
writel(0, base + NvRegMSIXMap0); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2794 |
writel(0, base + NvRegMSIXMap1); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2795 |
set_msix_vector_map(dev, NV_MSI_X_VECTOR_RX, NVREG_IRQ_RX_ALL); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2796 |
set_msix_vector_map(dev, NV_MSI_X_VECTOR_TX, NVREG_IRQ_TX_ALL); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2797 |
set_msix_vector_map(dev, NV_MSI_X_VECTOR_OTHER, NVREG_IRQ_OTHER); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2798 |
} else { |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2799 |
/* Request irq for all interrupts */ |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2800 |
if ((!intr_test && |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2801 |
request_irq(np->msi_x_entry[NV_MSI_X_VECTOR_ALL].vector, &nv_nic_irq, IRQF_SHARED, dev->name, dev) != 0) || |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2802 |
(intr_test && |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2803 |
request_irq(np->msi_x_entry[NV_MSI_X_VECTOR_ALL].vector, &nv_nic_irq_test, IRQF_SHARED, dev->name, dev) != 0)) { |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2804 |
printk(KERN_INFO "forcedeth: request_irq failed %d\n", ret); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2805 |
pci_disable_msix(np->pci_dev); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2806 |
np->msi_flags &= ~NV_MSI_X_ENABLED; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2807 |
goto out_err; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2808 |
} |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2809 |
|
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2810 |
/* map interrupts to vector 0 */ |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2811 |
writel(0, base + NvRegMSIXMap0); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2812 |
writel(0, base + NvRegMSIXMap1); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2813 |
} |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2814 |
} |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2815 |
} |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2816 |
if (ret != 0 && np->msi_flags & NV_MSI_CAPABLE) { |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2817 |
if ((ret = pci_enable_msi(np->pci_dev)) == 0) { |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2818 |
pci_intx(np->pci_dev, 0); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2819 |
np->msi_flags |= NV_MSI_ENABLED; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2820 |
if ((!intr_test && request_irq(np->pci_dev->irq, &nv_nic_irq, IRQF_SHARED, dev->name, dev) != 0) || |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2821 |
(intr_test && request_irq(np->pci_dev->irq, &nv_nic_irq_test, IRQF_SHARED, dev->name, dev) != 0)) { |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2822 |
printk(KERN_INFO "forcedeth: request_irq failed %d\n", ret); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2823 |
pci_disable_msi(np->pci_dev); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2824 |
pci_intx(np->pci_dev, 1); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2825 |
np->msi_flags &= ~NV_MSI_ENABLED; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2826 |
goto out_err; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2827 |
} |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2828 |
|
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2829 |
/* map interrupts to vector 0 */ |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2830 |
writel(0, base + NvRegMSIMap0); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2831 |
writel(0, base + NvRegMSIMap1); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2832 |
/* enable msi vector 0 */ |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2833 |
writel(NVREG_MSI_VECTOR_0_ENABLED, base + NvRegMSIIrqMask); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2834 |
} |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2835 |
} |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2836 |
if (ret != 0) { |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2837 |
if ((!intr_test && request_irq(np->pci_dev->irq, &nv_nic_irq, IRQF_SHARED, dev->name, dev) != 0) || |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2838 |
(intr_test && request_irq(np->pci_dev->irq, &nv_nic_irq_test, IRQF_SHARED, dev->name, dev) != 0)) |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2839 |
goto out_err; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2840 |
|
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2841 |
} |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2842 |
|
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2843 |
return 0; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2844 |
out_free_tx: |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2845 |
free_irq(np->msi_x_entry[NV_MSI_X_VECTOR_TX].vector, dev); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2846 |
out_free_rx: |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2847 |
free_irq(np->msi_x_entry[NV_MSI_X_VECTOR_RX].vector, dev); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2848 |
out_err: |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2849 |
return 1; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2850 |
} |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2851 |
|
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2852 |
static void nv_free_irq(struct net_device *dev) |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2853 |
{ |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2854 |
struct fe_priv *np = get_nvpriv(dev); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2855 |
int i; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2856 |
|
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2857 |
if (np->msi_flags & NV_MSI_X_ENABLED) { |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2858 |
for (i = 0; i < (np->msi_flags & NV_MSI_X_VECTORS_MASK); i++) { |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2859 |
free_irq(np->msi_x_entry[i].vector, dev); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2860 |
} |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2861 |
pci_disable_msix(np->pci_dev); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2862 |
np->msi_flags &= ~NV_MSI_X_ENABLED; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2863 |
} else { |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2864 |
free_irq(np->pci_dev->irq, dev); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2865 |
if (np->msi_flags & NV_MSI_ENABLED) { |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2866 |
pci_disable_msi(np->pci_dev); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2867 |
pci_intx(np->pci_dev, 1); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2868 |
np->msi_flags &= ~NV_MSI_ENABLED; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2869 |
} |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2870 |
} |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2871 |
} |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2872 |
|
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2873 |
static void nv_do_nic_poll(unsigned long data) |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2874 |
{ |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2875 |
struct net_device *dev = (struct net_device *) data; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2876 |
struct fe_priv *np = netdev_priv(dev); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2877 |
u8 __iomem *base = get_hwbase(dev); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2878 |
u32 mask = 0; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2879 |
|
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2880 |
/* |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2881 |
* First disable irq(s) and then |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2882 |
* reenable interrupts on the nic, we have to do this before calling |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2883 |
* nv_nic_irq because that may decide to do otherwise |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2884 |
*/ |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2885 |
|
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2886 |
if (!using_multi_irqs(dev)) { |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2887 |
if (np->msi_flags & NV_MSI_X_ENABLED) |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2888 |
disable_irq_lockdep(np->msi_x_entry[NV_MSI_X_VECTOR_ALL].vector); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2889 |
else |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2890 |
disable_irq_lockdep(dev->irq); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2891 |
mask = np->irqmask; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2892 |
} else { |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2893 |
if (np->nic_poll_irq & NVREG_IRQ_RX_ALL) { |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2894 |
disable_irq_lockdep(np->msi_x_entry[NV_MSI_X_VECTOR_RX].vector); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2895 |
mask |= NVREG_IRQ_RX_ALL; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2896 |
} |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2897 |
if (np->nic_poll_irq & NVREG_IRQ_TX_ALL) { |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2898 |
disable_irq_lockdep(np->msi_x_entry[NV_MSI_X_VECTOR_TX].vector); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2899 |
mask |= NVREG_IRQ_TX_ALL; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2900 |
} |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2901 |
if (np->nic_poll_irq & NVREG_IRQ_OTHER) { |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2902 |
disable_irq_lockdep(np->msi_x_entry[NV_MSI_X_VECTOR_OTHER].vector); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2903 |
mask |= NVREG_IRQ_OTHER; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2904 |
} |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2905 |
} |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2906 |
np->nic_poll_irq = 0; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2907 |
|
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2908 |
/* FIXME: Do we need synchronize_irq(dev->irq) here? */ |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2909 |
|
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2910 |
writel(mask, base + NvRegIrqMask); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2911 |
pci_push(base); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2912 |
|
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2913 |
if (!using_multi_irqs(dev)) { |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2914 |
nv_nic_irq(0, dev); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2915 |
if (np->msi_flags & NV_MSI_X_ENABLED) |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2916 |
enable_irq_lockdep(np->msi_x_entry[NV_MSI_X_VECTOR_ALL].vector); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2917 |
else |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2918 |
enable_irq_lockdep(dev->irq); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2919 |
} else { |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2920 |
if (np->nic_poll_irq & NVREG_IRQ_RX_ALL) { |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2921 |
nv_nic_irq_rx(0, dev); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2922 |
enable_irq_lockdep(np->msi_x_entry[NV_MSI_X_VECTOR_RX].vector); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2923 |
} |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2924 |
if (np->nic_poll_irq & NVREG_IRQ_TX_ALL) { |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2925 |
nv_nic_irq_tx(0, dev); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2926 |
enable_irq_lockdep(np->msi_x_entry[NV_MSI_X_VECTOR_TX].vector); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2927 |
} |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2928 |
if (np->nic_poll_irq & NVREG_IRQ_OTHER) { |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2929 |
nv_nic_irq_other(0, dev); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2930 |
enable_irq_lockdep(np->msi_x_entry[NV_MSI_X_VECTOR_OTHER].vector); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2931 |
} |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2932 |
} |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2933 |
} |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2934 |
|
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2935 |
#ifdef CONFIG_NET_POLL_CONTROLLER |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2936 |
static void nv_poll_controller(struct net_device *dev) |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2937 |
{ |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2938 |
nv_do_nic_poll((unsigned long) dev); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2939 |
} |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2940 |
#endif |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2941 |
|
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2942 |
static void nv_do_stats_poll(unsigned long data) |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2943 |
{ |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2944 |
struct net_device *dev = (struct net_device *) data; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2945 |
struct fe_priv *np = netdev_priv(dev); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2946 |
u8 __iomem *base = get_hwbase(dev); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2947 |
|
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2948 |
np->estats.tx_bytes += readl(base + NvRegTxCnt); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2949 |
np->estats.tx_zero_rexmt += readl(base + NvRegTxZeroReXmt); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2950 |
np->estats.tx_one_rexmt += readl(base + NvRegTxOneReXmt); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2951 |
np->estats.tx_many_rexmt += readl(base + NvRegTxManyReXmt); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2952 |
np->estats.tx_late_collision += readl(base + NvRegTxLateCol); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2953 |
np->estats.tx_fifo_errors += readl(base + NvRegTxUnderflow); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2954 |
np->estats.tx_carrier_errors += readl(base + NvRegTxLossCarrier); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2955 |
np->estats.tx_excess_deferral += readl(base + NvRegTxExcessDef); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2956 |
np->estats.tx_retry_error += readl(base + NvRegTxRetryErr); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2957 |
np->estats.tx_deferral += readl(base + NvRegTxDef); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2958 |
np->estats.tx_packets += readl(base + NvRegTxFrame); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2959 |
np->estats.tx_pause += readl(base + NvRegTxPause); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2960 |
np->estats.rx_frame_error += readl(base + NvRegRxFrameErr); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2961 |
np->estats.rx_extra_byte += readl(base + NvRegRxExtraByte); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2962 |
np->estats.rx_late_collision += readl(base + NvRegRxLateCol); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2963 |
np->estats.rx_runt += readl(base + NvRegRxRunt); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2964 |
np->estats.rx_frame_too_long += readl(base + NvRegRxFrameTooLong); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2965 |
np->estats.rx_over_errors += readl(base + NvRegRxOverflow); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2966 |
np->estats.rx_crc_errors += readl(base + NvRegRxFCSErr); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2967 |
np->estats.rx_frame_align_error += readl(base + NvRegRxFrameAlignErr); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2968 |
np->estats.rx_length_error += readl(base + NvRegRxLenErr); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2969 |
np->estats.rx_unicast += readl(base + NvRegRxUnicast); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2970 |
np->estats.rx_multicast += readl(base + NvRegRxMulticast); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2971 |
np->estats.rx_broadcast += readl(base + NvRegRxBroadcast); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2972 |
np->estats.rx_bytes += readl(base + NvRegRxCnt); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2973 |
np->estats.rx_pause += readl(base + NvRegRxPause); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2974 |
np->estats.rx_drop_frame += readl(base + NvRegRxDropFrame); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2975 |
np->estats.rx_packets = |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2976 |
np->estats.rx_unicast + |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2977 |
np->estats.rx_multicast + |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2978 |
np->estats.rx_broadcast; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2979 |
np->estats.rx_errors_total = |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2980 |
np->estats.rx_crc_errors + |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2981 |
np->estats.rx_over_errors + |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2982 |
np->estats.rx_frame_error + |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2983 |
(np->estats.rx_frame_align_error - np->estats.rx_extra_byte) + |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2984 |
np->estats.rx_late_collision + |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2985 |
np->estats.rx_runt + |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2986 |
np->estats.rx_frame_too_long; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2987 |
|
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2988 |
if (!np->in_shutdown) |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2989 |
mod_timer(&np->stats_poll, jiffies + STATS_INTERVAL); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2990 |
} |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2991 |
|
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2992 |
static void nv_get_drvinfo(struct net_device *dev, struct ethtool_drvinfo *info) |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2993 |
{ |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2994 |
struct fe_priv *np = netdev_priv(dev); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2995 |
strcpy(info->driver, "forcedeth"); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2996 |
strcpy(info->version, FORCEDETH_VERSION); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2997 |
strcpy(info->bus_info, pci_name(np->pci_dev)); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2998 |
} |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2999 |
|
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3000 |
static void nv_get_wol(struct net_device *dev, struct ethtool_wolinfo *wolinfo) |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3001 |
{ |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3002 |
struct fe_priv *np = netdev_priv(dev); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3003 |
wolinfo->supported = WAKE_MAGIC; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3004 |
|
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3005 |
spin_lock_irq(&np->lock); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3006 |
if (np->wolenabled) |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3007 |
wolinfo->wolopts = WAKE_MAGIC; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3008 |
spin_unlock_irq(&np->lock); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3009 |
} |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3010 |
|
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3011 |
static int nv_set_wol(struct net_device *dev, struct ethtool_wolinfo *wolinfo) |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3012 |
{ |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3013 |
struct fe_priv *np = netdev_priv(dev); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3014 |
u8 __iomem *base = get_hwbase(dev); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3015 |
u32 flags = 0; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3016 |
|
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3017 |
if (wolinfo->wolopts == 0) { |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3018 |
np->wolenabled = 0; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3019 |
} else if (wolinfo->wolopts & WAKE_MAGIC) { |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3020 |
np->wolenabled = 1; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3021 |
flags = NVREG_WAKEUPFLAGS_ENABLE; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3022 |
} |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3023 |
if (netif_running(dev)) { |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3024 |
spin_lock_irq(&np->lock); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3025 |
writel(flags, base + NvRegWakeUpFlags); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3026 |
spin_unlock_irq(&np->lock); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3027 |
} |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3028 |
return 0; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3029 |
} |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3030 |
|
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3031 |
static int nv_get_settings(struct net_device *dev, struct ethtool_cmd *ecmd) |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3032 |
{ |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3033 |
struct fe_priv *np = netdev_priv(dev); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3034 |
int adv; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3035 |
|
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3036 |
spin_lock_irq(&np->lock); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3037 |
ecmd->port = PORT_MII; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3038 |
if (!netif_running(dev)) { |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3039 |
/* We do not track link speed / duplex setting if the |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3040 |
* interface is disabled. Force a link check */ |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3041 |
if (nv_update_linkspeed(dev)) { |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3042 |
if (!netif_carrier_ok(dev)) |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3043 |
netif_carrier_on(dev); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3044 |
} else { |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3045 |
if (netif_carrier_ok(dev)) |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3046 |
netif_carrier_off(dev); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3047 |
} |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3048 |
} |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3049 |
|
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3050 |
if (netif_carrier_ok(dev)) { |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3051 |
switch(np->linkspeed & (NVREG_LINKSPEED_MASK)) { |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3052 |
case NVREG_LINKSPEED_10: |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3053 |
ecmd->speed = SPEED_10; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3054 |
break; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3055 |
case NVREG_LINKSPEED_100: |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3056 |
ecmd->speed = SPEED_100; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3057 |
break; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3058 |
case NVREG_LINKSPEED_1000: |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3059 |
ecmd->speed = SPEED_1000; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3060 |
break; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3061 |
} |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3062 |
ecmd->duplex = DUPLEX_HALF; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3063 |
if (np->duplex) |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3064 |
ecmd->duplex = DUPLEX_FULL; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3065 |
} else { |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3066 |
ecmd->speed = -1; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3067 |
ecmd->duplex = -1; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3068 |
} |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3069 |
|
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3070 |
ecmd->autoneg = np->autoneg; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3071 |
|
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3072 |
ecmd->advertising = ADVERTISED_MII; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3073 |
if (np->autoneg) { |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3074 |
ecmd->advertising |= ADVERTISED_Autoneg; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3075 |
adv = mii_rw(dev, np->phyaddr, MII_ADVERTISE, MII_READ); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3076 |
if (adv & ADVERTISE_10HALF) |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3077 |
ecmd->advertising |= ADVERTISED_10baseT_Half; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3078 |
if (adv & ADVERTISE_10FULL) |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3079 |
ecmd->advertising |= ADVERTISED_10baseT_Full; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3080 |
if (adv & ADVERTISE_100HALF) |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3081 |
ecmd->advertising |= ADVERTISED_100baseT_Half; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3082 |
if (adv & ADVERTISE_100FULL) |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3083 |
ecmd->advertising |= ADVERTISED_100baseT_Full; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3084 |
if (np->gigabit == PHY_GIGABIT) { |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3085 |
adv = mii_rw(dev, np->phyaddr, MII_CTRL1000, MII_READ); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3086 |
if (adv & ADVERTISE_1000FULL) |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3087 |
ecmd->advertising |= ADVERTISED_1000baseT_Full; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3088 |
} |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3089 |
} |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3090 |
ecmd->supported = (SUPPORTED_Autoneg | |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3091 |
SUPPORTED_10baseT_Half | SUPPORTED_10baseT_Full | |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3092 |
SUPPORTED_100baseT_Half | SUPPORTED_100baseT_Full | |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3093 |
SUPPORTED_MII); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3094 |
if (np->gigabit == PHY_GIGABIT) |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3095 |
ecmd->supported |= SUPPORTED_1000baseT_Full; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3096 |
|
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3097 |
ecmd->phy_address = np->phyaddr; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3098 |
ecmd->transceiver = XCVR_EXTERNAL; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3099 |
|
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3100 |
/* ignore maxtxpkt, maxrxpkt for now */ |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3101 |
spin_unlock_irq(&np->lock); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3102 |
return 0; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3103 |
} |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3104 |
|
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3105 |
static int nv_set_settings(struct net_device *dev, struct ethtool_cmd *ecmd) |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3106 |
{ |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3107 |
struct fe_priv *np = netdev_priv(dev); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3108 |
|
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3109 |
if (ecmd->port != PORT_MII) |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3110 |
return -EINVAL; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3111 |
if (ecmd->transceiver != XCVR_EXTERNAL) |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3112 |
return -EINVAL; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3113 |
if (ecmd->phy_address != np->phyaddr) { |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3114 |
/* TODO: support switching between multiple phys. Should be |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3115 |
* trivial, but not enabled due to lack of test hardware. */ |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3116 |
return -EINVAL; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3117 |
} |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3118 |
if (ecmd->autoneg == AUTONEG_ENABLE) { |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3119 |
u32 mask; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3120 |
|
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3121 |
mask = ADVERTISED_10baseT_Half | ADVERTISED_10baseT_Full | |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3122 |
ADVERTISED_100baseT_Half | ADVERTISED_100baseT_Full; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3123 |
if (np->gigabit == PHY_GIGABIT) |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3124 |
mask |= ADVERTISED_1000baseT_Full; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3125 |
|
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3126 |
if ((ecmd->advertising & mask) == 0) |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3127 |
return -EINVAL; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3128 |
|
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3129 |
} else if (ecmd->autoneg == AUTONEG_DISABLE) { |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3130 |
/* Note: autonegotiation disable, speed 1000 intentionally |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3131 |
* forbidden - noone should need that. */ |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3132 |
|
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3133 |
if (ecmd->speed != SPEED_10 && ecmd->speed != SPEED_100) |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3134 |
return -EINVAL; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3135 |
if (ecmd->duplex != DUPLEX_HALF && ecmd->duplex != DUPLEX_FULL) |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3136 |
return -EINVAL; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3137 |
} else { |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3138 |
return -EINVAL; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3139 |
} |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3140 |
|
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3141 |
netif_carrier_off(dev); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3142 |
if (netif_running(dev)) { |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3143 |
nv_disable_irq(dev); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3144 |
netif_tx_lock_bh(dev); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3145 |
spin_lock(&np->lock); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3146 |
/* stop engines */ |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3147 |
nv_stop_rx(dev); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3148 |
nv_stop_tx(dev); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3149 |
spin_unlock(&np->lock); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3150 |
netif_tx_unlock_bh(dev); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3151 |
} |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3152 |
|
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3153 |
if (ecmd->autoneg == AUTONEG_ENABLE) { |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3154 |
int adv, bmcr; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3155 |
|
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3156 |
np->autoneg = 1; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3157 |
|
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3158 |
/* advertise only what has been requested */ |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3159 |
adv = mii_rw(dev, np->phyaddr, MII_ADVERTISE, MII_READ); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3160 |
adv &= ~(ADVERTISE_ALL | ADVERTISE_100BASE4 | ADVERTISE_PAUSE_CAP | ADVERTISE_PAUSE_ASYM); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3161 |
if (ecmd->advertising & ADVERTISED_10baseT_Half) |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3162 |
adv |= ADVERTISE_10HALF; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3163 |
if (ecmd->advertising & ADVERTISED_10baseT_Full) |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3164 |
adv |= ADVERTISE_10FULL; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3165 |
if (ecmd->advertising & ADVERTISED_100baseT_Half) |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3166 |
adv |= ADVERTISE_100HALF; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3167 |
if (ecmd->advertising & ADVERTISED_100baseT_Full) |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3168 |
adv |= ADVERTISE_100FULL; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3169 |
if (np->pause_flags & NV_PAUSEFRAME_RX_REQ) /* for rx we set both advertisments but disable tx pause */ |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3170 |
adv |= ADVERTISE_PAUSE_CAP | ADVERTISE_PAUSE_ASYM; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3171 |
if (np->pause_flags & NV_PAUSEFRAME_TX_REQ) |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3172 |
adv |= ADVERTISE_PAUSE_ASYM; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3173 |
mii_rw(dev, np->phyaddr, MII_ADVERTISE, adv); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3174 |
|
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3175 |
if (np->gigabit == PHY_GIGABIT) { |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3176 |
adv = mii_rw(dev, np->phyaddr, MII_CTRL1000, MII_READ); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3177 |
adv &= ~ADVERTISE_1000FULL; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3178 |
if (ecmd->advertising & ADVERTISED_1000baseT_Full) |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3179 |
adv |= ADVERTISE_1000FULL; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3180 |
mii_rw(dev, np->phyaddr, MII_CTRL1000, adv); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3181 |
} |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3182 |
|
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3183 |
if (netif_running(dev)) |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3184 |
printk(KERN_INFO "%s: link down.\n", dev->name); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3185 |
bmcr = mii_rw(dev, np->phyaddr, MII_BMCR, MII_READ); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3186 |
if (np->phy_model == PHY_MODEL_MARVELL_E3016) { |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3187 |
bmcr |= BMCR_ANENABLE; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3188 |
/* reset the phy in order for settings to stick, |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3189 |
* and cause autoneg to start */ |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3190 |
if (phy_reset(dev, bmcr)) { |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3191 |
printk(KERN_INFO "%s: phy reset failed\n", dev->name); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3192 |
return -EINVAL; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3193 |
} |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3194 |
} else { |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3195 |
bmcr |= (BMCR_ANENABLE | BMCR_ANRESTART); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3196 |
mii_rw(dev, np->phyaddr, MII_BMCR, bmcr); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3197 |
} |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3198 |
} else { |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3199 |
int adv, bmcr; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3200 |
|
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3201 |
np->autoneg = 0; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3202 |
|
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3203 |
adv = mii_rw(dev, np->phyaddr, MII_ADVERTISE, MII_READ); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3204 |
adv &= ~(ADVERTISE_ALL | ADVERTISE_100BASE4 | ADVERTISE_PAUSE_CAP | ADVERTISE_PAUSE_ASYM); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3205 |
if (ecmd->speed == SPEED_10 && ecmd->duplex == DUPLEX_HALF) |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3206 |
adv |= ADVERTISE_10HALF; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3207 |
if (ecmd->speed == SPEED_10 && ecmd->duplex == DUPLEX_FULL) |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3208 |
adv |= ADVERTISE_10FULL; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3209 |
if (ecmd->speed == SPEED_100 && ecmd->duplex == DUPLEX_HALF) |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3210 |
adv |= ADVERTISE_100HALF; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3211 |
if (ecmd->speed == SPEED_100 && ecmd->duplex == DUPLEX_FULL) |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3212 |
adv |= ADVERTISE_100FULL; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3213 |
np->pause_flags &= ~(NV_PAUSEFRAME_AUTONEG|NV_PAUSEFRAME_RX_ENABLE|NV_PAUSEFRAME_TX_ENABLE); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3214 |
if (np->pause_flags & NV_PAUSEFRAME_RX_REQ) {/* for rx we set both advertisments but disable tx pause */ |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3215 |
adv |= ADVERTISE_PAUSE_CAP | ADVERTISE_PAUSE_ASYM; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3216 |
np->pause_flags |= NV_PAUSEFRAME_RX_ENABLE; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3217 |
} |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3218 |
if (np->pause_flags & NV_PAUSEFRAME_TX_REQ) { |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3219 |
adv |= ADVERTISE_PAUSE_ASYM; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3220 |
np->pause_flags |= NV_PAUSEFRAME_TX_ENABLE; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3221 |
} |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3222 |
mii_rw(dev, np->phyaddr, MII_ADVERTISE, adv); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3223 |
np->fixed_mode = adv; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3224 |
|
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3225 |
if (np->gigabit == PHY_GIGABIT) { |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3226 |
adv = mii_rw(dev, np->phyaddr, MII_CTRL1000, MII_READ); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3227 |
adv &= ~ADVERTISE_1000FULL; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3228 |
mii_rw(dev, np->phyaddr, MII_CTRL1000, adv); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3229 |
} |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3230 |
|
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3231 |
bmcr = mii_rw(dev, np->phyaddr, MII_BMCR, MII_READ); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3232 |
bmcr &= ~(BMCR_ANENABLE|BMCR_SPEED100|BMCR_SPEED1000|BMCR_FULLDPLX); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3233 |
if (np->fixed_mode & (ADVERTISE_10FULL|ADVERTISE_100FULL)) |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3234 |
bmcr |= BMCR_FULLDPLX; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3235 |
if (np->fixed_mode & (ADVERTISE_100HALF|ADVERTISE_100FULL)) |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3236 |
bmcr |= BMCR_SPEED100; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3237 |
if (np->phy_oui == PHY_OUI_MARVELL) { |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3238 |
/* reset the phy in order for forced mode settings to stick */ |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3239 |
if (phy_reset(dev, bmcr)) { |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3240 |
printk(KERN_INFO "%s: phy reset failed\n", dev->name); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3241 |
return -EINVAL; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3242 |
} |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3243 |
} else { |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3244 |
mii_rw(dev, np->phyaddr, MII_BMCR, bmcr); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3245 |
if (netif_running(dev)) { |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3246 |
/* Wait a bit and then reconfigure the nic. */ |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3247 |
udelay(10); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3248 |
nv_linkchange(dev); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3249 |
} |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3250 |
} |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3251 |
} |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3252 |
|
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3253 |
if (netif_running(dev)) { |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3254 |
nv_start_rx(dev); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3255 |
nv_start_tx(dev); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3256 |
nv_enable_irq(dev); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3257 |
} |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3258 |
|
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3259 |
return 0; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3260 |
} |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3261 |
|
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3262 |
#define FORCEDETH_REGS_VER 1 |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3263 |
|
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3264 |
static int nv_get_regs_len(struct net_device *dev) |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3265 |
{ |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3266 |
struct fe_priv *np = netdev_priv(dev); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3267 |
return np->register_size; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3268 |
} |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3269 |
|
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3270 |
static void nv_get_regs(struct net_device *dev, struct ethtool_regs *regs, void *buf) |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3271 |
{ |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3272 |
struct fe_priv *np = netdev_priv(dev); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3273 |
u8 __iomem *base = get_hwbase(dev); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3274 |
u32 *rbuf = buf; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3275 |
int i; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3276 |
|
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3277 |
regs->version = FORCEDETH_REGS_VER; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3278 |
spin_lock_irq(&np->lock); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3279 |
for (i = 0;i <= np->register_size/sizeof(u32); i++) |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3280 |
rbuf[i] = readl(base + i*sizeof(u32)); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3281 |
spin_unlock_irq(&np->lock); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3282 |
} |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3283 |
|
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3284 |
static int nv_nway_reset(struct net_device *dev) |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3285 |
{ |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3286 |
struct fe_priv *np = netdev_priv(dev); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3287 |
int ret; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3288 |
|
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3289 |
if (np->autoneg) { |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3290 |
int bmcr; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3291 |
|
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3292 |
netif_carrier_off(dev); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3293 |
if (netif_running(dev)) { |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3294 |
nv_disable_irq(dev); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3295 |
netif_tx_lock_bh(dev); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3296 |
spin_lock(&np->lock); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3297 |
/* stop engines */ |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3298 |
nv_stop_rx(dev); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3299 |
nv_stop_tx(dev); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3300 |
spin_unlock(&np->lock); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3301 |
netif_tx_unlock_bh(dev); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3302 |
printk(KERN_INFO "%s: link down.\n", dev->name); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3303 |
} |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3304 |
|
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3305 |
bmcr = mii_rw(dev, np->phyaddr, MII_BMCR, MII_READ); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3306 |
if (np->phy_model == PHY_MODEL_MARVELL_E3016) { |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3307 |
bmcr |= BMCR_ANENABLE; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3308 |
/* reset the phy in order for settings to stick*/ |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3309 |
if (phy_reset(dev, bmcr)) { |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3310 |
printk(KERN_INFO "%s: phy reset failed\n", dev->name); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3311 |
return -EINVAL; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3312 |
} |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3313 |
} else { |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3314 |
bmcr |= (BMCR_ANENABLE | BMCR_ANRESTART); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3315 |
mii_rw(dev, np->phyaddr, MII_BMCR, bmcr); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3316 |
} |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3317 |
|
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3318 |
if (netif_running(dev)) { |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3319 |
nv_start_rx(dev); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3320 |
nv_start_tx(dev); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3321 |
nv_enable_irq(dev); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3322 |
} |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3323 |
ret = 0; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3324 |
} else { |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3325 |
ret = -EINVAL; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3326 |
} |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3327 |
|
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3328 |
return ret; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3329 |
} |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3330 |
|
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3331 |
static int nv_set_tso(struct net_device *dev, u32 value) |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3332 |
{ |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3333 |
struct fe_priv *np = netdev_priv(dev); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3334 |
|
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3335 |
if ((np->driver_data & DEV_HAS_CHECKSUM)) |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3336 |
return ethtool_op_set_tso(dev, value); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3337 |
else |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3338 |
return -EOPNOTSUPP; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3339 |
} |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3340 |
|
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3341 |
static void nv_get_ringparam(struct net_device *dev, struct ethtool_ringparam* ring) |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3342 |
{ |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3343 |
struct fe_priv *np = netdev_priv(dev); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3344 |
|
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3345 |
ring->rx_max_pending = (np->desc_ver == DESC_VER_1) ? RING_MAX_DESC_VER_1 : RING_MAX_DESC_VER_2_3; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3346 |
ring->rx_mini_max_pending = 0; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3347 |
ring->rx_jumbo_max_pending = 0; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3348 |
ring->tx_max_pending = (np->desc_ver == DESC_VER_1) ? RING_MAX_DESC_VER_1 : RING_MAX_DESC_VER_2_3; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3349 |
|
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3350 |
ring->rx_pending = np->rx_ring_size; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3351 |
ring->rx_mini_pending = 0; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3352 |
ring->rx_jumbo_pending = 0; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3353 |
ring->tx_pending = np->tx_ring_size; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3354 |
} |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3355 |
|
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3356 |
static int nv_set_ringparam(struct net_device *dev, struct ethtool_ringparam* ring) |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3357 |
{ |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3358 |
struct fe_priv *np = netdev_priv(dev); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3359 |
u8 __iomem *base = get_hwbase(dev); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3360 |
u8 *rxtx_ring, *rx_skbuff, *tx_skbuff, *rx_dma, *tx_dma, *tx_dma_len; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3361 |
dma_addr_t ring_addr; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3362 |
|
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3363 |
if (ring->rx_pending < RX_RING_MIN || |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3364 |
ring->tx_pending < TX_RING_MIN || |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3365 |
ring->rx_mini_pending != 0 || |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3366 |
ring->rx_jumbo_pending != 0 || |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3367 |
(np->desc_ver == DESC_VER_1 && |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3368 |
(ring->rx_pending > RING_MAX_DESC_VER_1 || |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3369 |
ring->tx_pending > RING_MAX_DESC_VER_1)) || |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3370 |
(np->desc_ver != DESC_VER_1 && |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3371 |
(ring->rx_pending > RING_MAX_DESC_VER_2_3 || |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3372 |
ring->tx_pending > RING_MAX_DESC_VER_2_3))) { |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3373 |
return -EINVAL; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3374 |
} |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3375 |
|
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3376 |
/* allocate new rings */ |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3377 |
if (np->desc_ver == DESC_VER_1 || np->desc_ver == DESC_VER_2) { |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3378 |
rxtx_ring = pci_alloc_consistent(np->pci_dev, |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3379 |
sizeof(struct ring_desc) * (ring->rx_pending + ring->tx_pending), |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3380 |
&ring_addr); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3381 |
} else { |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3382 |
rxtx_ring = pci_alloc_consistent(np->pci_dev, |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3383 |
sizeof(struct ring_desc_ex) * (ring->rx_pending + ring->tx_pending), |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3384 |
&ring_addr); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3385 |
} |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3386 |
rx_skbuff = kmalloc(sizeof(struct sk_buff*) * ring->rx_pending, GFP_KERNEL); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3387 |
rx_dma = kmalloc(sizeof(dma_addr_t) * ring->rx_pending, GFP_KERNEL); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3388 |
tx_skbuff = kmalloc(sizeof(struct sk_buff*) * ring->tx_pending, GFP_KERNEL); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3389 |
tx_dma = kmalloc(sizeof(dma_addr_t) * ring->tx_pending, GFP_KERNEL); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3390 |
tx_dma_len = kmalloc(sizeof(unsigned int) * ring->tx_pending, GFP_KERNEL); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3391 |
if (!rxtx_ring || !rx_skbuff || !rx_dma || !tx_skbuff || !tx_dma || !tx_dma_len) { |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3392 |
/* fall back to old rings */ |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3393 |
if (np->desc_ver == DESC_VER_1 || np->desc_ver == DESC_VER_2) { |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3394 |
if (rxtx_ring) |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3395 |
pci_free_consistent(np->pci_dev, sizeof(struct ring_desc) * (ring->rx_pending + ring->tx_pending), |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3396 |
rxtx_ring, ring_addr); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3397 |
} else { |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3398 |
if (rxtx_ring) |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3399 |
pci_free_consistent(np->pci_dev, sizeof(struct ring_desc_ex) * (ring->rx_pending + ring->tx_pending), |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3400 |
rxtx_ring, ring_addr); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3401 |
} |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3402 |
if (rx_skbuff) |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3403 |
kfree(rx_skbuff); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3404 |
if (rx_dma) |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3405 |
kfree(rx_dma); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3406 |
if (tx_skbuff) |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3407 |
kfree(tx_skbuff); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3408 |
if (tx_dma) |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3409 |
kfree(tx_dma); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3410 |
if (tx_dma_len) |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3411 |
kfree(tx_dma_len); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3412 |
goto exit; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3413 |
} |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3414 |
|
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3415 |
if (netif_running(dev)) { |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3416 |
nv_disable_irq(dev); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3417 |
netif_tx_lock_bh(dev); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3418 |
spin_lock(&np->lock); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3419 |
/* stop engines */ |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3420 |
nv_stop_rx(dev); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3421 |
nv_stop_tx(dev); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3422 |
nv_txrx_reset(dev); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3423 |
/* drain queues */ |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3424 |
nv_drain_rx(dev); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3425 |
nv_drain_tx(dev); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3426 |
/* delete queues */ |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3427 |
free_rings(dev); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3428 |
} |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3429 |
|
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3430 |
/* set new values */ |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3431 |
np->rx_ring_size = ring->rx_pending; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3432 |
np->tx_ring_size = ring->tx_pending; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3433 |
np->tx_limit_stop = ring->tx_pending - TX_LIMIT_DIFFERENCE; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3434 |
np->tx_limit_start = ring->tx_pending - TX_LIMIT_DIFFERENCE - 1; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3435 |
if (np->desc_ver == DESC_VER_1 || np->desc_ver == DESC_VER_2) { |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3436 |
np->rx_ring.orig = (struct ring_desc*)rxtx_ring; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3437 |
np->tx_ring.orig = &np->rx_ring.orig[np->rx_ring_size]; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3438 |
} else { |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3439 |
np->rx_ring.ex = (struct ring_desc_ex*)rxtx_ring; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3440 |
np->tx_ring.ex = &np->rx_ring.ex[np->rx_ring_size]; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3441 |
} |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3442 |
np->rx_skbuff = (struct sk_buff**)rx_skbuff; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3443 |
np->rx_dma = (dma_addr_t*)rx_dma; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3444 |
np->tx_skbuff = (struct sk_buff**)tx_skbuff; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3445 |
np->tx_dma = (dma_addr_t*)tx_dma; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3446 |
np->tx_dma_len = (unsigned int*)tx_dma_len; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3447 |
np->ring_addr = ring_addr; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3448 |
|
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3449 |
memset(np->rx_skbuff, 0, sizeof(struct sk_buff*) * np->rx_ring_size); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3450 |
memset(np->rx_dma, 0, sizeof(dma_addr_t) * np->rx_ring_size); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3451 |
memset(np->tx_skbuff, 0, sizeof(struct sk_buff*) * np->tx_ring_size); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3452 |
memset(np->tx_dma, 0, sizeof(dma_addr_t) * np->tx_ring_size); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3453 |
memset(np->tx_dma_len, 0, sizeof(unsigned int) * np->tx_ring_size); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3454 |
|
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3455 |
if (netif_running(dev)) { |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3456 |
/* reinit driver view of the queues */ |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3457 |
set_bufsize(dev); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3458 |
if (nv_init_ring(dev)) { |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3459 |
if (!np->in_shutdown) |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3460 |
mod_timer(&np->oom_kick, jiffies + OOM_REFILL); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3461 |
} |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3462 |
|
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3463 |
/* reinit nic view of the queues */ |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3464 |
writel(np->rx_buf_sz, base + NvRegOffloadConfig); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3465 |
setup_hw_rings(dev, NV_SETUP_RX_RING | NV_SETUP_TX_RING); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3466 |
writel( ((np->rx_ring_size-1) << NVREG_RINGSZ_RXSHIFT) + ((np->tx_ring_size-1) << NVREG_RINGSZ_TXSHIFT), |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3467 |
base + NvRegRingSizes); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3468 |
pci_push(base); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3469 |
writel(NVREG_TXRXCTL_KICK|np->txrxctl_bits, get_hwbase(dev) + NvRegTxRxControl); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3470 |
pci_push(base); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3471 |
|
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3472 |
/* restart engines */ |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3473 |
nv_start_rx(dev); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3474 |
nv_start_tx(dev); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3475 |
spin_unlock(&np->lock); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3476 |
netif_tx_unlock_bh(dev); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3477 |
nv_enable_irq(dev); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3478 |
} |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3479 |
return 0; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3480 |
exit: |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3481 |
return -ENOMEM; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3482 |
} |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3483 |
|
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3484 |
static void nv_get_pauseparam(struct net_device *dev, struct ethtool_pauseparam* pause) |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3485 |
{ |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3486 |
struct fe_priv *np = netdev_priv(dev); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3487 |
|
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3488 |
pause->autoneg = (np->pause_flags & NV_PAUSEFRAME_AUTONEG) != 0; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3489 |
pause->rx_pause = (np->pause_flags & NV_PAUSEFRAME_RX_ENABLE) != 0; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3490 |
pause->tx_pause = (np->pause_flags & NV_PAUSEFRAME_TX_ENABLE) != 0; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3491 |
} |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3492 |
|
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3493 |
static int nv_set_pauseparam(struct net_device *dev, struct ethtool_pauseparam* pause) |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3494 |
{ |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3495 |
struct fe_priv *np = netdev_priv(dev); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3496 |
int adv, bmcr; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3497 |
|
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3498 |
if ((!np->autoneg && np->duplex == 0) || |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3499 |
(np->autoneg && !pause->autoneg && np->duplex == 0)) { |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3500 |
printk(KERN_INFO "%s: can not set pause settings when forced link is in half duplex.\n", |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3501 |
dev->name); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3502 |
return -EINVAL; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3503 |
} |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3504 |
if (pause->tx_pause && !(np->pause_flags & NV_PAUSEFRAME_TX_CAPABLE)) { |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3505 |
printk(KERN_INFO "%s: hardware does not support tx pause frames.\n", dev->name); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3506 |
return -EINVAL; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3507 |
} |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3508 |
|
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3509 |
netif_carrier_off(dev); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3510 |
if (netif_running(dev)) { |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3511 |
nv_disable_irq(dev); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3512 |
netif_tx_lock_bh(dev); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3513 |
spin_lock(&np->lock); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3514 |
/* stop engines */ |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3515 |
nv_stop_rx(dev); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3516 |
nv_stop_tx(dev); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3517 |
spin_unlock(&np->lock); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3518 |
netif_tx_unlock_bh(dev); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3519 |
} |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3520 |
|
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3521 |
np->pause_flags &= ~(NV_PAUSEFRAME_RX_REQ|NV_PAUSEFRAME_TX_REQ); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3522 |
if (pause->rx_pause) |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3523 |
np->pause_flags |= NV_PAUSEFRAME_RX_REQ; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3524 |
if (pause->tx_pause) |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3525 |
np->pause_flags |= NV_PAUSEFRAME_TX_REQ; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3526 |
|
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3527 |
if (np->autoneg && pause->autoneg) { |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3528 |
np->pause_flags |= NV_PAUSEFRAME_AUTONEG; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3529 |
|
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3530 |
adv = mii_rw(dev, np->phyaddr, MII_ADVERTISE, MII_READ); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3531 |
adv &= ~(ADVERTISE_PAUSE_CAP | ADVERTISE_PAUSE_ASYM); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3532 |
if (np->pause_flags & NV_PAUSEFRAME_RX_REQ) /* for rx we set both advertisments but disable tx pause */ |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3533 |
adv |= ADVERTISE_PAUSE_CAP | ADVERTISE_PAUSE_ASYM; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3534 |
if (np->pause_flags & NV_PAUSEFRAME_TX_REQ) |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3535 |
adv |= ADVERTISE_PAUSE_ASYM; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3536 |
mii_rw(dev, np->phyaddr, MII_ADVERTISE, adv); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3537 |
|
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3538 |
if (netif_running(dev)) |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3539 |
printk(KERN_INFO "%s: link down.\n", dev->name); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3540 |
bmcr = mii_rw(dev, np->phyaddr, MII_BMCR, MII_READ); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3541 |
bmcr |= (BMCR_ANENABLE | BMCR_ANRESTART); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3542 |
mii_rw(dev, np->phyaddr, MII_BMCR, bmcr); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3543 |
} else { |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3544 |
np->pause_flags &= ~(NV_PAUSEFRAME_AUTONEG|NV_PAUSEFRAME_RX_ENABLE|NV_PAUSEFRAME_TX_ENABLE); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3545 |
if (pause->rx_pause) |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3546 |
np->pause_flags |= NV_PAUSEFRAME_RX_ENABLE; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3547 |
if (pause->tx_pause) |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3548 |
np->pause_flags |= NV_PAUSEFRAME_TX_ENABLE; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3549 |
|
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3550 |
if (!netif_running(dev)) |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3551 |
nv_update_linkspeed(dev); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3552 |
else |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3553 |
nv_update_pause(dev, np->pause_flags); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3554 |
} |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3555 |
|
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3556 |
if (netif_running(dev)) { |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3557 |
nv_start_rx(dev); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3558 |
nv_start_tx(dev); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3559 |
nv_enable_irq(dev); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3560 |
} |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3561 |
return 0; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3562 |
} |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3563 |
|
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3564 |
static u32 nv_get_rx_csum(struct net_device *dev) |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3565 |
{ |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3566 |
struct fe_priv *np = netdev_priv(dev); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3567 |
return (np->rx_csum) != 0; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3568 |
} |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3569 |
|
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3570 |
static int nv_set_rx_csum(struct net_device *dev, u32 data) |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3571 |
{ |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3572 |
struct fe_priv *np = netdev_priv(dev); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3573 |
u8 __iomem *base = get_hwbase(dev); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3574 |
int retcode = 0; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3575 |
|
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3576 |
if (np->driver_data & DEV_HAS_CHECKSUM) { |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3577 |
if (data) { |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3578 |
np->rx_csum = 1; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3579 |
np->txrxctl_bits |= NVREG_TXRXCTL_RXCHECK; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3580 |
} else { |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3581 |
np->rx_csum = 0; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3582 |
/* vlan is dependent on rx checksum offload */ |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3583 |
if (!(np->vlanctl_bits & NVREG_VLANCONTROL_ENABLE)) |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3584 |
np->txrxctl_bits &= ~NVREG_TXRXCTL_RXCHECK; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3585 |
} |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3586 |
if (netif_running(dev)) { |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3587 |
spin_lock_irq(&np->lock); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3588 |
writel(np->txrxctl_bits, base + NvRegTxRxControl); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3589 |
spin_unlock_irq(&np->lock); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3590 |
} |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3591 |
} else { |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3592 |
return -EINVAL; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3593 |
} |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3594 |
|
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3595 |
return retcode; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3596 |
} |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3597 |
|
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3598 |
static int nv_set_tx_csum(struct net_device *dev, u32 data) |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3599 |
{ |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3600 |
struct fe_priv *np = netdev_priv(dev); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3601 |
|
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3602 |
if (np->driver_data & DEV_HAS_CHECKSUM) |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3603 |
return ethtool_op_set_tx_hw_csum(dev, data); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3604 |
else |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3605 |
return -EOPNOTSUPP; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3606 |
} |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3607 |
|
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3608 |
static int nv_set_sg(struct net_device *dev, u32 data) |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3609 |
{ |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3610 |
struct fe_priv *np = netdev_priv(dev); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3611 |
|
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3612 |
if (np->driver_data & DEV_HAS_CHECKSUM) |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3613 |
return ethtool_op_set_sg(dev, data); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3614 |
else |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3615 |
return -EOPNOTSUPP; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3616 |
} |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3617 |
|
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3618 |
static int nv_get_stats_count(struct net_device *dev) |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3619 |
{ |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3620 |
struct fe_priv *np = netdev_priv(dev); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3621 |
|
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3622 |
if (np->driver_data & DEV_HAS_STATISTICS) |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3623 |
return sizeof(struct nv_ethtool_stats)/sizeof(u64); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3624 |
else |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3625 |
return 0; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3626 |
} |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3627 |
|
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3628 |
static void nv_get_ethtool_stats(struct net_device *dev, struct ethtool_stats *estats, u64 *buffer) |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3629 |
{ |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3630 |
struct fe_priv *np = netdev_priv(dev); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3631 |
|
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3632 |
/* update stats */ |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3633 |
nv_do_stats_poll((unsigned long)dev); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3634 |
|
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3635 |
memcpy(buffer, &np->estats, nv_get_stats_count(dev)*sizeof(u64)); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3636 |
} |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3637 |
|
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3638 |
static int nv_self_test_count(struct net_device *dev) |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3639 |
{ |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3640 |
struct fe_priv *np = netdev_priv(dev); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3641 |
|
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3642 |
if (np->driver_data & DEV_HAS_TEST_EXTENDED) |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3643 |
return NV_TEST_COUNT_EXTENDED; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3644 |
else |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3645 |
return NV_TEST_COUNT_BASE; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3646 |
} |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3647 |
|
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3648 |
static int nv_link_test(struct net_device *dev) |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3649 |
{ |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3650 |
struct fe_priv *np = netdev_priv(dev); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3651 |
int mii_status; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3652 |
|
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3653 |
mii_rw(dev, np->phyaddr, MII_BMSR, MII_READ); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3654 |
mii_status = mii_rw(dev, np->phyaddr, MII_BMSR, MII_READ); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3655 |
|
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3656 |
/* check phy link status */ |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3657 |
if (!(mii_status & BMSR_LSTATUS)) |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3658 |
return 0; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3659 |
else |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3660 |
return 1; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3661 |
} |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3662 |
|
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3663 |
static int nv_register_test(struct net_device *dev) |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3664 |
{ |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3665 |
u8 __iomem *base = get_hwbase(dev); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3666 |
int i = 0; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3667 |
u32 orig_read, new_read; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3668 |
|
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3669 |
do { |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3670 |
orig_read = readl(base + nv_registers_test[i].reg); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3671 |
|
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3672 |
/* xor with mask to toggle bits */ |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3673 |
orig_read ^= nv_registers_test[i].mask; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3674 |
|
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3675 |
writel(orig_read, base + nv_registers_test[i].reg); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3676 |
|
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3677 |
new_read = readl(base + nv_registers_test[i].reg); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3678 |
|
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3679 |
if ((new_read & nv_registers_test[i].mask) != (orig_read & nv_registers_test[i].mask)) |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3680 |
return 0; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3681 |
|
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3682 |
/* restore original value */ |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3683 |
orig_read ^= nv_registers_test[i].mask; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3684 |
writel(orig_read, base + nv_registers_test[i].reg); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3685 |
|
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3686 |
} while (nv_registers_test[++i].reg != 0); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3687 |
|
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3688 |
return 1; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3689 |
} |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3690 |
|
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3691 |
static int nv_interrupt_test(struct net_device *dev) |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3692 |
{ |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3693 |
struct fe_priv *np = netdev_priv(dev); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3694 |
u8 __iomem *base = get_hwbase(dev); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3695 |
int ret = 1; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3696 |
int testcnt; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3697 |
u32 save_msi_flags, save_poll_interval = 0; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3698 |
|
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3699 |
if (netif_running(dev)) { |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3700 |
/* free current irq */ |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3701 |
nv_free_irq(dev); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3702 |
save_poll_interval = readl(base+NvRegPollingInterval); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3703 |
} |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3704 |
|
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3705 |
/* flag to test interrupt handler */ |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3706 |
np->intr_test = 0; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3707 |
|
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3708 |
/* setup test irq */ |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3709 |
save_msi_flags = np->msi_flags; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3710 |
np->msi_flags &= ~NV_MSI_X_VECTORS_MASK; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3711 |
np->msi_flags |= 0x001; /* setup 1 vector */ |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3712 |
if (nv_request_irq(dev, 1)) |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3713 |
return 0; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3714 |
|
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3715 |
/* setup timer interrupt */ |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3716 |
writel(NVREG_POLL_DEFAULT_CPU, base + NvRegPollingInterval); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3717 |
writel(NVREG_UNKSETUP6_VAL, base + NvRegUnknownSetupReg6); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3718 |
|
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3719 |
nv_enable_hw_interrupts(dev, NVREG_IRQ_TIMER); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3720 |
|
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3721 |
/* wait for at least one interrupt */ |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3722 |
msleep(100); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3723 |
|
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3724 |
spin_lock_irq(&np->lock); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3725 |
|
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3726 |
/* flag should be set within ISR */ |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3727 |
testcnt = np->intr_test; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3728 |
if (!testcnt) |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3729 |
ret = 2; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3730 |
|
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3731 |
nv_disable_hw_interrupts(dev, NVREG_IRQ_TIMER); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3732 |
if (!(np->msi_flags & NV_MSI_X_ENABLED)) |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3733 |
writel(NVREG_IRQSTAT_MASK, base + NvRegIrqStatus); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3734 |
else |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3735 |
writel(NVREG_IRQSTAT_MASK, base + NvRegMSIXIrqStatus); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3736 |
|
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3737 |
spin_unlock_irq(&np->lock); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3738 |
|
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3739 |
nv_free_irq(dev); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3740 |
|
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3741 |
np->msi_flags = save_msi_flags; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3742 |
|
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3743 |
if (netif_running(dev)) { |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3744 |
writel(save_poll_interval, base + NvRegPollingInterval); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3745 |
writel(NVREG_UNKSETUP6_VAL, base + NvRegUnknownSetupReg6); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3746 |
/* restore original irq */ |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3747 |
if (nv_request_irq(dev, 0)) |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3748 |
return 0; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3749 |
} |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3750 |
|
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3751 |
return ret; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3752 |
} |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3753 |
|
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3754 |
static int nv_loopback_test(struct net_device *dev) |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3755 |
{ |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3756 |
struct fe_priv *np = netdev_priv(dev); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3757 |
u8 __iomem *base = get_hwbase(dev); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3758 |
struct sk_buff *tx_skb, *rx_skb; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3759 |
dma_addr_t test_dma_addr; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3760 |
u32 tx_flags_extra = (np->desc_ver == DESC_VER_1 ? NV_TX_LASTPACKET : NV_TX2_LASTPACKET); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3761 |
u32 flags; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3762 |
int len, i, pkt_len; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3763 |
u8 *pkt_data; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3764 |
u32 filter_flags = 0; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3765 |
u32 misc1_flags = 0; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3766 |
int ret = 1; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3767 |
|
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3768 |
if (netif_running(dev)) { |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3769 |
nv_disable_irq(dev); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3770 |
filter_flags = readl(base + NvRegPacketFilterFlags); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3771 |
misc1_flags = readl(base + NvRegMisc1); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3772 |
} else { |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3773 |
nv_txrx_reset(dev); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3774 |
} |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3775 |
|
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3776 |
/* reinit driver view of the rx queue */ |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3777 |
set_bufsize(dev); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3778 |
nv_init_ring(dev); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3779 |
|
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3780 |
/* setup hardware for loopback */ |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3781 |
writel(NVREG_MISC1_FORCE, base + NvRegMisc1); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3782 |
writel(NVREG_PFF_ALWAYS | NVREG_PFF_LOOPBACK, base + NvRegPacketFilterFlags); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3783 |
|
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3784 |
/* reinit nic view of the rx queue */ |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3785 |
writel(np->rx_buf_sz, base + NvRegOffloadConfig); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3786 |
setup_hw_rings(dev, NV_SETUP_RX_RING | NV_SETUP_TX_RING); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3787 |
writel( ((np->rx_ring_size-1) << NVREG_RINGSZ_RXSHIFT) + ((np->tx_ring_size-1) << NVREG_RINGSZ_TXSHIFT), |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3788 |
base + NvRegRingSizes); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3789 |
pci_push(base); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3790 |
|
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3791 |
/* restart rx engine */ |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3792 |
nv_start_rx(dev); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3793 |
nv_start_tx(dev); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3794 |
|
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3795 |
/* setup packet for tx */ |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3796 |
pkt_len = ETH_DATA_LEN; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3797 |
tx_skb = dev_alloc_skb(pkt_len); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3798 |
if (!tx_skb) { |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3799 |
printk(KERN_ERR "dev_alloc_skb() failed during loopback test" |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3800 |
" of %s\n", dev->name); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3801 |
ret = 0; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3802 |
goto out; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3803 |
} |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3804 |
pkt_data = skb_put(tx_skb, pkt_len); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3805 |
for (i = 0; i < pkt_len; i++) |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3806 |
pkt_data[i] = (u8)(i & 0xff); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3807 |
test_dma_addr = pci_map_single(np->pci_dev, tx_skb->data, |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3808 |
tx_skb->end-tx_skb->data, PCI_DMA_FROMDEVICE); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3809 |
|
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3810 |
if (np->desc_ver == DESC_VER_1 || np->desc_ver == DESC_VER_2) { |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3811 |
np->tx_ring.orig[0].buf = cpu_to_le32(test_dma_addr); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3812 |
np->tx_ring.orig[0].flaglen = cpu_to_le32((pkt_len-1) | np->tx_flags | tx_flags_extra); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3813 |
} else { |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3814 |
np->tx_ring.ex[0].bufhigh = cpu_to_le64(test_dma_addr) >> 32; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3815 |
np->tx_ring.ex[0].buflow = cpu_to_le64(test_dma_addr) & 0x0FFFFFFFF; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3816 |
np->tx_ring.ex[0].flaglen = cpu_to_le32((pkt_len-1) | np->tx_flags | tx_flags_extra); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3817 |
} |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3818 |
writel(NVREG_TXRXCTL_KICK|np->txrxctl_bits, get_hwbase(dev) + NvRegTxRxControl); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3819 |
pci_push(get_hwbase(dev)); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3820 |
|
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3821 |
msleep(500); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3822 |
|
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3823 |
/* check for rx of the packet */ |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3824 |
if (np->desc_ver == DESC_VER_1 || np->desc_ver == DESC_VER_2) { |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3825 |
flags = le32_to_cpu(np->rx_ring.orig[0].flaglen); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3826 |
len = nv_descr_getlength(&np->rx_ring.orig[0], np->desc_ver); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3827 |
|
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3828 |
} else { |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3829 |
flags = le32_to_cpu(np->rx_ring.ex[0].flaglen); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3830 |
len = nv_descr_getlength_ex(&np->rx_ring.ex[0], np->desc_ver); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3831 |
} |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3832 |
|
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3833 |
if (flags & NV_RX_AVAIL) { |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3834 |
ret = 0; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3835 |
} else if (np->desc_ver == DESC_VER_1) { |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3836 |
if (flags & NV_RX_ERROR) |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3837 |
ret = 0; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3838 |
} else { |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3839 |
if (flags & NV_RX2_ERROR) { |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3840 |
ret = 0; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3841 |
} |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3842 |
} |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3843 |
|
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3844 |
if (ret) { |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3845 |
if (len != pkt_len) { |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3846 |
ret = 0; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3847 |
dprintk(KERN_DEBUG "%s: loopback len mismatch %d vs %d\n", |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3848 |
dev->name, len, pkt_len); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3849 |
} else { |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3850 |
rx_skb = np->rx_skbuff[0]; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3851 |
for (i = 0; i < pkt_len; i++) { |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3852 |
if (rx_skb->data[i] != (u8)(i & 0xff)) { |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3853 |
ret = 0; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3854 |
dprintk(KERN_DEBUG "%s: loopback pattern check failed on byte %d\n", |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3855 |
dev->name, i); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3856 |
break; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3857 |
} |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3858 |
} |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3859 |
} |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3860 |
} else { |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3861 |
dprintk(KERN_DEBUG "%s: loopback - did not receive test packet\n", dev->name); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3862 |
} |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3863 |
|
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3864 |
pci_unmap_page(np->pci_dev, test_dma_addr, |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3865 |
tx_skb->end-tx_skb->data, |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3866 |
PCI_DMA_TODEVICE); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3867 |
dev_kfree_skb_any(tx_skb); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3868 |
out: |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3869 |
/* stop engines */ |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3870 |
nv_stop_rx(dev); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3871 |
nv_stop_tx(dev); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3872 |
nv_txrx_reset(dev); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3873 |
/* drain rx queue */ |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3874 |
nv_drain_rx(dev); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3875 |
nv_drain_tx(dev); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3876 |
|
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3877 |
if (netif_running(dev)) { |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3878 |
writel(misc1_flags, base + NvRegMisc1); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3879 |
writel(filter_flags, base + NvRegPacketFilterFlags); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3880 |
nv_enable_irq(dev); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3881 |
} |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3882 |
|
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3883 |
return ret; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3884 |
} |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3885 |
|
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3886 |
static void nv_self_test(struct net_device *dev, struct ethtool_test *test, u64 *buffer) |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3887 |
{ |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3888 |
struct fe_priv *np = netdev_priv(dev); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3889 |
u8 __iomem *base = get_hwbase(dev); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3890 |
int result; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3891 |
memset(buffer, 0, nv_self_test_count(dev)*sizeof(u64)); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3892 |
|
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3893 |
if (!nv_link_test(dev)) { |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3894 |
test->flags |= ETH_TEST_FL_FAILED; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3895 |
buffer[0] = 1; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3896 |
} |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3897 |
|
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3898 |
if (test->flags & ETH_TEST_FL_OFFLINE) { |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3899 |
if (netif_running(dev)) { |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3900 |
netif_stop_queue(dev); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3901 |
netif_poll_disable(dev); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3902 |
netif_tx_lock_bh(dev); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3903 |
spin_lock_irq(&np->lock); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3904 |
nv_disable_hw_interrupts(dev, np->irqmask); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3905 |
if (!(np->msi_flags & NV_MSI_X_ENABLED)) { |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3906 |
writel(NVREG_IRQSTAT_MASK, base + NvRegIrqStatus); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3907 |
} else { |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3908 |
writel(NVREG_IRQSTAT_MASK, base + NvRegMSIXIrqStatus); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3909 |
} |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3910 |
/* stop engines */ |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3911 |
nv_stop_rx(dev); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3912 |
nv_stop_tx(dev); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3913 |
nv_txrx_reset(dev); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3914 |
/* drain rx queue */ |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3915 |
nv_drain_rx(dev); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3916 |
nv_drain_tx(dev); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3917 |
spin_unlock_irq(&np->lock); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3918 |
netif_tx_unlock_bh(dev); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3919 |
} |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3920 |
|
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3921 |
if (!nv_register_test(dev)) { |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3922 |
test->flags |= ETH_TEST_FL_FAILED; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3923 |
buffer[1] = 1; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3924 |
} |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3925 |
|
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3926 |
result = nv_interrupt_test(dev); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3927 |
if (result != 1) { |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3928 |
test->flags |= ETH_TEST_FL_FAILED; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3929 |
buffer[2] = 1; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3930 |
} |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3931 |
if (result == 0) { |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3932 |
/* bail out */ |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3933 |
return; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3934 |
} |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3935 |
|
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3936 |
if (!nv_loopback_test(dev)) { |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3937 |
test->flags |= ETH_TEST_FL_FAILED; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3938 |
buffer[3] = 1; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3939 |
} |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3940 |
|
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3941 |
if (netif_running(dev)) { |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3942 |
/* reinit driver view of the rx queue */ |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3943 |
set_bufsize(dev); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3944 |
if (nv_init_ring(dev)) { |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3945 |
if (!np->in_shutdown) |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3946 |
mod_timer(&np->oom_kick, jiffies + OOM_REFILL); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3947 |
} |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3948 |
/* reinit nic view of the rx queue */ |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3949 |
writel(np->rx_buf_sz, base + NvRegOffloadConfig); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3950 |
setup_hw_rings(dev, NV_SETUP_RX_RING | NV_SETUP_TX_RING); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3951 |
writel( ((np->rx_ring_size-1) << NVREG_RINGSZ_RXSHIFT) + ((np->tx_ring_size-1) << NVREG_RINGSZ_TXSHIFT), |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3952 |
base + NvRegRingSizes); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3953 |
pci_push(base); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3954 |
writel(NVREG_TXRXCTL_KICK|np->txrxctl_bits, get_hwbase(dev) + NvRegTxRxControl); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3955 |
pci_push(base); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3956 |
/* restart rx engine */ |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3957 |
nv_start_rx(dev); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3958 |
nv_start_tx(dev); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3959 |
netif_start_queue(dev); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3960 |
netif_poll_enable(dev); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3961 |
nv_enable_hw_interrupts(dev, np->irqmask); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3962 |
} |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3963 |
} |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3964 |
} |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3965 |
|
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3966 |
static void nv_get_strings(struct net_device *dev, u32 stringset, u8 *buffer) |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3967 |
{ |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3968 |
switch (stringset) { |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3969 |
case ETH_SS_STATS: |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3970 |
memcpy(buffer, &nv_estats_str, nv_get_stats_count(dev)*sizeof(struct nv_ethtool_str)); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3971 |
break; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3972 |
case ETH_SS_TEST: |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3973 |
memcpy(buffer, &nv_etests_str, nv_self_test_count(dev)*sizeof(struct nv_ethtool_str)); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3974 |
break; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3975 |
} |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3976 |
} |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3977 |
|
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3978 |
static const struct ethtool_ops ops = { |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3979 |
.get_drvinfo = nv_get_drvinfo, |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3980 |
.get_link = ethtool_op_get_link, |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3981 |
.get_wol = nv_get_wol, |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3982 |
.set_wol = nv_set_wol, |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3983 |
.get_settings = nv_get_settings, |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3984 |
.set_settings = nv_set_settings, |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3985 |
.get_regs_len = nv_get_regs_len, |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3986 |
.get_regs = nv_get_regs, |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3987 |
.nway_reset = nv_nway_reset, |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3988 |
.get_perm_addr = ethtool_op_get_perm_addr, |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3989 |
.get_tso = ethtool_op_get_tso, |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3990 |
.set_tso = nv_set_tso, |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3991 |
.get_ringparam = nv_get_ringparam, |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3992 |
.set_ringparam = nv_set_ringparam, |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3993 |
.get_pauseparam = nv_get_pauseparam, |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3994 |
.set_pauseparam = nv_set_pauseparam, |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3995 |
.get_rx_csum = nv_get_rx_csum, |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3996 |
.set_rx_csum = nv_set_rx_csum, |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3997 |
.get_tx_csum = ethtool_op_get_tx_csum, |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3998 |
.set_tx_csum = nv_set_tx_csum, |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3999 |
.get_sg = ethtool_op_get_sg, |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4000 |
.set_sg = nv_set_sg, |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4001 |
.get_strings = nv_get_strings, |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4002 |
.get_stats_count = nv_get_stats_count, |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4003 |
.get_ethtool_stats = nv_get_ethtool_stats, |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4004 |
.self_test_count = nv_self_test_count, |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4005 |
.self_test = nv_self_test, |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4006 |
}; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4007 |
|
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4008 |
static void nv_vlan_rx_register(struct net_device *dev, struct vlan_group *grp) |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4009 |
{ |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4010 |
struct fe_priv *np = get_nvpriv(dev); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4011 |
|
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4012 |
spin_lock_irq(&np->lock); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4013 |
|
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4014 |
/* save vlan group */ |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4015 |
np->vlangrp = grp; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4016 |
|
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4017 |
if (grp) { |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4018 |
/* enable vlan on MAC */ |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4019 |
np->txrxctl_bits |= NVREG_TXRXCTL_VLANSTRIP | NVREG_TXRXCTL_VLANINS; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4020 |
} else { |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4021 |
/* disable vlan on MAC */ |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4022 |
np->txrxctl_bits &= ~NVREG_TXRXCTL_VLANSTRIP; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4023 |
np->txrxctl_bits &= ~NVREG_TXRXCTL_VLANINS; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4024 |
} |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4025 |
|
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4026 |
writel(np->txrxctl_bits, get_hwbase(dev) + NvRegTxRxControl); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4027 |
|
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4028 |
spin_unlock_irq(&np->lock); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4029 |
}; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4030 |
|
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4031 |
static void nv_vlan_rx_kill_vid(struct net_device *dev, unsigned short vid) |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4032 |
{ |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4033 |
/* nothing to do */ |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4034 |
}; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4035 |
|
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4036 |
static int nv_open(struct net_device *dev) |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4037 |
{ |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4038 |
struct fe_priv *np = netdev_priv(dev); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4039 |
u8 __iomem *base = get_hwbase(dev); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4040 |
int ret = 1; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4041 |
int oom, i; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4042 |
|
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4043 |
dprintk(KERN_DEBUG "nv_open: begin\n"); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4044 |
|
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4045 |
/* erase previous misconfiguration */ |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4046 |
if (np->driver_data & DEV_HAS_POWER_CNTRL) |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4047 |
nv_mac_reset(dev); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4048 |
writel(NVREG_MCASTADDRA_FORCE, base + NvRegMulticastAddrA); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4049 |
writel(0, base + NvRegMulticastAddrB); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4050 |
writel(0, base + NvRegMulticastMaskA); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4051 |
writel(0, base + NvRegMulticastMaskB); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4052 |
writel(0, base + NvRegPacketFilterFlags); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4053 |
|
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4054 |
writel(0, base + NvRegTransmitterControl); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4055 |
writel(0, base + NvRegReceiverControl); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4056 |
|
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4057 |
writel(0, base + NvRegAdapterControl); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4058 |
|
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4059 |
if (np->pause_flags & NV_PAUSEFRAME_TX_CAPABLE) |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4060 |
writel(NVREG_TX_PAUSEFRAME_DISABLE, base + NvRegTxPauseFrame); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4061 |
|
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4062 |
/* initialize descriptor rings */ |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4063 |
set_bufsize(dev); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4064 |
oom = nv_init_ring(dev); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4065 |
|
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4066 |
writel(0, base + NvRegLinkSpeed); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4067 |
writel(readl(base + NvRegTransmitPoll) & NVREG_TRANSMITPOLL_MAC_ADDR_REV, base + NvRegTransmitPoll); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4068 |
nv_txrx_reset(dev); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4069 |
writel(0, base + NvRegUnknownSetupReg6); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4070 |
|
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4071 |
np->in_shutdown = 0; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4072 |
|
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4073 |
/* give hw rings */ |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4074 |
setup_hw_rings(dev, NV_SETUP_RX_RING | NV_SETUP_TX_RING); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4075 |
writel( ((np->rx_ring_size-1) << NVREG_RINGSZ_RXSHIFT) + ((np->tx_ring_size-1) << NVREG_RINGSZ_TXSHIFT), |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4076 |
base + NvRegRingSizes); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4077 |
|
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4078 |
writel(np->linkspeed, base + NvRegLinkSpeed); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4079 |
if (np->desc_ver == DESC_VER_1) |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4080 |
writel(NVREG_TX_WM_DESC1_DEFAULT, base + NvRegTxWatermark); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4081 |
else |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4082 |
writel(NVREG_TX_WM_DESC2_3_DEFAULT, base + NvRegTxWatermark); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4083 |
writel(np->txrxctl_bits, base + NvRegTxRxControl); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4084 |
writel(np->vlanctl_bits, base + NvRegVlanControl); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4085 |
pci_push(base); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4086 |
writel(NVREG_TXRXCTL_BIT1|np->txrxctl_bits, base + NvRegTxRxControl); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4087 |
reg_delay(dev, NvRegUnknownSetupReg5, NVREG_UNKSETUP5_BIT31, NVREG_UNKSETUP5_BIT31, |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4088 |
NV_SETUP5_DELAY, NV_SETUP5_DELAYMAX, |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4089 |
KERN_INFO "open: SetupReg5, Bit 31 remained off\n"); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4090 |
|
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4091 |
writel(0, base + NvRegUnknownSetupReg4); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4092 |
writel(NVREG_IRQSTAT_MASK, base + NvRegIrqStatus); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4093 |
writel(NVREG_MIISTAT_MASK2, base + NvRegMIIStatus); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4094 |
|
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4095 |
writel(NVREG_MISC1_FORCE | NVREG_MISC1_HD, base + NvRegMisc1); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4096 |
writel(readl(base + NvRegTransmitterStatus), base + NvRegTransmitterStatus); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4097 |
writel(NVREG_PFF_ALWAYS, base + NvRegPacketFilterFlags); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4098 |
writel(np->rx_buf_sz, base + NvRegOffloadConfig); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4099 |
|
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4100 |
writel(readl(base + NvRegReceiverStatus), base + NvRegReceiverStatus); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4101 |
get_random_bytes(&i, sizeof(i)); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4102 |
writel(NVREG_RNDSEED_FORCE | (i&NVREG_RNDSEED_MASK), base + NvRegRandomSeed); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4103 |
writel(NVREG_TX_DEFERRAL_DEFAULT, base + NvRegTxDeferral); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4104 |
writel(NVREG_RX_DEFERRAL_DEFAULT, base + NvRegRxDeferral); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4105 |
if (poll_interval == -1) { |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4106 |
if (optimization_mode == NV_OPTIMIZATION_MODE_THROUGHPUT) |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4107 |
writel(NVREG_POLL_DEFAULT_THROUGHPUT, base + NvRegPollingInterval); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4108 |
else |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4109 |
writel(NVREG_POLL_DEFAULT_CPU, base + NvRegPollingInterval); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4110 |
} |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4111 |
else |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4112 |
writel(poll_interval & 0xFFFF, base + NvRegPollingInterval); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4113 |
writel(NVREG_UNKSETUP6_VAL, base + NvRegUnknownSetupReg6); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4114 |
writel((np->phyaddr << NVREG_ADAPTCTL_PHYSHIFT)|NVREG_ADAPTCTL_PHYVALID|NVREG_ADAPTCTL_RUNNING, |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4115 |
base + NvRegAdapterControl); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4116 |
writel(NVREG_MIISPEED_BIT8|NVREG_MIIDELAY, base + NvRegMIISpeed); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4117 |
writel(NVREG_UNKSETUP4_VAL, base + NvRegUnknownSetupReg4); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4118 |
if (np->wolenabled) |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4119 |
writel(NVREG_WAKEUPFLAGS_ENABLE , base + NvRegWakeUpFlags); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4120 |
|
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4121 |
i = readl(base + NvRegPowerState); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4122 |
if ( (i & NVREG_POWERSTATE_POWEREDUP) == 0) |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4123 |
writel(NVREG_POWERSTATE_POWEREDUP|i, base + NvRegPowerState); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4124 |
|
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4125 |
pci_push(base); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4126 |
udelay(10); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4127 |
writel(readl(base + NvRegPowerState) | NVREG_POWERSTATE_VALID, base + NvRegPowerState); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4128 |
|
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4129 |
nv_disable_hw_interrupts(dev, np->irqmask); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4130 |
pci_push(base); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4131 |
writel(NVREG_MIISTAT_MASK2, base + NvRegMIIStatus); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4132 |
writel(NVREG_IRQSTAT_MASK, base + NvRegIrqStatus); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4133 |
pci_push(base); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4134 |
|
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4135 |
if (nv_request_irq(dev, 0)) { |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4136 |
goto out_drain; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4137 |
} |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4138 |
|
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4139 |
/* ask for interrupts */ |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4140 |
nv_enable_hw_interrupts(dev, np->irqmask); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4141 |
|
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4142 |
spin_lock_irq(&np->lock); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4143 |
writel(NVREG_MCASTADDRA_FORCE, base + NvRegMulticastAddrA); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4144 |
writel(0, base + NvRegMulticastAddrB); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4145 |
writel(0, base + NvRegMulticastMaskA); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4146 |
writel(0, base + NvRegMulticastMaskB); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4147 |
writel(NVREG_PFF_ALWAYS|NVREG_PFF_MYADDR, base + NvRegPacketFilterFlags); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4148 |
/* One manual link speed update: Interrupts are enabled, future link |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4149 |
* speed changes cause interrupts and are handled by nv_link_irq(). |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4150 |
*/ |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4151 |
{ |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4152 |
u32 miistat; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4153 |
miistat = readl(base + NvRegMIIStatus); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4154 |
writel(NVREG_MIISTAT_MASK, base + NvRegMIIStatus); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4155 |
dprintk(KERN_INFO "startup: got 0x%08x.\n", miistat); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4156 |
} |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4157 |
/* set linkspeed to invalid value, thus force nv_update_linkspeed |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4158 |
* to init hw */ |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4159 |
np->linkspeed = 0; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4160 |
ret = nv_update_linkspeed(dev); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4161 |
nv_start_rx(dev); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4162 |
nv_start_tx(dev); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4163 |
netif_start_queue(dev); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4164 |
netif_poll_enable(dev); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4165 |
|
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4166 |
if (ret) { |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4167 |
netif_carrier_on(dev); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4168 |
} else { |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4169 |
printk("%s: no link during initialization.\n", dev->name); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4170 |
netif_carrier_off(dev); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4171 |
} |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4172 |
if (oom) |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4173 |
mod_timer(&np->oom_kick, jiffies + OOM_REFILL); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4174 |
|
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4175 |
/* start statistics timer */ |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4176 |
if (np->driver_data & DEV_HAS_STATISTICS) |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4177 |
mod_timer(&np->stats_poll, jiffies + STATS_INTERVAL); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4178 |
|
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4179 |
spin_unlock_irq(&np->lock); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4180 |
|
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4181 |
return 0; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4182 |
out_drain: |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4183 |
drain_ring(dev); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4184 |
return ret; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4185 |
} |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4186 |
|
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4187 |
static int nv_close(struct net_device *dev) |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4188 |
{ |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4189 |
struct fe_priv *np = netdev_priv(dev); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4190 |
u8 __iomem *base; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4191 |
|
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4192 |
spin_lock_irq(&np->lock); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4193 |
np->in_shutdown = 1; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4194 |
spin_unlock_irq(&np->lock); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4195 |
netif_poll_disable(dev); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4196 |
synchronize_irq(dev->irq); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4197 |
|
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4198 |
del_timer_sync(&np->oom_kick); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4199 |
del_timer_sync(&np->nic_poll); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4200 |
del_timer_sync(&np->stats_poll); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4201 |
|
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4202 |
netif_stop_queue(dev); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4203 |
spin_lock_irq(&np->lock); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4204 |
nv_stop_tx(dev); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4205 |
nv_stop_rx(dev); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4206 |
nv_txrx_reset(dev); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4207 |
|
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4208 |
/* disable interrupts on the nic or we will lock up */ |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4209 |
base = get_hwbase(dev); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4210 |
nv_disable_hw_interrupts(dev, np->irqmask); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4211 |
pci_push(base); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4212 |
dprintk(KERN_INFO "%s: Irqmask is zero again\n", dev->name); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4213 |
|
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4214 |
spin_unlock_irq(&np->lock); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4215 |
|
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4216 |
nv_free_irq(dev); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4217 |
|
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4218 |
drain_ring(dev); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4219 |
|
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4220 |
if (np->wolenabled) |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4221 |
nv_start_rx(dev); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4222 |
|
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4223 |
/* FIXME: power down nic */ |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4224 |
|
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4225 |
return 0; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4226 |
} |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4227 |
|
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4228 |
static int __devinit nv_probe(struct pci_dev *pci_dev, const struct pci_device_id *id) |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4229 |
{ |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4230 |
struct net_device *dev; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4231 |
struct fe_priv *np; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4232 |
unsigned long addr; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4233 |
u8 __iomem *base; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4234 |
int err, i; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4235 |
u32 powerstate, txreg; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4236 |
|
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4237 |
dev = alloc_etherdev(sizeof(struct fe_priv)); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4238 |
err = -ENOMEM; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4239 |
if (!dev) |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4240 |
goto out; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4241 |
|
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4242 |
np = netdev_priv(dev); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4243 |
np->pci_dev = pci_dev; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4244 |
spin_lock_init(&np->lock); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4245 |
SET_MODULE_OWNER(dev); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4246 |
SET_NETDEV_DEV(dev, &pci_dev->dev); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4247 |
|
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4248 |
init_timer(&np->oom_kick); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4249 |
np->oom_kick.data = (unsigned long) dev; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4250 |
np->oom_kick.function = &nv_do_rx_refill; /* timer handler */ |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4251 |
init_timer(&np->nic_poll); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4252 |
np->nic_poll.data = (unsigned long) dev; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4253 |
np->nic_poll.function = &nv_do_nic_poll; /* timer handler */ |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4254 |
init_timer(&np->stats_poll); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4255 |
np->stats_poll.data = (unsigned long) dev; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4256 |
np->stats_poll.function = &nv_do_stats_poll; /* timer handler */ |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4257 |
|
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4258 |
err = pci_enable_device(pci_dev); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4259 |
if (err) { |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4260 |
printk(KERN_INFO "forcedeth: pci_enable_dev failed (%d) for device %s\n", |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4261 |
err, pci_name(pci_dev)); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4262 |
goto out_free; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4263 |
} |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4264 |
|
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4265 |
pci_set_master(pci_dev); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4266 |
|
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4267 |
err = pci_request_regions(pci_dev, DRV_NAME); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4268 |
if (err < 0) |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4269 |
goto out_disable; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4270 |
|
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4271 |
if (id->driver_data & (DEV_HAS_VLAN|DEV_HAS_MSI_X|DEV_HAS_POWER_CNTRL|DEV_HAS_STATISTICS)) |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4272 |
np->register_size = NV_PCI_REGSZ_VER2; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4273 |
else |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4274 |
np->register_size = NV_PCI_REGSZ_VER1; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4275 |
|
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4276 |
err = -EINVAL; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4277 |
addr = 0; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4278 |
for (i = 0; i < DEVICE_COUNT_RESOURCE; i++) { |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4279 |
dprintk(KERN_DEBUG "%s: resource %d start %p len %ld flags 0x%08lx.\n", |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4280 |
pci_name(pci_dev), i, (void*)pci_resource_start(pci_dev, i), |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4281 |
pci_resource_len(pci_dev, i), |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4282 |
pci_resource_flags(pci_dev, i)); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4283 |
if (pci_resource_flags(pci_dev, i) & IORESOURCE_MEM && |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4284 |
pci_resource_len(pci_dev, i) >= np->register_size) { |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4285 |
addr = pci_resource_start(pci_dev, i); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4286 |
break; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4287 |
} |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4288 |
} |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4289 |
if (i == DEVICE_COUNT_RESOURCE) { |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4290 |
printk(KERN_INFO "forcedeth: Couldn't find register window for device %s.\n", |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4291 |
pci_name(pci_dev)); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4292 |
goto out_relreg; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4293 |
} |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4294 |
|
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4295 |
/* copy of driver data */ |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4296 |
np->driver_data = id->driver_data; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4297 |
|
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4298 |
/* handle different descriptor versions */ |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4299 |
if (id->driver_data & DEV_HAS_HIGH_DMA) { |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4300 |
/* packet format 3: supports 40-bit addressing */ |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4301 |
np->desc_ver = DESC_VER_3; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4302 |
np->txrxctl_bits = NVREG_TXRXCTL_DESC_3; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4303 |
if (dma_64bit) { |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4304 |
if (pci_set_dma_mask(pci_dev, DMA_39BIT_MASK)) { |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4305 |
printk(KERN_INFO "forcedeth: 64-bit DMA failed, using 32-bit addressing for device %s.\n", |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4306 |
pci_name(pci_dev)); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4307 |
} else { |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4308 |
dev->features |= NETIF_F_HIGHDMA; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4309 |
printk(KERN_INFO "forcedeth: using HIGHDMA\n"); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4310 |
} |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4311 |
if (pci_set_consistent_dma_mask(pci_dev, DMA_39BIT_MASK)) { |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4312 |
printk(KERN_INFO "forcedeth: 64-bit DMA (consistent) failed, using 32-bit ring buffers for device %s.\n", |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4313 |
pci_name(pci_dev)); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4314 |
} |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4315 |
} |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4316 |
} else if (id->driver_data & DEV_HAS_LARGEDESC) { |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4317 |
/* packet format 2: supports jumbo frames */ |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4318 |
np->desc_ver = DESC_VER_2; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4319 |
np->txrxctl_bits = NVREG_TXRXCTL_DESC_2; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4320 |
} else { |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4321 |
/* original packet format */ |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4322 |
np->desc_ver = DESC_VER_1; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4323 |
np->txrxctl_bits = NVREG_TXRXCTL_DESC_1; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4324 |
} |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4325 |
|
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4326 |
np->pkt_limit = NV_PKTLIMIT_1; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4327 |
if (id->driver_data & DEV_HAS_LARGEDESC) |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4328 |
np->pkt_limit = NV_PKTLIMIT_2; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4329 |
|
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4330 |
if (id->driver_data & DEV_HAS_CHECKSUM) { |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4331 |
np->rx_csum = 1; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4332 |
np->txrxctl_bits |= NVREG_TXRXCTL_RXCHECK; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4333 |
dev->features |= NETIF_F_HW_CSUM | NETIF_F_SG; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4334 |
#ifdef NETIF_F_TSO |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4335 |
dev->features |= NETIF_F_TSO; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4336 |
#endif |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4337 |
} |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4338 |
|
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4339 |
np->vlanctl_bits = 0; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4340 |
if (id->driver_data & DEV_HAS_VLAN) { |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4341 |
np->vlanctl_bits = NVREG_VLANCONTROL_ENABLE; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4342 |
dev->features |= NETIF_F_HW_VLAN_RX | NETIF_F_HW_VLAN_TX; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4343 |
dev->vlan_rx_register = nv_vlan_rx_register; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4344 |
dev->vlan_rx_kill_vid = nv_vlan_rx_kill_vid; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4345 |
} |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4346 |
|
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4347 |
np->msi_flags = 0; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4348 |
if ((id->driver_data & DEV_HAS_MSI) && msi) { |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4349 |
np->msi_flags |= NV_MSI_CAPABLE; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4350 |
} |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4351 |
if ((id->driver_data & DEV_HAS_MSI_X) && msix) { |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4352 |
np->msi_flags |= NV_MSI_X_CAPABLE; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4353 |
} |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4354 |
|
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4355 |
np->pause_flags = NV_PAUSEFRAME_RX_CAPABLE | NV_PAUSEFRAME_RX_REQ | NV_PAUSEFRAME_AUTONEG; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4356 |
if (id->driver_data & DEV_HAS_PAUSEFRAME_TX) { |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4357 |
np->pause_flags |= NV_PAUSEFRAME_TX_CAPABLE | NV_PAUSEFRAME_TX_REQ; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4358 |
} |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4359 |
|
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4360 |
|
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4361 |
err = -ENOMEM; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4362 |
np->base = ioremap(addr, np->register_size); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4363 |
if (!np->base) |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4364 |
goto out_relreg; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4365 |
dev->base_addr = (unsigned long)np->base; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4366 |
|
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4367 |
dev->irq = pci_dev->irq; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4368 |
|
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4369 |
np->rx_ring_size = RX_RING_DEFAULT; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4370 |
np->tx_ring_size = TX_RING_DEFAULT; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4371 |
np->tx_limit_stop = np->tx_ring_size - TX_LIMIT_DIFFERENCE; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4372 |
np->tx_limit_start = np->tx_ring_size - TX_LIMIT_DIFFERENCE - 1; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4373 |
|
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4374 |
if (np->desc_ver == DESC_VER_1 || np->desc_ver == DESC_VER_2) { |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4375 |
np->rx_ring.orig = pci_alloc_consistent(pci_dev, |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4376 |
sizeof(struct ring_desc) * (np->rx_ring_size + np->tx_ring_size), |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4377 |
&np->ring_addr); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4378 |
if (!np->rx_ring.orig) |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4379 |
goto out_unmap; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4380 |
np->tx_ring.orig = &np->rx_ring.orig[np->rx_ring_size]; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4381 |
} else { |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4382 |
np->rx_ring.ex = pci_alloc_consistent(pci_dev, |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4383 |
sizeof(struct ring_desc_ex) * (np->rx_ring_size + np->tx_ring_size), |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4384 |
&np->ring_addr); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4385 |
if (!np->rx_ring.ex) |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4386 |
goto out_unmap; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4387 |
np->tx_ring.ex = &np->rx_ring.ex[np->rx_ring_size]; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4388 |
} |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4389 |
np->rx_skbuff = kmalloc(sizeof(struct sk_buff*) * np->rx_ring_size, GFP_KERNEL); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4390 |
np->rx_dma = kmalloc(sizeof(dma_addr_t) * np->rx_ring_size, GFP_KERNEL); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4391 |
np->tx_skbuff = kmalloc(sizeof(struct sk_buff*) * np->tx_ring_size, GFP_KERNEL); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4392 |
np->tx_dma = kmalloc(sizeof(dma_addr_t) * np->tx_ring_size, GFP_KERNEL); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4393 |
np->tx_dma_len = kmalloc(sizeof(unsigned int) * np->tx_ring_size, GFP_KERNEL); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4394 |
if (!np->rx_skbuff || !np->rx_dma || !np->tx_skbuff || !np->tx_dma || !np->tx_dma_len) |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4395 |
goto out_freering; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4396 |
memset(np->rx_skbuff, 0, sizeof(struct sk_buff*) * np->rx_ring_size); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4397 |
memset(np->rx_dma, 0, sizeof(dma_addr_t) * np->rx_ring_size); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4398 |
memset(np->tx_skbuff, 0, sizeof(struct sk_buff*) * np->tx_ring_size); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4399 |
memset(np->tx_dma, 0, sizeof(dma_addr_t) * np->tx_ring_size); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4400 |
memset(np->tx_dma_len, 0, sizeof(unsigned int) * np->tx_ring_size); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4401 |
|
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4402 |
dev->open = nv_open; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4403 |
dev->stop = nv_close; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4404 |
dev->hard_start_xmit = nv_start_xmit; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4405 |
dev->get_stats = nv_get_stats; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4406 |
dev->change_mtu = nv_change_mtu; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4407 |
dev->set_mac_address = nv_set_mac_address; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4408 |
dev->set_multicast_list = nv_set_multicast; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4409 |
#ifdef CONFIG_NET_POLL_CONTROLLER |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4410 |
dev->poll_controller = nv_poll_controller; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4411 |
#endif |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4412 |
dev->weight = 64; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4413 |
#ifdef CONFIG_FORCEDETH_NAPI |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4414 |
dev->poll = nv_napi_poll; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4415 |
#endif |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4416 |
SET_ETHTOOL_OPS(dev, &ops); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4417 |
dev->tx_timeout = nv_tx_timeout; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4418 |
dev->watchdog_timeo = NV_WATCHDOG_TIMEO; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4419 |
|
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4420 |
pci_set_drvdata(pci_dev, dev); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4421 |
|
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4422 |
/* read the mac address */ |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4423 |
base = get_hwbase(dev); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4424 |
np->orig_mac[0] = readl(base + NvRegMacAddrA); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4425 |
np->orig_mac[1] = readl(base + NvRegMacAddrB); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4426 |
|
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4427 |
/* check the workaround bit for correct mac address order */ |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4428 |
txreg = readl(base + NvRegTransmitPoll); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4429 |
if (txreg & NVREG_TRANSMITPOLL_MAC_ADDR_REV) { |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4430 |
/* mac address is already in correct order */ |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4431 |
dev->dev_addr[0] = (np->orig_mac[0] >> 0) & 0xff; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4432 |
dev->dev_addr[1] = (np->orig_mac[0] >> 8) & 0xff; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4433 |
dev->dev_addr[2] = (np->orig_mac[0] >> 16) & 0xff; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4434 |
dev->dev_addr[3] = (np->orig_mac[0] >> 24) & 0xff; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4435 |
dev->dev_addr[4] = (np->orig_mac[1] >> 0) & 0xff; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4436 |
dev->dev_addr[5] = (np->orig_mac[1] >> 8) & 0xff; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4437 |
} else { |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4438 |
/* need to reverse mac address to correct order */ |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4439 |
dev->dev_addr[0] = (np->orig_mac[1] >> 8) & 0xff; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4440 |
dev->dev_addr[1] = (np->orig_mac[1] >> 0) & 0xff; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4441 |
dev->dev_addr[2] = (np->orig_mac[0] >> 24) & 0xff; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4442 |
dev->dev_addr[3] = (np->orig_mac[0] >> 16) & 0xff; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4443 |
dev->dev_addr[4] = (np->orig_mac[0] >> 8) & 0xff; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4444 |
dev->dev_addr[5] = (np->orig_mac[0] >> 0) & 0xff; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4445 |
/* set permanent address to be correct aswell */ |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4446 |
np->orig_mac[0] = (dev->dev_addr[0] << 0) + (dev->dev_addr[1] << 8) + |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4447 |
(dev->dev_addr[2] << 16) + (dev->dev_addr[3] << 24); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4448 |
np->orig_mac[1] = (dev->dev_addr[4] << 0) + (dev->dev_addr[5] << 8); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4449 |
writel(txreg|NVREG_TRANSMITPOLL_MAC_ADDR_REV, base + NvRegTransmitPoll); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4450 |
} |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4451 |
memcpy(dev->perm_addr, dev->dev_addr, dev->addr_len); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4452 |
|
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4453 |
if (!is_valid_ether_addr(dev->perm_addr)) { |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4454 |
/* |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4455 |
* Bad mac address. At least one bios sets the mac address |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4456 |
* to 01:23:45:67:89:ab |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4457 |
*/ |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4458 |
printk(KERN_ERR "%s: Invalid Mac address detected: %02x:%02x:%02x:%02x:%02x:%02x\n", |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4459 |
pci_name(pci_dev), |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4460 |
dev->dev_addr[0], dev->dev_addr[1], dev->dev_addr[2], |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4461 |
dev->dev_addr[3], dev->dev_addr[4], dev->dev_addr[5]); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4462 |
printk(KERN_ERR "Please complain to your hardware vendor. Switching to a random MAC.\n"); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4463 |
dev->dev_addr[0] = 0x00; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4464 |
dev->dev_addr[1] = 0x00; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4465 |
dev->dev_addr[2] = 0x6c; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4466 |
get_random_bytes(&dev->dev_addr[3], 3); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4467 |
} |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4468 |
|
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4469 |
dprintk(KERN_DEBUG "%s: MAC Address %02x:%02x:%02x:%02x:%02x:%02x\n", pci_name(pci_dev), |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4470 |
dev->dev_addr[0], dev->dev_addr[1], dev->dev_addr[2], |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4471 |
dev->dev_addr[3], dev->dev_addr[4], dev->dev_addr[5]); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4472 |
|
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4473 |
/* set mac address */ |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4474 |
nv_copy_mac_to_hw(dev); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4475 |
|
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4476 |
/* disable WOL */ |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4477 |
writel(0, base + NvRegWakeUpFlags); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4478 |
np->wolenabled = 0; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4479 |
|
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4480 |
if (id->driver_data & DEV_HAS_POWER_CNTRL) { |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4481 |
u8 revision_id; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4482 |
pci_read_config_byte(pci_dev, PCI_REVISION_ID, &revision_id); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4483 |
|
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4484 |
/* take phy and nic out of low power mode */ |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4485 |
powerstate = readl(base + NvRegPowerState2); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4486 |
powerstate &= ~NVREG_POWERSTATE2_POWERUP_MASK; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4487 |
if ((id->device == PCI_DEVICE_ID_NVIDIA_NVENET_12 || |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4488 |
id->device == PCI_DEVICE_ID_NVIDIA_NVENET_13) && |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4489 |
revision_id >= 0xA3) |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4490 |
powerstate |= NVREG_POWERSTATE2_POWERUP_REV_A3; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4491 |
writel(powerstate, base + NvRegPowerState2); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4492 |
} |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4493 |
|
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4494 |
if (np->desc_ver == DESC_VER_1) { |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4495 |
np->tx_flags = NV_TX_VALID; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4496 |
} else { |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4497 |
np->tx_flags = NV_TX2_VALID; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4498 |
} |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4499 |
if (optimization_mode == NV_OPTIMIZATION_MODE_THROUGHPUT) { |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4500 |
np->irqmask = NVREG_IRQMASK_THROUGHPUT; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4501 |
if (np->msi_flags & NV_MSI_X_CAPABLE) /* set number of vectors */ |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4502 |
np->msi_flags |= 0x0003; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4503 |
} else { |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4504 |
np->irqmask = NVREG_IRQMASK_CPU; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4505 |
if (np->msi_flags & NV_MSI_X_CAPABLE) /* set number of vectors */ |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4506 |
np->msi_flags |= 0x0001; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4507 |
} |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4508 |
|
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4509 |
if (id->driver_data & DEV_NEED_TIMERIRQ) |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4510 |
np->irqmask |= NVREG_IRQ_TIMER; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4511 |
if (id->driver_data & DEV_NEED_LINKTIMER) { |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4512 |
dprintk(KERN_INFO "%s: link timer on.\n", pci_name(pci_dev)); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4513 |
np->need_linktimer = 1; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4514 |
np->link_timeout = jiffies + LINK_TIMEOUT; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4515 |
} else { |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4516 |
dprintk(KERN_INFO "%s: link timer off.\n", pci_name(pci_dev)); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4517 |
np->need_linktimer = 0; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4518 |
} |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4519 |
|
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4520 |
/* find a suitable phy */ |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4521 |
for (i = 1; i <= 32; i++) { |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4522 |
int id1, id2; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4523 |
int phyaddr = i & 0x1F; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4524 |
|
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4525 |
spin_lock_irq(&np->lock); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4526 |
id1 = mii_rw(dev, phyaddr, MII_PHYSID1, MII_READ); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4527 |
spin_unlock_irq(&np->lock); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4528 |
if (id1 < 0 || id1 == 0xffff) |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4529 |
continue; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4530 |
spin_lock_irq(&np->lock); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4531 |
id2 = mii_rw(dev, phyaddr, MII_PHYSID2, MII_READ); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4532 |
spin_unlock_irq(&np->lock); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4533 |
if (id2 < 0 || id2 == 0xffff) |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4534 |
continue; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4535 |
|
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4536 |
np->phy_model = id2 & PHYID2_MODEL_MASK; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4537 |
id1 = (id1 & PHYID1_OUI_MASK) << PHYID1_OUI_SHFT; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4538 |
id2 = (id2 & PHYID2_OUI_MASK) >> PHYID2_OUI_SHFT; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4539 |
dprintk(KERN_DEBUG "%s: open: Found PHY %04x:%04x at address %d.\n", |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4540 |
pci_name(pci_dev), id1, id2, phyaddr); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4541 |
np->phyaddr = phyaddr; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4542 |
np->phy_oui = id1 | id2; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4543 |
break; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4544 |
} |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4545 |
if (i == 33) { |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4546 |
printk(KERN_INFO "%s: open: Could not find a valid PHY.\n", |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4547 |
pci_name(pci_dev)); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4548 |
goto out_error; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4549 |
} |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4550 |
|
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4551 |
/* reset it */ |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4552 |
phy_init(dev); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4553 |
|
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4554 |
/* set default link speed settings */ |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4555 |
np->linkspeed = NVREG_LINKSPEED_FORCE|NVREG_LINKSPEED_10; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4556 |
np->duplex = 0; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4557 |
np->autoneg = 1; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4558 |
|
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4559 |
err = register_netdev(dev); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4560 |
if (err) { |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4561 |
printk(KERN_INFO "forcedeth: unable to register netdev: %d\n", err); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4562 |
goto out_error; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4563 |
} |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4564 |
printk(KERN_INFO "%s: forcedeth.c: subsystem: %05x:%04x bound to %s\n", |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4565 |
dev->name, pci_dev->subsystem_vendor, pci_dev->subsystem_device, |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4566 |
pci_name(pci_dev)); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4567 |
|
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4568 |
return 0; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4569 |
|
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4570 |
out_error: |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4571 |
pci_set_drvdata(pci_dev, NULL); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4572 |
out_freering: |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4573 |
free_rings(dev); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4574 |
out_unmap: |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4575 |
iounmap(get_hwbase(dev)); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4576 |
out_relreg: |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4577 |
pci_release_regions(pci_dev); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4578 |
out_disable: |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4579 |
pci_disable_device(pci_dev); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4580 |
out_free: |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4581 |
free_netdev(dev); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4582 |
out: |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4583 |
return err; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4584 |
} |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4585 |
|
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4586 |
static void __devexit nv_remove(struct pci_dev *pci_dev) |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4587 |
{ |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4588 |
struct net_device *dev = pci_get_drvdata(pci_dev); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4589 |
struct fe_priv *np = netdev_priv(dev); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4590 |
u8 __iomem *base = get_hwbase(dev); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4591 |
|
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4592 |
unregister_netdev(dev); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4593 |
|
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4594 |
/* special op: write back the misordered MAC address - otherwise |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4595 |
* the next nv_probe would see a wrong address. |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4596 |
*/ |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4597 |
writel(np->orig_mac[0], base + NvRegMacAddrA); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4598 |
writel(np->orig_mac[1], base + NvRegMacAddrB); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4599 |
|
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4600 |
/* free all structures */ |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4601 |
free_rings(dev); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4602 |
iounmap(get_hwbase(dev)); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4603 |
pci_release_regions(pci_dev); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4604 |
pci_disable_device(pci_dev); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4605 |
free_netdev(dev); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4606 |
pci_set_drvdata(pci_dev, NULL); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4607 |
} |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4608 |
|
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4609 |
static struct pci_device_id pci_tbl[] = { |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4610 |
{ /* nForce Ethernet Controller */ |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4611 |
PCI_DEVICE(PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_NVENET_1), |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4612 |
.driver_data = DEV_NEED_TIMERIRQ|DEV_NEED_LINKTIMER, |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4613 |
}, |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4614 |
{ /* nForce2 Ethernet Controller */ |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4615 |
PCI_DEVICE(PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_NVENET_2), |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4616 |
.driver_data = DEV_NEED_TIMERIRQ|DEV_NEED_LINKTIMER, |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4617 |
}, |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4618 |
{ /* nForce3 Ethernet Controller */ |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4619 |
PCI_DEVICE(PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_NVENET_3), |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4620 |
.driver_data = DEV_NEED_TIMERIRQ|DEV_NEED_LINKTIMER, |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4621 |
}, |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4622 |
{ /* nForce3 Ethernet Controller */ |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4623 |
PCI_DEVICE(PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_NVENET_4), |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4624 |
.driver_data = DEV_NEED_TIMERIRQ|DEV_NEED_LINKTIMER|DEV_HAS_LARGEDESC|DEV_HAS_CHECKSUM, |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4625 |
}, |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4626 |
{ /* nForce3 Ethernet Controller */ |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4627 |
PCI_DEVICE(PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_NVENET_5), |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4628 |
.driver_data = DEV_NEED_TIMERIRQ|DEV_NEED_LINKTIMER|DEV_HAS_LARGEDESC|DEV_HAS_CHECKSUM, |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4629 |
}, |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4630 |
{ /* nForce3 Ethernet Controller */ |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4631 |
PCI_DEVICE(PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_NVENET_6), |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4632 |
.driver_data = DEV_NEED_TIMERIRQ|DEV_NEED_LINKTIMER|DEV_HAS_LARGEDESC|DEV_HAS_CHECKSUM, |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4633 |
}, |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4634 |
{ /* nForce3 Ethernet Controller */ |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4635 |
PCI_DEVICE(PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_NVENET_7), |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4636 |
.driver_data = DEV_NEED_TIMERIRQ|DEV_NEED_LINKTIMER|DEV_HAS_LARGEDESC|DEV_HAS_CHECKSUM, |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4637 |
}, |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4638 |
{ /* CK804 Ethernet Controller */ |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4639 |
PCI_DEVICE(PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_NVENET_8), |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4640 |
.driver_data = DEV_NEED_TIMERIRQ|DEV_NEED_LINKTIMER|DEV_HAS_LARGEDESC|DEV_HAS_CHECKSUM|DEV_HAS_HIGH_DMA, |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4641 |
}, |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4642 |
{ /* CK804 Ethernet Controller */ |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4643 |
PCI_DEVICE(PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_NVENET_9), |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4644 |
.driver_data = DEV_NEED_TIMERIRQ|DEV_NEED_LINKTIMER|DEV_HAS_LARGEDESC|DEV_HAS_CHECKSUM|DEV_HAS_HIGH_DMA, |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4645 |
}, |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4646 |
{ /* MCP04 Ethernet Controller */ |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4647 |
PCI_DEVICE(PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_NVENET_10), |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4648 |
.driver_data = DEV_NEED_TIMERIRQ|DEV_NEED_LINKTIMER|DEV_HAS_LARGEDESC|DEV_HAS_CHECKSUM|DEV_HAS_HIGH_DMA, |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4649 |
}, |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4650 |
{ /* MCP04 Ethernet Controller */ |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4651 |
PCI_DEVICE(PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_NVENET_11), |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4652 |
.driver_data = DEV_NEED_TIMERIRQ|DEV_NEED_LINKTIMER|DEV_HAS_LARGEDESC|DEV_HAS_CHECKSUM|DEV_HAS_HIGH_DMA, |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4653 |
}, |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4654 |
{ /* MCP51 Ethernet Controller */ |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4655 |
PCI_DEVICE(PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_NVENET_12), |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4656 |
.driver_data = DEV_NEED_TIMERIRQ|DEV_NEED_LINKTIMER|DEV_HAS_HIGH_DMA|DEV_HAS_POWER_CNTRL, |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4657 |
}, |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4658 |
{ /* MCP51 Ethernet Controller */ |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4659 |
PCI_DEVICE(PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_NVENET_13), |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4660 |
.driver_data = DEV_NEED_TIMERIRQ|DEV_NEED_LINKTIMER|DEV_HAS_HIGH_DMA|DEV_HAS_POWER_CNTRL, |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4661 |
}, |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4662 |
{ /* MCP55 Ethernet Controller */ |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4663 |
PCI_DEVICE(PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_NVENET_14), |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4664 |
.driver_data = DEV_NEED_TIMERIRQ|DEV_NEED_LINKTIMER|DEV_HAS_LARGEDESC|DEV_HAS_CHECKSUM|DEV_HAS_HIGH_DMA|DEV_HAS_VLAN|DEV_HAS_MSI|DEV_HAS_MSI_X|DEV_HAS_POWER_CNTRL|DEV_HAS_PAUSEFRAME_TX|DEV_HAS_STATISTICS|DEV_HAS_TEST_EXTENDED, |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4665 |
}, |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4666 |
{ /* MCP55 Ethernet Controller */ |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4667 |
PCI_DEVICE(PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_NVENET_15), |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4668 |
.driver_data = DEV_NEED_TIMERIRQ|DEV_NEED_LINKTIMER|DEV_HAS_LARGEDESC|DEV_HAS_CHECKSUM|DEV_HAS_HIGH_DMA|DEV_HAS_VLAN|DEV_HAS_MSI|DEV_HAS_MSI_X|DEV_HAS_POWER_CNTRL|DEV_HAS_PAUSEFRAME_TX|DEV_HAS_STATISTICS|DEV_HAS_TEST_EXTENDED, |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4669 |
}, |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4670 |
{ /* MCP61 Ethernet Controller */ |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4671 |
PCI_DEVICE(PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_NVENET_16), |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4672 |
.driver_data = DEV_NEED_TIMERIRQ|DEV_NEED_LINKTIMER|DEV_HAS_HIGH_DMA|DEV_HAS_POWER_CNTRL|DEV_HAS_MSI|DEV_HAS_PAUSEFRAME_TX|DEV_HAS_STATISTICS|DEV_HAS_TEST_EXTENDED, |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4673 |
}, |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4674 |
{ /* MCP61 Ethernet Controller */ |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4675 |
PCI_DEVICE(PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_NVENET_17), |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4676 |
.driver_data = DEV_NEED_TIMERIRQ|DEV_NEED_LINKTIMER|DEV_HAS_HIGH_DMA|DEV_HAS_POWER_CNTRL|DEV_HAS_MSI|DEV_HAS_PAUSEFRAME_TX|DEV_HAS_STATISTICS|DEV_HAS_TEST_EXTENDED, |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4677 |
}, |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4678 |
{ /* MCP61 Ethernet Controller */ |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4679 |
PCI_DEVICE(PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_NVENET_18), |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4680 |
.driver_data = DEV_NEED_TIMERIRQ|DEV_NEED_LINKTIMER|DEV_HAS_HIGH_DMA|DEV_HAS_POWER_CNTRL|DEV_HAS_MSI|DEV_HAS_PAUSEFRAME_TX|DEV_HAS_STATISTICS|DEV_HAS_TEST_EXTENDED, |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4681 |
}, |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4682 |
{ /* MCP61 Ethernet Controller */ |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4683 |
PCI_DEVICE(PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_NVENET_19), |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4684 |
.driver_data = DEV_NEED_TIMERIRQ|DEV_NEED_LINKTIMER|DEV_HAS_HIGH_DMA|DEV_HAS_POWER_CNTRL|DEV_HAS_MSI|DEV_HAS_PAUSEFRAME_TX|DEV_HAS_STATISTICS|DEV_HAS_TEST_EXTENDED, |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4685 |
}, |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4686 |
{ /* MCP65 Ethernet Controller */ |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4687 |
PCI_DEVICE(PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_NVENET_20), |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4688 |
.driver_data = DEV_NEED_TIMERIRQ|DEV_NEED_LINKTIMER|DEV_HAS_LARGEDESC|DEV_HAS_CHECKSUM|DEV_HAS_HIGH_DMA|DEV_HAS_POWER_CNTRL|DEV_HAS_MSI|DEV_HAS_PAUSEFRAME_TX|DEV_HAS_STATISTICS|DEV_HAS_TEST_EXTENDED, |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4689 |
}, |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4690 |
{ /* MCP65 Ethernet Controller */ |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4691 |
PCI_DEVICE(PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_NVENET_21), |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4692 |
.driver_data = DEV_NEED_TIMERIRQ|DEV_NEED_LINKTIMER|DEV_HAS_LARGEDESC|DEV_HAS_CHECKSUM|DEV_HAS_HIGH_DMA|DEV_HAS_POWER_CNTRL|DEV_HAS_MSI|DEV_HAS_PAUSEFRAME_TX|DEV_HAS_STATISTICS|DEV_HAS_TEST_EXTENDED, |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4693 |
}, |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4694 |
{ /* MCP65 Ethernet Controller */ |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4695 |
PCI_DEVICE(PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_NVENET_22), |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4696 |
.driver_data = DEV_NEED_TIMERIRQ|DEV_NEED_LINKTIMER|DEV_HAS_LARGEDESC|DEV_HAS_CHECKSUM|DEV_HAS_HIGH_DMA|DEV_HAS_POWER_CNTRL|DEV_HAS_MSI|DEV_HAS_PAUSEFRAME_TX|DEV_HAS_STATISTICS|DEV_HAS_TEST_EXTENDED, |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4697 |
}, |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4698 |
{ /* MCP65 Ethernet Controller */ |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4699 |
PCI_DEVICE(PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_NVENET_23), |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4700 |
.driver_data = DEV_NEED_TIMERIRQ|DEV_NEED_LINKTIMER|DEV_HAS_LARGEDESC|DEV_HAS_CHECKSUM|DEV_HAS_HIGH_DMA|DEV_HAS_POWER_CNTRL|DEV_HAS_MSI|DEV_HAS_PAUSEFRAME_TX|DEV_HAS_STATISTICS|DEV_HAS_TEST_EXTENDED, |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4701 |
}, |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4702 |
{0,}, |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4703 |
}; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4704 |
|
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4705 |
static struct pci_driver driver = { |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4706 |
.name = "forcedeth", |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4707 |
.id_table = pci_tbl, |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4708 |
.probe = nv_probe, |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4709 |
.remove = __devexit_p(nv_remove), |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4710 |
}; |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4711 |
|
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4712 |
|
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4713 |
static int __init init_nic(void) |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4714 |
{ |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4715 |
printk(KERN_INFO "forcedeth.c: Reverse Engineered nForce ethernet driver. Version %s.\n", FORCEDETH_VERSION); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4716 |
return pci_register_driver(&driver); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4717 |
} |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4718 |
|
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4719 |
static void __exit exit_nic(void) |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4720 |
{ |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4721 |
pci_unregister_driver(&driver); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4722 |
} |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4723 |
|
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4724 |
module_param(max_interrupt_work, int, 0); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4725 |
MODULE_PARM_DESC(max_interrupt_work, "forcedeth maximum events handled per interrupt"); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4726 |
module_param(optimization_mode, int, 0); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4727 |
MODULE_PARM_DESC(optimization_mode, "In throughput mode (0), every tx & rx packet will generate an interrupt. In CPU mode (1), interrupts are controlled by a timer."); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4728 |
module_param(poll_interval, int, 0); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4729 |
MODULE_PARM_DESC(poll_interval, "Interval determines how frequent timer interrupt is generated by [(time_in_micro_secs * 100) / (2^10)]. Min is 0 and Max is 65535."); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4730 |
module_param(msi, int, 0); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4731 |
MODULE_PARM_DESC(msi, "MSI interrupts are enabled by setting to 1 and disabled by setting to 0."); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4732 |
module_param(msix, int, 0); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4733 |
MODULE_PARM_DESC(msix, "MSIX interrupts are enabled by setting to 1 and disabled by setting to 0."); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4734 |
module_param(dma_64bit, int, 0); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4735 |
MODULE_PARM_DESC(dma_64bit, "High DMA is enabled by setting to 1 and disabled by setting to 0."); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4736 |
|
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4737 |
MODULE_AUTHOR("Manfred Spraul <manfred@colorfullife.com>"); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4738 |
MODULE_DESCRIPTION("Reverse Engineered nForce ethernet driver"); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4739 |
MODULE_LICENSE("GPL"); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4740 |
|
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4741 |
MODULE_DEVICE_TABLE(pci, pci_tbl); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4742 |
|
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4743 |
module_init(init_nic); |
172d42146930
Added testing version for forcedeth for 2.6.19 kernel.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4744 |
module_exit(exit_nic); |