author | Florian Pose <fp@igh-essen.com> |
Mon, 30 Jul 2007 11:41:37 +0000 | |
changeset 672 | 271d6033314f |
parent 670 | f57de4585a5f |
child 1011 | a0759d0dded4 |
permissions | -rw-r--r-- |
581
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1 |
/* |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2 |
* forcedeth: Ethernet driver for NVIDIA nForce media access controllers. |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3 |
* |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4 |
* Note: This driver is a cleanroom reimplementation based on reverse |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5 |
* engineered documentation written by Carl-Daniel Hailfinger |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6 |
* and Andrew de Quincey. It's neither supported nor endorsed |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7 |
* by NVIDIA Corp. Use at your own risk. |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8 |
* |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
9 |
* NVIDIA, nForce and other NVIDIA marks are trademarks or registered |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
10 |
* trademarks of NVIDIA Corporation in the United States and other |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
11 |
* countries. |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
12 |
* |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
13 |
* Copyright (C) 2003,4,5 Manfred Spraul |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
14 |
* Copyright (C) 2004 Andrew de Quincey (wol support) |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
15 |
* Copyright (C) 2004 Carl-Daniel Hailfinger (invalid MAC handling, insane |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
16 |
* IRQ rate fixes, bigendian fixes, cleanups, verification) |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
17 |
* Copyright (c) 2004 NVIDIA Corporation |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
18 |
* |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
19 |
* This program is free software; you can redistribute it and/or modify |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
20 |
* it under the terms of the GNU General Public License as published by |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
21 |
* the Free Software Foundation; either version 2 of the License, or |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
22 |
* (at your option) any later version. |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
23 |
* |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
24 |
* This program is distributed in the hope that it will be useful, |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
25 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
26 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
27 |
* GNU General Public License for more details. |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
28 |
* |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
29 |
* You should have received a copy of the GNU General Public License |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
30 |
* along with this program; if not, write to the Free Software |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
31 |
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
32 |
* |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
33 |
* Changelog: |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
34 |
* 0.01: 05 Oct 2003: First release that compiles without warnings. |
99623f8a8493
Added testing version of forcedeth driver.
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. |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
36 |
* Check all PCI BARs for the register window. |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
37 |
* udelay added to mii_rw. |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
38 |
* 0.03: 06 Oct 2003: Initialize dev->irq. |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
39 |
* 0.04: 07 Oct 2003: Initialize np->lock, reduce handled irqs, add printks. |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
40 |
* 0.05: 09 Oct 2003: printk removed again, irq status print tx_timeout. |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
41 |
* 0.06: 10 Oct 2003: MAC Address read updated, pff flag generation updated, |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
42 |
* irq mask updated |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
43 |
* 0.07: 14 Oct 2003: Further irq mask updates. |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
44 |
* 0.08: 20 Oct 2003: rx_desc.Length initialization added, nv_alloc_rx refill |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
45 |
* added into irq handler, NULL check for drain_ring. |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
46 |
* 0.09: 20 Oct 2003: Basic link speed irq implementation. Only handle the |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
47 |
* requested interrupt sources. |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
48 |
* 0.10: 20 Oct 2003: First cleanup for release. |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
49 |
* 0.11: 21 Oct 2003: hexdump for tx added, rx buffer sizes increased. |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
50 |
* MAC Address init fix, set_multicast cleanup. |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
51 |
* 0.12: 23 Oct 2003: Cleanups for release. |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
52 |
* 0.13: 25 Oct 2003: Limit for concurrent tx packets increased to 10. |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
53 |
* Set link speed correctly. start rx before starting |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
54 |
* tx (nv_start_rx sets the link speed). |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
55 |
* 0.14: 25 Oct 2003: Nic dependant irq mask. |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
56 |
* 0.15: 08 Nov 2003: fix smp deadlock with set_multicast_list during |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
57 |
* open. |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
58 |
* 0.16: 15 Nov 2003: include file cleanup for ppc64, rx buffer size |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
59 |
* increased to 1628 bytes. |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
60 |
* 0.17: 16 Nov 2003: undo rx buffer size increase. Substract 1 from |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
61 |
* the tx length. |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
62 |
* 0.18: 17 Nov 2003: fix oops due to late initialization of dev_stats |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
63 |
* 0.19: 29 Nov 2003: Handle RxNoBuf, detect & handle invalid mac |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
64 |
* addresses, really stop rx if already running |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
65 |
* in nv_start_rx, clean up a bit. |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
66 |
* 0.20: 07 Dec 2003: alloc fixes |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
67 |
* 0.21: 12 Jan 2004: additional alloc fix, nic polling fix. |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
68 |
* 0.22: 19 Jan 2004: reprogram timer to a sane rate, avoid lockup |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
69 |
* on close. |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
70 |
* 0.23: 26 Jan 2004: various small cleanups |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
71 |
* 0.24: 27 Feb 2004: make driver even less anonymous in backtraces |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
72 |
* 0.25: 09 Mar 2004: wol support |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
73 |
* 0.26: 03 Jun 2004: netdriver specific annotation, sparse-related fixes |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
74 |
* 0.27: 19 Jun 2004: Gigabit support, new descriptor rings, |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
75 |
* added CK804/MCP04 device IDs, code fixes |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
76 |
* for registers, link status and other minor fixes. |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
77 |
* 0.28: 21 Jun 2004: Big cleanup, making driver mostly endian safe |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
78 |
* 0.29: 31 Aug 2004: Add backup timer for link change notification. |
99623f8a8493
Added testing version of forcedeth driver.
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 |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
80 |
* into nv_close, otherwise reenabling for wol can |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
81 |
* cause DMA to kfree'd memory. |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
82 |
* 0.31: 14 Nov 2004: ethtool support for getting/setting link |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
83 |
* capabilities. |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
84 |
* 0.32: 16 Apr 2005: RX_ERROR4 handling added. |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
85 |
* 0.33: 16 May 2005: Support for MCP51 added. |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
86 |
* 0.34: 18 Jun 2005: Add DEV_NEED_LINKTIMER to all nForce nics. |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
87 |
* 0.35: 26 Jun 2005: Support for MCP55 added. |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
88 |
* 0.36: 28 Jun 2005: Add jumbo frame support. |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
89 |
* 0.37: 10 Jul 2005: Additional ethtool support, cleanup of pci id list |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
90 |
* 0.38: 16 Jul 2005: tx irq rewrite: Use global flags instead of |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
91 |
* per-packet flags. |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
92 |
* 0.39: 18 Jul 2005: Add 64bit descriptor support. |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
93 |
* 0.40: 19 Jul 2005: Add support for mac address change. |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
94 |
* 0.41: 30 Jul 2005: Write back original MAC in nv_close instead |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
95 |
* of nv_remove |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
96 |
* 0.42: 06 Aug 2005: Fix lack of link speed initialization |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
97 |
* in the second (and later) nv_open call |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
98 |
* 0.43: 10 Aug 2005: Add support for tx checksum. |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
99 |
* 0.44: 20 Aug 2005: Add support for scatter gather and segmentation. |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
100 |
* 0.45: 18 Sep 2005: Remove nv_stop/start_rx from every link check |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
101 |
* 0.46: 20 Oct 2005: Add irq optimization modes. |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
102 |
* 0.47: 26 Oct 2005: Add phyaddr 0 in phy scan. |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
103 |
* 0.48: 24 Dec 2005: Disable TSO, bugfix for pci_map_single |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
104 |
* 0.49: 10 Dec 2005: Fix tso for large buffers. |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
105 |
* 0.50: 20 Jan 2006: Add 8021pq tagging support. |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
106 |
* 0.51: 20 Jan 2006: Add 64bit consistent memory allocation for rings. |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
107 |
* 0.52: 20 Jan 2006: Add MSI/MSIX support. |
99623f8a8493
Added testing version of forcedeth driver.
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. |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
109 |
* 0.54: 21 Mar 2006: Fix spin locks for multi irqs and cleanup. |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
110 |
* |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
111 |
* Known bugs: |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
112 |
* We suspect that on some hardware no TX done interrupts are generated. |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
113 |
* This means recovery from netif_stop_queue only happens if the hw timer |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
114 |
* interrupt fires (100 times/second, configurable with NVREG_POLL_DEFAULT) |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
115 |
* and the timer is active in the IRQMask, or if a rx packet arrives by chance. |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
116 |
* If your hardware reliably generates tx done interrupts, then you can remove |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
117 |
* DEV_NEED_TIMERIRQ from the driver_data flags. |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
118 |
* DEV_NEED_TIMERIRQ will not harm you on sane hardware, only generating a few |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
119 |
* superfluous timer interrupts from the nic. |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
120 |
*/ |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
121 |
#define FORCEDETH_VERSION "0.54" |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
122 |
#define DRV_NAME "forcedeth" |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
123 |
|
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
124 |
#include <linux/module.h> |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
125 |
#include <linux/types.h> |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
126 |
#include <linux/pci.h> |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
127 |
#include <linux/interrupt.h> |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
128 |
#include <linux/netdevice.h> |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
129 |
#include <linux/etherdevice.h> |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
130 |
#include <linux/delay.h> |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
131 |
#include <linux/spinlock.h> |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
132 |
#include <linux/ethtool.h> |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
133 |
#include <linux/timer.h> |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
134 |
#include <linux/skbuff.h> |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
135 |
#include <linux/mii.h> |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
136 |
#include <linux/random.h> |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
137 |
#include <linux/init.h> |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
138 |
#include <linux/if_vlan.h> |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
139 |
#include <linux/dma-mapping.h> |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
140 |
|
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
141 |
#include <asm/irq.h> |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
142 |
#include <asm/io.h> |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
143 |
#include <asm/uaccess.h> |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
144 |
#include <asm/system.h> |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
145 |
|
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
146 |
#include "../globals.h" |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
147 |
#include "ecdev.h" |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
148 |
|
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
149 |
#if 0 |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
150 |
#define dprintk printk |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
151 |
#else |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
152 |
#define dprintk(x...) do { } while (0) |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
153 |
#endif |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
154 |
|
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
155 |
|
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
156 |
/* |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
157 |
* Hardware access: |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
158 |
*/ |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
159 |
|
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
160 |
#define DEV_NEED_TIMERIRQ 0x0001 /* set the timer irq flag in the irq mask */ |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
161 |
#define DEV_NEED_LINKTIMER 0x0002 /* poll link settings. Relies on the timer irq */ |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
162 |
#define DEV_HAS_LARGEDESC 0x0004 /* device supports jumbo frames and needs packet format 2 */ |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
163 |
#define DEV_HAS_HIGH_DMA 0x0008 /* device supports 64bit dma */ |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
164 |
#define DEV_HAS_CHECKSUM 0x0010 /* device supports tx and rx checksum offloads */ |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
165 |
#define DEV_HAS_VLAN 0x0020 /* device supports vlan tagging and striping */ |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
166 |
#define DEV_HAS_MSI 0x0040 /* device supports MSI */ |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
167 |
#define DEV_HAS_MSI_X 0x0080 /* device supports MSI-X */ |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
168 |
#define DEV_HAS_POWER_CNTRL 0x0100 /* device supports power savings */ |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
169 |
|
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
170 |
enum { |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
171 |
NvRegIrqStatus = 0x000, |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
172 |
#define NVREG_IRQSTAT_MIIEVENT 0x040 |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
173 |
#define NVREG_IRQSTAT_MASK 0x1ff |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
174 |
NvRegIrqMask = 0x004, |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
175 |
#define NVREG_IRQ_RX_ERROR 0x0001 |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
176 |
#define NVREG_IRQ_RX 0x0002 |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
177 |
#define NVREG_IRQ_RX_NOBUF 0x0004 |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
178 |
#define NVREG_IRQ_TX_ERR 0x0008 |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
179 |
#define NVREG_IRQ_TX_OK 0x0010 |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
180 |
#define NVREG_IRQ_TIMER 0x0020 |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
181 |
#define NVREG_IRQ_LINK 0x0040 |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
182 |
#define NVREG_IRQ_RX_FORCED 0x0080 |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
183 |
#define NVREG_IRQ_TX_FORCED 0x0100 |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
184 |
#define NVREG_IRQMASK_THROUGHPUT 0x00df |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
185 |
#define NVREG_IRQMASK_CPU 0x0040 |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
186 |
#define NVREG_IRQ_TX_ALL (NVREG_IRQ_TX_ERR|NVREG_IRQ_TX_OK|NVREG_IRQ_TX_FORCED) |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
187 |
#define NVREG_IRQ_RX_ALL (NVREG_IRQ_RX_ERROR|NVREG_IRQ_RX|NVREG_IRQ_RX_NOBUF|NVREG_IRQ_RX_FORCED) |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
188 |
#define NVREG_IRQ_OTHER (NVREG_IRQ_TIMER|NVREG_IRQ_LINK) |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
189 |
|
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
190 |
#define NVREG_IRQ_UNKNOWN (~(NVREG_IRQ_RX_ERROR|NVREG_IRQ_RX|NVREG_IRQ_RX_NOBUF|NVREG_IRQ_TX_ERR| \ |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
191 |
NVREG_IRQ_TX_OK|NVREG_IRQ_TIMER|NVREG_IRQ_LINK|NVREG_IRQ_RX_FORCED| \ |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
192 |
NVREG_IRQ_TX_FORCED)) |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
193 |
|
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
194 |
NvRegUnknownSetupReg6 = 0x008, |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
195 |
#define NVREG_UNKSETUP6_VAL 3 |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
196 |
|
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
197 |
/* |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
198 |
* NVREG_POLL_DEFAULT is the interval length of the timer source on the nic |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
199 |
* NVREG_POLL_DEFAULT=97 would result in an interval length of 1 ms |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
200 |
*/ |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
201 |
NvRegPollingInterval = 0x00c, |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
202 |
#define NVREG_POLL_DEFAULT_THROUGHPUT 970 |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
203 |
#define NVREG_POLL_DEFAULT_CPU 13 |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
204 |
NvRegMSIMap0 = 0x020, |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
205 |
NvRegMSIMap1 = 0x024, |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
206 |
NvRegMSIIrqMask = 0x030, |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
207 |
#define NVREG_MSI_VECTOR_0_ENABLED 0x01 |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
208 |
NvRegMisc1 = 0x080, |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
209 |
#define NVREG_MISC1_HD 0x02 |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
210 |
#define NVREG_MISC1_FORCE 0x3b0f3c |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
211 |
|
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
212 |
NvRegMacReset = 0x3c, |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
213 |
#define NVREG_MAC_RESET_ASSERT 0x0F3 |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
214 |
NvRegTransmitterControl = 0x084, |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
215 |
#define NVREG_XMITCTL_START 0x01 |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
216 |
NvRegTransmitterStatus = 0x088, |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
217 |
#define NVREG_XMITSTAT_BUSY 0x01 |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
218 |
|
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
219 |
NvRegPacketFilterFlags = 0x8c, |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
220 |
#define NVREG_PFF_ALWAYS 0x7F0008 |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
221 |
#define NVREG_PFF_PROMISC 0x80 |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
222 |
#define NVREG_PFF_MYADDR 0x20 |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
223 |
|
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
224 |
NvRegOffloadConfig = 0x90, |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
225 |
#define NVREG_OFFLOAD_HOMEPHY 0x601 |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
226 |
#define NVREG_OFFLOAD_NORMAL RX_NIC_BUFSIZE |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
227 |
NvRegReceiverControl = 0x094, |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
228 |
#define NVREG_RCVCTL_START 0x01 |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
229 |
NvRegReceiverStatus = 0x98, |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
230 |
#define NVREG_RCVSTAT_BUSY 0x01 |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
231 |
|
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
232 |
NvRegRandomSeed = 0x9c, |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
233 |
#define NVREG_RNDSEED_MASK 0x00ff |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
234 |
#define NVREG_RNDSEED_FORCE 0x7f00 |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
235 |
#define NVREG_RNDSEED_FORCE2 0x2d00 |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
236 |
#define NVREG_RNDSEED_FORCE3 0x7400 |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
237 |
|
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
238 |
NvRegUnknownSetupReg1 = 0xA0, |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
239 |
#define NVREG_UNKSETUP1_VAL 0x16070f |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
240 |
NvRegUnknownSetupReg2 = 0xA4, |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
241 |
#define NVREG_UNKSETUP2_VAL 0x16 |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
242 |
NvRegMacAddrA = 0xA8, |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
243 |
NvRegMacAddrB = 0xAC, |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
244 |
NvRegMulticastAddrA = 0xB0, |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
245 |
#define NVREG_MCASTADDRA_FORCE 0x01 |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
246 |
NvRegMulticastAddrB = 0xB4, |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
247 |
NvRegMulticastMaskA = 0xB8, |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
248 |
NvRegMulticastMaskB = 0xBC, |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
249 |
|
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
250 |
NvRegPhyInterface = 0xC0, |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
251 |
#define PHY_RGMII 0x10000000 |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
252 |
|
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
253 |
NvRegTxRingPhysAddr = 0x100, |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
254 |
NvRegRxRingPhysAddr = 0x104, |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
255 |
NvRegRingSizes = 0x108, |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
256 |
#define NVREG_RINGSZ_TXSHIFT 0 |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
257 |
#define NVREG_RINGSZ_RXSHIFT 16 |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
258 |
NvRegUnknownTransmitterReg = 0x10c, |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
259 |
NvRegLinkSpeed = 0x110, |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
260 |
#define NVREG_LINKSPEED_FORCE 0x10000 |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
261 |
#define NVREG_LINKSPEED_10 1000 |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
262 |
#define NVREG_LINKSPEED_100 100 |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
263 |
#define NVREG_LINKSPEED_1000 50 |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
264 |
#define NVREG_LINKSPEED_MASK (0xFFF) |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
265 |
NvRegUnknownSetupReg5 = 0x130, |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
266 |
#define NVREG_UNKSETUP5_BIT31 (1<<31) |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
267 |
NvRegUnknownSetupReg3 = 0x13c, |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
268 |
#define NVREG_UNKSETUP3_VAL1 0x200010 |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
269 |
NvRegTxRxControl = 0x144, |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
270 |
#define NVREG_TXRXCTL_KICK 0x0001 |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
271 |
#define NVREG_TXRXCTL_BIT1 0x0002 |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
272 |
#define NVREG_TXRXCTL_BIT2 0x0004 |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
273 |
#define NVREG_TXRXCTL_IDLE 0x0008 |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
274 |
#define NVREG_TXRXCTL_RESET 0x0010 |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
275 |
#define NVREG_TXRXCTL_RXCHECK 0x0400 |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
276 |
#define NVREG_TXRXCTL_DESC_1 0 |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
277 |
#define NVREG_TXRXCTL_DESC_2 0x02100 |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
278 |
#define NVREG_TXRXCTL_DESC_3 0x02200 |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
279 |
#define NVREG_TXRXCTL_VLANSTRIP 0x00040 |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
280 |
#define NVREG_TXRXCTL_VLANINS 0x00080 |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
281 |
NvRegTxRingPhysAddrHigh = 0x148, |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
282 |
NvRegRxRingPhysAddrHigh = 0x14C, |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
283 |
NvRegMIIStatus = 0x180, |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
284 |
#define NVREG_MIISTAT_ERROR 0x0001 |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
285 |
#define NVREG_MIISTAT_LINKCHANGE 0x0008 |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
286 |
#define NVREG_MIISTAT_MASK 0x000f |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
287 |
#define NVREG_MIISTAT_MASK2 0x000f |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
288 |
NvRegUnknownSetupReg4 = 0x184, |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
289 |
#define NVREG_UNKSETUP4_VAL 8 |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
290 |
|
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
291 |
NvRegAdapterControl = 0x188, |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
292 |
#define NVREG_ADAPTCTL_START 0x02 |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
293 |
#define NVREG_ADAPTCTL_LINKUP 0x04 |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
294 |
#define NVREG_ADAPTCTL_PHYVALID 0x40000 |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
295 |
#define NVREG_ADAPTCTL_RUNNING 0x100000 |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
296 |
#define NVREG_ADAPTCTL_PHYSHIFT 24 |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
297 |
NvRegMIISpeed = 0x18c, |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
298 |
#define NVREG_MIISPEED_BIT8 (1<<8) |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
299 |
#define NVREG_MIIDELAY 5 |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
300 |
NvRegMIIControl = 0x190, |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
301 |
#define NVREG_MIICTL_INUSE 0x08000 |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
302 |
#define NVREG_MIICTL_WRITE 0x00400 |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
303 |
#define NVREG_MIICTL_ADDRSHIFT 5 |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
304 |
NvRegMIIData = 0x194, |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
305 |
NvRegWakeUpFlags = 0x200, |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
306 |
#define NVREG_WAKEUPFLAGS_VAL 0x7770 |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
307 |
#define NVREG_WAKEUPFLAGS_BUSYSHIFT 24 |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
308 |
#define NVREG_WAKEUPFLAGS_ENABLESHIFT 16 |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
309 |
#define NVREG_WAKEUPFLAGS_D3SHIFT 12 |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
310 |
#define NVREG_WAKEUPFLAGS_D2SHIFT 8 |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
311 |
#define NVREG_WAKEUPFLAGS_D1SHIFT 4 |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
312 |
#define NVREG_WAKEUPFLAGS_D0SHIFT 0 |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
313 |
#define NVREG_WAKEUPFLAGS_ACCEPT_MAGPAT 0x01 |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
314 |
#define NVREG_WAKEUPFLAGS_ACCEPT_WAKEUPPAT 0x02 |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
315 |
#define NVREG_WAKEUPFLAGS_ACCEPT_LINKCHANGE 0x04 |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
316 |
#define NVREG_WAKEUPFLAGS_ENABLE 0x1111 |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
317 |
|
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
318 |
NvRegPatternCRC = 0x204, |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
319 |
NvRegPatternMask = 0x208, |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
320 |
NvRegPowerCap = 0x268, |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
321 |
#define NVREG_POWERCAP_D3SUPP (1<<30) |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
322 |
#define NVREG_POWERCAP_D2SUPP (1<<26) |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
323 |
#define NVREG_POWERCAP_D1SUPP (1<<25) |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
324 |
NvRegPowerState = 0x26c, |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
325 |
#define NVREG_POWERSTATE_POWEREDUP 0x8000 |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
326 |
#define NVREG_POWERSTATE_VALID 0x0100 |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
327 |
#define NVREG_POWERSTATE_MASK 0x0003 |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
328 |
#define NVREG_POWERSTATE_D0 0x0000 |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
329 |
#define NVREG_POWERSTATE_D1 0x0001 |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
330 |
#define NVREG_POWERSTATE_D2 0x0002 |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
331 |
#define NVREG_POWERSTATE_D3 0x0003 |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
332 |
NvRegVlanControl = 0x300, |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
333 |
#define NVREG_VLANCONTROL_ENABLE 0x2000 |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
334 |
NvRegMSIXMap0 = 0x3e0, |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
335 |
NvRegMSIXMap1 = 0x3e4, |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
336 |
NvRegMSIXIrqStatus = 0x3f0, |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
337 |
|
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
338 |
NvRegPowerState2 = 0x600, |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
339 |
#define NVREG_POWERSTATE2_POWERUP_MASK 0x0F11 |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
340 |
#define NVREG_POWERSTATE2_POWERUP_REV_A3 0x0001 |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
341 |
}; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
342 |
|
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
343 |
/* Big endian: should work, but is untested */ |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
344 |
struct ring_desc { |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
345 |
u32 PacketBuffer; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
346 |
u32 FlagLen; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
347 |
}; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
348 |
|
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
349 |
struct ring_desc_ex { |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
350 |
u32 PacketBufferHigh; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
351 |
u32 PacketBufferLow; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
352 |
u32 TxVlan; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
353 |
u32 FlagLen; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
354 |
}; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
355 |
|
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
356 |
typedef union _ring_type { |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
357 |
struct ring_desc* orig; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
358 |
struct ring_desc_ex* ex; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
359 |
} ring_type; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
360 |
|
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
361 |
#define FLAG_MASK_V1 0xffff0000 |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
362 |
#define FLAG_MASK_V2 0xffffc000 |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
363 |
#define LEN_MASK_V1 (0xffffffff ^ FLAG_MASK_V1) |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
364 |
#define LEN_MASK_V2 (0xffffffff ^ FLAG_MASK_V2) |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
365 |
|
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
366 |
#define NV_TX_LASTPACKET (1<<16) |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
367 |
#define NV_TX_RETRYERROR (1<<19) |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
368 |
#define NV_TX_FORCED_INTERRUPT (1<<24) |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
369 |
#define NV_TX_DEFERRED (1<<26) |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
370 |
#define NV_TX_CARRIERLOST (1<<27) |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
371 |
#define NV_TX_LATECOLLISION (1<<28) |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
372 |
#define NV_TX_UNDERFLOW (1<<29) |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
373 |
#define NV_TX_ERROR (1<<30) |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
374 |
#define NV_TX_VALID (1<<31) |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
375 |
|
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
376 |
#define NV_TX2_LASTPACKET (1<<29) |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
377 |
#define NV_TX2_RETRYERROR (1<<18) |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
378 |
#define NV_TX2_FORCED_INTERRUPT (1<<30) |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
379 |
#define NV_TX2_DEFERRED (1<<25) |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
380 |
#define NV_TX2_CARRIERLOST (1<<26) |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
381 |
#define NV_TX2_LATECOLLISION (1<<27) |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
382 |
#define NV_TX2_UNDERFLOW (1<<28) |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
383 |
/* error and valid are the same for both */ |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
384 |
#define NV_TX2_ERROR (1<<30) |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
385 |
#define NV_TX2_VALID (1<<31) |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
386 |
#define NV_TX2_TSO (1<<28) |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
387 |
#define NV_TX2_TSO_SHIFT 14 |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
388 |
#define NV_TX2_TSO_MAX_SHIFT 14 |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
389 |
#define NV_TX2_TSO_MAX_SIZE (1<<NV_TX2_TSO_MAX_SHIFT) |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
390 |
#define NV_TX2_CHECKSUM_L3 (1<<27) |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
391 |
#define NV_TX2_CHECKSUM_L4 (1<<26) |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
392 |
|
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
393 |
#define NV_TX3_VLAN_TAG_PRESENT (1<<18) |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
394 |
|
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
395 |
#define NV_RX_DESCRIPTORVALID (1<<16) |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
396 |
#define NV_RX_MISSEDFRAME (1<<17) |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
397 |
#define NV_RX_SUBSTRACT1 (1<<18) |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
398 |
#define NV_RX_ERROR1 (1<<23) |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
399 |
#define NV_RX_ERROR2 (1<<24) |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
400 |
#define NV_RX_ERROR3 (1<<25) |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
401 |
#define NV_RX_ERROR4 (1<<26) |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
402 |
#define NV_RX_CRCERR (1<<27) |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
403 |
#define NV_RX_OVERFLOW (1<<28) |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
404 |
#define NV_RX_FRAMINGERR (1<<29) |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
405 |
#define NV_RX_ERROR (1<<30) |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
406 |
#define NV_RX_AVAIL (1<<31) |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
407 |
|
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
408 |
#define NV_RX2_CHECKSUMMASK (0x1C000000) |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
409 |
#define NV_RX2_CHECKSUMOK1 (0x10000000) |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
410 |
#define NV_RX2_CHECKSUMOK2 (0x14000000) |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
411 |
#define NV_RX2_CHECKSUMOK3 (0x18000000) |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
412 |
#define NV_RX2_DESCRIPTORVALID (1<<29) |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
413 |
#define NV_RX2_SUBSTRACT1 (1<<25) |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
414 |
#define NV_RX2_ERROR1 (1<<18) |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
415 |
#define NV_RX2_ERROR2 (1<<19) |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
416 |
#define NV_RX2_ERROR3 (1<<20) |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
417 |
#define NV_RX2_ERROR4 (1<<21) |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
418 |
#define NV_RX2_CRCERR (1<<22) |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
419 |
#define NV_RX2_OVERFLOW (1<<23) |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
420 |
#define NV_RX2_FRAMINGERR (1<<24) |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
421 |
/* error and avail are the same for both */ |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
422 |
#define NV_RX2_ERROR (1<<30) |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
423 |
#define NV_RX2_AVAIL (1<<31) |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
424 |
|
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
425 |
#define NV_RX3_VLAN_TAG_PRESENT (1<<16) |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
426 |
#define NV_RX3_VLAN_TAG_MASK (0x0000FFFF) |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
427 |
|
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
428 |
/* Miscelaneous hardware related defines: */ |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
429 |
#define NV_PCI_REGSZ_VER1 0x270 |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
430 |
#define NV_PCI_REGSZ_VER2 0x604 |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
431 |
|
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
432 |
/* various timeout delays: all in usec */ |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
433 |
#define NV_TXRX_RESET_DELAY 4 |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
434 |
#define NV_TXSTOP_DELAY1 10 |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
435 |
#define NV_TXSTOP_DELAY1MAX 500000 |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
436 |
#define NV_TXSTOP_DELAY2 100 |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
437 |
#define NV_RXSTOP_DELAY1 10 |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
438 |
#define NV_RXSTOP_DELAY1MAX 500000 |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
439 |
#define NV_RXSTOP_DELAY2 100 |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
440 |
#define NV_SETUP5_DELAY 5 |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
441 |
#define NV_SETUP5_DELAYMAX 50000 |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
442 |
#define NV_POWERUP_DELAY 5 |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
443 |
#define NV_POWERUP_DELAYMAX 5000 |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
444 |
#define NV_MIIBUSY_DELAY 50 |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
445 |
#define NV_MIIPHY_DELAY 10 |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
446 |
#define NV_MIIPHY_DELAYMAX 10000 |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
447 |
#define NV_MAC_RESET_DELAY 64 |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
448 |
|
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
449 |
#define NV_WAKEUPPATTERNS 5 |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
450 |
#define NV_WAKEUPMASKENTRIES 4 |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
451 |
|
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
452 |
/* General driver defaults */ |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
453 |
#define NV_WATCHDOG_TIMEO (5*HZ) |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
454 |
|
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
455 |
#define RX_RING 128 |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
456 |
#define TX_RING 256 |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
457 |
/* |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
458 |
* If your nic mysteriously hangs then try to reduce the limits |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
459 |
* to 1/0: It might be required to set NV_TX_LASTPACKET in the |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
460 |
* last valid ring entry. But this would be impossible to |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
461 |
* implement - probably a disassembly error. |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
462 |
*/ |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
463 |
#define TX_LIMIT_STOP 255 |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
464 |
#define TX_LIMIT_START 254 |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
465 |
|
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
466 |
/* rx/tx mac addr + type + vlan + align + slack*/ |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
467 |
#define NV_RX_HEADERS (64) |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
468 |
/* even more slack. */ |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
469 |
#define NV_RX_ALLOC_PAD (64) |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
470 |
|
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
471 |
/* maximum mtu size */ |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
472 |
#define NV_PKTLIMIT_1 ETH_DATA_LEN /* hard limit not known */ |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
473 |
#define NV_PKTLIMIT_2 9100 /* Actual limit according to NVidia: 9202 */ |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
474 |
|
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
475 |
#define OOM_REFILL (1+HZ/20) |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
476 |
#define POLL_WAIT (1+HZ/100) |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
477 |
#define LINK_TIMEOUT (3*HZ) |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
478 |
|
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
479 |
/* |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
480 |
* desc_ver values: |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
481 |
* The nic supports three different descriptor types: |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
482 |
* - DESC_VER_1: Original |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
483 |
* - DESC_VER_2: support for jumbo frames. |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
484 |
* - DESC_VER_3: 64-bit format. |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
485 |
*/ |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
486 |
#define DESC_VER_1 1 |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
487 |
#define DESC_VER_2 2 |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
488 |
#define DESC_VER_3 3 |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
489 |
|
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
490 |
/* PHY defines */ |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
491 |
#define PHY_OUI_MARVELL 0x5043 |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
492 |
#define PHY_OUI_CICADA 0x03f1 |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
493 |
#define PHYID1_OUI_MASK 0x03ff |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
494 |
#define PHYID1_OUI_SHFT 6 |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
495 |
#define PHYID2_OUI_MASK 0xfc00 |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
496 |
#define PHYID2_OUI_SHFT 10 |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
497 |
#define PHY_INIT1 0x0f000 |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
498 |
#define PHY_INIT2 0x0e00 |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
499 |
#define PHY_INIT3 0x01000 |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
500 |
#define PHY_INIT4 0x0200 |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
501 |
#define PHY_INIT5 0x0004 |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
502 |
#define PHY_INIT6 0x02000 |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
503 |
#define PHY_GIGABIT 0x0100 |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
504 |
|
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
505 |
#define PHY_TIMEOUT 0x1 |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
506 |
#define PHY_ERROR 0x2 |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
507 |
|
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
508 |
#define PHY_100 0x1 |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
509 |
#define PHY_1000 0x2 |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
510 |
#define PHY_HALF 0x100 |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
511 |
|
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
512 |
/* FIXME: MII defines that should be added to <linux/mii.h> */ |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
513 |
#define MII_1000BT_CR 0x09 |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
514 |
#define MII_1000BT_SR 0x0a |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
515 |
#define ADVERTISE_1000FULL 0x0200 |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
516 |
#define ADVERTISE_1000HALF 0x0100 |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
517 |
#define LPA_1000FULL 0x0800 |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
518 |
#define LPA_1000HALF 0x0400 |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
519 |
|
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
520 |
/* MSI/MSI-X defines */ |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
521 |
#define NV_MSI_X_MAX_VECTORS 8 |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
522 |
#define NV_MSI_X_VECTORS_MASK 0x000f |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
523 |
#define NV_MSI_CAPABLE 0x0010 |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
524 |
#define NV_MSI_X_CAPABLE 0x0020 |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
525 |
#define NV_MSI_ENABLED 0x0040 |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
526 |
#define NV_MSI_X_ENABLED 0x0080 |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
527 |
|
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
528 |
#define NV_MSI_X_VECTOR_ALL 0x0 |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
529 |
#define NV_MSI_X_VECTOR_RX 0x0 |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
530 |
#define NV_MSI_X_VECTOR_TX 0x1 |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
531 |
#define NV_MSI_X_VECTOR_OTHER 0x2 |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
532 |
|
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
533 |
/* |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
534 |
* SMP locking: |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
535 |
* All hardware access under dev->priv->lock, except the performance |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
536 |
* critical parts: |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
537 |
* - rx is (pseudo-) lockless: it relies on the single-threading provided |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
538 |
* by the arch code for interrupts. |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
539 |
* - tx setup is lockless: it relies on dev->xmit_lock. Actual submission |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
540 |
* needs dev->priv->lock :-( |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
541 |
* - set_multicast_list: preparation lockless, relies on dev->xmit_lock. |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
542 |
*/ |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
543 |
|
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
544 |
/* in dev: base, irq */ |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
545 |
struct fe_priv { |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
546 |
spinlock_t lock; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
547 |
|
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
548 |
/* General data: |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
549 |
* Locking: spin_lock(&np->lock); */ |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
550 |
struct net_device_stats stats; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
551 |
int in_shutdown; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
552 |
u32 linkspeed; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
553 |
int duplex; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
554 |
int autoneg; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
555 |
int fixed_mode; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
556 |
int phyaddr; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
557 |
int wolenabled; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
558 |
unsigned int phy_oui; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
559 |
u16 gigabit; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
560 |
|
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
561 |
/* General data: RO fields */ |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
562 |
dma_addr_t ring_addr; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
563 |
struct pci_dev *pci_dev; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
564 |
u32 orig_mac[2]; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
565 |
u32 irqmask; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
566 |
u32 desc_ver; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
567 |
u32 txrxctl_bits; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
568 |
u32 vlanctl_bits; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
569 |
u32 driver_data; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
570 |
u32 register_size; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
571 |
|
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
572 |
void __iomem *base; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
573 |
|
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
574 |
/* rx specific fields. |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
575 |
* Locking: Within irq hander or disable_irq+spin_lock(&np->lock); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
576 |
*/ |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
577 |
ring_type rx_ring; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
578 |
unsigned int cur_rx, refill_rx; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
579 |
struct sk_buff *rx_skbuff[RX_RING]; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
580 |
dma_addr_t rx_dma[RX_RING]; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
581 |
unsigned int rx_buf_sz; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
582 |
unsigned int pkt_limit; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
583 |
struct timer_list oom_kick; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
584 |
struct timer_list nic_poll; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
585 |
u32 nic_poll_irq; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
586 |
|
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
587 |
/* media detection workaround. |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
588 |
* Locking: Within irq hander or disable_irq+spin_lock(&np->lock); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
589 |
*/ |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
590 |
int need_linktimer; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
591 |
unsigned long link_timeout; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
592 |
/* |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
593 |
* tx specific fields. |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
594 |
*/ |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
595 |
ring_type tx_ring; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
596 |
unsigned int next_tx, nic_tx; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
597 |
struct sk_buff *tx_skbuff[TX_RING]; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
598 |
dma_addr_t tx_dma[TX_RING]; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
599 |
unsigned int tx_dma_len[TX_RING]; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
600 |
u32 tx_flags; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
601 |
|
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
602 |
/* vlan fields */ |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
603 |
struct vlan_group *vlangrp; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
604 |
|
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
605 |
/* msi/msi-x fields */ |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
606 |
u32 msi_flags; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
607 |
struct msix_entry msi_x_entry[NV_MSI_X_MAX_VECTORS]; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
608 |
|
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
609 |
ec_device_t *ecdev; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
610 |
}; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
611 |
|
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
612 |
/* |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
613 |
* Maximum number of loops until we assume that a bit in the irq mask |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
614 |
* is stuck. Overridable with module param. |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
615 |
*/ |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
616 |
static int max_interrupt_work = 5; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
617 |
|
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
618 |
/* |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
619 |
* Optimization can be either throuput mode or cpu mode |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
620 |
* |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
621 |
* Throughput Mode: Every tx and rx packet will generate an interrupt. |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
622 |
* CPU Mode: Interrupts are controlled by a timer. |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
623 |
*/ |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
624 |
#define NV_OPTIMIZATION_MODE_THROUGHPUT 0 |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
625 |
#define NV_OPTIMIZATION_MODE_CPU 1 |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
626 |
static int optimization_mode = NV_OPTIMIZATION_MODE_THROUGHPUT; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
627 |
|
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
628 |
/* |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
629 |
* Poll interval for timer irq |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
630 |
* |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
631 |
* This interval determines how frequent an interrupt is generated. |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
632 |
* The is value is determined by [(time_in_micro_secs * 100) / (2^10)] |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
633 |
* Min = 0, and Max = 65535 |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
634 |
*/ |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
635 |
static int poll_interval = -1; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
636 |
|
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
637 |
/* |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
638 |
* Disable MSI interrupts |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
639 |
*/ |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
640 |
static int disable_msi = 0; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
641 |
|
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
642 |
/* |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
643 |
* Disable MSIX interrupts |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
644 |
*/ |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
645 |
static int disable_msix = 0; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
646 |
|
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
647 |
static int board_idx = -1; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
648 |
|
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
649 |
static inline struct fe_priv *get_nvpriv(struct net_device *dev) |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
650 |
{ |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
651 |
return netdev_priv(dev); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
652 |
} |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
653 |
|
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
654 |
static inline u8 __iomem *get_hwbase(struct net_device *dev) |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
655 |
{ |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
656 |
return ((struct fe_priv *)netdev_priv(dev))->base; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
657 |
} |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
658 |
|
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
659 |
static inline void pci_push(u8 __iomem *base) |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
660 |
{ |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
661 |
/* force out pending posted writes */ |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
662 |
readl(base); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
663 |
} |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
664 |
|
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
665 |
static inline u32 nv_descr_getlength(struct ring_desc *prd, u32 v) |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
666 |
{ |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
667 |
return le32_to_cpu(prd->FlagLen) |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
668 |
& ((v == DESC_VER_1) ? LEN_MASK_V1 : LEN_MASK_V2); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
669 |
} |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
670 |
|
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
671 |
static inline u32 nv_descr_getlength_ex(struct ring_desc_ex *prd, u32 v) |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
672 |
{ |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
673 |
return le32_to_cpu(prd->FlagLen) & LEN_MASK_V2; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
674 |
} |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
675 |
|
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
676 |
static int reg_delay(struct net_device *dev, int offset, u32 mask, u32 target, |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
677 |
int delay, int delaymax, const char *msg) |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
678 |
{ |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
679 |
u8 __iomem *base = get_hwbase(dev); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
680 |
|
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
681 |
pci_push(base); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
682 |
do { |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
683 |
udelay(delay); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
684 |
delaymax -= delay; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
685 |
if (delaymax < 0) { |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
686 |
if (msg) |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
687 |
printk(msg); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
688 |
return 1; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
689 |
} |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
690 |
} while ((readl(base + offset) & mask) != target); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
691 |
return 0; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
692 |
} |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
693 |
|
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
694 |
#define NV_SETUP_RX_RING 0x01 |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
695 |
#define NV_SETUP_TX_RING 0x02 |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
696 |
|
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
697 |
static void setup_hw_rings(struct net_device *dev, int rxtx_flags) |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
698 |
{ |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
699 |
struct fe_priv *np = get_nvpriv(dev); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
700 |
u8 __iomem *base = get_hwbase(dev); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
701 |
|
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
702 |
if (np->desc_ver == DESC_VER_1 || np->desc_ver == DESC_VER_2) { |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
703 |
if (rxtx_flags & NV_SETUP_RX_RING) { |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
704 |
writel((u32) cpu_to_le64(np->ring_addr), base + NvRegRxRingPhysAddr); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
705 |
} |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
706 |
if (rxtx_flags & NV_SETUP_TX_RING) { |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
707 |
writel((u32) cpu_to_le64(np->ring_addr + RX_RING*sizeof(struct ring_desc)), base + NvRegTxRingPhysAddr); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
708 |
} |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
709 |
} else { |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
710 |
if (rxtx_flags & NV_SETUP_RX_RING) { |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
711 |
writel((u32) cpu_to_le64(np->ring_addr), base + NvRegRxRingPhysAddr); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
712 |
writel((u32) (cpu_to_le64(np->ring_addr) >> 32), base + NvRegRxRingPhysAddrHigh); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
713 |
} |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
714 |
if (rxtx_flags & NV_SETUP_TX_RING) { |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
715 |
writel((u32) cpu_to_le64(np->ring_addr + RX_RING*sizeof(struct ring_desc_ex)), base + NvRegTxRingPhysAddr); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
716 |
writel((u32) (cpu_to_le64(np->ring_addr + RX_RING*sizeof(struct ring_desc_ex)) >> 32), base + NvRegTxRingPhysAddrHigh); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
717 |
} |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
718 |
} |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
719 |
} |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
720 |
|
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
721 |
static int using_multi_irqs(struct net_device *dev) |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
722 |
{ |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
723 |
struct fe_priv *np = get_nvpriv(dev); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
724 |
|
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
725 |
if (!(np->msi_flags & NV_MSI_X_ENABLED) || |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
726 |
((np->msi_flags & NV_MSI_X_ENABLED) && |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
727 |
((np->msi_flags & NV_MSI_X_VECTORS_MASK) == 0x1))) |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
728 |
return 0; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
729 |
else |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
730 |
return 1; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
731 |
} |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
732 |
|
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
733 |
static void nv_enable_irq(struct net_device *dev) |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
734 |
{ |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
735 |
struct fe_priv *np = get_nvpriv(dev); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
736 |
|
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
737 |
if (!using_multi_irqs(dev)) { |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
738 |
if (np->msi_flags & NV_MSI_X_ENABLED) |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
739 |
enable_irq(np->msi_x_entry[NV_MSI_X_VECTOR_ALL].vector); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
740 |
else |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
741 |
enable_irq(dev->irq); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
742 |
} else { |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
743 |
enable_irq(np->msi_x_entry[NV_MSI_X_VECTOR_RX].vector); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
744 |
enable_irq(np->msi_x_entry[NV_MSI_X_VECTOR_TX].vector); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
745 |
enable_irq(np->msi_x_entry[NV_MSI_X_VECTOR_OTHER].vector); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
746 |
} |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
747 |
} |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
748 |
|
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
749 |
static void nv_disable_irq(struct net_device *dev) |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
750 |
{ |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
751 |
struct fe_priv *np = get_nvpriv(dev); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
752 |
|
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
753 |
if (!using_multi_irqs(dev)) { |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
754 |
if (np->msi_flags & NV_MSI_X_ENABLED) |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
755 |
disable_irq(np->msi_x_entry[NV_MSI_X_VECTOR_ALL].vector); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
756 |
else |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
757 |
disable_irq(dev->irq); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
758 |
} else { |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
759 |
disable_irq(np->msi_x_entry[NV_MSI_X_VECTOR_RX].vector); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
760 |
disable_irq(np->msi_x_entry[NV_MSI_X_VECTOR_TX].vector); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
761 |
disable_irq(np->msi_x_entry[NV_MSI_X_VECTOR_OTHER].vector); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
762 |
} |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
763 |
} |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
764 |
|
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
765 |
/* In MSIX mode, a write to irqmask behaves as XOR */ |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
766 |
static void nv_enable_hw_interrupts(struct net_device *dev, u32 mask) |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
767 |
{ |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
768 |
u8 __iomem *base = get_hwbase(dev); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
769 |
|
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
770 |
writel(mask, base + NvRegIrqMask); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
771 |
} |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
772 |
|
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
773 |
static void nv_disable_hw_interrupts(struct net_device *dev, u32 mask) |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
774 |
{ |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
775 |
struct fe_priv *np = get_nvpriv(dev); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
776 |
u8 __iomem *base = get_hwbase(dev); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
777 |
|
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
778 |
if (np->msi_flags & NV_MSI_X_ENABLED) { |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
779 |
writel(mask, base + NvRegIrqMask); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
780 |
} else { |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
781 |
if (np->msi_flags & NV_MSI_ENABLED) |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
782 |
writel(0, base + NvRegMSIIrqMask); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
783 |
writel(0, base + NvRegIrqMask); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
784 |
} |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
785 |
} |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
786 |
|
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
787 |
#define MII_READ (-1) |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
788 |
/* mii_rw: read/write a register on the PHY. |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
789 |
* |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
790 |
* Caller must guarantee serialization |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
791 |
*/ |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
792 |
static int mii_rw(struct net_device *dev, int addr, int miireg, int value) |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
793 |
{ |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
794 |
u8 __iomem *base = get_hwbase(dev); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
795 |
u32 reg; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
796 |
int retval; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
797 |
|
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
798 |
writel(NVREG_MIISTAT_MASK, base + NvRegMIIStatus); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
799 |
|
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
800 |
reg = readl(base + NvRegMIIControl); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
801 |
if (reg & NVREG_MIICTL_INUSE) { |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
802 |
writel(NVREG_MIICTL_INUSE, base + NvRegMIIControl); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
803 |
udelay(NV_MIIBUSY_DELAY); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
804 |
} |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
805 |
|
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
806 |
reg = (addr << NVREG_MIICTL_ADDRSHIFT) | miireg; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
807 |
if (value != MII_READ) { |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
808 |
writel(value, base + NvRegMIIData); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
809 |
reg |= NVREG_MIICTL_WRITE; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
810 |
} |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
811 |
writel(reg, base + NvRegMIIControl); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
812 |
|
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
813 |
if (reg_delay(dev, NvRegMIIControl, NVREG_MIICTL_INUSE, 0, |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
814 |
NV_MIIPHY_DELAY, NV_MIIPHY_DELAYMAX, NULL)) { |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
815 |
dprintk(KERN_DEBUG "%s: mii_rw of reg %d at PHY %d timed out.\n", |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
816 |
dev->name, miireg, addr); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
817 |
retval = -1; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
818 |
} else if (value != MII_READ) { |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
819 |
/* it was a write operation - fewer failures are detectable */ |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
820 |
dprintk(KERN_DEBUG "%s: mii_rw wrote 0x%x to reg %d at PHY %d\n", |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
821 |
dev->name, value, miireg, addr); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
822 |
retval = 0; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
823 |
} else if (readl(base + NvRegMIIStatus) & NVREG_MIISTAT_ERROR) { |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
824 |
dprintk(KERN_DEBUG "%s: mii_rw of reg %d at PHY %d failed.\n", |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
825 |
dev->name, miireg, addr); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
826 |
retval = -1; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
827 |
} else { |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
828 |
retval = readl(base + NvRegMIIData); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
829 |
dprintk(KERN_DEBUG "%s: mii_rw read from reg %d at PHY %d: 0x%x.\n", |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
830 |
dev->name, miireg, addr, retval); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
831 |
} |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
832 |
|
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
833 |
return retval; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
834 |
} |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
835 |
|
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
836 |
static int phy_reset(struct net_device *dev) |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
837 |
{ |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
838 |
struct fe_priv *np = netdev_priv(dev); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
839 |
u32 miicontrol; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
840 |
unsigned int tries = 0; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
841 |
|
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
842 |
miicontrol = mii_rw(dev, np->phyaddr, MII_BMCR, MII_READ); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
843 |
miicontrol |= BMCR_RESET; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
844 |
if (mii_rw(dev, np->phyaddr, MII_BMCR, miicontrol)) { |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
845 |
return -1; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
846 |
} |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
847 |
|
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
848 |
/* wait for 500ms */ |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
849 |
msleep(500); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
850 |
|
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
851 |
/* must wait till reset is deasserted */ |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
852 |
while (miicontrol & BMCR_RESET) { |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
853 |
msleep(10); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
854 |
miicontrol = mii_rw(dev, np->phyaddr, MII_BMCR, MII_READ); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
855 |
/* FIXME: 100 tries seem excessive */ |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
856 |
if (tries++ > 100) |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
857 |
return -1; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
858 |
} |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
859 |
return 0; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
860 |
} |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
861 |
|
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
862 |
static int phy_init(struct net_device *dev) |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
863 |
{ |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
864 |
struct fe_priv *np = get_nvpriv(dev); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
865 |
u8 __iomem *base = get_hwbase(dev); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
866 |
u32 phyinterface, phy_reserved, mii_status, mii_control, mii_control_1000,reg; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
867 |
|
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
868 |
/* set advertise register */ |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
869 |
reg = mii_rw(dev, np->phyaddr, MII_ADVERTISE, MII_READ); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
870 |
reg |= (ADVERTISE_10HALF|ADVERTISE_10FULL|ADVERTISE_100HALF|ADVERTISE_100FULL|0x800|0x400); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
871 |
if (mii_rw(dev, np->phyaddr, MII_ADVERTISE, reg)) { |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
872 |
printk(KERN_INFO "%s: phy write to advertise failed.\n", pci_name(np->pci_dev)); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
873 |
return PHY_ERROR; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
874 |
} |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
875 |
|
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
876 |
/* get phy interface type */ |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
877 |
phyinterface = readl(base + NvRegPhyInterface); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
878 |
|
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
879 |
/* see if gigabit phy */ |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
880 |
mii_status = mii_rw(dev, np->phyaddr, MII_BMSR, MII_READ); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
881 |
if (mii_status & PHY_GIGABIT) { |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
882 |
np->gigabit = PHY_GIGABIT; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
883 |
mii_control_1000 = mii_rw(dev, np->phyaddr, MII_1000BT_CR, MII_READ); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
884 |
mii_control_1000 &= ~ADVERTISE_1000HALF; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
885 |
if (phyinterface & PHY_RGMII) |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
886 |
mii_control_1000 |= ADVERTISE_1000FULL; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
887 |
else |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
888 |
mii_control_1000 &= ~ADVERTISE_1000FULL; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
889 |
|
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
890 |
if (mii_rw(dev, np->phyaddr, MII_1000BT_CR, mii_control_1000)) { |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
891 |
printk(KERN_INFO "%s: phy init failed.\n", pci_name(np->pci_dev)); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
892 |
return PHY_ERROR; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
893 |
} |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
894 |
} |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
895 |
else |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
896 |
np->gigabit = 0; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
897 |
|
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
898 |
/* reset the phy */ |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
899 |
if (phy_reset(dev)) { |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
900 |
printk(KERN_INFO "%s: phy reset failed\n", pci_name(np->pci_dev)); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
901 |
return PHY_ERROR; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
902 |
} |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
903 |
|
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
904 |
/* phy vendor specific configuration */ |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
905 |
if ((np->phy_oui == PHY_OUI_CICADA) && (phyinterface & PHY_RGMII) ) { |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
906 |
phy_reserved = mii_rw(dev, np->phyaddr, MII_RESV1, MII_READ); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
907 |
phy_reserved &= ~(PHY_INIT1 | PHY_INIT2); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
908 |
phy_reserved |= (PHY_INIT3 | PHY_INIT4); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
909 |
if (mii_rw(dev, np->phyaddr, MII_RESV1, phy_reserved)) { |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
910 |
printk(KERN_INFO "%s: phy init failed.\n", pci_name(np->pci_dev)); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
911 |
return PHY_ERROR; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
912 |
} |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
913 |
phy_reserved = mii_rw(dev, np->phyaddr, MII_NCONFIG, MII_READ); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
914 |
phy_reserved |= PHY_INIT5; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
915 |
if (mii_rw(dev, np->phyaddr, MII_NCONFIG, phy_reserved)) { |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
916 |
printk(KERN_INFO "%s: phy init failed.\n", pci_name(np->pci_dev)); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
917 |
return PHY_ERROR; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
918 |
} |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
919 |
} |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
920 |
if (np->phy_oui == PHY_OUI_CICADA) { |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
921 |
phy_reserved = mii_rw(dev, np->phyaddr, MII_SREVISION, MII_READ); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
922 |
phy_reserved |= PHY_INIT6; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
923 |
if (mii_rw(dev, np->phyaddr, MII_SREVISION, phy_reserved)) { |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
924 |
printk(KERN_INFO "%s: phy init failed.\n", pci_name(np->pci_dev)); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
925 |
return PHY_ERROR; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
926 |
} |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
927 |
} |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
928 |
|
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
929 |
/* restart auto negotiation */ |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
930 |
mii_control = mii_rw(dev, np->phyaddr, MII_BMCR, MII_READ); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
931 |
mii_control |= (BMCR_ANRESTART | BMCR_ANENABLE); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
932 |
if (mii_rw(dev, np->phyaddr, MII_BMCR, mii_control)) { |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
933 |
return PHY_ERROR; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
934 |
} |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
935 |
|
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
936 |
return 0; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
937 |
} |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
938 |
|
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
939 |
static void nv_start_rx(struct net_device *dev) |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
940 |
{ |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
941 |
struct fe_priv *np = netdev_priv(dev); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
942 |
u8 __iomem *base = get_hwbase(dev); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
943 |
|
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
944 |
dprintk(KERN_DEBUG "%s: nv_start_rx\n", dev->name); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
945 |
/* Already running? Stop it. */ |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
946 |
if (readl(base + NvRegReceiverControl) & NVREG_RCVCTL_START) { |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
947 |
writel(0, base + NvRegReceiverControl); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
948 |
pci_push(base); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
949 |
} |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
950 |
writel(np->linkspeed, base + NvRegLinkSpeed); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
951 |
pci_push(base); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
952 |
writel(NVREG_RCVCTL_START, base + NvRegReceiverControl); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
953 |
dprintk(KERN_DEBUG "%s: nv_start_rx to duplex %d, speed 0x%08x.\n", |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
954 |
dev->name, np->duplex, np->linkspeed); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
955 |
pci_push(base); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
956 |
} |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
957 |
|
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
958 |
static void nv_stop_rx(struct net_device *dev) |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
959 |
{ |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
960 |
u8 __iomem *base = get_hwbase(dev); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
961 |
|
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
962 |
dprintk(KERN_DEBUG "%s: nv_stop_rx\n", dev->name); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
963 |
writel(0, base + NvRegReceiverControl); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
964 |
reg_delay(dev, NvRegReceiverStatus, NVREG_RCVSTAT_BUSY, 0, |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
965 |
NV_RXSTOP_DELAY1, NV_RXSTOP_DELAY1MAX, |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
966 |
KERN_INFO "nv_stop_rx: ReceiverStatus remained busy"); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
967 |
|
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
968 |
udelay(NV_RXSTOP_DELAY2); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
969 |
writel(0, base + NvRegLinkSpeed); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
970 |
} |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
971 |
|
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
972 |
static void nv_start_tx(struct net_device *dev) |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
973 |
{ |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
974 |
u8 __iomem *base = get_hwbase(dev); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
975 |
|
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
976 |
dprintk(KERN_DEBUG "%s: nv_start_tx\n", dev->name); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
977 |
writel(NVREG_XMITCTL_START, base + NvRegTransmitterControl); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
978 |
pci_push(base); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
979 |
} |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
980 |
|
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
981 |
static void nv_stop_tx(struct net_device *dev) |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
982 |
{ |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
983 |
u8 __iomem *base = get_hwbase(dev); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
984 |
|
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
985 |
dprintk(KERN_DEBUG "%s: nv_stop_tx\n", dev->name); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
986 |
writel(0, base + NvRegTransmitterControl); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
987 |
reg_delay(dev, NvRegTransmitterStatus, NVREG_XMITSTAT_BUSY, 0, |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
988 |
NV_TXSTOP_DELAY1, NV_TXSTOP_DELAY1MAX, |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
989 |
KERN_INFO "nv_stop_tx: TransmitterStatus remained busy"); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
990 |
|
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
991 |
udelay(NV_TXSTOP_DELAY2); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
992 |
writel(0, base + NvRegUnknownTransmitterReg); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
993 |
} |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
994 |
|
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
995 |
static void nv_txrx_reset(struct net_device *dev) |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
996 |
{ |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
997 |
struct fe_priv *np = netdev_priv(dev); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
998 |
u8 __iomem *base = get_hwbase(dev); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
999 |
|
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1000 |
dprintk(KERN_DEBUG "%s: nv_txrx_reset\n", dev->name); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1001 |
writel(NVREG_TXRXCTL_BIT2 | NVREG_TXRXCTL_RESET | np->txrxctl_bits, base + NvRegTxRxControl); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1002 |
pci_push(base); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1003 |
udelay(NV_TXRX_RESET_DELAY); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1004 |
writel(NVREG_TXRXCTL_BIT2 | np->txrxctl_bits, base + NvRegTxRxControl); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1005 |
pci_push(base); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1006 |
} |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1007 |
|
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1008 |
static void nv_mac_reset(struct net_device *dev) |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1009 |
{ |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1010 |
struct fe_priv *np = netdev_priv(dev); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1011 |
u8 __iomem *base = get_hwbase(dev); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1012 |
|
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1013 |
dprintk(KERN_DEBUG "%s: nv_mac_reset\n", dev->name); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1014 |
writel(NVREG_TXRXCTL_BIT2 | NVREG_TXRXCTL_RESET | np->txrxctl_bits, base + NvRegTxRxControl); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1015 |
pci_push(base); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1016 |
writel(NVREG_MAC_RESET_ASSERT, base + NvRegMacReset); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1017 |
pci_push(base); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1018 |
udelay(NV_MAC_RESET_DELAY); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1019 |
writel(0, base + NvRegMacReset); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1020 |
pci_push(base); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1021 |
udelay(NV_MAC_RESET_DELAY); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1022 |
writel(NVREG_TXRXCTL_BIT2 | np->txrxctl_bits, base + NvRegTxRxControl); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1023 |
pci_push(base); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1024 |
} |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1025 |
|
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1026 |
/* |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1027 |
* nv_get_stats: dev->get_stats function |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1028 |
* Get latest stats value from the nic. |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1029 |
* Called with read_lock(&dev_base_lock) held for read - |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1030 |
* only synchronized against unregister_netdevice. |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1031 |
*/ |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1032 |
static struct net_device_stats *nv_get_stats(struct net_device *dev) |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1033 |
{ |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1034 |
struct fe_priv *np = netdev_priv(dev); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1035 |
|
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1036 |
/* It seems that the nic always generates interrupts and doesn't |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1037 |
* accumulate errors internally. Thus the current values in np->stats |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1038 |
* are already up to date. |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1039 |
*/ |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1040 |
return &np->stats; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1041 |
} |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1042 |
|
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1043 |
/* |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1044 |
* nv_alloc_rx: fill rx ring entries. |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1045 |
* Return 1 if the allocations for the skbs failed and the |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1046 |
* rx engine is without Available descriptors |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1047 |
*/ |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1048 |
static int nv_alloc_rx(struct net_device *dev) |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1049 |
{ |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1050 |
struct fe_priv *np = netdev_priv(dev); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1051 |
unsigned int refill_rx = np->refill_rx; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1052 |
int nr; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1053 |
|
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1054 |
while (np->cur_rx != refill_rx) { |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1055 |
struct sk_buff *skb; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1056 |
|
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1057 |
nr = refill_rx % RX_RING; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1058 |
if (np->rx_skbuff[nr] == NULL) { |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1059 |
|
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1060 |
skb = dev_alloc_skb(np->rx_buf_sz + NV_RX_ALLOC_PAD); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1061 |
if (!skb) |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1062 |
break; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1063 |
|
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1064 |
skb->dev = dev; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1065 |
np->rx_skbuff[nr] = skb; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1066 |
} else { |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1067 |
skb = np->rx_skbuff[nr]; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1068 |
} |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1069 |
np->rx_dma[nr] = pci_map_single(np->pci_dev, skb->data, |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1070 |
skb->end-skb->data, PCI_DMA_FROMDEVICE); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1071 |
if (np->desc_ver == DESC_VER_1 || np->desc_ver == DESC_VER_2) { |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1072 |
np->rx_ring.orig[nr].PacketBuffer = cpu_to_le32(np->rx_dma[nr]); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1073 |
wmb(); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1074 |
np->rx_ring.orig[nr].FlagLen = cpu_to_le32(np->rx_buf_sz | NV_RX_AVAIL); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1075 |
} else { |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1076 |
np->rx_ring.ex[nr].PacketBufferHigh = cpu_to_le64(np->rx_dma[nr]) >> 32; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1077 |
np->rx_ring.ex[nr].PacketBufferLow = cpu_to_le64(np->rx_dma[nr]) & 0x0FFFFFFFF; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1078 |
wmb(); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1079 |
np->rx_ring.ex[nr].FlagLen = cpu_to_le32(np->rx_buf_sz | NV_RX2_AVAIL); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1080 |
} |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1081 |
dprintk(KERN_DEBUG "%s: nv_alloc_rx: Packet %d marked as Available\n", |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1082 |
dev->name, refill_rx); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1083 |
refill_rx++; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1084 |
} |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1085 |
np->refill_rx = refill_rx; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1086 |
if (np->cur_rx - refill_rx == RX_RING) |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1087 |
return 1; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1088 |
return 0; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1089 |
} |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1090 |
|
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1091 |
static void nv_do_rx_refill(unsigned long data) |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1092 |
{ |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1093 |
struct net_device *dev = (struct net_device *) data; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1094 |
struct fe_priv *np = netdev_priv(dev); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1095 |
|
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1096 |
if (!using_multi_irqs(dev)) { |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1097 |
if (np->msi_flags & NV_MSI_X_ENABLED) |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1098 |
disable_irq(np->msi_x_entry[NV_MSI_X_VECTOR_ALL].vector); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1099 |
else |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1100 |
disable_irq(dev->irq); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1101 |
} else { |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1102 |
disable_irq(np->msi_x_entry[NV_MSI_X_VECTOR_RX].vector); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1103 |
} |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1104 |
if (nv_alloc_rx(dev)) { |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1105 |
spin_lock_irq(&np->lock); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1106 |
if (!np->in_shutdown) |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1107 |
mod_timer(&np->oom_kick, jiffies + OOM_REFILL); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1108 |
spin_unlock_irq(&np->lock); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1109 |
} |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1110 |
if (!using_multi_irqs(dev)) { |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1111 |
if (np->msi_flags & NV_MSI_X_ENABLED) |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1112 |
enable_irq(np->msi_x_entry[NV_MSI_X_VECTOR_ALL].vector); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1113 |
else |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1114 |
enable_irq(dev->irq); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1115 |
} else { |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1116 |
enable_irq(np->msi_x_entry[NV_MSI_X_VECTOR_RX].vector); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1117 |
} |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1118 |
} |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1119 |
|
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1120 |
static void nv_init_rx(struct net_device *dev) |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1121 |
{ |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1122 |
struct fe_priv *np = netdev_priv(dev); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1123 |
int i; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1124 |
|
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1125 |
np->cur_rx = RX_RING; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1126 |
np->refill_rx = 0; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1127 |
for (i = 0; i < RX_RING; i++) |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1128 |
if (np->desc_ver == DESC_VER_1 || np->desc_ver == DESC_VER_2) |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1129 |
np->rx_ring.orig[i].FlagLen = 0; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1130 |
else |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1131 |
np->rx_ring.ex[i].FlagLen = 0; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1132 |
} |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1133 |
|
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1134 |
static void nv_init_tx(struct net_device *dev) |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1135 |
{ |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1136 |
struct fe_priv *np = netdev_priv(dev); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1137 |
int i; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1138 |
|
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1139 |
np->next_tx = np->nic_tx = 0; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1140 |
for (i = 0; i < TX_RING; i++) { |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1141 |
if (np->desc_ver == DESC_VER_1 || np->desc_ver == DESC_VER_2) |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1142 |
np->tx_ring.orig[i].FlagLen = 0; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1143 |
else |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1144 |
np->tx_ring.ex[i].FlagLen = 0; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1145 |
np->tx_skbuff[i] = NULL; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1146 |
np->tx_dma[i] = 0; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1147 |
} |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1148 |
} |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1149 |
|
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1150 |
static int nv_init_ring(struct net_device *dev) |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1151 |
{ |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1152 |
nv_init_tx(dev); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1153 |
nv_init_rx(dev); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1154 |
return nv_alloc_rx(dev); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1155 |
} |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1156 |
|
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1157 |
static int nv_release_txskb(struct net_device *dev, unsigned int skbnr) |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1158 |
{ |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1159 |
struct fe_priv *np = netdev_priv(dev); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1160 |
|
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1161 |
dprintk(KERN_INFO "%s: nv_release_txskb for skbnr %d\n", |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1162 |
dev->name, skbnr); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1163 |
|
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1164 |
if (np->tx_dma[skbnr]) { |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1165 |
pci_unmap_page(np->pci_dev, np->tx_dma[skbnr], |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1166 |
np->tx_dma_len[skbnr], |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1167 |
PCI_DMA_TODEVICE); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1168 |
np->tx_dma[skbnr] = 0; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1169 |
} |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1170 |
|
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1171 |
if (np->tx_skbuff[skbnr]) { |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1172 |
if (!np->ecdev) dev_kfree_skb_any(np->tx_skbuff[skbnr]); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1173 |
np->tx_skbuff[skbnr] = NULL; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1174 |
return 1; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1175 |
} else { |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1176 |
return 0; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1177 |
} |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1178 |
} |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1179 |
|
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1180 |
static void nv_drain_tx(struct net_device *dev) |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1181 |
{ |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1182 |
struct fe_priv *np = netdev_priv(dev); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1183 |
unsigned int i; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1184 |
|
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1185 |
for (i = 0; i < TX_RING; i++) { |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1186 |
if (np->desc_ver == DESC_VER_1 || np->desc_ver == DESC_VER_2) |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1187 |
np->tx_ring.orig[i].FlagLen = 0; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1188 |
else |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1189 |
np->tx_ring.ex[i].FlagLen = 0; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1190 |
if (nv_release_txskb(dev, i)) |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1191 |
np->stats.tx_dropped++; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1192 |
} |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1193 |
} |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1194 |
|
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1195 |
static void nv_drain_rx(struct net_device *dev) |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1196 |
{ |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1197 |
struct fe_priv *np = netdev_priv(dev); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1198 |
int i; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1199 |
for (i = 0; i < RX_RING; i++) { |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1200 |
if (np->desc_ver == DESC_VER_1 || np->desc_ver == DESC_VER_2) |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1201 |
np->rx_ring.orig[i].FlagLen = 0; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1202 |
else |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1203 |
np->rx_ring.ex[i].FlagLen = 0; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1204 |
wmb(); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1205 |
if (np->rx_skbuff[i]) { |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1206 |
pci_unmap_single(np->pci_dev, np->rx_dma[i], |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1207 |
np->rx_skbuff[i]->end-np->rx_skbuff[i]->data, |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1208 |
PCI_DMA_FROMDEVICE); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1209 |
if (!np->ecdev) dev_kfree_skb(np->rx_skbuff[i]); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1210 |
np->rx_skbuff[i] = NULL; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1211 |
} |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1212 |
} |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1213 |
} |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1214 |
|
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1215 |
static void drain_ring(struct net_device *dev) |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1216 |
{ |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1217 |
nv_drain_tx(dev); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1218 |
nv_drain_rx(dev); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1219 |
} |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1220 |
|
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1221 |
/* |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1222 |
* nv_start_xmit: dev->hard_start_xmit function |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1223 |
* Called with dev->xmit_lock held. |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1224 |
*/ |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1225 |
static int nv_start_xmit(struct sk_buff *skb, struct net_device *dev) |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1226 |
{ |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1227 |
struct fe_priv *np = netdev_priv(dev); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1228 |
u32 tx_flags = 0; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1229 |
u32 tx_flags_extra = (np->desc_ver == DESC_VER_1 ? NV_TX_LASTPACKET : NV_TX2_LASTPACKET); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1230 |
unsigned int fragments = skb_shinfo(skb)->nr_frags; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1231 |
unsigned int nr = (np->next_tx - 1) % TX_RING; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1232 |
unsigned int start_nr = np->next_tx % TX_RING; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1233 |
unsigned int i; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1234 |
u32 offset = 0; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1235 |
u32 bcnt; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1236 |
u32 size = skb->len-skb->data_len; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1237 |
u32 entries = (size >> NV_TX2_TSO_MAX_SHIFT) + ((size & (NV_TX2_TSO_MAX_SIZE-1)) ? 1 : 0); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1238 |
u32 tx_flags_vlan = 0; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1239 |
|
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1240 |
/* add fragments to entries count */ |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1241 |
for (i = 0; i < fragments; i++) { |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1242 |
entries += (skb_shinfo(skb)->frags[i].size >> NV_TX2_TSO_MAX_SHIFT) + |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1243 |
((skb_shinfo(skb)->frags[i].size & (NV_TX2_TSO_MAX_SIZE-1)) ? 1 : 0); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1244 |
} |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1245 |
|
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1246 |
if (!np->ecdev) { |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1247 |
spin_lock_irq(&np->lock); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1248 |
|
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1249 |
if ((np->next_tx - np->nic_tx + entries - 1) > TX_LIMIT_STOP) { |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1250 |
spin_unlock_irq(&np->lock); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1251 |
netif_stop_queue(dev); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1252 |
return NETDEV_TX_BUSY; |
592
6ca369325cdd
Back-ported the running forcedeth driver from 2.6.19 to 2.6.17.
Florian Pose <fp@igh-essen.com>
parents:
581
diff
changeset
|
1253 |
} |
581
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1254 |
} |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1255 |
|
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1256 |
/* setup the header buffer */ |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1257 |
do { |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1258 |
bcnt = (size > NV_TX2_TSO_MAX_SIZE) ? NV_TX2_TSO_MAX_SIZE : size; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1259 |
nr = (nr + 1) % TX_RING; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1260 |
|
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1261 |
np->tx_dma[nr] = pci_map_single(np->pci_dev, skb->data + offset, bcnt, |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1262 |
PCI_DMA_TODEVICE); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1263 |
np->tx_dma_len[nr] = bcnt; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1264 |
|
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1265 |
if (np->desc_ver == DESC_VER_1 || np->desc_ver == DESC_VER_2) { |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1266 |
np->tx_ring.orig[nr].PacketBuffer = cpu_to_le32(np->tx_dma[nr]); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1267 |
np->tx_ring.orig[nr].FlagLen = cpu_to_le32((bcnt-1) | tx_flags); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1268 |
} else { |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1269 |
np->tx_ring.ex[nr].PacketBufferHigh = cpu_to_le64(np->tx_dma[nr]) >> 32; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1270 |
np->tx_ring.ex[nr].PacketBufferLow = cpu_to_le64(np->tx_dma[nr]) & 0x0FFFFFFFF; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1271 |
np->tx_ring.ex[nr].FlagLen = cpu_to_le32((bcnt-1) | tx_flags); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1272 |
} |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1273 |
tx_flags = np->tx_flags; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1274 |
offset += bcnt; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1275 |
size -= bcnt; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1276 |
} while(size); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1277 |
|
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1278 |
/* setup the fragments */ |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1279 |
for (i = 0; i < fragments; i++) { |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1280 |
skb_frag_t *frag = &skb_shinfo(skb)->frags[i]; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1281 |
u32 size = frag->size; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1282 |
offset = 0; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1283 |
|
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1284 |
do { |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1285 |
bcnt = (size > NV_TX2_TSO_MAX_SIZE) ? NV_TX2_TSO_MAX_SIZE : size; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1286 |
nr = (nr + 1) % TX_RING; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1287 |
|
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1288 |
np->tx_dma[nr] = pci_map_page(np->pci_dev, frag->page, frag->page_offset+offset, bcnt, |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1289 |
PCI_DMA_TODEVICE); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1290 |
np->tx_dma_len[nr] = bcnt; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1291 |
|
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1292 |
if (np->desc_ver == DESC_VER_1 || np->desc_ver == DESC_VER_2) { |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1293 |
np->tx_ring.orig[nr].PacketBuffer = cpu_to_le32(np->tx_dma[nr]); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1294 |
np->tx_ring.orig[nr].FlagLen = cpu_to_le32((bcnt-1) | tx_flags); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1295 |
} else { |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1296 |
np->tx_ring.ex[nr].PacketBufferHigh = cpu_to_le64(np->tx_dma[nr]) >> 32; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1297 |
np->tx_ring.ex[nr].PacketBufferLow = cpu_to_le64(np->tx_dma[nr]) & 0x0FFFFFFFF; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1298 |
np->tx_ring.ex[nr].FlagLen = cpu_to_le32((bcnt-1) | tx_flags); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1299 |
} |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1300 |
offset += bcnt; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1301 |
size -= bcnt; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1302 |
} while (size); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1303 |
} |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1304 |
|
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1305 |
/* set last fragment flag */ |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1306 |
if (np->desc_ver == DESC_VER_1 || np->desc_ver == DESC_VER_2) { |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1307 |
np->tx_ring.orig[nr].FlagLen |= cpu_to_le32(tx_flags_extra); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1308 |
} else { |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1309 |
np->tx_ring.ex[nr].FlagLen |= cpu_to_le32(tx_flags_extra); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1310 |
} |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1311 |
|
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1312 |
np->tx_skbuff[nr] = skb; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1313 |
|
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1314 |
#ifdef NETIF_F_TSO |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1315 |
if (skb_shinfo(skb)->tso_size) |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1316 |
tx_flags_extra = NV_TX2_TSO | (skb_shinfo(skb)->tso_size << NV_TX2_TSO_SHIFT); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1317 |
else |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1318 |
#endif |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1319 |
tx_flags_extra = (skb->ip_summed == CHECKSUM_HW ? (NV_TX2_CHECKSUM_L3|NV_TX2_CHECKSUM_L4) : 0); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1320 |
|
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1321 |
/* vlan tag */ |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1322 |
if (np->vlangrp && vlan_tx_tag_present(skb)) { |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1323 |
tx_flags_vlan = NV_TX3_VLAN_TAG_PRESENT | vlan_tx_tag_get(skb); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1324 |
} |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1325 |
|
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1326 |
/* set tx flags */ |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1327 |
if (np->desc_ver == DESC_VER_1 || np->desc_ver == DESC_VER_2) { |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1328 |
np->tx_ring.orig[start_nr].FlagLen |= cpu_to_le32(tx_flags | tx_flags_extra); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1329 |
} else { |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1330 |
np->tx_ring.ex[start_nr].TxVlan = cpu_to_le32(tx_flags_vlan); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1331 |
np->tx_ring.ex[start_nr].FlagLen |= cpu_to_le32(tx_flags | tx_flags_extra); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1332 |
} |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1333 |
|
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1334 |
dprintk(KERN_DEBUG "%s: nv_start_xmit: packet %d (entries %d) queued for transmission. tx_flags_extra: %x\n", |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1335 |
dev->name, np->next_tx, entries, tx_flags_extra); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1336 |
{ |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1337 |
int j; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1338 |
for (j=0; j<64; j++) { |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1339 |
if ((j%16) == 0) |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1340 |
dprintk("\n%03x:", j); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1341 |
dprintk(" %02x", ((unsigned char*)skb->data)[j]); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1342 |
} |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1343 |
dprintk("\n"); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1344 |
} |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1345 |
|
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1346 |
np->next_tx += entries; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1347 |
|
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1348 |
dev->trans_start = jiffies; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1349 |
if (!np->ecdev) spin_unlock_irq(&np->lock); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1350 |
writel(NVREG_TXRXCTL_KICK|np->txrxctl_bits, get_hwbase(dev) + NvRegTxRxControl); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1351 |
pci_push(get_hwbase(dev)); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1352 |
return NETDEV_TX_OK; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1353 |
} |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1354 |
|
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1355 |
/* |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1356 |
* nv_tx_done: check for completed packets, release the skbs. |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1357 |
* |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1358 |
* Caller must own np->lock. |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1359 |
*/ |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1360 |
static void nv_tx_done(struct net_device *dev) |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1361 |
{ |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1362 |
struct fe_priv *np = netdev_priv(dev); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1363 |
u32 Flags; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1364 |
unsigned int i; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1365 |
struct sk_buff *skb; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1366 |
|
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1367 |
while (np->nic_tx != np->next_tx) { |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1368 |
i = np->nic_tx % TX_RING; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1369 |
|
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1370 |
if (np->desc_ver == DESC_VER_1 || np->desc_ver == DESC_VER_2) |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1371 |
Flags = le32_to_cpu(np->tx_ring.orig[i].FlagLen); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1372 |
else |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1373 |
Flags = le32_to_cpu(np->tx_ring.ex[i].FlagLen); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1374 |
|
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1375 |
dprintk(KERN_DEBUG "%s: nv_tx_done: looking at packet %d, Flags 0x%x.\n", |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1376 |
dev->name, np->nic_tx, Flags); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1377 |
if (Flags & NV_TX_VALID) |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1378 |
break; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1379 |
if (np->desc_ver == DESC_VER_1) { |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1380 |
if (Flags & NV_TX_LASTPACKET) { |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1381 |
skb = np->tx_skbuff[i]; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1382 |
if (Flags & (NV_TX_RETRYERROR|NV_TX_CARRIERLOST|NV_TX_LATECOLLISION| |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1383 |
NV_TX_UNDERFLOW|NV_TX_ERROR)) { |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1384 |
if (Flags & NV_TX_UNDERFLOW) |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1385 |
np->stats.tx_fifo_errors++; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1386 |
if (Flags & NV_TX_CARRIERLOST) |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1387 |
np->stats.tx_carrier_errors++; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1388 |
np->stats.tx_errors++; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1389 |
} else { |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1390 |
np->stats.tx_packets++; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1391 |
np->stats.tx_bytes += skb->len; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1392 |
} |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1393 |
} |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1394 |
} else { |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1395 |
if (Flags & NV_TX2_LASTPACKET) { |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1396 |
skb = np->tx_skbuff[i]; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1397 |
if (Flags & (NV_TX2_RETRYERROR|NV_TX2_CARRIERLOST|NV_TX2_LATECOLLISION| |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1398 |
NV_TX2_UNDERFLOW|NV_TX2_ERROR)) { |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1399 |
if (Flags & NV_TX2_UNDERFLOW) |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1400 |
np->stats.tx_fifo_errors++; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1401 |
if (Flags & NV_TX2_CARRIERLOST) |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1402 |
np->stats.tx_carrier_errors++; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1403 |
np->stats.tx_errors++; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1404 |
} else { |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1405 |
np->stats.tx_packets++; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1406 |
np->stats.tx_bytes += skb->len; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1407 |
} |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1408 |
} |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1409 |
} |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1410 |
nv_release_txskb(dev, i); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1411 |
np->nic_tx++; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1412 |
} |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1413 |
if (!np->ecdev && np->next_tx - np->nic_tx < TX_LIMIT_START) |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1414 |
netif_wake_queue(dev); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1415 |
} |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1416 |
|
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1417 |
/* |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1418 |
* nv_tx_timeout: dev->tx_timeout function |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1419 |
* Called with dev->xmit_lock held. |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1420 |
*/ |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1421 |
static void nv_tx_timeout(struct net_device *dev) |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1422 |
{ |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1423 |
struct fe_priv *np = netdev_priv(dev); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1424 |
u8 __iomem *base = get_hwbase(dev); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1425 |
u32 status; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1426 |
|
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1427 |
if (np->msi_flags & NV_MSI_X_ENABLED) |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1428 |
status = readl(base + NvRegMSIXIrqStatus) & NVREG_IRQSTAT_MASK; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1429 |
else |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1430 |
status = readl(base + NvRegIrqStatus) & NVREG_IRQSTAT_MASK; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1431 |
|
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1432 |
printk(KERN_INFO "%s: Got tx_timeout. irq: %08x\n", dev->name, status); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1433 |
|
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1434 |
{ |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1435 |
int i; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1436 |
|
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1437 |
printk(KERN_INFO "%s: Ring at %lx: next %d nic %d\n", |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1438 |
dev->name, (unsigned long)np->ring_addr, |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1439 |
np->next_tx, np->nic_tx); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1440 |
printk(KERN_INFO "%s: Dumping tx registers\n", dev->name); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1441 |
for (i=0;i<=np->register_size;i+= 32) { |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1442 |
printk(KERN_INFO "%3x: %08x %08x %08x %08x %08x %08x %08x %08x\n", |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1443 |
i, |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1444 |
readl(base + i + 0), readl(base + i + 4), |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1445 |
readl(base + i + 8), readl(base + i + 12), |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1446 |
readl(base + i + 16), readl(base + i + 20), |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1447 |
readl(base + i + 24), readl(base + i + 28)); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1448 |
} |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1449 |
printk(KERN_INFO "%s: Dumping tx ring\n", dev->name); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1450 |
for (i=0;i<TX_RING;i+= 4) { |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1451 |
if (np->desc_ver == DESC_VER_1 || np->desc_ver == DESC_VER_2) { |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1452 |
printk(KERN_INFO "%03x: %08x %08x // %08x %08x // %08x %08x // %08x %08x\n", |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1453 |
i, |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1454 |
le32_to_cpu(np->tx_ring.orig[i].PacketBuffer), |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1455 |
le32_to_cpu(np->tx_ring.orig[i].FlagLen), |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1456 |
le32_to_cpu(np->tx_ring.orig[i+1].PacketBuffer), |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1457 |
le32_to_cpu(np->tx_ring.orig[i+1].FlagLen), |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1458 |
le32_to_cpu(np->tx_ring.orig[i+2].PacketBuffer), |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1459 |
le32_to_cpu(np->tx_ring.orig[i+2].FlagLen), |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1460 |
le32_to_cpu(np->tx_ring.orig[i+3].PacketBuffer), |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1461 |
le32_to_cpu(np->tx_ring.orig[i+3].FlagLen)); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1462 |
} else { |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1463 |
printk(KERN_INFO "%03x: %08x %08x %08x // %08x %08x %08x // %08x %08x %08x // %08x %08x %08x\n", |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1464 |
i, |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1465 |
le32_to_cpu(np->tx_ring.ex[i].PacketBufferHigh), |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1466 |
le32_to_cpu(np->tx_ring.ex[i].PacketBufferLow), |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1467 |
le32_to_cpu(np->tx_ring.ex[i].FlagLen), |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1468 |
le32_to_cpu(np->tx_ring.ex[i+1].PacketBufferHigh), |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1469 |
le32_to_cpu(np->tx_ring.ex[i+1].PacketBufferLow), |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1470 |
le32_to_cpu(np->tx_ring.ex[i+1].FlagLen), |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1471 |
le32_to_cpu(np->tx_ring.ex[i+2].PacketBufferHigh), |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1472 |
le32_to_cpu(np->tx_ring.ex[i+2].PacketBufferLow), |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1473 |
le32_to_cpu(np->tx_ring.ex[i+2].FlagLen), |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1474 |
le32_to_cpu(np->tx_ring.ex[i+3].PacketBufferHigh), |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1475 |
le32_to_cpu(np->tx_ring.ex[i+3].PacketBufferLow), |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1476 |
le32_to_cpu(np->tx_ring.ex[i+3].FlagLen)); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1477 |
} |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1478 |
} |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1479 |
} |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1480 |
|
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1481 |
if (!np->ecdev) spin_lock_irq(&np->lock); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1482 |
|
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1483 |
/* 1) stop tx engine */ |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1484 |
nv_stop_tx(dev); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1485 |
|
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1486 |
/* 2) check that the packets were not sent already: */ |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1487 |
nv_tx_done(dev); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1488 |
|
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1489 |
/* 3) if there are dead entries: clear everything */ |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1490 |
if (np->next_tx != np->nic_tx) { |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1491 |
printk(KERN_DEBUG "%s: tx_timeout: dead entries!\n", dev->name); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1492 |
nv_drain_tx(dev); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1493 |
np->next_tx = np->nic_tx = 0; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1494 |
setup_hw_rings(dev, NV_SETUP_TX_RING); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1495 |
if (!np->ecdev) netif_wake_queue(dev); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1496 |
} |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1497 |
|
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1498 |
/* 4) restart tx engine */ |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1499 |
nv_start_tx(dev); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1500 |
if (!np->ecdev) spin_unlock_irq(&np->lock); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1501 |
} |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1502 |
|
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1503 |
/* |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1504 |
* Called when the nic notices a mismatch between the actual data len on the |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1505 |
* wire and the len indicated in the 802 header |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1506 |
*/ |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1507 |
static int nv_getlen(struct net_device *dev, void *packet, int datalen) |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1508 |
{ |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1509 |
int hdrlen; /* length of the 802 header */ |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1510 |
int protolen; /* length as stored in the proto field */ |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1511 |
|
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1512 |
/* 1) calculate len according to header */ |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1513 |
if ( ((struct vlan_ethhdr *)packet)->h_vlan_proto == __constant_htons(ETH_P_8021Q)) { |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1514 |
protolen = ntohs( ((struct vlan_ethhdr *)packet)->h_vlan_encapsulated_proto ); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1515 |
hdrlen = VLAN_HLEN; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1516 |
} else { |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1517 |
protolen = ntohs( ((struct ethhdr *)packet)->h_proto); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1518 |
hdrlen = ETH_HLEN; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1519 |
} |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1520 |
dprintk(KERN_DEBUG "%s: nv_getlen: datalen %d, protolen %d, hdrlen %d\n", |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1521 |
dev->name, datalen, protolen, hdrlen); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1522 |
if (protolen > ETH_DATA_LEN) |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1523 |
return datalen; /* Value in proto field not a len, no checks possible */ |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1524 |
|
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1525 |
protolen += hdrlen; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1526 |
/* consistency checks: */ |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1527 |
if (datalen > ETH_ZLEN) { |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1528 |
if (datalen >= protolen) { |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1529 |
/* more data on wire than in 802 header, trim of |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1530 |
* additional data. |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1531 |
*/ |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1532 |
dprintk(KERN_DEBUG "%s: nv_getlen: accepting %d bytes.\n", |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1533 |
dev->name, protolen); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1534 |
return protolen; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1535 |
} else { |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1536 |
/* less data on wire than mentioned in header. |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1537 |
* Discard the packet. |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1538 |
*/ |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1539 |
dprintk(KERN_DEBUG "%s: nv_getlen: discarding long packet.\n", |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1540 |
dev->name); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1541 |
return -1; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1542 |
} |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1543 |
} else { |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1544 |
/* short packet. Accept only if 802 values are also short */ |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1545 |
if (protolen > ETH_ZLEN) { |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1546 |
dprintk(KERN_DEBUG "%s: nv_getlen: discarding short packet.\n", |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1547 |
dev->name); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1548 |
return -1; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1549 |
} |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1550 |
dprintk(KERN_DEBUG "%s: nv_getlen: accepting %d bytes.\n", |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1551 |
dev->name, datalen); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1552 |
return datalen; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1553 |
} |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1554 |
} |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1555 |
|
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1556 |
static void nv_rx_process(struct net_device *dev) |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1557 |
{ |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1558 |
struct fe_priv *np = netdev_priv(dev); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1559 |
u32 Flags; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1560 |
u32 vlanflags = 0; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1561 |
|
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1562 |
|
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1563 |
for (;;) { |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1564 |
struct sk_buff *skb; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1565 |
int len; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1566 |
int i; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1567 |
if (np->cur_rx - np->refill_rx >= RX_RING) |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1568 |
break; /* we scanned the whole ring - do not continue */ |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1569 |
|
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1570 |
i = np->cur_rx % RX_RING; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1571 |
if (np->desc_ver == DESC_VER_1 || np->desc_ver == DESC_VER_2) { |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1572 |
Flags = le32_to_cpu(np->rx_ring.orig[i].FlagLen); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1573 |
len = nv_descr_getlength(&np->rx_ring.orig[i], np->desc_ver); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1574 |
} else { |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1575 |
Flags = le32_to_cpu(np->rx_ring.ex[i].FlagLen); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1576 |
len = nv_descr_getlength_ex(&np->rx_ring.ex[i], np->desc_ver); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1577 |
vlanflags = le32_to_cpu(np->rx_ring.ex[i].PacketBufferLow); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1578 |
} |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1579 |
|
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1580 |
dprintk(KERN_DEBUG "%s: nv_rx_process: looking at packet %d, Flags 0x%x.\n", |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1581 |
dev->name, np->cur_rx, Flags); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1582 |
|
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1583 |
if (Flags & NV_RX_AVAIL) |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1584 |
break; /* still owned by hardware, */ |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1585 |
|
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1586 |
/* |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1587 |
* the packet is for us - immediately tear down the pci mapping. |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1588 |
* TODO: check if a prefetch of the first cacheline improves |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1589 |
* the performance. |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1590 |
*/ |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1591 |
pci_unmap_single(np->pci_dev, np->rx_dma[i], |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1592 |
np->rx_skbuff[i]->end-np->rx_skbuff[i]->data, |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1593 |
PCI_DMA_FROMDEVICE); |
592
6ca369325cdd
Back-ported the running forcedeth driver from 2.6.19 to 2.6.17.
Florian Pose <fp@igh-essen.com>
parents:
581
diff
changeset
|
1594 |
|
581
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1595 |
{ |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1596 |
int j; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1597 |
dprintk(KERN_DEBUG "Dumping packet (flags 0x%x).",Flags); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1598 |
for (j=0; j<64; j++) { |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1599 |
if ((j%16) == 0) |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1600 |
dprintk("\n%03x:", j); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1601 |
dprintk(" %02x", ((unsigned char*)np->rx_skbuff[i]->data)[j]); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1602 |
} |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1603 |
dprintk("\n"); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1604 |
} |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1605 |
/* look at what we actually got: */ |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1606 |
if (np->desc_ver == DESC_VER_1) { |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1607 |
if (!(Flags & NV_RX_DESCRIPTORVALID)) |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1608 |
goto next_pkt; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1609 |
|
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1610 |
if (Flags & NV_RX_ERROR) { |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1611 |
if (Flags & NV_RX_MISSEDFRAME) { |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1612 |
np->stats.rx_missed_errors++; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1613 |
np->stats.rx_errors++; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1614 |
goto next_pkt; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1615 |
} |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1616 |
if (Flags & (NV_RX_ERROR1|NV_RX_ERROR2|NV_RX_ERROR3)) { |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1617 |
np->stats.rx_errors++; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1618 |
goto next_pkt; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1619 |
} |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1620 |
if (Flags & NV_RX_CRCERR) { |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1621 |
np->stats.rx_crc_errors++; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1622 |
np->stats.rx_errors++; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1623 |
goto next_pkt; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1624 |
} |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1625 |
if (Flags & NV_RX_OVERFLOW) { |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1626 |
np->stats.rx_over_errors++; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1627 |
np->stats.rx_errors++; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1628 |
goto next_pkt; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1629 |
} |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1630 |
if (Flags & NV_RX_ERROR4) { |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1631 |
len = nv_getlen(dev, np->rx_skbuff[i]->data, len); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1632 |
if (len < 0) { |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1633 |
np->stats.rx_errors++; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1634 |
goto next_pkt; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1635 |
} |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1636 |
} |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1637 |
/* framing errors are soft errors. */ |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1638 |
if (Flags & NV_RX_FRAMINGERR) { |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1639 |
if (Flags & NV_RX_SUBSTRACT1) { |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1640 |
len--; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1641 |
} |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1642 |
} |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1643 |
} |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1644 |
} else { |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1645 |
if (!(Flags & NV_RX2_DESCRIPTORVALID)) |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1646 |
goto next_pkt; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1647 |
|
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1648 |
if (Flags & NV_RX2_ERROR) { |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1649 |
if (Flags & (NV_RX2_ERROR1|NV_RX2_ERROR2|NV_RX2_ERROR3)) { |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1650 |
np->stats.rx_errors++; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1651 |
goto next_pkt; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1652 |
} |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1653 |
if (Flags & NV_RX2_CRCERR) { |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1654 |
np->stats.rx_crc_errors++; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1655 |
np->stats.rx_errors++; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1656 |
goto next_pkt; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1657 |
} |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1658 |
if (Flags & NV_RX2_OVERFLOW) { |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1659 |
np->stats.rx_over_errors++; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1660 |
np->stats.rx_errors++; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1661 |
goto next_pkt; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1662 |
} |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1663 |
if (Flags & NV_RX2_ERROR4) { |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1664 |
len = nv_getlen(dev, np->rx_skbuff[i]->data, len); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1665 |
if (len < 0) { |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1666 |
np->stats.rx_errors++; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1667 |
goto next_pkt; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1668 |
} |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1669 |
} |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1670 |
/* framing errors are soft errors */ |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1671 |
if (Flags & NV_RX2_FRAMINGERR) { |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1672 |
if (Flags & NV_RX2_SUBSTRACT1) { |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1673 |
len--; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1674 |
} |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1675 |
} |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1676 |
} |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1677 |
Flags &= NV_RX2_CHECKSUMMASK; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1678 |
if (Flags == NV_RX2_CHECKSUMOK1 || |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1679 |
Flags == NV_RX2_CHECKSUMOK2 || |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1680 |
Flags == NV_RX2_CHECKSUMOK3) { |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1681 |
dprintk(KERN_DEBUG "%s: hw checksum hit!.\n", dev->name); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1682 |
np->rx_skbuff[i]->ip_summed = CHECKSUM_UNNECESSARY; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1683 |
} else { |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1684 |
dprintk(KERN_DEBUG "%s: hwchecksum miss!.\n", dev->name); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1685 |
} |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1686 |
} |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1687 |
if (np->ecdev) { |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1688 |
ecdev_receive(np->ecdev, np->rx_skbuff[i]->data, len); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1689 |
} |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1690 |
else { |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1691 |
/* got a valid packet - forward it to the network core */ |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1692 |
skb = np->rx_skbuff[i]; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1693 |
np->rx_skbuff[i] = NULL; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1694 |
|
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1695 |
skb_put(skb, len); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1696 |
skb->protocol = eth_type_trans(skb, dev); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1697 |
dprintk(KERN_DEBUG "%s: nv_rx_process: packet %d with %d bytes, proto %d accepted.\n", |
592
6ca369325cdd
Back-ported the running forcedeth driver from 2.6.19 to 2.6.17.
Florian Pose <fp@igh-essen.com>
parents:
581
diff
changeset
|
1698 |
dev->name, np->cur_rx, len, skb->protocol); |
581
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1699 |
if (np->vlangrp && (vlanflags & NV_RX3_VLAN_TAG_PRESENT)) { |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1700 |
vlan_hwaccel_rx(skb, np->vlangrp, vlanflags & NV_RX3_VLAN_TAG_MASK); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1701 |
} else { |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1702 |
netif_rx(skb); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1703 |
} |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1704 |
} |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1705 |
dev->last_rx = jiffies; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1706 |
np->stats.rx_packets++; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1707 |
np->stats.rx_bytes += len; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1708 |
next_pkt: |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1709 |
np->cur_rx++; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1710 |
} |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1711 |
} |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1712 |
|
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1713 |
static void set_bufsize(struct net_device *dev) |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1714 |
{ |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1715 |
struct fe_priv *np = netdev_priv(dev); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1716 |
|
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1717 |
if (dev->mtu <= ETH_DATA_LEN) |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1718 |
np->rx_buf_sz = ETH_DATA_LEN + NV_RX_HEADERS; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1719 |
else |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1720 |
np->rx_buf_sz = dev->mtu + NV_RX_HEADERS; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1721 |
} |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1722 |
|
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1723 |
/* |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1724 |
* nv_change_mtu: dev->change_mtu function |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1725 |
* Called with dev_base_lock held for read. |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1726 |
*/ |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1727 |
static int nv_change_mtu(struct net_device *dev, int new_mtu) |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1728 |
{ |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1729 |
struct fe_priv *np = netdev_priv(dev); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1730 |
int old_mtu; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1731 |
|
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1732 |
if (new_mtu < 64 || new_mtu > np->pkt_limit) |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1733 |
return -EINVAL; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1734 |
|
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1735 |
old_mtu = dev->mtu; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1736 |
dev->mtu = new_mtu; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1737 |
|
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1738 |
/* return early if the buffer sizes will not change */ |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1739 |
if (old_mtu <= ETH_DATA_LEN && new_mtu <= ETH_DATA_LEN) |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1740 |
return 0; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1741 |
if (old_mtu == new_mtu) |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1742 |
return 0; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1743 |
|
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1744 |
/* synchronized against open : rtnl_lock() held by caller */ |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1745 |
if (netif_running(dev)) { |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1746 |
u8 __iomem *base = get_hwbase(dev); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1747 |
/* |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1748 |
* It seems that the nic preloads valid ring entries into an |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1749 |
* internal buffer. The procedure for flushing everything is |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1750 |
* guessed, there is probably a simpler approach. |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1751 |
* Changing the MTU is a rare event, it shouldn't matter. |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1752 |
*/ |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1753 |
nv_disable_irq(dev); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1754 |
spin_lock_bh(&dev->xmit_lock); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1755 |
spin_lock(&np->lock); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1756 |
/* stop engines */ |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1757 |
nv_stop_rx(dev); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1758 |
nv_stop_tx(dev); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1759 |
nv_txrx_reset(dev); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1760 |
/* drain rx queue */ |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1761 |
nv_drain_rx(dev); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1762 |
nv_drain_tx(dev); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1763 |
/* reinit driver view of the rx queue */ |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1764 |
nv_init_rx(dev); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1765 |
nv_init_tx(dev); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1766 |
/* alloc new rx buffers */ |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1767 |
set_bufsize(dev); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1768 |
if (nv_alloc_rx(dev)) { |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1769 |
if (!np->in_shutdown) |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1770 |
mod_timer(&np->oom_kick, jiffies + OOM_REFILL); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1771 |
} |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1772 |
/* reinit nic view of the rx queue */ |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1773 |
writel(np->rx_buf_sz, base + NvRegOffloadConfig); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1774 |
setup_hw_rings(dev, NV_SETUP_RX_RING | NV_SETUP_TX_RING); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1775 |
writel( ((RX_RING-1) << NVREG_RINGSZ_RXSHIFT) + ((TX_RING-1) << NVREG_RINGSZ_TXSHIFT), |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1776 |
base + NvRegRingSizes); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1777 |
pci_push(base); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1778 |
writel(NVREG_TXRXCTL_KICK|np->txrxctl_bits, get_hwbase(dev) + NvRegTxRxControl); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1779 |
pci_push(base); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1780 |
|
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1781 |
/* restart rx engine */ |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1782 |
nv_start_rx(dev); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1783 |
nv_start_tx(dev); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1784 |
spin_unlock(&np->lock); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1785 |
spin_unlock_bh(&dev->xmit_lock); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1786 |
nv_enable_irq(dev); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1787 |
} |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1788 |
return 0; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1789 |
} |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1790 |
|
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1791 |
static void nv_copy_mac_to_hw(struct net_device *dev) |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1792 |
{ |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1793 |
u8 __iomem *base = get_hwbase(dev); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1794 |
u32 mac[2]; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1795 |
|
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1796 |
mac[0] = (dev->dev_addr[0] << 0) + (dev->dev_addr[1] << 8) + |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1797 |
(dev->dev_addr[2] << 16) + (dev->dev_addr[3] << 24); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1798 |
mac[1] = (dev->dev_addr[4] << 0) + (dev->dev_addr[5] << 8); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1799 |
|
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1800 |
writel(mac[0], base + NvRegMacAddrA); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1801 |
writel(mac[1], base + NvRegMacAddrB); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1802 |
} |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1803 |
|
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1804 |
/* |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1805 |
* nv_set_mac_address: dev->set_mac_address function |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1806 |
* Called with rtnl_lock() held. |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1807 |
*/ |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1808 |
static int nv_set_mac_address(struct net_device *dev, void *addr) |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1809 |
{ |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1810 |
struct fe_priv *np = netdev_priv(dev); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1811 |
struct sockaddr *macaddr = (struct sockaddr*)addr; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1812 |
|
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1813 |
if(!is_valid_ether_addr(macaddr->sa_data)) |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1814 |
return -EADDRNOTAVAIL; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1815 |
|
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1816 |
/* synchronized against open : rtnl_lock() held by caller */ |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1817 |
memcpy(dev->dev_addr, macaddr->sa_data, ETH_ALEN); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1818 |
|
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1819 |
if (netif_running(dev)) { |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1820 |
spin_lock_bh(&dev->xmit_lock); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1821 |
spin_lock_irq(&np->lock); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1822 |
|
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1823 |
/* stop rx engine */ |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1824 |
nv_stop_rx(dev); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1825 |
|
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1826 |
/* set mac address */ |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1827 |
nv_copy_mac_to_hw(dev); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1828 |
|
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1829 |
/* restart rx engine */ |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1830 |
nv_start_rx(dev); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1831 |
spin_unlock_irq(&np->lock); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1832 |
spin_unlock_bh(&dev->xmit_lock); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1833 |
} else { |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1834 |
nv_copy_mac_to_hw(dev); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1835 |
} |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1836 |
return 0; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1837 |
} |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1838 |
|
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1839 |
/* |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1840 |
* nv_set_multicast: dev->set_multicast function |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1841 |
* Called with dev->xmit_lock held. |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1842 |
*/ |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1843 |
static void nv_set_multicast(struct net_device *dev) |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1844 |
{ |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1845 |
struct fe_priv *np = netdev_priv(dev); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1846 |
u8 __iomem *base = get_hwbase(dev); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1847 |
u32 addr[2]; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1848 |
u32 mask[2]; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1849 |
u32 pff; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1850 |
|
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1851 |
memset(addr, 0, sizeof(addr)); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1852 |
memset(mask, 0, sizeof(mask)); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1853 |
|
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1854 |
if (dev->flags & IFF_PROMISC) { |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1855 |
printk(KERN_NOTICE "%s: Promiscuous mode enabled.\n", dev->name); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1856 |
pff = NVREG_PFF_PROMISC; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1857 |
} else { |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1858 |
pff = NVREG_PFF_MYADDR; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1859 |
|
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1860 |
if (dev->flags & IFF_ALLMULTI || dev->mc_list) { |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1861 |
u32 alwaysOff[2]; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1862 |
u32 alwaysOn[2]; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1863 |
|
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1864 |
alwaysOn[0] = alwaysOn[1] = alwaysOff[0] = alwaysOff[1] = 0xffffffff; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1865 |
if (dev->flags & IFF_ALLMULTI) { |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1866 |
alwaysOn[0] = alwaysOn[1] = alwaysOff[0] = alwaysOff[1] = 0; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1867 |
} else { |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1868 |
struct dev_mc_list *walk; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1869 |
|
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1870 |
walk = dev->mc_list; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1871 |
while (walk != NULL) { |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1872 |
u32 a, b; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1873 |
a = le32_to_cpu(*(u32 *) walk->dmi_addr); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1874 |
b = le16_to_cpu(*(u16 *) (&walk->dmi_addr[4])); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1875 |
alwaysOn[0] &= a; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1876 |
alwaysOff[0] &= ~a; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1877 |
alwaysOn[1] &= b; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1878 |
alwaysOff[1] &= ~b; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1879 |
walk = walk->next; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1880 |
} |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1881 |
} |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1882 |
addr[0] = alwaysOn[0]; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1883 |
addr[1] = alwaysOn[1]; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1884 |
mask[0] = alwaysOn[0] | alwaysOff[0]; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1885 |
mask[1] = alwaysOn[1] | alwaysOff[1]; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1886 |
} |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1887 |
} |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1888 |
addr[0] |= NVREG_MCASTADDRA_FORCE; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1889 |
pff |= NVREG_PFF_ALWAYS; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1890 |
spin_lock_irq(&np->lock); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1891 |
nv_stop_rx(dev); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1892 |
writel(addr[0], base + NvRegMulticastAddrA); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1893 |
writel(addr[1], base + NvRegMulticastAddrB); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1894 |
writel(mask[0], base + NvRegMulticastMaskA); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1895 |
writel(mask[1], base + NvRegMulticastMaskB); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1896 |
writel(pff, base + NvRegPacketFilterFlags); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1897 |
dprintk(KERN_INFO "%s: reconfiguration for multicast lists.\n", |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1898 |
dev->name); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1899 |
nv_start_rx(dev); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1900 |
spin_unlock_irq(&np->lock); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1901 |
} |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1902 |
|
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1903 |
/** |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1904 |
* nv_update_linkspeed: Setup the MAC according to the link partner |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1905 |
* @dev: Network device to be configured |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1906 |
* |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1907 |
* The function queries the PHY and checks if there is a link partner. |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1908 |
* If yes, then it sets up the MAC accordingly. Otherwise, the MAC is |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1909 |
* set to 10 MBit HD. |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1910 |
* |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1911 |
* The function returns 0 if there is no link partner and 1 if there is |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1912 |
* a good link partner. |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1913 |
*/ |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1914 |
static int nv_update_linkspeed(struct net_device *dev) |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1915 |
{ |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1916 |
struct fe_priv *np = netdev_priv(dev); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1917 |
u8 __iomem *base = get_hwbase(dev); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1918 |
int adv, lpa; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1919 |
int newls = np->linkspeed; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1920 |
int newdup = np->duplex; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1921 |
int mii_status; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1922 |
int retval = 0; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1923 |
u32 control_1000, status_1000, phyreg; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1924 |
|
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1925 |
/* BMSR_LSTATUS is latched, read it twice: |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1926 |
* we want the current value. |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1927 |
*/ |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1928 |
mii_rw(dev, np->phyaddr, MII_BMSR, MII_READ); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1929 |
mii_status = mii_rw(dev, np->phyaddr, MII_BMSR, MII_READ); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1930 |
|
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1931 |
if (!(mii_status & BMSR_LSTATUS)) { |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1932 |
dprintk(KERN_DEBUG "%s: no link detected by phy - falling back to 10HD.\n", |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1933 |
dev->name); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1934 |
newls = NVREG_LINKSPEED_FORCE|NVREG_LINKSPEED_10; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1935 |
newdup = 0; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1936 |
retval = 0; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1937 |
goto set_speed; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1938 |
} |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1939 |
|
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1940 |
if (np->autoneg == 0) { |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1941 |
dprintk(KERN_DEBUG "%s: nv_update_linkspeed: autoneg off, PHY set to 0x%04x.\n", |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1942 |
dev->name, np->fixed_mode); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1943 |
if (np->fixed_mode & LPA_100FULL) { |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1944 |
newls = NVREG_LINKSPEED_FORCE|NVREG_LINKSPEED_100; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1945 |
newdup = 1; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1946 |
} else if (np->fixed_mode & LPA_100HALF) { |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1947 |
newls = NVREG_LINKSPEED_FORCE|NVREG_LINKSPEED_100; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1948 |
newdup = 0; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1949 |
} else if (np->fixed_mode & LPA_10FULL) { |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1950 |
newls = NVREG_LINKSPEED_FORCE|NVREG_LINKSPEED_10; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1951 |
newdup = 1; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1952 |
} else { |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1953 |
newls = NVREG_LINKSPEED_FORCE|NVREG_LINKSPEED_10; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1954 |
newdup = 0; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1955 |
} |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1956 |
retval = 1; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1957 |
goto set_speed; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1958 |
} |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1959 |
/* check auto negotiation is complete */ |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1960 |
if (!(mii_status & BMSR_ANEGCOMPLETE)) { |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1961 |
/* still in autonegotiation - configure nic for 10 MBit HD and wait. */ |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1962 |
newls = NVREG_LINKSPEED_FORCE|NVREG_LINKSPEED_10; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1963 |
newdup = 0; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1964 |
retval = 0; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1965 |
dprintk(KERN_DEBUG "%s: autoneg not completed - falling back to 10HD.\n", dev->name); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1966 |
goto set_speed; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1967 |
} |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1968 |
|
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1969 |
retval = 1; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1970 |
if (np->gigabit == PHY_GIGABIT) { |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1971 |
control_1000 = mii_rw(dev, np->phyaddr, MII_1000BT_CR, MII_READ); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1972 |
status_1000 = mii_rw(dev, np->phyaddr, MII_1000BT_SR, MII_READ); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1973 |
|
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1974 |
if ((control_1000 & ADVERTISE_1000FULL) && |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1975 |
(status_1000 & LPA_1000FULL)) { |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1976 |
dprintk(KERN_DEBUG "%s: nv_update_linkspeed: GBit ethernet detected.\n", |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1977 |
dev->name); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1978 |
newls = NVREG_LINKSPEED_FORCE|NVREG_LINKSPEED_1000; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1979 |
newdup = 1; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1980 |
goto set_speed; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1981 |
} |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1982 |
} |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1983 |
|
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1984 |
adv = mii_rw(dev, np->phyaddr, MII_ADVERTISE, MII_READ); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1985 |
lpa = mii_rw(dev, np->phyaddr, MII_LPA, MII_READ); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1986 |
dprintk(KERN_DEBUG "%s: nv_update_linkspeed: PHY advertises 0x%04x, lpa 0x%04x.\n", |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1987 |
dev->name, adv, lpa); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1988 |
|
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1989 |
/* FIXME: handle parallel detection properly */ |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1990 |
lpa = lpa & adv; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1991 |
if (lpa & LPA_100FULL) { |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1992 |
newls = NVREG_LINKSPEED_FORCE|NVREG_LINKSPEED_100; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1993 |
newdup = 1; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1994 |
} else if (lpa & LPA_100HALF) { |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1995 |
newls = NVREG_LINKSPEED_FORCE|NVREG_LINKSPEED_100; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1996 |
newdup = 0; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1997 |
} else if (lpa & LPA_10FULL) { |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1998 |
newls = NVREG_LINKSPEED_FORCE|NVREG_LINKSPEED_10; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1999 |
newdup = 1; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2000 |
} else if (lpa & LPA_10HALF) { |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2001 |
newls = NVREG_LINKSPEED_FORCE|NVREG_LINKSPEED_10; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2002 |
newdup = 0; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2003 |
} else { |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2004 |
dprintk(KERN_DEBUG "%s: bad ability %04x - falling back to 10HD.\n", dev->name, lpa); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2005 |
newls = NVREG_LINKSPEED_FORCE|NVREG_LINKSPEED_10; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2006 |
newdup = 0; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2007 |
} |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2008 |
|
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2009 |
set_speed: |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2010 |
if (np->duplex == newdup && np->linkspeed == newls) |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2011 |
return retval; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2012 |
|
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2013 |
dprintk(KERN_INFO "%s: changing link setting from %d/%d to %d/%d.\n", |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2014 |
dev->name, np->linkspeed, np->duplex, newls, newdup); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2015 |
|
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2016 |
np->duplex = newdup; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2017 |
np->linkspeed = newls; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2018 |
|
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2019 |
if (np->gigabit == PHY_GIGABIT) { |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2020 |
phyreg = readl(base + NvRegRandomSeed); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2021 |
phyreg &= ~(0x3FF00); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2022 |
if ((np->linkspeed & 0xFFF) == NVREG_LINKSPEED_10) |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2023 |
phyreg |= NVREG_RNDSEED_FORCE3; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2024 |
else if ((np->linkspeed & 0xFFF) == NVREG_LINKSPEED_100) |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2025 |
phyreg |= NVREG_RNDSEED_FORCE2; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2026 |
else if ((np->linkspeed & 0xFFF) == NVREG_LINKSPEED_1000) |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2027 |
phyreg |= NVREG_RNDSEED_FORCE; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2028 |
writel(phyreg, base + NvRegRandomSeed); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2029 |
} |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2030 |
|
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2031 |
phyreg = readl(base + NvRegPhyInterface); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2032 |
phyreg &= ~(PHY_HALF|PHY_100|PHY_1000); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2033 |
if (np->duplex == 0) |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2034 |
phyreg |= PHY_HALF; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2035 |
if ((np->linkspeed & NVREG_LINKSPEED_MASK) == NVREG_LINKSPEED_100) |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2036 |
phyreg |= PHY_100; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2037 |
else if ((np->linkspeed & NVREG_LINKSPEED_MASK) == NVREG_LINKSPEED_1000) |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2038 |
phyreg |= PHY_1000; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2039 |
writel(phyreg, base + NvRegPhyInterface); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2040 |
|
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2041 |
writel(NVREG_MISC1_FORCE | ( np->duplex ? 0 : NVREG_MISC1_HD), |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2042 |
base + NvRegMisc1); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2043 |
pci_push(base); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2044 |
writel(np->linkspeed, base + NvRegLinkSpeed); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2045 |
pci_push(base); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2046 |
|
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2047 |
return retval; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2048 |
} |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2049 |
|
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2050 |
static void nv_linkchange(struct net_device *dev) |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2051 |
{ |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2052 |
struct fe_priv *np = netdev_priv(dev); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2053 |
|
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2054 |
if (np->ecdev) { |
592
6ca369325cdd
Back-ported the running forcedeth driver from 2.6.19 to 2.6.17.
Florian Pose <fp@igh-essen.com>
parents:
581
diff
changeset
|
2055 |
int link = nv_update_linkspeed(dev); |
670
f57de4585a5f
Replaced ecdev_link_state() with ecdev_set_link(); added
Florian Pose <fp@igh-essen.com>
parents:
639
diff
changeset
|
2056 |
ecdev_set_link(np->ecdev, link); |
581
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2057 |
return; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2058 |
} |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2059 |
|
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2060 |
if (nv_update_linkspeed(dev)) { |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2061 |
if (!netif_carrier_ok(dev)) { |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2062 |
netif_carrier_on(dev); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2063 |
printk(KERN_INFO "%s: link up.\n", dev->name); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2064 |
nv_start_rx(dev); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2065 |
} |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2066 |
} else { |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2067 |
if (netif_carrier_ok(dev)) { |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2068 |
netif_carrier_off(dev); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2069 |
printk(KERN_INFO "%s: link down.\n", dev->name); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2070 |
nv_stop_rx(dev); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2071 |
} |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2072 |
} |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2073 |
} |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2074 |
|
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2075 |
static void nv_link_irq(struct net_device *dev) |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2076 |
{ |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2077 |
u8 __iomem *base = get_hwbase(dev); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2078 |
u32 miistat; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2079 |
|
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2080 |
miistat = readl(base + NvRegMIIStatus); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2081 |
writel(NVREG_MIISTAT_MASK, base + NvRegMIIStatus); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2082 |
dprintk(KERN_INFO "%s: link change irq, status 0x%x.\n", dev->name, miistat); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2083 |
|
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2084 |
if (miistat & (NVREG_MIISTAT_LINKCHANGE)) |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2085 |
nv_linkchange(dev); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2086 |
dprintk(KERN_DEBUG "%s: link change notification done.\n", dev->name); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2087 |
} |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2088 |
|
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2089 |
static irqreturn_t nv_nic_irq(int foo, void *data, struct pt_regs *regs) |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2090 |
{ |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2091 |
struct net_device *dev = (struct net_device *) data; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2092 |
struct fe_priv *np = netdev_priv(dev); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2093 |
u8 __iomem *base = get_hwbase(dev); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2094 |
u32 events; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2095 |
int i; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2096 |
|
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2097 |
dprintk(KERN_DEBUG "%s: nv_nic_irq\n", dev->name); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2098 |
|
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2099 |
for (i=0; ; i++) { |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2100 |
if (!(np->msi_flags & NV_MSI_X_ENABLED)) { |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2101 |
events = readl(base + NvRegIrqStatus) & NVREG_IRQSTAT_MASK; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2102 |
writel(NVREG_IRQSTAT_MASK, base + NvRegIrqStatus); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2103 |
} else { |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2104 |
events = readl(base + NvRegMSIXIrqStatus) & NVREG_IRQSTAT_MASK; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2105 |
writel(NVREG_IRQSTAT_MASK, base + NvRegMSIXIrqStatus); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2106 |
} |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2107 |
pci_push(base); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2108 |
dprintk(KERN_DEBUG "%s: irq: %08x\n", dev->name, events); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2109 |
if (!(events & np->irqmask)) |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2110 |
break; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2111 |
|
592
6ca369325cdd
Back-ported the running forcedeth driver from 2.6.19 to 2.6.17.
Florian Pose <fp@igh-essen.com>
parents:
581
diff
changeset
|
2112 |
if (!np->ecdev) spin_lock(&np->lock); |
581
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2113 |
nv_tx_done(dev); |
592
6ca369325cdd
Back-ported the running forcedeth driver from 2.6.19 to 2.6.17.
Florian Pose <fp@igh-essen.com>
parents:
581
diff
changeset
|
2114 |
if (!np->ecdev) spin_unlock(&np->lock); |
581
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2115 |
|
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2116 |
nv_rx_process(dev); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2117 |
if (nv_alloc_rx(dev)) { |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2118 |
spin_lock(&np->lock); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2119 |
if (!np->in_shutdown) |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2120 |
mod_timer(&np->oom_kick, jiffies + OOM_REFILL); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2121 |
spin_unlock(&np->lock); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2122 |
} |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2123 |
|
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2124 |
if (events & NVREG_IRQ_LINK) { |
592
6ca369325cdd
Back-ported the running forcedeth driver from 2.6.19 to 2.6.17.
Florian Pose <fp@igh-essen.com>
parents:
581
diff
changeset
|
2125 |
if (!np->ecdev) spin_lock(&np->lock); |
581
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2126 |
nv_link_irq(dev); |
592
6ca369325cdd
Back-ported the running forcedeth driver from 2.6.19 to 2.6.17.
Florian Pose <fp@igh-essen.com>
parents:
581
diff
changeset
|
2127 |
if (!np->ecdev) spin_unlock(&np->lock); |
581
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2128 |
} |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2129 |
if (np->need_linktimer && time_after(jiffies, np->link_timeout)) { |
592
6ca369325cdd
Back-ported the running forcedeth driver from 2.6.19 to 2.6.17.
Florian Pose <fp@igh-essen.com>
parents:
581
diff
changeset
|
2130 |
if (!np->ecdev) spin_lock(&np->lock); |
581
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2131 |
nv_linkchange(dev); |
592
6ca369325cdd
Back-ported the running forcedeth driver from 2.6.19 to 2.6.17.
Florian Pose <fp@igh-essen.com>
parents:
581
diff
changeset
|
2132 |
if (!np->ecdev) spin_unlock(&np->lock); |
581
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2133 |
np->link_timeout = jiffies + LINK_TIMEOUT; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2134 |
} |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2135 |
if (events & (NVREG_IRQ_TX_ERR)) { |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2136 |
dprintk(KERN_DEBUG "%s: received irq with events 0x%x. Probably TX fail.\n", |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2137 |
dev->name, events); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2138 |
} |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2139 |
if (events & (NVREG_IRQ_UNKNOWN)) { |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2140 |
printk(KERN_DEBUG "%s: received irq with unknown events 0x%x. Please report\n", |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2141 |
dev->name, events); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2142 |
} |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2143 |
if (i > max_interrupt_work) { |
592
6ca369325cdd
Back-ported the running forcedeth driver from 2.6.19 to 2.6.17.
Florian Pose <fp@igh-essen.com>
parents:
581
diff
changeset
|
2144 |
if (!np->ecdev) { |
6ca369325cdd
Back-ported the running forcedeth driver from 2.6.19 to 2.6.17.
Florian Pose <fp@igh-essen.com>
parents:
581
diff
changeset
|
2145 |
spin_lock(&np->lock); |
6ca369325cdd
Back-ported the running forcedeth driver from 2.6.19 to 2.6.17.
Florian Pose <fp@igh-essen.com>
parents:
581
diff
changeset
|
2146 |
/* disable interrupts on the nic */ |
6ca369325cdd
Back-ported the running forcedeth driver from 2.6.19 to 2.6.17.
Florian Pose <fp@igh-essen.com>
parents:
581
diff
changeset
|
2147 |
if (!(np->msi_flags & NV_MSI_X_ENABLED)) |
6ca369325cdd
Back-ported the running forcedeth driver from 2.6.19 to 2.6.17.
Florian Pose <fp@igh-essen.com>
parents:
581
diff
changeset
|
2148 |
writel(0, base + NvRegIrqMask); |
6ca369325cdd
Back-ported the running forcedeth driver from 2.6.19 to 2.6.17.
Florian Pose <fp@igh-essen.com>
parents:
581
diff
changeset
|
2149 |
else |
6ca369325cdd
Back-ported the running forcedeth driver from 2.6.19 to 2.6.17.
Florian Pose <fp@igh-essen.com>
parents:
581
diff
changeset
|
2150 |
writel(np->irqmask, base + NvRegIrqMask); |
6ca369325cdd
Back-ported the running forcedeth driver from 2.6.19 to 2.6.17.
Florian Pose <fp@igh-essen.com>
parents:
581
diff
changeset
|
2151 |
pci_push(base); |
6ca369325cdd
Back-ported the running forcedeth driver from 2.6.19 to 2.6.17.
Florian Pose <fp@igh-essen.com>
parents:
581
diff
changeset
|
2152 |
|
6ca369325cdd
Back-ported the running forcedeth driver from 2.6.19 to 2.6.17.
Florian Pose <fp@igh-essen.com>
parents:
581
diff
changeset
|
2153 |
if (!np->in_shutdown) { |
6ca369325cdd
Back-ported the running forcedeth driver from 2.6.19 to 2.6.17.
Florian Pose <fp@igh-essen.com>
parents:
581
diff
changeset
|
2154 |
np->nic_poll_irq = np->irqmask; |
6ca369325cdd
Back-ported the running forcedeth driver from 2.6.19 to 2.6.17.
Florian Pose <fp@igh-essen.com>
parents:
581
diff
changeset
|
2155 |
mod_timer(&np->nic_poll, jiffies + POLL_WAIT); |
6ca369325cdd
Back-ported the running forcedeth driver from 2.6.19 to 2.6.17.
Florian Pose <fp@igh-essen.com>
parents:
581
diff
changeset
|
2156 |
} |
6ca369325cdd
Back-ported the running forcedeth driver from 2.6.19 to 2.6.17.
Florian Pose <fp@igh-essen.com>
parents:
581
diff
changeset
|
2157 |
spin_unlock(&np->lock); |
581
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2158 |
} |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2159 |
printk(KERN_DEBUG "%s: too many iterations (%d) in nv_nic_irq.\n", dev->name, i); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2160 |
break; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2161 |
} |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2162 |
|
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2163 |
} |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2164 |
dprintk(KERN_DEBUG "%s: nv_nic_irq completed\n", dev->name); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2165 |
|
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2166 |
return IRQ_RETVAL(i); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2167 |
} |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2168 |
|
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2169 |
static irqreturn_t nv_nic_irq_tx(int foo, void *data, struct pt_regs *regs) |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2170 |
{ |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2171 |
struct net_device *dev = (struct net_device *) data; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2172 |
struct fe_priv *np = netdev_priv(dev); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2173 |
u8 __iomem *base = get_hwbase(dev); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2174 |
u32 events; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2175 |
int i; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2176 |
|
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2177 |
dprintk(KERN_DEBUG "%s: nv_nic_irq_tx\n", dev->name); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2178 |
|
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2179 |
for (i=0; ; i++) { |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2180 |
events = readl(base + NvRegMSIXIrqStatus) & NVREG_IRQ_TX_ALL; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2181 |
writel(NVREG_IRQ_TX_ALL, base + NvRegMSIXIrqStatus); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2182 |
pci_push(base); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2183 |
dprintk(KERN_DEBUG "%s: tx irq: %08x\n", dev->name, events); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2184 |
if (!(events & np->irqmask)) |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2185 |
break; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2186 |
|
592
6ca369325cdd
Back-ported the running forcedeth driver from 2.6.19 to 2.6.17.
Florian Pose <fp@igh-essen.com>
parents:
581
diff
changeset
|
2187 |
if (!np->ecdev) spin_lock_irq(&np->lock); |
581
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2188 |
nv_tx_done(dev); |
592
6ca369325cdd
Back-ported the running forcedeth driver from 2.6.19 to 2.6.17.
Florian Pose <fp@igh-essen.com>
parents:
581
diff
changeset
|
2189 |
if (!np->ecdev) spin_unlock_irq(&np->lock); |
581
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2190 |
|
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2191 |
if (events & (NVREG_IRQ_TX_ERR)) { |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2192 |
dprintk(KERN_DEBUG "%s: received irq with events 0x%x. Probably TX fail.\n", |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2193 |
dev->name, events); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2194 |
} |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2195 |
if (i > max_interrupt_work) { |
592
6ca369325cdd
Back-ported the running forcedeth driver from 2.6.19 to 2.6.17.
Florian Pose <fp@igh-essen.com>
parents:
581
diff
changeset
|
2196 |
if (!np->ecdev) { |
6ca369325cdd
Back-ported the running forcedeth driver from 2.6.19 to 2.6.17.
Florian Pose <fp@igh-essen.com>
parents:
581
diff
changeset
|
2197 |
spin_lock_irq(&np->lock); |
6ca369325cdd
Back-ported the running forcedeth driver from 2.6.19 to 2.6.17.
Florian Pose <fp@igh-essen.com>
parents:
581
diff
changeset
|
2198 |
/* disable interrupts on the nic */ |
6ca369325cdd
Back-ported the running forcedeth driver from 2.6.19 to 2.6.17.
Florian Pose <fp@igh-essen.com>
parents:
581
diff
changeset
|
2199 |
writel(NVREG_IRQ_TX_ALL, base + NvRegIrqMask); |
6ca369325cdd
Back-ported the running forcedeth driver from 2.6.19 to 2.6.17.
Florian Pose <fp@igh-essen.com>
parents:
581
diff
changeset
|
2200 |
pci_push(base); |
6ca369325cdd
Back-ported the running forcedeth driver from 2.6.19 to 2.6.17.
Florian Pose <fp@igh-essen.com>
parents:
581
diff
changeset
|
2201 |
|
6ca369325cdd
Back-ported the running forcedeth driver from 2.6.19 to 2.6.17.
Florian Pose <fp@igh-essen.com>
parents:
581
diff
changeset
|
2202 |
if (!np->in_shutdown) { |
6ca369325cdd
Back-ported the running forcedeth driver from 2.6.19 to 2.6.17.
Florian Pose <fp@igh-essen.com>
parents:
581
diff
changeset
|
2203 |
np->nic_poll_irq |= NVREG_IRQ_TX_ALL; |
6ca369325cdd
Back-ported the running forcedeth driver from 2.6.19 to 2.6.17.
Florian Pose <fp@igh-essen.com>
parents:
581
diff
changeset
|
2204 |
mod_timer(&np->nic_poll, jiffies + POLL_WAIT); |
6ca369325cdd
Back-ported the running forcedeth driver from 2.6.19 to 2.6.17.
Florian Pose <fp@igh-essen.com>
parents:
581
diff
changeset
|
2205 |
} |
6ca369325cdd
Back-ported the running forcedeth driver from 2.6.19 to 2.6.17.
Florian Pose <fp@igh-essen.com>
parents:
581
diff
changeset
|
2206 |
spin_unlock_irq(&np->lock); |
581
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2207 |
} |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2208 |
printk(KERN_DEBUG "%s: too many iterations (%d) in nv_nic_irq_tx.\n", dev->name, i); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2209 |
break; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2210 |
} |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2211 |
|
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2212 |
} |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2213 |
dprintk(KERN_DEBUG "%s: nv_nic_irq_tx completed\n", dev->name); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2214 |
|
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2215 |
return IRQ_RETVAL(i); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2216 |
} |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2217 |
|
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2218 |
static irqreturn_t nv_nic_irq_rx(int foo, void *data, struct pt_regs *regs) |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2219 |
{ |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2220 |
struct net_device *dev = (struct net_device *) data; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2221 |
struct fe_priv *np = netdev_priv(dev); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2222 |
u8 __iomem *base = get_hwbase(dev); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2223 |
u32 events; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2224 |
int i; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2225 |
|
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2226 |
dprintk(KERN_DEBUG "%s: nv_nic_irq_rx\n", dev->name); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2227 |
|
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2228 |
for (i=0; ; i++) { |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2229 |
events = readl(base + NvRegMSIXIrqStatus) & NVREG_IRQ_RX_ALL; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2230 |
writel(NVREG_IRQ_RX_ALL, base + NvRegMSIXIrqStatus); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2231 |
pci_push(base); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2232 |
dprintk(KERN_DEBUG "%s: rx irq: %08x\n", dev->name, events); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2233 |
if (!(events & np->irqmask)) |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2234 |
break; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2235 |
|
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2236 |
nv_rx_process(dev); |
592
6ca369325cdd
Back-ported the running forcedeth driver from 2.6.19 to 2.6.17.
Florian Pose <fp@igh-essen.com>
parents:
581
diff
changeset
|
2237 |
if (nv_alloc_rx(dev) && !np->ecdev) { |
581
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2238 |
spin_lock_irq(&np->lock); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2239 |
if (!np->in_shutdown) |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2240 |
mod_timer(&np->oom_kick, jiffies + OOM_REFILL); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2241 |
spin_unlock_irq(&np->lock); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2242 |
} |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2243 |
|
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2244 |
if (i > max_interrupt_work) { |
592
6ca369325cdd
Back-ported the running forcedeth driver from 2.6.19 to 2.6.17.
Florian Pose <fp@igh-essen.com>
parents:
581
diff
changeset
|
2245 |
if (!np->ecdev) { |
6ca369325cdd
Back-ported the running forcedeth driver from 2.6.19 to 2.6.17.
Florian Pose <fp@igh-essen.com>
parents:
581
diff
changeset
|
2246 |
spin_lock_irq(&np->lock); |
6ca369325cdd
Back-ported the running forcedeth driver from 2.6.19 to 2.6.17.
Florian Pose <fp@igh-essen.com>
parents:
581
diff
changeset
|
2247 |
/* disable interrupts on the nic */ |
6ca369325cdd
Back-ported the running forcedeth driver from 2.6.19 to 2.6.17.
Florian Pose <fp@igh-essen.com>
parents:
581
diff
changeset
|
2248 |
writel(NVREG_IRQ_RX_ALL, base + NvRegIrqMask); |
6ca369325cdd
Back-ported the running forcedeth driver from 2.6.19 to 2.6.17.
Florian Pose <fp@igh-essen.com>
parents:
581
diff
changeset
|
2249 |
pci_push(base); |
6ca369325cdd
Back-ported the running forcedeth driver from 2.6.19 to 2.6.17.
Florian Pose <fp@igh-essen.com>
parents:
581
diff
changeset
|
2250 |
|
6ca369325cdd
Back-ported the running forcedeth driver from 2.6.19 to 2.6.17.
Florian Pose <fp@igh-essen.com>
parents:
581
diff
changeset
|
2251 |
if (!np->in_shutdown) { |
6ca369325cdd
Back-ported the running forcedeth driver from 2.6.19 to 2.6.17.
Florian Pose <fp@igh-essen.com>
parents:
581
diff
changeset
|
2252 |
np->nic_poll_irq |= NVREG_IRQ_RX_ALL; |
6ca369325cdd
Back-ported the running forcedeth driver from 2.6.19 to 2.6.17.
Florian Pose <fp@igh-essen.com>
parents:
581
diff
changeset
|
2253 |
mod_timer(&np->nic_poll, jiffies + POLL_WAIT); |
6ca369325cdd
Back-ported the running forcedeth driver from 2.6.19 to 2.6.17.
Florian Pose <fp@igh-essen.com>
parents:
581
diff
changeset
|
2254 |
} |
6ca369325cdd
Back-ported the running forcedeth driver from 2.6.19 to 2.6.17.
Florian Pose <fp@igh-essen.com>
parents:
581
diff
changeset
|
2255 |
spin_unlock_irq(&np->lock); |
581
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2256 |
} |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2257 |
printk(KERN_DEBUG "%s: too many iterations (%d) in nv_nic_irq_rx.\n", dev->name, i); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2258 |
break; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2259 |
} |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2260 |
|
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2261 |
} |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2262 |
dprintk(KERN_DEBUG "%s: nv_nic_irq_rx completed\n", dev->name); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2263 |
|
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2264 |
return IRQ_RETVAL(i); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2265 |
} |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2266 |
|
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2267 |
static irqreturn_t nv_nic_irq_other(int foo, void *data, struct pt_regs *regs) |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2268 |
{ |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2269 |
struct net_device *dev = (struct net_device *) data; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2270 |
struct fe_priv *np = netdev_priv(dev); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2271 |
u8 __iomem *base = get_hwbase(dev); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2272 |
u32 events; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2273 |
int i; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2274 |
|
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2275 |
dprintk(KERN_DEBUG "%s: nv_nic_irq_other\n", dev->name); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2276 |
|
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2277 |
for (i=0; ; i++) { |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2278 |
events = readl(base + NvRegMSIXIrqStatus) & NVREG_IRQ_OTHER; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2279 |
writel(NVREG_IRQ_OTHER, base + NvRegMSIXIrqStatus); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2280 |
pci_push(base); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2281 |
dprintk(KERN_DEBUG "%s: irq: %08x\n", dev->name, events); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2282 |
if (!(events & np->irqmask)) |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2283 |
break; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2284 |
|
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2285 |
if (events & NVREG_IRQ_LINK) { |
592
6ca369325cdd
Back-ported the running forcedeth driver from 2.6.19 to 2.6.17.
Florian Pose <fp@igh-essen.com>
parents:
581
diff
changeset
|
2286 |
if (!np->ecdev) spin_lock_irq(&np->lock); |
581
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2287 |
nv_link_irq(dev); |
592
6ca369325cdd
Back-ported the running forcedeth driver from 2.6.19 to 2.6.17.
Florian Pose <fp@igh-essen.com>
parents:
581
diff
changeset
|
2288 |
if (!np->ecdev) spin_unlock_irq(&np->lock); |
581
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2289 |
} |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2290 |
if (np->need_linktimer && time_after(jiffies, np->link_timeout)) { |
592
6ca369325cdd
Back-ported the running forcedeth driver from 2.6.19 to 2.6.17.
Florian Pose <fp@igh-essen.com>
parents:
581
diff
changeset
|
2291 |
if (!np->ecdev) spin_lock_irq(&np->lock); |
581
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2292 |
nv_linkchange(dev); |
592
6ca369325cdd
Back-ported the running forcedeth driver from 2.6.19 to 2.6.17.
Florian Pose <fp@igh-essen.com>
parents:
581
diff
changeset
|
2293 |
if (!np->ecdev) spin_unlock_irq(&np->lock); |
581
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2294 |
np->link_timeout = jiffies + LINK_TIMEOUT; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2295 |
} |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2296 |
if (events & (NVREG_IRQ_UNKNOWN)) { |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2297 |
printk(KERN_DEBUG "%s: received irq with unknown events 0x%x. Please report\n", |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2298 |
dev->name, events); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2299 |
} |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2300 |
if (i > max_interrupt_work) { |
592
6ca369325cdd
Back-ported the running forcedeth driver from 2.6.19 to 2.6.17.
Florian Pose <fp@igh-essen.com>
parents:
581
diff
changeset
|
2301 |
if (!np->ecdev) { |
6ca369325cdd
Back-ported the running forcedeth driver from 2.6.19 to 2.6.17.
Florian Pose <fp@igh-essen.com>
parents:
581
diff
changeset
|
2302 |
spin_lock_irq(&np->lock); |
6ca369325cdd
Back-ported the running forcedeth driver from 2.6.19 to 2.6.17.
Florian Pose <fp@igh-essen.com>
parents:
581
diff
changeset
|
2303 |
/* disable interrupts on the nic */ |
6ca369325cdd
Back-ported the running forcedeth driver from 2.6.19 to 2.6.17.
Florian Pose <fp@igh-essen.com>
parents:
581
diff
changeset
|
2304 |
writel(NVREG_IRQ_OTHER, base + NvRegIrqMask); |
6ca369325cdd
Back-ported the running forcedeth driver from 2.6.19 to 2.6.17.
Florian Pose <fp@igh-essen.com>
parents:
581
diff
changeset
|
2305 |
pci_push(base); |
6ca369325cdd
Back-ported the running forcedeth driver from 2.6.19 to 2.6.17.
Florian Pose <fp@igh-essen.com>
parents:
581
diff
changeset
|
2306 |
|
6ca369325cdd
Back-ported the running forcedeth driver from 2.6.19 to 2.6.17.
Florian Pose <fp@igh-essen.com>
parents:
581
diff
changeset
|
2307 |
if (!np->in_shutdown) { |
6ca369325cdd
Back-ported the running forcedeth driver from 2.6.19 to 2.6.17.
Florian Pose <fp@igh-essen.com>
parents:
581
diff
changeset
|
2308 |
np->nic_poll_irq |= NVREG_IRQ_OTHER; |
6ca369325cdd
Back-ported the running forcedeth driver from 2.6.19 to 2.6.17.
Florian Pose <fp@igh-essen.com>
parents:
581
diff
changeset
|
2309 |
mod_timer(&np->nic_poll, jiffies + POLL_WAIT); |
6ca369325cdd
Back-ported the running forcedeth driver from 2.6.19 to 2.6.17.
Florian Pose <fp@igh-essen.com>
parents:
581
diff
changeset
|
2310 |
} |
6ca369325cdd
Back-ported the running forcedeth driver from 2.6.19 to 2.6.17.
Florian Pose <fp@igh-essen.com>
parents:
581
diff
changeset
|
2311 |
spin_unlock_irq(&np->lock); |
581
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2312 |
} |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2313 |
printk(KERN_DEBUG "%s: too many iterations (%d) in nv_nic_irq_other.\n", dev->name, i); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2314 |
break; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2315 |
} |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2316 |
|
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2317 |
} |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2318 |
dprintk(KERN_DEBUG "%s: nv_nic_irq_other completed\n", dev->name); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2319 |
|
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2320 |
return IRQ_RETVAL(i); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2321 |
} |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2322 |
|
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2323 |
void ec_poll(struct net_device *dev) |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2324 |
{ |
592
6ca369325cdd
Back-ported the running forcedeth driver from 2.6.19 to 2.6.17.
Florian Pose <fp@igh-essen.com>
parents:
581
diff
changeset
|
2325 |
struct fe_priv *np = netdev_priv(dev); |
6ca369325cdd
Back-ported the running forcedeth driver from 2.6.19 to 2.6.17.
Florian Pose <fp@igh-essen.com>
parents:
581
diff
changeset
|
2326 |
|
6ca369325cdd
Back-ported the running forcedeth driver from 2.6.19 to 2.6.17.
Florian Pose <fp@igh-essen.com>
parents:
581
diff
changeset
|
2327 |
if (!using_multi_irqs(dev)) { |
6ca369325cdd
Back-ported the running forcedeth driver from 2.6.19 to 2.6.17.
Florian Pose <fp@igh-essen.com>
parents:
581
diff
changeset
|
2328 |
nv_nic_irq((int) 0, dev, (struct pt_regs *) NULL); |
6ca369325cdd
Back-ported the running forcedeth driver from 2.6.19 to 2.6.17.
Florian Pose <fp@igh-essen.com>
parents:
581
diff
changeset
|
2329 |
} else { |
6ca369325cdd
Back-ported the running forcedeth driver from 2.6.19 to 2.6.17.
Florian Pose <fp@igh-essen.com>
parents:
581
diff
changeset
|
2330 |
if (np->nic_poll_irq & NVREG_IRQ_RX_ALL) { |
6ca369325cdd
Back-ported the running forcedeth driver from 2.6.19 to 2.6.17.
Florian Pose <fp@igh-essen.com>
parents:
581
diff
changeset
|
2331 |
nv_nic_irq_rx((int) 0, dev, (struct pt_regs *) NULL); |
6ca369325cdd
Back-ported the running forcedeth driver from 2.6.19 to 2.6.17.
Florian Pose <fp@igh-essen.com>
parents:
581
diff
changeset
|
2332 |
} |
6ca369325cdd
Back-ported the running forcedeth driver from 2.6.19 to 2.6.17.
Florian Pose <fp@igh-essen.com>
parents:
581
diff
changeset
|
2333 |
if (np->nic_poll_irq & NVREG_IRQ_TX_ALL) { |
6ca369325cdd
Back-ported the running forcedeth driver from 2.6.19 to 2.6.17.
Florian Pose <fp@igh-essen.com>
parents:
581
diff
changeset
|
2334 |
nv_nic_irq_tx((int) 0, dev, (struct pt_regs *) NULL); |
6ca369325cdd
Back-ported the running forcedeth driver from 2.6.19 to 2.6.17.
Florian Pose <fp@igh-essen.com>
parents:
581
diff
changeset
|
2335 |
} |
6ca369325cdd
Back-ported the running forcedeth driver from 2.6.19 to 2.6.17.
Florian Pose <fp@igh-essen.com>
parents:
581
diff
changeset
|
2336 |
if (np->nic_poll_irq & NVREG_IRQ_OTHER) { |
6ca369325cdd
Back-ported the running forcedeth driver from 2.6.19 to 2.6.17.
Florian Pose <fp@igh-essen.com>
parents:
581
diff
changeset
|
2337 |
nv_nic_irq_other((int) 0, dev, (struct pt_regs *) NULL); |
6ca369325cdd
Back-ported the running forcedeth driver from 2.6.19 to 2.6.17.
Florian Pose <fp@igh-essen.com>
parents:
581
diff
changeset
|
2338 |
} |
6ca369325cdd
Back-ported the running forcedeth driver from 2.6.19 to 2.6.17.
Florian Pose <fp@igh-essen.com>
parents:
581
diff
changeset
|
2339 |
} |
581
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2340 |
} |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2341 |
|
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2342 |
static void nv_do_nic_poll(unsigned long data) |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2343 |
{ |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2344 |
struct net_device *dev = (struct net_device *) data; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2345 |
struct fe_priv *np = netdev_priv(dev); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2346 |
u8 __iomem *base = get_hwbase(dev); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2347 |
u32 mask = 0; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2348 |
|
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2349 |
/* |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2350 |
* First disable irq(s) and then |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2351 |
* reenable interrupts on the nic, we have to do this before calling |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2352 |
* nv_nic_irq because that may decide to do otherwise |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2353 |
*/ |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2354 |
|
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2355 |
if (!using_multi_irqs(dev)) { |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2356 |
if (np->msi_flags & NV_MSI_X_ENABLED) |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2357 |
disable_irq(np->msi_x_entry[NV_MSI_X_VECTOR_ALL].vector); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2358 |
else |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2359 |
disable_irq(dev->irq); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2360 |
mask = np->irqmask; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2361 |
} else { |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2362 |
if (np->nic_poll_irq & NVREG_IRQ_RX_ALL) { |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2363 |
disable_irq(np->msi_x_entry[NV_MSI_X_VECTOR_RX].vector); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2364 |
mask |= NVREG_IRQ_RX_ALL; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2365 |
} |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2366 |
if (np->nic_poll_irq & NVREG_IRQ_TX_ALL) { |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2367 |
disable_irq(np->msi_x_entry[NV_MSI_X_VECTOR_TX].vector); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2368 |
mask |= NVREG_IRQ_TX_ALL; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2369 |
} |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2370 |
if (np->nic_poll_irq & NVREG_IRQ_OTHER) { |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2371 |
disable_irq(np->msi_x_entry[NV_MSI_X_VECTOR_OTHER].vector); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2372 |
mask |= NVREG_IRQ_OTHER; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2373 |
} |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2374 |
} |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2375 |
np->nic_poll_irq = 0; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2376 |
|
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2377 |
/* FIXME: Do we need synchronize_irq(dev->irq) here? */ |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2378 |
|
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2379 |
writel(mask, base + NvRegIrqMask); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2380 |
pci_push(base); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2381 |
|
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2382 |
if (!using_multi_irqs(dev)) { |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2383 |
nv_nic_irq((int) 0, (void *) data, (struct pt_regs *) NULL); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2384 |
if (np->msi_flags & NV_MSI_X_ENABLED) |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2385 |
enable_irq(np->msi_x_entry[NV_MSI_X_VECTOR_ALL].vector); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2386 |
else |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2387 |
enable_irq(dev->irq); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2388 |
} else { |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2389 |
if (np->nic_poll_irq & NVREG_IRQ_RX_ALL) { |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2390 |
nv_nic_irq_rx((int) 0, (void *) data, (struct pt_regs *) NULL); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2391 |
enable_irq(np->msi_x_entry[NV_MSI_X_VECTOR_RX].vector); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2392 |
} |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2393 |
if (np->nic_poll_irq & NVREG_IRQ_TX_ALL) { |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2394 |
nv_nic_irq_tx((int) 0, (void *) data, (struct pt_regs *) NULL); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2395 |
enable_irq(np->msi_x_entry[NV_MSI_X_VECTOR_TX].vector); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2396 |
} |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2397 |
if (np->nic_poll_irq & NVREG_IRQ_OTHER) { |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2398 |
nv_nic_irq_other((int) 0, (void *) data, (struct pt_regs *) NULL); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2399 |
enable_irq(np->msi_x_entry[NV_MSI_X_VECTOR_OTHER].vector); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2400 |
} |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2401 |
} |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2402 |
} |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2403 |
|
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2404 |
#ifdef CONFIG_NET_POLL_CONTROLLER |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2405 |
static void nv_poll_controller(struct net_device *dev) |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2406 |
{ |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2407 |
nv_do_nic_poll((unsigned long) dev); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2408 |
} |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2409 |
#endif |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2410 |
|
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2411 |
static void nv_get_drvinfo(struct net_device *dev, struct ethtool_drvinfo *info) |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2412 |
{ |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2413 |
struct fe_priv *np = netdev_priv(dev); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2414 |
strcpy(info->driver, "forcedeth"); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2415 |
strcpy(info->version, FORCEDETH_VERSION); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2416 |
strcpy(info->bus_info, pci_name(np->pci_dev)); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2417 |
} |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2418 |
|
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2419 |
static void nv_get_wol(struct net_device *dev, struct ethtool_wolinfo *wolinfo) |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2420 |
{ |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2421 |
struct fe_priv *np = netdev_priv(dev); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2422 |
wolinfo->supported = WAKE_MAGIC; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2423 |
|
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2424 |
spin_lock_irq(&np->lock); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2425 |
if (np->wolenabled) |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2426 |
wolinfo->wolopts = WAKE_MAGIC; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2427 |
spin_unlock_irq(&np->lock); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2428 |
} |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2429 |
|
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2430 |
static int nv_set_wol(struct net_device *dev, struct ethtool_wolinfo *wolinfo) |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2431 |
{ |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2432 |
struct fe_priv *np = netdev_priv(dev); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2433 |
u8 __iomem *base = get_hwbase(dev); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2434 |
|
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2435 |
spin_lock_irq(&np->lock); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2436 |
if (wolinfo->wolopts == 0) { |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2437 |
writel(0, base + NvRegWakeUpFlags); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2438 |
np->wolenabled = 0; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2439 |
} |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2440 |
if (wolinfo->wolopts & WAKE_MAGIC) { |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2441 |
writel(NVREG_WAKEUPFLAGS_ENABLE, base + NvRegWakeUpFlags); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2442 |
np->wolenabled = 1; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2443 |
} |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2444 |
spin_unlock_irq(&np->lock); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2445 |
return 0; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2446 |
} |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2447 |
|
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2448 |
static int nv_get_settings(struct net_device *dev, struct ethtool_cmd *ecmd) |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2449 |
{ |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2450 |
struct fe_priv *np = netdev_priv(dev); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2451 |
int adv; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2452 |
|
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2453 |
spin_lock_irq(&np->lock); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2454 |
ecmd->port = PORT_MII; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2455 |
if (!netif_running(dev)) { |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2456 |
/* We do not track link speed / duplex setting if the |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2457 |
* interface is disabled. Force a link check */ |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2458 |
nv_update_linkspeed(dev); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2459 |
} |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2460 |
switch(np->linkspeed & (NVREG_LINKSPEED_MASK)) { |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2461 |
case NVREG_LINKSPEED_10: |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2462 |
ecmd->speed = SPEED_10; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2463 |
break; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2464 |
case NVREG_LINKSPEED_100: |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2465 |
ecmd->speed = SPEED_100; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2466 |
break; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2467 |
case NVREG_LINKSPEED_1000: |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2468 |
ecmd->speed = SPEED_1000; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2469 |
break; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2470 |
} |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2471 |
ecmd->duplex = DUPLEX_HALF; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2472 |
if (np->duplex) |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2473 |
ecmd->duplex = DUPLEX_FULL; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2474 |
|
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2475 |
ecmd->autoneg = np->autoneg; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2476 |
|
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2477 |
ecmd->advertising = ADVERTISED_MII; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2478 |
if (np->autoneg) { |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2479 |
ecmd->advertising |= ADVERTISED_Autoneg; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2480 |
adv = mii_rw(dev, np->phyaddr, MII_ADVERTISE, MII_READ); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2481 |
} else { |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2482 |
adv = np->fixed_mode; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2483 |
} |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2484 |
if (adv & ADVERTISE_10HALF) |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2485 |
ecmd->advertising |= ADVERTISED_10baseT_Half; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2486 |
if (adv & ADVERTISE_10FULL) |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2487 |
ecmd->advertising |= ADVERTISED_10baseT_Full; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2488 |
if (adv & ADVERTISE_100HALF) |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2489 |
ecmd->advertising |= ADVERTISED_100baseT_Half; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2490 |
if (adv & ADVERTISE_100FULL) |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2491 |
ecmd->advertising |= ADVERTISED_100baseT_Full; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2492 |
if (np->autoneg && np->gigabit == PHY_GIGABIT) { |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2493 |
adv = mii_rw(dev, np->phyaddr, MII_1000BT_CR, MII_READ); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2494 |
if (adv & ADVERTISE_1000FULL) |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2495 |
ecmd->advertising |= ADVERTISED_1000baseT_Full; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2496 |
} |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2497 |
|
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2498 |
ecmd->supported = (SUPPORTED_Autoneg | |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2499 |
SUPPORTED_10baseT_Half | SUPPORTED_10baseT_Full | |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2500 |
SUPPORTED_100baseT_Half | SUPPORTED_100baseT_Full | |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2501 |
SUPPORTED_MII); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2502 |
if (np->gigabit == PHY_GIGABIT) |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2503 |
ecmd->supported |= SUPPORTED_1000baseT_Full; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2504 |
|
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2505 |
ecmd->phy_address = np->phyaddr; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2506 |
ecmd->transceiver = XCVR_EXTERNAL; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2507 |
|
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2508 |
/* ignore maxtxpkt, maxrxpkt for now */ |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2509 |
spin_unlock_irq(&np->lock); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2510 |
return 0; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2511 |
} |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2512 |
|
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2513 |
static int nv_set_settings(struct net_device *dev, struct ethtool_cmd *ecmd) |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2514 |
{ |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2515 |
struct fe_priv *np = netdev_priv(dev); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2516 |
|
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2517 |
if (ecmd->port != PORT_MII) |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2518 |
return -EINVAL; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2519 |
if (ecmd->transceiver != XCVR_EXTERNAL) |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2520 |
return -EINVAL; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2521 |
if (ecmd->phy_address != np->phyaddr) { |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2522 |
/* TODO: support switching between multiple phys. Should be |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2523 |
* trivial, but not enabled due to lack of test hardware. */ |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2524 |
return -EINVAL; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2525 |
} |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2526 |
if (ecmd->autoneg == AUTONEG_ENABLE) { |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2527 |
u32 mask; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2528 |
|
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2529 |
mask = ADVERTISED_10baseT_Half | ADVERTISED_10baseT_Full | |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2530 |
ADVERTISED_100baseT_Half | ADVERTISED_100baseT_Full; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2531 |
if (np->gigabit == PHY_GIGABIT) |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2532 |
mask |= ADVERTISED_1000baseT_Full; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2533 |
|
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2534 |
if ((ecmd->advertising & mask) == 0) |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2535 |
return -EINVAL; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2536 |
|
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2537 |
} else if (ecmd->autoneg == AUTONEG_DISABLE) { |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2538 |
/* Note: autonegotiation disable, speed 1000 intentionally |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2539 |
* forbidden - noone should need that. */ |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2540 |
|
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2541 |
if (ecmd->speed != SPEED_10 && ecmd->speed != SPEED_100) |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2542 |
return -EINVAL; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2543 |
if (ecmd->duplex != DUPLEX_HALF && ecmd->duplex != DUPLEX_FULL) |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2544 |
return -EINVAL; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2545 |
} else { |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2546 |
return -EINVAL; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2547 |
} |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2548 |
|
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2549 |
spin_lock_irq(&np->lock); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2550 |
if (ecmd->autoneg == AUTONEG_ENABLE) { |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2551 |
int adv, bmcr; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2552 |
|
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2553 |
np->autoneg = 1; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2554 |
|
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2555 |
/* advertise only what has been requested */ |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2556 |
adv = mii_rw(dev, np->phyaddr, MII_ADVERTISE, MII_READ); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2557 |
adv &= ~(ADVERTISE_ALL | ADVERTISE_100BASE4); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2558 |
if (ecmd->advertising & ADVERTISED_10baseT_Half) |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2559 |
adv |= ADVERTISE_10HALF; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2560 |
if (ecmd->advertising & ADVERTISED_10baseT_Full) |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2561 |
adv |= ADVERTISE_10FULL; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2562 |
if (ecmd->advertising & ADVERTISED_100baseT_Half) |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2563 |
adv |= ADVERTISE_100HALF; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2564 |
if (ecmd->advertising & ADVERTISED_100baseT_Full) |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2565 |
adv |= ADVERTISE_100FULL; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2566 |
mii_rw(dev, np->phyaddr, MII_ADVERTISE, adv); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2567 |
|
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2568 |
if (np->gigabit == PHY_GIGABIT) { |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2569 |
adv = mii_rw(dev, np->phyaddr, MII_1000BT_CR, MII_READ); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2570 |
adv &= ~ADVERTISE_1000FULL; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2571 |
if (ecmd->advertising & ADVERTISED_1000baseT_Full) |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2572 |
adv |= ADVERTISE_1000FULL; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2573 |
mii_rw(dev, np->phyaddr, MII_1000BT_CR, adv); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2574 |
} |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2575 |
|
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2576 |
bmcr = mii_rw(dev, np->phyaddr, MII_BMCR, MII_READ); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2577 |
bmcr |= (BMCR_ANENABLE | BMCR_ANRESTART); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2578 |
mii_rw(dev, np->phyaddr, MII_BMCR, bmcr); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2579 |
|
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2580 |
} else { |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2581 |
int adv, bmcr; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2582 |
|
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2583 |
np->autoneg = 0; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2584 |
|
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2585 |
adv = mii_rw(dev, np->phyaddr, MII_ADVERTISE, MII_READ); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2586 |
adv &= ~(ADVERTISE_ALL | ADVERTISE_100BASE4); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2587 |
if (ecmd->speed == SPEED_10 && ecmd->duplex == DUPLEX_HALF) |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2588 |
adv |= ADVERTISE_10HALF; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2589 |
if (ecmd->speed == SPEED_10 && ecmd->duplex == DUPLEX_FULL) |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2590 |
adv |= ADVERTISE_10FULL; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2591 |
if (ecmd->speed == SPEED_100 && ecmd->duplex == DUPLEX_HALF) |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2592 |
adv |= ADVERTISE_100HALF; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2593 |
if (ecmd->speed == SPEED_100 && ecmd->duplex == DUPLEX_FULL) |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2594 |
adv |= ADVERTISE_100FULL; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2595 |
mii_rw(dev, np->phyaddr, MII_ADVERTISE, adv); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2596 |
np->fixed_mode = adv; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2597 |
|
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2598 |
if (np->gigabit == PHY_GIGABIT) { |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2599 |
adv = mii_rw(dev, np->phyaddr, MII_1000BT_CR, MII_READ); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2600 |
adv &= ~ADVERTISE_1000FULL; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2601 |
mii_rw(dev, np->phyaddr, MII_1000BT_CR, adv); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2602 |
} |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2603 |
|
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2604 |
bmcr = mii_rw(dev, np->phyaddr, MII_BMCR, MII_READ); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2605 |
bmcr |= ~(BMCR_ANENABLE|BMCR_SPEED100|BMCR_FULLDPLX); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2606 |
if (adv & (ADVERTISE_10FULL|ADVERTISE_100FULL)) |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2607 |
bmcr |= BMCR_FULLDPLX; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2608 |
if (adv & (ADVERTISE_100HALF|ADVERTISE_100FULL)) |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2609 |
bmcr |= BMCR_SPEED100; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2610 |
mii_rw(dev, np->phyaddr, MII_BMCR, bmcr); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2611 |
|
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2612 |
if (netif_running(dev)) { |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2613 |
/* Wait a bit and then reconfigure the nic. */ |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2614 |
udelay(10); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2615 |
nv_linkchange(dev); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2616 |
} |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2617 |
} |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2618 |
spin_unlock_irq(&np->lock); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2619 |
|
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2620 |
return 0; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2621 |
} |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2622 |
|
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2623 |
#define FORCEDETH_REGS_VER 1 |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2624 |
|
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2625 |
static int nv_get_regs_len(struct net_device *dev) |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2626 |
{ |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2627 |
struct fe_priv *np = netdev_priv(dev); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2628 |
return np->register_size; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2629 |
} |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2630 |
|
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2631 |
static void nv_get_regs(struct net_device *dev, struct ethtool_regs *regs, void *buf) |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2632 |
{ |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2633 |
struct fe_priv *np = netdev_priv(dev); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2634 |
u8 __iomem *base = get_hwbase(dev); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2635 |
u32 *rbuf = buf; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2636 |
int i; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2637 |
|
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2638 |
regs->version = FORCEDETH_REGS_VER; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2639 |
spin_lock_irq(&np->lock); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2640 |
for (i = 0;i <= np->register_size/sizeof(u32); i++) |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2641 |
rbuf[i] = readl(base + i*sizeof(u32)); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2642 |
spin_unlock_irq(&np->lock); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2643 |
} |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2644 |
|
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2645 |
static int nv_nway_reset(struct net_device *dev) |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2646 |
{ |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2647 |
struct fe_priv *np = netdev_priv(dev); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2648 |
int ret; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2649 |
|
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2650 |
spin_lock_irq(&np->lock); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2651 |
if (np->autoneg) { |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2652 |
int bmcr; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2653 |
|
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2654 |
bmcr = mii_rw(dev, np->phyaddr, MII_BMCR, MII_READ); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2655 |
bmcr |= (BMCR_ANENABLE | BMCR_ANRESTART); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2656 |
mii_rw(dev, np->phyaddr, MII_BMCR, bmcr); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2657 |
|
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2658 |
ret = 0; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2659 |
} else { |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2660 |
ret = -EINVAL; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2661 |
} |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2662 |
spin_unlock_irq(&np->lock); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2663 |
|
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2664 |
return ret; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2665 |
} |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2666 |
|
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2667 |
#ifdef NETIF_F_TSO |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2668 |
static int nv_set_tso(struct net_device *dev, u32 value) |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2669 |
{ |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2670 |
struct fe_priv *np = netdev_priv(dev); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2671 |
|
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2672 |
if ((np->driver_data & DEV_HAS_CHECKSUM)) |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2673 |
return ethtool_op_set_tso(dev, value); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2674 |
else |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2675 |
return value ? -EOPNOTSUPP : 0; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2676 |
} |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2677 |
#endif |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2678 |
|
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2679 |
static struct ethtool_ops ops = { |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2680 |
.get_drvinfo = nv_get_drvinfo, |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2681 |
.get_link = ethtool_op_get_link, |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2682 |
.get_wol = nv_get_wol, |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2683 |
.set_wol = nv_set_wol, |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2684 |
.get_settings = nv_get_settings, |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2685 |
.set_settings = nv_set_settings, |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2686 |
.get_regs_len = nv_get_regs_len, |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2687 |
.get_regs = nv_get_regs, |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2688 |
.nway_reset = nv_nway_reset, |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2689 |
.get_perm_addr = ethtool_op_get_perm_addr, |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2690 |
#ifdef NETIF_F_TSO |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2691 |
.get_tso = ethtool_op_get_tso, |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2692 |
.set_tso = nv_set_tso |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2693 |
#endif |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2694 |
}; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2695 |
|
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2696 |
static void nv_vlan_rx_register(struct net_device *dev, struct vlan_group *grp) |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2697 |
{ |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2698 |
struct fe_priv *np = get_nvpriv(dev); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2699 |
|
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2700 |
spin_lock_irq(&np->lock); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2701 |
|
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2702 |
/* save vlan group */ |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2703 |
np->vlangrp = grp; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2704 |
|
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2705 |
if (grp) { |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2706 |
/* enable vlan on MAC */ |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2707 |
np->txrxctl_bits |= NVREG_TXRXCTL_VLANSTRIP | NVREG_TXRXCTL_VLANINS; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2708 |
} else { |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2709 |
/* disable vlan on MAC */ |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2710 |
np->txrxctl_bits &= ~NVREG_TXRXCTL_VLANSTRIP; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2711 |
np->txrxctl_bits &= ~NVREG_TXRXCTL_VLANINS; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2712 |
} |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2713 |
|
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2714 |
writel(np->txrxctl_bits, get_hwbase(dev) + NvRegTxRxControl); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2715 |
|
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2716 |
spin_unlock_irq(&np->lock); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2717 |
}; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2718 |
|
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2719 |
static void nv_vlan_rx_kill_vid(struct net_device *dev, unsigned short vid) |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2720 |
{ |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2721 |
/* nothing to do */ |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2722 |
}; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2723 |
|
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2724 |
static void set_msix_vector_map(struct net_device *dev, u32 vector, u32 irqmask) |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2725 |
{ |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2726 |
u8 __iomem *base = get_hwbase(dev); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2727 |
int i; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2728 |
u32 msixmap = 0; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2729 |
|
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2730 |
/* Each interrupt bit can be mapped to a MSIX vector (4 bits). |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2731 |
* MSIXMap0 represents the first 8 interrupts and MSIXMap1 represents |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2732 |
* the remaining 8 interrupts. |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2733 |
*/ |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2734 |
for (i = 0; i < 8; i++) { |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2735 |
if ((irqmask >> i) & 0x1) { |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2736 |
msixmap |= vector << (i << 2); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2737 |
} |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2738 |
} |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2739 |
writel(readl(base + NvRegMSIXMap0) | msixmap, base + NvRegMSIXMap0); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2740 |
|
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2741 |
msixmap = 0; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2742 |
for (i = 0; i < 8; i++) { |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2743 |
if ((irqmask >> (i + 8)) & 0x1) { |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2744 |
msixmap |= vector << (i << 2); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2745 |
} |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2746 |
} |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2747 |
writel(readl(base + NvRegMSIXMap1) | msixmap, base + NvRegMSIXMap1); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2748 |
} |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2749 |
|
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2750 |
static int nv_request_irq(struct net_device *dev) |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2751 |
{ |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2752 |
struct fe_priv *np = get_nvpriv(dev); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2753 |
u8 __iomem *base = get_hwbase(dev); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2754 |
int ret = 1; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2755 |
int i; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2756 |
|
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2757 |
if (np->msi_flags & NV_MSI_X_CAPABLE) { |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2758 |
for (i = 0; i < (np->msi_flags & NV_MSI_X_VECTORS_MASK); i++) { |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2759 |
np->msi_x_entry[i].entry = i; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2760 |
} |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2761 |
if ((ret = pci_enable_msix(np->pci_dev, np->msi_x_entry, (np->msi_flags & NV_MSI_X_VECTORS_MASK))) == 0) { |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2762 |
np->msi_flags |= NV_MSI_X_ENABLED; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2763 |
if (optimization_mode == NV_OPTIMIZATION_MODE_THROUGHPUT) { |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2764 |
/* Request irq for rx handling */ |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2765 |
if (request_irq(np->msi_x_entry[NV_MSI_X_VECTOR_RX].vector, &nv_nic_irq_rx, SA_SHIRQ, dev->name, dev) != 0) { |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2766 |
printk(KERN_INFO "forcedeth: request_irq failed for rx %d\n", ret); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2767 |
pci_disable_msix(np->pci_dev); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2768 |
np->msi_flags &= ~NV_MSI_X_ENABLED; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2769 |
goto out_err; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2770 |
} |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2771 |
/* Request irq for tx handling */ |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2772 |
if (request_irq(np->msi_x_entry[NV_MSI_X_VECTOR_TX].vector, &nv_nic_irq_tx, SA_SHIRQ, dev->name, dev) != 0) { |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2773 |
printk(KERN_INFO "forcedeth: request_irq failed for tx %d\n", ret); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2774 |
pci_disable_msix(np->pci_dev); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2775 |
np->msi_flags &= ~NV_MSI_X_ENABLED; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2776 |
goto out_free_rx; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2777 |
} |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2778 |
/* Request irq for link and timer handling */ |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2779 |
if (request_irq(np->msi_x_entry[NV_MSI_X_VECTOR_OTHER].vector, &nv_nic_irq_other, SA_SHIRQ, dev->name, dev) != 0) { |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2780 |
printk(KERN_INFO "forcedeth: request_irq failed for link %d\n", ret); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2781 |
pci_disable_msix(np->pci_dev); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2782 |
np->msi_flags &= ~NV_MSI_X_ENABLED; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2783 |
goto out_free_tx; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2784 |
} |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2785 |
/* map interrupts to their respective vector */ |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2786 |
writel(0, base + NvRegMSIXMap0); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2787 |
writel(0, base + NvRegMSIXMap1); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2788 |
set_msix_vector_map(dev, NV_MSI_X_VECTOR_RX, NVREG_IRQ_RX_ALL); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2789 |
set_msix_vector_map(dev, NV_MSI_X_VECTOR_TX, NVREG_IRQ_TX_ALL); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2790 |
set_msix_vector_map(dev, NV_MSI_X_VECTOR_OTHER, NVREG_IRQ_OTHER); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2791 |
} else { |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2792 |
/* Request irq for all interrupts */ |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2793 |
if (request_irq(np->msi_x_entry[NV_MSI_X_VECTOR_ALL].vector, &nv_nic_irq, SA_SHIRQ, dev->name, dev) != 0) { |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2794 |
printk(KERN_INFO "forcedeth: request_irq failed %d\n", ret); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2795 |
pci_disable_msix(np->pci_dev); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2796 |
np->msi_flags &= ~NV_MSI_X_ENABLED; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2797 |
goto out_err; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2798 |
} |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2799 |
|
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2800 |
/* map interrupts to vector 0 */ |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2801 |
writel(0, base + NvRegMSIXMap0); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2802 |
writel(0, base + NvRegMSIXMap1); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2803 |
} |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2804 |
} |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2805 |
} |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2806 |
if (ret != 0 && np->msi_flags & NV_MSI_CAPABLE) { |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2807 |
if ((ret = pci_enable_msi(np->pci_dev)) == 0) { |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2808 |
np->msi_flags |= NV_MSI_ENABLED; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2809 |
if (request_irq(np->pci_dev->irq, &nv_nic_irq, SA_SHIRQ, dev->name, dev) != 0) { |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2810 |
printk(KERN_INFO "forcedeth: request_irq failed %d\n", ret); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2811 |
pci_disable_msi(np->pci_dev); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2812 |
np->msi_flags &= ~NV_MSI_ENABLED; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2813 |
goto out_err; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2814 |
} |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2815 |
|
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2816 |
/* map interrupts to vector 0 */ |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2817 |
writel(0, base + NvRegMSIMap0); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2818 |
writel(0, base + NvRegMSIMap1); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2819 |
/* enable msi vector 0 */ |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2820 |
writel(NVREG_MSI_VECTOR_0_ENABLED, base + NvRegMSIIrqMask); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2821 |
} |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2822 |
} |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2823 |
if (ret != 0) { |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2824 |
if (request_irq(np->pci_dev->irq, &nv_nic_irq, SA_SHIRQ, dev->name, dev) != 0) |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2825 |
goto out_err; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2826 |
} |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2827 |
|
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2828 |
return 0; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2829 |
out_free_tx: |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2830 |
free_irq(np->msi_x_entry[NV_MSI_X_VECTOR_TX].vector, dev); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2831 |
out_free_rx: |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2832 |
free_irq(np->msi_x_entry[NV_MSI_X_VECTOR_RX].vector, dev); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2833 |
out_err: |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2834 |
return 1; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2835 |
} |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2836 |
|
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2837 |
static void nv_free_irq(struct net_device *dev) |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2838 |
{ |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2839 |
struct fe_priv *np = get_nvpriv(dev); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2840 |
int i; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2841 |
|
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2842 |
if (np->msi_flags & NV_MSI_X_ENABLED) { |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2843 |
for (i = 0; i < (np->msi_flags & NV_MSI_X_VECTORS_MASK); i++) { |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2844 |
free_irq(np->msi_x_entry[i].vector, dev); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2845 |
} |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2846 |
pci_disable_msix(np->pci_dev); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2847 |
np->msi_flags &= ~NV_MSI_X_ENABLED; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2848 |
} else { |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2849 |
free_irq(np->pci_dev->irq, dev); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2850 |
if (np->msi_flags & NV_MSI_ENABLED) { |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2851 |
pci_disable_msi(np->pci_dev); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2852 |
np->msi_flags &= ~NV_MSI_ENABLED; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2853 |
} |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2854 |
} |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2855 |
} |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2856 |
|
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2857 |
static int nv_open(struct net_device *dev) |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2858 |
{ |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2859 |
struct fe_priv *np = netdev_priv(dev); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2860 |
u8 __iomem *base = get_hwbase(dev); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2861 |
int ret = 1; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2862 |
int oom, i; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2863 |
|
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2864 |
dprintk(KERN_DEBUG "nv_open: begin\n"); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2865 |
|
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2866 |
/* 1) erase previous misconfiguration */ |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2867 |
if (np->driver_data & DEV_HAS_POWER_CNTRL) |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2868 |
nv_mac_reset(dev); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2869 |
/* 4.1-1: stop adapter: ignored, 4.3 seems to be overkill */ |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2870 |
writel(NVREG_MCASTADDRA_FORCE, base + NvRegMulticastAddrA); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2871 |
writel(0, base + NvRegMulticastAddrB); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2872 |
writel(0, base + NvRegMulticastMaskA); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2873 |
writel(0, base + NvRegMulticastMaskB); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2874 |
writel(0, base + NvRegPacketFilterFlags); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2875 |
|
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2876 |
writel(0, base + NvRegTransmitterControl); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2877 |
writel(0, base + NvRegReceiverControl); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2878 |
|
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2879 |
writel(0, base + NvRegAdapterControl); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2880 |
|
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2881 |
/* 2) initialize descriptor rings */ |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2882 |
set_bufsize(dev); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2883 |
oom = nv_init_ring(dev); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2884 |
|
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2885 |
writel(0, base + NvRegLinkSpeed); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2886 |
writel(0, base + NvRegUnknownTransmitterReg); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2887 |
nv_txrx_reset(dev); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2888 |
writel(0, base + NvRegUnknownSetupReg6); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2889 |
|
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2890 |
np->in_shutdown = 0; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2891 |
|
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2892 |
/* 3) set mac address */ |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2893 |
nv_copy_mac_to_hw(dev); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2894 |
|
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2895 |
/* 4) give hw rings */ |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2896 |
setup_hw_rings(dev, NV_SETUP_RX_RING | NV_SETUP_TX_RING); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2897 |
writel( ((RX_RING-1) << NVREG_RINGSZ_RXSHIFT) + ((TX_RING-1) << NVREG_RINGSZ_TXSHIFT), |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2898 |
base + NvRegRingSizes); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2899 |
|
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2900 |
/* 5) continue setup */ |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2901 |
writel(np->linkspeed, base + NvRegLinkSpeed); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2902 |
writel(NVREG_UNKSETUP3_VAL1, base + NvRegUnknownSetupReg3); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2903 |
writel(np->txrxctl_bits, base + NvRegTxRxControl); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2904 |
writel(np->vlanctl_bits, base + NvRegVlanControl); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2905 |
pci_push(base); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2906 |
writel(NVREG_TXRXCTL_BIT1|np->txrxctl_bits, base + NvRegTxRxControl); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2907 |
reg_delay(dev, NvRegUnknownSetupReg5, NVREG_UNKSETUP5_BIT31, NVREG_UNKSETUP5_BIT31, |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2908 |
NV_SETUP5_DELAY, NV_SETUP5_DELAYMAX, |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2909 |
KERN_INFO "open: SetupReg5, Bit 31 remained off\n"); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2910 |
|
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2911 |
writel(0, base + NvRegUnknownSetupReg4); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2912 |
writel(NVREG_IRQSTAT_MASK, base + NvRegIrqStatus); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2913 |
writel(NVREG_MIISTAT_MASK2, base + NvRegMIIStatus); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2914 |
|
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2915 |
/* 6) continue setup */ |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2916 |
writel(NVREG_MISC1_FORCE | NVREG_MISC1_HD, base + NvRegMisc1); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2917 |
writel(readl(base + NvRegTransmitterStatus), base + NvRegTransmitterStatus); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2918 |
writel(NVREG_PFF_ALWAYS, base + NvRegPacketFilterFlags); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2919 |
writel(np->rx_buf_sz, base + NvRegOffloadConfig); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2920 |
|
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2921 |
writel(readl(base + NvRegReceiverStatus), base + NvRegReceiverStatus); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2922 |
get_random_bytes(&i, sizeof(i)); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2923 |
writel(NVREG_RNDSEED_FORCE | (i&NVREG_RNDSEED_MASK), base + NvRegRandomSeed); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2924 |
writel(NVREG_UNKSETUP1_VAL, base + NvRegUnknownSetupReg1); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2925 |
writel(NVREG_UNKSETUP2_VAL, base + NvRegUnknownSetupReg2); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2926 |
if (poll_interval == -1) { |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2927 |
if (optimization_mode == NV_OPTIMIZATION_MODE_THROUGHPUT) |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2928 |
writel(NVREG_POLL_DEFAULT_THROUGHPUT, base + NvRegPollingInterval); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2929 |
else |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2930 |
writel(NVREG_POLL_DEFAULT_CPU, base + NvRegPollingInterval); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2931 |
} |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2932 |
else |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2933 |
writel(poll_interval & 0xFFFF, base + NvRegPollingInterval); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2934 |
writel(NVREG_UNKSETUP6_VAL, base + NvRegUnknownSetupReg6); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2935 |
writel((np->phyaddr << NVREG_ADAPTCTL_PHYSHIFT)|NVREG_ADAPTCTL_PHYVALID|NVREG_ADAPTCTL_RUNNING, |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2936 |
base + NvRegAdapterControl); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2937 |
writel(NVREG_MIISPEED_BIT8|NVREG_MIIDELAY, base + NvRegMIISpeed); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2938 |
writel(NVREG_UNKSETUP4_VAL, base + NvRegUnknownSetupReg4); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2939 |
writel(NVREG_WAKEUPFLAGS_VAL, base + NvRegWakeUpFlags); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2940 |
|
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2941 |
i = readl(base + NvRegPowerState); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2942 |
if ( (i & NVREG_POWERSTATE_POWEREDUP) == 0) |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2943 |
writel(NVREG_POWERSTATE_POWEREDUP|i, base + NvRegPowerState); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2944 |
|
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2945 |
pci_push(base); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2946 |
udelay(10); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2947 |
writel(readl(base + NvRegPowerState) | NVREG_POWERSTATE_VALID, base + NvRegPowerState); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2948 |
|
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2949 |
nv_disable_hw_interrupts(dev, np->irqmask); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2950 |
pci_push(base); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2951 |
writel(NVREG_MIISTAT_MASK2, base + NvRegMIIStatus); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2952 |
writel(NVREG_IRQSTAT_MASK, base + NvRegIrqStatus); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2953 |
pci_push(base); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2954 |
|
592
6ca369325cdd
Back-ported the running forcedeth driver from 2.6.19 to 2.6.17.
Florian Pose <fp@igh-essen.com>
parents:
581
diff
changeset
|
2955 |
if (!np->ecdev) { |
6ca369325cdd
Back-ported the running forcedeth driver from 2.6.19 to 2.6.17.
Florian Pose <fp@igh-essen.com>
parents:
581
diff
changeset
|
2956 |
if (nv_request_irq(dev)) { |
6ca369325cdd
Back-ported the running forcedeth driver from 2.6.19 to 2.6.17.
Florian Pose <fp@igh-essen.com>
parents:
581
diff
changeset
|
2957 |
goto out_drain; |
6ca369325cdd
Back-ported the running forcedeth driver from 2.6.19 to 2.6.17.
Florian Pose <fp@igh-essen.com>
parents:
581
diff
changeset
|
2958 |
} |
6ca369325cdd
Back-ported the running forcedeth driver from 2.6.19 to 2.6.17.
Florian Pose <fp@igh-essen.com>
parents:
581
diff
changeset
|
2959 |
|
6ca369325cdd
Back-ported the running forcedeth driver from 2.6.19 to 2.6.17.
Florian Pose <fp@igh-essen.com>
parents:
581
diff
changeset
|
2960 |
/* ask for interrupts */ |
6ca369325cdd
Back-ported the running forcedeth driver from 2.6.19 to 2.6.17.
Florian Pose <fp@igh-essen.com>
parents:
581
diff
changeset
|
2961 |
nv_enable_hw_interrupts(dev, np->irqmask); |
6ca369325cdd
Back-ported the running forcedeth driver from 2.6.19 to 2.6.17.
Florian Pose <fp@igh-essen.com>
parents:
581
diff
changeset
|
2962 |
|
6ca369325cdd
Back-ported the running forcedeth driver from 2.6.19 to 2.6.17.
Florian Pose <fp@igh-essen.com>
parents:
581
diff
changeset
|
2963 |
spin_lock_irq(&np->lock); |
6ca369325cdd
Back-ported the running forcedeth driver from 2.6.19 to 2.6.17.
Florian Pose <fp@igh-essen.com>
parents:
581
diff
changeset
|
2964 |
} |
6ca369325cdd
Back-ported the running forcedeth driver from 2.6.19 to 2.6.17.
Florian Pose <fp@igh-essen.com>
parents:
581
diff
changeset
|
2965 |
|
581
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2966 |
writel(NVREG_MCASTADDRA_FORCE, base + NvRegMulticastAddrA); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2967 |
writel(0, base + NvRegMulticastAddrB); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2968 |
writel(0, base + NvRegMulticastMaskA); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2969 |
writel(0, base + NvRegMulticastMaskB); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2970 |
writel(NVREG_PFF_ALWAYS|NVREG_PFF_MYADDR, base + NvRegPacketFilterFlags); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2971 |
/* One manual link speed update: Interrupts are enabled, future link |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2972 |
* speed changes cause interrupts and are handled by nv_link_irq(). |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2973 |
*/ |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2974 |
{ |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2975 |
u32 miistat; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2976 |
miistat = readl(base + NvRegMIIStatus); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2977 |
writel(NVREG_MIISTAT_MASK, base + NvRegMIIStatus); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2978 |
dprintk(KERN_INFO "startup: got 0x%08x.\n", miistat); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2979 |
} |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2980 |
/* set linkspeed to invalid value, thus force nv_update_linkspeed |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2981 |
* to init hw */ |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2982 |
np->linkspeed = 0; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2983 |
ret = nv_update_linkspeed(dev); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2984 |
nv_start_rx(dev); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2985 |
nv_start_tx(dev); |
592
6ca369325cdd
Back-ported the running forcedeth driver from 2.6.19 to 2.6.17.
Florian Pose <fp@igh-essen.com>
parents:
581
diff
changeset
|
2986 |
|
6ca369325cdd
Back-ported the running forcedeth driver from 2.6.19 to 2.6.17.
Florian Pose <fp@igh-essen.com>
parents:
581
diff
changeset
|
2987 |
if (np->ecdev) { |
670
f57de4585a5f
Replaced ecdev_link_state() with ecdev_set_link(); added
Florian Pose <fp@igh-essen.com>
parents:
639
diff
changeset
|
2988 |
ecdev_set_link(np->ecdev, ret); |
592
6ca369325cdd
Back-ported the running forcedeth driver from 2.6.19 to 2.6.17.
Florian Pose <fp@igh-essen.com>
parents:
581
diff
changeset
|
2989 |
} |
6ca369325cdd
Back-ported the running forcedeth driver from 2.6.19 to 2.6.17.
Florian Pose <fp@igh-essen.com>
parents:
581
diff
changeset
|
2990 |
else { |
6ca369325cdd
Back-ported the running forcedeth driver from 2.6.19 to 2.6.17.
Florian Pose <fp@igh-essen.com>
parents:
581
diff
changeset
|
2991 |
netif_start_queue(dev); |
6ca369325cdd
Back-ported the running forcedeth driver from 2.6.19 to 2.6.17.
Florian Pose <fp@igh-essen.com>
parents:
581
diff
changeset
|
2992 |
if (ret) { |
6ca369325cdd
Back-ported the running forcedeth driver from 2.6.19 to 2.6.17.
Florian Pose <fp@igh-essen.com>
parents:
581
diff
changeset
|
2993 |
netif_carrier_on(dev); |
6ca369325cdd
Back-ported the running forcedeth driver from 2.6.19 to 2.6.17.
Florian Pose <fp@igh-essen.com>
parents:
581
diff
changeset
|
2994 |
} else { |
6ca369325cdd
Back-ported the running forcedeth driver from 2.6.19 to 2.6.17.
Florian Pose <fp@igh-essen.com>
parents:
581
diff
changeset
|
2995 |
printk("%s: no link during initialization.\n", dev->name); |
6ca369325cdd
Back-ported the running forcedeth driver from 2.6.19 to 2.6.17.
Florian Pose <fp@igh-essen.com>
parents:
581
diff
changeset
|
2996 |
netif_carrier_off(dev); |
6ca369325cdd
Back-ported the running forcedeth driver from 2.6.19 to 2.6.17.
Florian Pose <fp@igh-essen.com>
parents:
581
diff
changeset
|
2997 |
} |
6ca369325cdd
Back-ported the running forcedeth driver from 2.6.19 to 2.6.17.
Florian Pose <fp@igh-essen.com>
parents:
581
diff
changeset
|
2998 |
if (oom) |
6ca369325cdd
Back-ported the running forcedeth driver from 2.6.19 to 2.6.17.
Florian Pose <fp@igh-essen.com>
parents:
581
diff
changeset
|
2999 |
mod_timer(&np->oom_kick, jiffies + OOM_REFILL); |
6ca369325cdd
Back-ported the running forcedeth driver from 2.6.19 to 2.6.17.
Florian Pose <fp@igh-essen.com>
parents:
581
diff
changeset
|
3000 |
spin_unlock_irq(&np->lock); |
6ca369325cdd
Back-ported the running forcedeth driver from 2.6.19 to 2.6.17.
Florian Pose <fp@igh-essen.com>
parents:
581
diff
changeset
|
3001 |
} |
581
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3002 |
|
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3003 |
return 0; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3004 |
out_drain: |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3005 |
drain_ring(dev); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3006 |
return ret; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3007 |
} |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3008 |
|
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3009 |
static int nv_close(struct net_device *dev) |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3010 |
{ |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3011 |
struct fe_priv *np = netdev_priv(dev); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3012 |
u8 __iomem *base; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3013 |
|
592
6ca369325cdd
Back-ported the running forcedeth driver from 2.6.19 to 2.6.17.
Florian Pose <fp@igh-essen.com>
parents:
581
diff
changeset
|
3014 |
if (!np->ecdev) { |
6ca369325cdd
Back-ported the running forcedeth driver from 2.6.19 to 2.6.17.
Florian Pose <fp@igh-essen.com>
parents:
581
diff
changeset
|
3015 |
spin_lock_irq(&np->lock); |
6ca369325cdd
Back-ported the running forcedeth driver from 2.6.19 to 2.6.17.
Florian Pose <fp@igh-essen.com>
parents:
581
diff
changeset
|
3016 |
np->in_shutdown = 1; |
6ca369325cdd
Back-ported the running forcedeth driver from 2.6.19 to 2.6.17.
Florian Pose <fp@igh-essen.com>
parents:
581
diff
changeset
|
3017 |
spin_unlock_irq(&np->lock); |
6ca369325cdd
Back-ported the running forcedeth driver from 2.6.19 to 2.6.17.
Florian Pose <fp@igh-essen.com>
parents:
581
diff
changeset
|
3018 |
synchronize_irq(dev->irq); |
6ca369325cdd
Back-ported the running forcedeth driver from 2.6.19 to 2.6.17.
Florian Pose <fp@igh-essen.com>
parents:
581
diff
changeset
|
3019 |
|
6ca369325cdd
Back-ported the running forcedeth driver from 2.6.19 to 2.6.17.
Florian Pose <fp@igh-essen.com>
parents:
581
diff
changeset
|
3020 |
del_timer_sync(&np->oom_kick); |
6ca369325cdd
Back-ported the running forcedeth driver from 2.6.19 to 2.6.17.
Florian Pose <fp@igh-essen.com>
parents:
581
diff
changeset
|
3021 |
del_timer_sync(&np->nic_poll); |
6ca369325cdd
Back-ported the running forcedeth driver from 2.6.19 to 2.6.17.
Florian Pose <fp@igh-essen.com>
parents:
581
diff
changeset
|
3022 |
|
6ca369325cdd
Back-ported the running forcedeth driver from 2.6.19 to 2.6.17.
Florian Pose <fp@igh-essen.com>
parents:
581
diff
changeset
|
3023 |
netif_stop_queue(dev); |
6ca369325cdd
Back-ported the running forcedeth driver from 2.6.19 to 2.6.17.
Florian Pose <fp@igh-essen.com>
parents:
581
diff
changeset
|
3024 |
spin_lock_irq(&np->lock); |
6ca369325cdd
Back-ported the running forcedeth driver from 2.6.19 to 2.6.17.
Florian Pose <fp@igh-essen.com>
parents:
581
diff
changeset
|
3025 |
} |
6ca369325cdd
Back-ported the running forcedeth driver from 2.6.19 to 2.6.17.
Florian Pose <fp@igh-essen.com>
parents:
581
diff
changeset
|
3026 |
|
581
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3027 |
nv_stop_tx(dev); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3028 |
nv_stop_rx(dev); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3029 |
nv_txrx_reset(dev); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3030 |
|
592
6ca369325cdd
Back-ported the running forcedeth driver from 2.6.19 to 2.6.17.
Florian Pose <fp@igh-essen.com>
parents:
581
diff
changeset
|
3031 |
base = get_hwbase(dev); |
6ca369325cdd
Back-ported the running forcedeth driver from 2.6.19 to 2.6.17.
Florian Pose <fp@igh-essen.com>
parents:
581
diff
changeset
|
3032 |
|
6ca369325cdd
Back-ported the running forcedeth driver from 2.6.19 to 2.6.17.
Florian Pose <fp@igh-essen.com>
parents:
581
diff
changeset
|
3033 |
if (!np->ecdev) { |
6ca369325cdd
Back-ported the running forcedeth driver from 2.6.19 to 2.6.17.
Florian Pose <fp@igh-essen.com>
parents:
581
diff
changeset
|
3034 |
/* disable interrupts on the nic or we will lock up */ |
6ca369325cdd
Back-ported the running forcedeth driver from 2.6.19 to 2.6.17.
Florian Pose <fp@igh-essen.com>
parents:
581
diff
changeset
|
3035 |
nv_disable_hw_interrupts(dev, np->irqmask); |
6ca369325cdd
Back-ported the running forcedeth driver from 2.6.19 to 2.6.17.
Florian Pose <fp@igh-essen.com>
parents:
581
diff
changeset
|
3036 |
pci_push(base); |
6ca369325cdd
Back-ported the running forcedeth driver from 2.6.19 to 2.6.17.
Florian Pose <fp@igh-essen.com>
parents:
581
diff
changeset
|
3037 |
dprintk(KERN_INFO "%s: Irqmask is zero again\n", dev->name); |
6ca369325cdd
Back-ported the running forcedeth driver from 2.6.19 to 2.6.17.
Florian Pose <fp@igh-essen.com>
parents:
581
diff
changeset
|
3038 |
|
6ca369325cdd
Back-ported the running forcedeth driver from 2.6.19 to 2.6.17.
Florian Pose <fp@igh-essen.com>
parents:
581
diff
changeset
|
3039 |
spin_unlock_irq(&np->lock); |
6ca369325cdd
Back-ported the running forcedeth driver from 2.6.19 to 2.6.17.
Florian Pose <fp@igh-essen.com>
parents:
581
diff
changeset
|
3040 |
|
6ca369325cdd
Back-ported the running forcedeth driver from 2.6.19 to 2.6.17.
Florian Pose <fp@igh-essen.com>
parents:
581
diff
changeset
|
3041 |
nv_free_irq(dev); |
6ca369325cdd
Back-ported the running forcedeth driver from 2.6.19 to 2.6.17.
Florian Pose <fp@igh-essen.com>
parents:
581
diff
changeset
|
3042 |
} |
581
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3043 |
|
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3044 |
drain_ring(dev); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3045 |
|
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3046 |
if (np->wolenabled) |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3047 |
nv_start_rx(dev); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3048 |
|
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3049 |
/* special op: write back the misordered MAC address - otherwise |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3050 |
* the next nv_probe would see a wrong address. |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3051 |
*/ |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3052 |
writel(np->orig_mac[0], base + NvRegMacAddrA); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3053 |
writel(np->orig_mac[1], base + NvRegMacAddrB); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3054 |
|
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3055 |
/* FIXME: power down nic */ |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3056 |
|
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3057 |
return 0; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3058 |
} |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3059 |
|
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3060 |
static int __devinit nv_probe(struct pci_dev *pci_dev, const struct pci_device_id *id) |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3061 |
{ |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3062 |
struct net_device *dev; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3063 |
struct fe_priv *np; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3064 |
unsigned long addr; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3065 |
u8 __iomem *base; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3066 |
int err, i; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3067 |
u32 powerstate; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3068 |
|
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3069 |
board_idx++; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3070 |
|
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3071 |
dev = alloc_etherdev(sizeof(struct fe_priv)); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3072 |
err = -ENOMEM; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3073 |
if (!dev) |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3074 |
goto out; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3075 |
|
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3076 |
np = netdev_priv(dev); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3077 |
np->pci_dev = pci_dev; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3078 |
spin_lock_init(&np->lock); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3079 |
SET_MODULE_OWNER(dev); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3080 |
SET_NETDEV_DEV(dev, &pci_dev->dev); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3081 |
|
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3082 |
init_timer(&np->oom_kick); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3083 |
np->oom_kick.data = (unsigned long) dev; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3084 |
np->oom_kick.function = &nv_do_rx_refill; /* timer handler */ |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3085 |
init_timer(&np->nic_poll); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3086 |
np->nic_poll.data = (unsigned long) dev; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3087 |
np->nic_poll.function = &nv_do_nic_poll; /* timer handler */ |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3088 |
|
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3089 |
err = pci_enable_device(pci_dev); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3090 |
if (err) { |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3091 |
printk(KERN_INFO "forcedeth: pci_enable_dev failed (%d) for device %s\n", |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3092 |
err, pci_name(pci_dev)); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3093 |
goto out_free; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3094 |
} |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3095 |
|
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3096 |
pci_set_master(pci_dev); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3097 |
|
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3098 |
err = pci_request_regions(pci_dev, DRV_NAME); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3099 |
if (err < 0) |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3100 |
goto out_disable; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3101 |
|
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3102 |
if (id->driver_data & (DEV_HAS_VLAN|DEV_HAS_MSI_X|DEV_HAS_POWER_CNTRL)) |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3103 |
np->register_size = NV_PCI_REGSZ_VER2; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3104 |
else |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3105 |
np->register_size = NV_PCI_REGSZ_VER1; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3106 |
|
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3107 |
err = -EINVAL; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3108 |
addr = 0; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3109 |
for (i = 0; i < DEVICE_COUNT_RESOURCE; i++) { |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3110 |
dprintk(KERN_DEBUG "%s: resource %d start %p len %ld flags 0x%08lx.\n", |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3111 |
pci_name(pci_dev), i, (void*)pci_resource_start(pci_dev, i), |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3112 |
pci_resource_len(pci_dev, i), |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3113 |
pci_resource_flags(pci_dev, i)); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3114 |
if (pci_resource_flags(pci_dev, i) & IORESOURCE_MEM && |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3115 |
pci_resource_len(pci_dev, i) >= np->register_size) { |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3116 |
addr = pci_resource_start(pci_dev, i); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3117 |
break; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3118 |
} |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3119 |
} |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3120 |
if (i == DEVICE_COUNT_RESOURCE) { |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3121 |
printk(KERN_INFO "forcedeth: Couldn't find register window for device %s.\n", |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3122 |
pci_name(pci_dev)); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3123 |
goto out_relreg; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3124 |
} |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3125 |
|
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3126 |
/* copy of driver data */ |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3127 |
np->driver_data = id->driver_data; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3128 |
|
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3129 |
/* handle different descriptor versions */ |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3130 |
if (id->driver_data & DEV_HAS_HIGH_DMA) { |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3131 |
/* packet format 3: supports 40-bit addressing */ |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3132 |
np->desc_ver = DESC_VER_3; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3133 |
np->txrxctl_bits = NVREG_TXRXCTL_DESC_3; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3134 |
if (pci_set_dma_mask(pci_dev, DMA_39BIT_MASK)) { |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3135 |
printk(KERN_INFO "forcedeth: 64-bit DMA failed, using 32-bit addressing for device %s.\n", |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3136 |
pci_name(pci_dev)); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3137 |
} else { |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3138 |
dev->features |= NETIF_F_HIGHDMA; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3139 |
printk(KERN_INFO "forcedeth: using HIGHDMA\n"); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3140 |
} |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3141 |
if (pci_set_consistent_dma_mask(pci_dev, 0x0000007fffffffffULL)) { |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3142 |
printk(KERN_INFO "forcedeth: 64-bit DMA (consistent) failed for device %s.\n", |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3143 |
pci_name(pci_dev)); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3144 |
} |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3145 |
} else if (id->driver_data & DEV_HAS_LARGEDESC) { |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3146 |
/* packet format 2: supports jumbo frames */ |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3147 |
np->desc_ver = DESC_VER_2; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3148 |
np->txrxctl_bits = NVREG_TXRXCTL_DESC_2; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3149 |
} else { |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3150 |
/* original packet format */ |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3151 |
np->desc_ver = DESC_VER_1; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3152 |
np->txrxctl_bits = NVREG_TXRXCTL_DESC_1; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3153 |
} |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3154 |
|
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3155 |
np->pkt_limit = NV_PKTLIMIT_1; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3156 |
if (id->driver_data & DEV_HAS_LARGEDESC) |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3157 |
np->pkt_limit = NV_PKTLIMIT_2; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3158 |
|
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3159 |
if (id->driver_data & DEV_HAS_CHECKSUM) { |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3160 |
np->txrxctl_bits |= NVREG_TXRXCTL_RXCHECK; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3161 |
dev->features |= NETIF_F_HW_CSUM | NETIF_F_SG; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3162 |
#ifdef NETIF_F_TSO |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3163 |
dev->features |= NETIF_F_TSO; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3164 |
#endif |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3165 |
} |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3166 |
|
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3167 |
np->vlanctl_bits = 0; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3168 |
if (id->driver_data & DEV_HAS_VLAN) { |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3169 |
np->vlanctl_bits = NVREG_VLANCONTROL_ENABLE; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3170 |
dev->features |= NETIF_F_HW_VLAN_RX | NETIF_F_HW_VLAN_TX; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3171 |
dev->vlan_rx_register = nv_vlan_rx_register; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3172 |
dev->vlan_rx_kill_vid = nv_vlan_rx_kill_vid; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3173 |
} |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3174 |
|
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3175 |
np->msi_flags = 0; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3176 |
if ((id->driver_data & DEV_HAS_MSI) && !disable_msi) { |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3177 |
np->msi_flags |= NV_MSI_CAPABLE; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3178 |
} |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3179 |
if ((id->driver_data & DEV_HAS_MSI_X) && !disable_msix) { |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3180 |
np->msi_flags |= NV_MSI_X_CAPABLE; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3181 |
} |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3182 |
|
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3183 |
err = -ENOMEM; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3184 |
np->base = ioremap(addr, np->register_size); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3185 |
if (!np->base) |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3186 |
goto out_relreg; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3187 |
dev->base_addr = (unsigned long)np->base; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3188 |
|
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3189 |
dev->irq = pci_dev->irq; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3190 |
|
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3191 |
if (np->desc_ver == DESC_VER_1 || np->desc_ver == DESC_VER_2) { |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3192 |
np->rx_ring.orig = pci_alloc_consistent(pci_dev, |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3193 |
sizeof(struct ring_desc) * (RX_RING + TX_RING), |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3194 |
&np->ring_addr); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3195 |
if (!np->rx_ring.orig) |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3196 |
goto out_unmap; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3197 |
np->tx_ring.orig = &np->rx_ring.orig[RX_RING]; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3198 |
} else { |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3199 |
np->rx_ring.ex = pci_alloc_consistent(pci_dev, |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3200 |
sizeof(struct ring_desc_ex) * (RX_RING + TX_RING), |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3201 |
&np->ring_addr); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3202 |
if (!np->rx_ring.ex) |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3203 |
goto out_unmap; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3204 |
np->tx_ring.ex = &np->rx_ring.ex[RX_RING]; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3205 |
} |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3206 |
|
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3207 |
dev->open = nv_open; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3208 |
dev->stop = nv_close; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3209 |
dev->hard_start_xmit = nv_start_xmit; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3210 |
dev->get_stats = nv_get_stats; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3211 |
dev->change_mtu = nv_change_mtu; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3212 |
dev->set_mac_address = nv_set_mac_address; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3213 |
dev->set_multicast_list = nv_set_multicast; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3214 |
#ifdef CONFIG_NET_POLL_CONTROLLER |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3215 |
dev->poll_controller = nv_poll_controller; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3216 |
#endif |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3217 |
SET_ETHTOOL_OPS(dev, &ops); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3218 |
dev->tx_timeout = nv_tx_timeout; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3219 |
dev->watchdog_timeo = NV_WATCHDOG_TIMEO; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3220 |
|
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3221 |
pci_set_drvdata(pci_dev, dev); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3222 |
|
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3223 |
/* read the mac address */ |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3224 |
base = get_hwbase(dev); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3225 |
np->orig_mac[0] = readl(base + NvRegMacAddrA); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3226 |
np->orig_mac[1] = readl(base + NvRegMacAddrB); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3227 |
|
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3228 |
dev->dev_addr[0] = (np->orig_mac[1] >> 8) & 0xff; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3229 |
dev->dev_addr[1] = (np->orig_mac[1] >> 0) & 0xff; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3230 |
dev->dev_addr[2] = (np->orig_mac[0] >> 24) & 0xff; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3231 |
dev->dev_addr[3] = (np->orig_mac[0] >> 16) & 0xff; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3232 |
dev->dev_addr[4] = (np->orig_mac[0] >> 8) & 0xff; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3233 |
dev->dev_addr[5] = (np->orig_mac[0] >> 0) & 0xff; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3234 |
memcpy(dev->perm_addr, dev->dev_addr, dev->addr_len); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3235 |
|
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3236 |
if (!is_valid_ether_addr(dev->perm_addr)) { |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3237 |
/* |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3238 |
* Bad mac address. At least one bios sets the mac address |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3239 |
* to 01:23:45:67:89:ab |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3240 |
*/ |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3241 |
printk(KERN_ERR "%s: Invalid Mac address detected: %02x:%02x:%02x:%02x:%02x:%02x\n", |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3242 |
pci_name(pci_dev), |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3243 |
dev->dev_addr[0], dev->dev_addr[1], dev->dev_addr[2], |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3244 |
dev->dev_addr[3], dev->dev_addr[4], dev->dev_addr[5]); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3245 |
printk(KERN_ERR "Please complain to your hardware vendor. Switching to a random MAC.\n"); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3246 |
dev->dev_addr[0] = 0x00; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3247 |
dev->dev_addr[1] = 0x00; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3248 |
dev->dev_addr[2] = 0x6c; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3249 |
get_random_bytes(&dev->dev_addr[3], 3); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3250 |
} |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3251 |
|
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3252 |
dprintk(KERN_DEBUG "%s: MAC Address %02x:%02x:%02x:%02x:%02x:%02x\n", pci_name(pci_dev), |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3253 |
dev->dev_addr[0], dev->dev_addr[1], dev->dev_addr[2], |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3254 |
dev->dev_addr[3], dev->dev_addr[4], dev->dev_addr[5]); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3255 |
|
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3256 |
/* disable WOL */ |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3257 |
writel(0, base + NvRegWakeUpFlags); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3258 |
np->wolenabled = 0; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3259 |
|
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3260 |
if (id->driver_data & DEV_HAS_POWER_CNTRL) { |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3261 |
u8 revision_id; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3262 |
pci_read_config_byte(pci_dev, PCI_REVISION_ID, &revision_id); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3263 |
|
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3264 |
/* take phy and nic out of low power mode */ |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3265 |
powerstate = readl(base + NvRegPowerState2); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3266 |
powerstate &= ~NVREG_POWERSTATE2_POWERUP_MASK; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3267 |
if ((id->device == PCI_DEVICE_ID_NVIDIA_NVENET_12 || |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3268 |
id->device == PCI_DEVICE_ID_NVIDIA_NVENET_13) && |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3269 |
revision_id >= 0xA3) |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3270 |
powerstate |= NVREG_POWERSTATE2_POWERUP_REV_A3; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3271 |
writel(powerstate, base + NvRegPowerState2); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3272 |
} |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3273 |
|
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3274 |
if (np->desc_ver == DESC_VER_1) { |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3275 |
np->tx_flags = NV_TX_VALID; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3276 |
} else { |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3277 |
np->tx_flags = NV_TX2_VALID; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3278 |
} |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3279 |
if (optimization_mode == NV_OPTIMIZATION_MODE_THROUGHPUT) { |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3280 |
np->irqmask = NVREG_IRQMASK_THROUGHPUT; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3281 |
if (np->msi_flags & NV_MSI_X_CAPABLE) /* set number of vectors */ |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3282 |
np->msi_flags |= 0x0003; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3283 |
} else { |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3284 |
np->irqmask = NVREG_IRQMASK_CPU; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3285 |
if (np->msi_flags & NV_MSI_X_CAPABLE) /* set number of vectors */ |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3286 |
np->msi_flags |= 0x0001; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3287 |
} |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3288 |
|
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3289 |
if (id->driver_data & DEV_NEED_TIMERIRQ) |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3290 |
np->irqmask |= NVREG_IRQ_TIMER; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3291 |
if (id->driver_data & DEV_NEED_LINKTIMER) { |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3292 |
dprintk(KERN_INFO "%s: link timer on.\n", pci_name(pci_dev)); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3293 |
np->need_linktimer = 1; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3294 |
np->link_timeout = jiffies + LINK_TIMEOUT; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3295 |
} else { |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3296 |
dprintk(KERN_INFO "%s: link timer off.\n", pci_name(pci_dev)); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3297 |
np->need_linktimer = 0; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3298 |
} |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3299 |
|
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3300 |
/* find a suitable phy */ |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3301 |
for (i = 1; i <= 32; i++) { |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3302 |
int id1, id2; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3303 |
int phyaddr = i & 0x1F; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3304 |
|
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3305 |
spin_lock_irq(&np->lock); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3306 |
id1 = mii_rw(dev, phyaddr, MII_PHYSID1, MII_READ); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3307 |
spin_unlock_irq(&np->lock); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3308 |
if (id1 < 0 || id1 == 0xffff) |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3309 |
continue; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3310 |
spin_lock_irq(&np->lock); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3311 |
id2 = mii_rw(dev, phyaddr, MII_PHYSID2, MII_READ); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3312 |
spin_unlock_irq(&np->lock); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3313 |
if (id2 < 0 || id2 == 0xffff) |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3314 |
continue; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3315 |
|
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3316 |
id1 = (id1 & PHYID1_OUI_MASK) << PHYID1_OUI_SHFT; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3317 |
id2 = (id2 & PHYID2_OUI_MASK) >> PHYID2_OUI_SHFT; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3318 |
dprintk(KERN_DEBUG "%s: open: Found PHY %04x:%04x at address %d.\n", |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3319 |
pci_name(pci_dev), id1, id2, phyaddr); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3320 |
np->phyaddr = phyaddr; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3321 |
np->phy_oui = id1 | id2; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3322 |
break; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3323 |
} |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3324 |
if (i == 33) { |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3325 |
printk(KERN_INFO "%s: open: Could not find a valid PHY.\n", |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3326 |
pci_name(pci_dev)); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3327 |
goto out_freering; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3328 |
} |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3329 |
|
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3330 |
/* reset it */ |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3331 |
phy_init(dev); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3332 |
|
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3333 |
/* set default link speed settings */ |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3334 |
np->linkspeed = NVREG_LINKSPEED_FORCE|NVREG_LINKSPEED_10; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3335 |
np->duplex = 0; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3336 |
np->autoneg = 1; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3337 |
|
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3338 |
// offer device to EtherCAT master module |
639
aa23c48dca2d
Allow only MAC addresses as device identifiers; replaced master list by
Florian Pose <fp@igh-essen.com>
parents:
592
diff
changeset
|
3339 |
if (ecdev_offer(dev, ec_poll, THIS_MODULE, &np->ecdev)) { |
581
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3340 |
printk(KERN_ERR "forcedeth: Failed to offer device.\n"); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3341 |
goto out_freering; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3342 |
} |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3343 |
|
592
6ca369325cdd
Back-ported the running forcedeth driver from 2.6.19 to 2.6.17.
Florian Pose <fp@igh-essen.com>
parents:
581
diff
changeset
|
3344 |
if (np->ecdev) { |
6ca369325cdd
Back-ported the running forcedeth driver from 2.6.19 to 2.6.17.
Florian Pose <fp@igh-essen.com>
parents:
581
diff
changeset
|
3345 |
if (ecdev_open(np->ecdev)) { |
6ca369325cdd
Back-ported the running forcedeth driver from 2.6.19 to 2.6.17.
Florian Pose <fp@igh-essen.com>
parents:
581
diff
changeset
|
3346 |
ecdev_withdraw(np->ecdev); |
6ca369325cdd
Back-ported the running forcedeth driver from 2.6.19 to 2.6.17.
Florian Pose <fp@igh-essen.com>
parents:
581
diff
changeset
|
3347 |
goto out_freering; |
6ca369325cdd
Back-ported the running forcedeth driver from 2.6.19 to 2.6.17.
Florian Pose <fp@igh-essen.com>
parents:
581
diff
changeset
|
3348 |
} |
6ca369325cdd
Back-ported the running forcedeth driver from 2.6.19 to 2.6.17.
Florian Pose <fp@igh-essen.com>
parents:
581
diff
changeset
|
3349 |
} |
6ca369325cdd
Back-ported the running forcedeth driver from 2.6.19 to 2.6.17.
Florian Pose <fp@igh-essen.com>
parents:
581
diff
changeset
|
3350 |
else { |
581
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3351 |
err = register_netdev(dev); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3352 |
if (err) { |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3353 |
printk(KERN_INFO "forcedeth: unable to register netdev: %d\n", err); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3354 |
goto out_freering; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3355 |
} |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3356 |
} |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3357 |
printk(KERN_INFO "%s: forcedeth.c: subsystem: %05x:%04x bound to %s\n", |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3358 |
dev->name, pci_dev->subsystem_vendor, pci_dev->subsystem_device, |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3359 |
pci_name(pci_dev)); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3360 |
|
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3361 |
return 0; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3362 |
|
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3363 |
out_freering: |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3364 |
if (np->desc_ver == DESC_VER_1 || np->desc_ver == DESC_VER_2) |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3365 |
pci_free_consistent(np->pci_dev, sizeof(struct ring_desc) * (RX_RING + TX_RING), |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3366 |
np->rx_ring.orig, np->ring_addr); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3367 |
else |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3368 |
pci_free_consistent(np->pci_dev, sizeof(struct ring_desc_ex) * (RX_RING + TX_RING), |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3369 |
np->rx_ring.ex, np->ring_addr); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3370 |
pci_set_drvdata(pci_dev, NULL); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3371 |
out_unmap: |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3372 |
iounmap(get_hwbase(dev)); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3373 |
out_relreg: |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3374 |
pci_release_regions(pci_dev); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3375 |
out_disable: |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3376 |
pci_disable_device(pci_dev); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3377 |
out_free: |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3378 |
free_netdev(dev); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3379 |
out: |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3380 |
return err; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3381 |
} |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3382 |
|
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3383 |
static void __devexit nv_remove(struct pci_dev *pci_dev) |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3384 |
{ |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3385 |
struct net_device *dev = pci_get_drvdata(pci_dev); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3386 |
struct fe_priv *np = netdev_priv(dev); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3387 |
|
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3388 |
if (np->ecdev) { |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3389 |
ecdev_close(np->ecdev); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3390 |
ecdev_withdraw(np->ecdev); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3391 |
} |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3392 |
else { |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3393 |
unregister_netdev(dev); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3394 |
} |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3395 |
|
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3396 |
/* free all structures */ |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3397 |
if (np->desc_ver == DESC_VER_1 || np->desc_ver == DESC_VER_2) |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3398 |
pci_free_consistent(np->pci_dev, sizeof(struct ring_desc) * (RX_RING + TX_RING), np->rx_ring.orig, np->ring_addr); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3399 |
else |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3400 |
pci_free_consistent(np->pci_dev, sizeof(struct ring_desc_ex) * (RX_RING + TX_RING), np->rx_ring.ex, np->ring_addr); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3401 |
iounmap(get_hwbase(dev)); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3402 |
pci_release_regions(pci_dev); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3403 |
pci_disable_device(pci_dev); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3404 |
free_netdev(dev); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3405 |
pci_set_drvdata(pci_dev, NULL); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3406 |
} |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3407 |
|
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3408 |
static struct pci_device_id pci_tbl[] = { |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3409 |
{ /* nForce Ethernet Controller */ |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3410 |
PCI_DEVICE(PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_NVENET_1), |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3411 |
.driver_data = DEV_NEED_TIMERIRQ|DEV_NEED_LINKTIMER, |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3412 |
}, |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3413 |
{ /* nForce2 Ethernet Controller */ |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3414 |
PCI_DEVICE(PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_NVENET_2), |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3415 |
.driver_data = DEV_NEED_TIMERIRQ|DEV_NEED_LINKTIMER, |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3416 |
}, |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3417 |
{ /* nForce3 Ethernet Controller */ |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3418 |
PCI_DEVICE(PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_NVENET_3), |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3419 |
.driver_data = DEV_NEED_TIMERIRQ|DEV_NEED_LINKTIMER, |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3420 |
}, |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3421 |
{ /* nForce3 Ethernet Controller */ |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3422 |
PCI_DEVICE(PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_NVENET_4), |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3423 |
.driver_data = DEV_NEED_TIMERIRQ|DEV_NEED_LINKTIMER|DEV_HAS_LARGEDESC|DEV_HAS_CHECKSUM, |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3424 |
}, |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3425 |
{ /* nForce3 Ethernet Controller */ |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3426 |
PCI_DEVICE(PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_NVENET_5), |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3427 |
.driver_data = DEV_NEED_TIMERIRQ|DEV_NEED_LINKTIMER|DEV_HAS_LARGEDESC|DEV_HAS_CHECKSUM, |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3428 |
}, |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3429 |
{ /* nForce3 Ethernet Controller */ |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3430 |
PCI_DEVICE(PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_NVENET_6), |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3431 |
.driver_data = DEV_NEED_TIMERIRQ|DEV_NEED_LINKTIMER|DEV_HAS_LARGEDESC|DEV_HAS_CHECKSUM, |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3432 |
}, |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3433 |
{ /* nForce3 Ethernet Controller */ |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3434 |
PCI_DEVICE(PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_NVENET_7), |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3435 |
.driver_data = DEV_NEED_TIMERIRQ|DEV_NEED_LINKTIMER|DEV_HAS_LARGEDESC|DEV_HAS_CHECKSUM, |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3436 |
}, |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3437 |
{ /* CK804 Ethernet Controller */ |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3438 |
PCI_DEVICE(PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_NVENET_8), |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3439 |
.driver_data = DEV_NEED_TIMERIRQ|DEV_NEED_LINKTIMER|DEV_HAS_LARGEDESC|DEV_HAS_CHECKSUM|DEV_HAS_HIGH_DMA, |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3440 |
}, |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3441 |
{ /* CK804 Ethernet Controller */ |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3442 |
PCI_DEVICE(PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_NVENET_9), |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3443 |
.driver_data = DEV_NEED_TIMERIRQ|DEV_NEED_LINKTIMER|DEV_HAS_LARGEDESC|DEV_HAS_CHECKSUM|DEV_HAS_HIGH_DMA, |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3444 |
}, |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3445 |
{ /* MCP04 Ethernet Controller */ |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3446 |
PCI_DEVICE(PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_NVENET_10), |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3447 |
.driver_data = DEV_NEED_TIMERIRQ|DEV_NEED_LINKTIMER|DEV_HAS_LARGEDESC|DEV_HAS_CHECKSUM|DEV_HAS_HIGH_DMA, |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3448 |
}, |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3449 |
{ /* MCP04 Ethernet Controller */ |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3450 |
PCI_DEVICE(PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_NVENET_11), |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3451 |
.driver_data = DEV_NEED_TIMERIRQ|DEV_NEED_LINKTIMER|DEV_HAS_LARGEDESC|DEV_HAS_CHECKSUM|DEV_HAS_HIGH_DMA, |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3452 |
}, |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3453 |
{ /* MCP51 Ethernet Controller */ |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3454 |
PCI_DEVICE(PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_NVENET_12), |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3455 |
.driver_data = DEV_NEED_TIMERIRQ|DEV_NEED_LINKTIMER|DEV_HAS_HIGH_DMA|DEV_HAS_POWER_CNTRL, |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3456 |
}, |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3457 |
{ /* MCP51 Ethernet Controller */ |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3458 |
PCI_DEVICE(PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_NVENET_13), |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3459 |
.driver_data = DEV_NEED_TIMERIRQ|DEV_NEED_LINKTIMER|DEV_HAS_HIGH_DMA|DEV_HAS_POWER_CNTRL, |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3460 |
}, |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3461 |
{ /* MCP55 Ethernet Controller */ |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3462 |
PCI_DEVICE(PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_NVENET_14), |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3463 |
.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, |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3464 |
}, |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3465 |
{ /* MCP55 Ethernet Controller */ |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3466 |
PCI_DEVICE(PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_NVENET_15), |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3467 |
.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, |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3468 |
}, |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3469 |
{0,}, |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3470 |
}; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3471 |
|
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3472 |
static struct pci_driver driver = { |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3473 |
.name = "forcedeth", |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3474 |
.id_table = pci_tbl, |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3475 |
.probe = nv_probe, |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3476 |
.remove = __devexit_p(nv_remove), |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3477 |
}; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3478 |
|
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3479 |
|
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3480 |
static int __init init_nic(void) |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3481 |
{ |
592
6ca369325cdd
Back-ported the running forcedeth driver from 2.6.19 to 2.6.17.
Florian Pose <fp@igh-essen.com>
parents:
581
diff
changeset
|
3482 |
printk(KERN_INFO "forcedeth: EtherCAT-capable nForce ethernet driver." |
6ca369325cdd
Back-ported the running forcedeth driver from 2.6.19 to 2.6.17.
Florian Pose <fp@igh-essen.com>
parents:
581
diff
changeset
|
3483 |
" Version %s, master %s.\n", |
6ca369325cdd
Back-ported the running forcedeth driver from 2.6.19 to 2.6.17.
Florian Pose <fp@igh-essen.com>
parents:
581
diff
changeset
|
3484 |
FORCEDETH_VERSION, EC_MASTER_VERSION); |
581
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3485 |
return pci_module_init(&driver); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3486 |
} |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3487 |
|
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3488 |
static void __exit exit_nic(void) |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3489 |
{ |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3490 |
pci_unregister_driver(&driver); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3491 |
} |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3492 |
|
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3493 |
module_param(max_interrupt_work, int, 0); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3494 |
MODULE_PARM_DESC(max_interrupt_work, "forcedeth maximum events handled per interrupt"); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3495 |
module_param(optimization_mode, int, 0); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3496 |
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."); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3497 |
module_param(poll_interval, int, 0); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3498 |
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."); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3499 |
module_param(disable_msi, int, 0); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3500 |
MODULE_PARM_DESC(disable_msi, "Disable MSI interrupts by setting to 1."); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3501 |
module_param(disable_msix, int, 0); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3502 |
MODULE_PARM_DESC(disable_msix, "Disable MSIX interrupts by setting to 1."); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3503 |
|
592
6ca369325cdd
Back-ported the running forcedeth driver from 2.6.19 to 2.6.17.
Florian Pose <fp@igh-essen.com>
parents:
581
diff
changeset
|
3504 |
MODULE_AUTHOR("Dipl.-Ing. (FH) Florian Pose <fp@igh-essen.com>"); |
6ca369325cdd
Back-ported the running forcedeth driver from 2.6.19 to 2.6.17.
Florian Pose <fp@igh-essen.com>
parents:
581
diff
changeset
|
3505 |
MODULE_DESCRIPTION("EtherCAT-capable nForce ethernet driver"); |
581
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3506 |
MODULE_LICENSE("GPL"); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3507 |
|
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3508 |
//MODULE_DEVICE_TABLE(pci, pci_tbl); // prevent auto-loading |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3509 |
|
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3510 |
module_init(init_nic); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3511 |
module_exit(exit_nic); |