author | Florian Pose <fp@igh-essen.com> |
Wed, 19 Mar 2008 10:51:18 +0000 | |
changeset 877 | d2915690047f |
parent 581 | 99623f8a8493 |
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 |
#if 0 |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
147 |
#define dprintk printk |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
148 |
#else |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
149 |
#define dprintk(x...) do { } while (0) |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
150 |
#endif |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
151 |
|
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
152 |
|
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
153 |
/* |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
154 |
* Hardware access: |
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 |
#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
|
158 |
#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
|
159 |
#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
|
160 |
#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
|
161 |
#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
|
162 |
#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
|
163 |
#define DEV_HAS_MSI 0x0040 /* device supports MSI */ |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
164 |
#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
|
165 |
#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
|
166 |
|
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
167 |
enum { |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
168 |
NvRegIrqStatus = 0x000, |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
169 |
#define NVREG_IRQSTAT_MIIEVENT 0x040 |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
170 |
#define NVREG_IRQSTAT_MASK 0x1ff |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
171 |
NvRegIrqMask = 0x004, |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
172 |
#define NVREG_IRQ_RX_ERROR 0x0001 |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
173 |
#define NVREG_IRQ_RX 0x0002 |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
174 |
#define NVREG_IRQ_RX_NOBUF 0x0004 |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
175 |
#define NVREG_IRQ_TX_ERR 0x0008 |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
176 |
#define NVREG_IRQ_TX_OK 0x0010 |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
177 |
#define NVREG_IRQ_TIMER 0x0020 |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
178 |
#define NVREG_IRQ_LINK 0x0040 |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
179 |
#define NVREG_IRQ_RX_FORCED 0x0080 |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
180 |
#define NVREG_IRQ_TX_FORCED 0x0100 |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
181 |
#define NVREG_IRQMASK_THROUGHPUT 0x00df |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
182 |
#define NVREG_IRQMASK_CPU 0x0040 |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
183 |
#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
|
184 |
#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
|
185 |
#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
|
186 |
|
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
187 |
#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
|
188 |
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
|
189 |
NVREG_IRQ_TX_FORCED)) |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
190 |
|
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
191 |
NvRegUnknownSetupReg6 = 0x008, |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
192 |
#define NVREG_UNKSETUP6_VAL 3 |
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 |
/* |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
195 |
* 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
|
196 |
* 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
|
197 |
*/ |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
198 |
NvRegPollingInterval = 0x00c, |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
199 |
#define NVREG_POLL_DEFAULT_THROUGHPUT 970 |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
200 |
#define NVREG_POLL_DEFAULT_CPU 13 |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
201 |
NvRegMSIMap0 = 0x020, |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
202 |
NvRegMSIMap1 = 0x024, |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
203 |
NvRegMSIIrqMask = 0x030, |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
204 |
#define NVREG_MSI_VECTOR_0_ENABLED 0x01 |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
205 |
NvRegMisc1 = 0x080, |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
206 |
#define NVREG_MISC1_HD 0x02 |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
207 |
#define NVREG_MISC1_FORCE 0x3b0f3c |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
208 |
|
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
209 |
NvRegMacReset = 0x3c, |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
210 |
#define NVREG_MAC_RESET_ASSERT 0x0F3 |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
211 |
NvRegTransmitterControl = 0x084, |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
212 |
#define NVREG_XMITCTL_START 0x01 |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
213 |
NvRegTransmitterStatus = 0x088, |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
214 |
#define NVREG_XMITSTAT_BUSY 0x01 |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
215 |
|
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
216 |
NvRegPacketFilterFlags = 0x8c, |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
217 |
#define NVREG_PFF_ALWAYS 0x7F0008 |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
218 |
#define NVREG_PFF_PROMISC 0x80 |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
219 |
#define NVREG_PFF_MYADDR 0x20 |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
220 |
|
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
221 |
NvRegOffloadConfig = 0x90, |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
222 |
#define NVREG_OFFLOAD_HOMEPHY 0x601 |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
223 |
#define NVREG_OFFLOAD_NORMAL RX_NIC_BUFSIZE |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
224 |
NvRegReceiverControl = 0x094, |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
225 |
#define NVREG_RCVCTL_START 0x01 |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
226 |
NvRegReceiverStatus = 0x98, |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
227 |
#define NVREG_RCVSTAT_BUSY 0x01 |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
228 |
|
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
229 |
NvRegRandomSeed = 0x9c, |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
230 |
#define NVREG_RNDSEED_MASK 0x00ff |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
231 |
#define NVREG_RNDSEED_FORCE 0x7f00 |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
232 |
#define NVREG_RNDSEED_FORCE2 0x2d00 |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
233 |
#define NVREG_RNDSEED_FORCE3 0x7400 |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
234 |
|
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
235 |
NvRegUnknownSetupReg1 = 0xA0, |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
236 |
#define NVREG_UNKSETUP1_VAL 0x16070f |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
237 |
NvRegUnknownSetupReg2 = 0xA4, |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
238 |
#define NVREG_UNKSETUP2_VAL 0x16 |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
239 |
NvRegMacAddrA = 0xA8, |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
240 |
NvRegMacAddrB = 0xAC, |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
241 |
NvRegMulticastAddrA = 0xB0, |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
242 |
#define NVREG_MCASTADDRA_FORCE 0x01 |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
243 |
NvRegMulticastAddrB = 0xB4, |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
244 |
NvRegMulticastMaskA = 0xB8, |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
245 |
NvRegMulticastMaskB = 0xBC, |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
246 |
|
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
247 |
NvRegPhyInterface = 0xC0, |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
248 |
#define PHY_RGMII 0x10000000 |
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 |
NvRegTxRingPhysAddr = 0x100, |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
251 |
NvRegRxRingPhysAddr = 0x104, |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
252 |
NvRegRingSizes = 0x108, |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
253 |
#define NVREG_RINGSZ_TXSHIFT 0 |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
254 |
#define NVREG_RINGSZ_RXSHIFT 16 |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
255 |
NvRegUnknownTransmitterReg = 0x10c, |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
256 |
NvRegLinkSpeed = 0x110, |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
257 |
#define NVREG_LINKSPEED_FORCE 0x10000 |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
258 |
#define NVREG_LINKSPEED_10 1000 |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
259 |
#define NVREG_LINKSPEED_100 100 |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
260 |
#define NVREG_LINKSPEED_1000 50 |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
261 |
#define NVREG_LINKSPEED_MASK (0xFFF) |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
262 |
NvRegUnknownSetupReg5 = 0x130, |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
263 |
#define NVREG_UNKSETUP5_BIT31 (1<<31) |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
264 |
NvRegUnknownSetupReg3 = 0x13c, |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
265 |
#define NVREG_UNKSETUP3_VAL1 0x200010 |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
266 |
NvRegTxRxControl = 0x144, |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
267 |
#define NVREG_TXRXCTL_KICK 0x0001 |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
268 |
#define NVREG_TXRXCTL_BIT1 0x0002 |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
269 |
#define NVREG_TXRXCTL_BIT2 0x0004 |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
270 |
#define NVREG_TXRXCTL_IDLE 0x0008 |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
271 |
#define NVREG_TXRXCTL_RESET 0x0010 |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
272 |
#define NVREG_TXRXCTL_RXCHECK 0x0400 |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
273 |
#define NVREG_TXRXCTL_DESC_1 0 |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
274 |
#define NVREG_TXRXCTL_DESC_2 0x02100 |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
275 |
#define NVREG_TXRXCTL_DESC_3 0x02200 |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
276 |
#define NVREG_TXRXCTL_VLANSTRIP 0x00040 |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
277 |
#define NVREG_TXRXCTL_VLANINS 0x00080 |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
278 |
NvRegTxRingPhysAddrHigh = 0x148, |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
279 |
NvRegRxRingPhysAddrHigh = 0x14C, |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
280 |
NvRegMIIStatus = 0x180, |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
281 |
#define NVREG_MIISTAT_ERROR 0x0001 |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
282 |
#define NVREG_MIISTAT_LINKCHANGE 0x0008 |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
283 |
#define NVREG_MIISTAT_MASK 0x000f |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
284 |
#define NVREG_MIISTAT_MASK2 0x000f |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
285 |
NvRegUnknownSetupReg4 = 0x184, |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
286 |
#define NVREG_UNKSETUP4_VAL 8 |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
287 |
|
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
288 |
NvRegAdapterControl = 0x188, |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
289 |
#define NVREG_ADAPTCTL_START 0x02 |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
290 |
#define NVREG_ADAPTCTL_LINKUP 0x04 |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
291 |
#define NVREG_ADAPTCTL_PHYVALID 0x40000 |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
292 |
#define NVREG_ADAPTCTL_RUNNING 0x100000 |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
293 |
#define NVREG_ADAPTCTL_PHYSHIFT 24 |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
294 |
NvRegMIISpeed = 0x18c, |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
295 |
#define NVREG_MIISPEED_BIT8 (1<<8) |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
296 |
#define NVREG_MIIDELAY 5 |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
297 |
NvRegMIIControl = 0x190, |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
298 |
#define NVREG_MIICTL_INUSE 0x08000 |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
299 |
#define NVREG_MIICTL_WRITE 0x00400 |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
300 |
#define NVREG_MIICTL_ADDRSHIFT 5 |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
301 |
NvRegMIIData = 0x194, |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
302 |
NvRegWakeUpFlags = 0x200, |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
303 |
#define NVREG_WAKEUPFLAGS_VAL 0x7770 |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
304 |
#define NVREG_WAKEUPFLAGS_BUSYSHIFT 24 |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
305 |
#define NVREG_WAKEUPFLAGS_ENABLESHIFT 16 |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
306 |
#define NVREG_WAKEUPFLAGS_D3SHIFT 12 |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
307 |
#define NVREG_WAKEUPFLAGS_D2SHIFT 8 |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
308 |
#define NVREG_WAKEUPFLAGS_D1SHIFT 4 |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
309 |
#define NVREG_WAKEUPFLAGS_D0SHIFT 0 |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
310 |
#define NVREG_WAKEUPFLAGS_ACCEPT_MAGPAT 0x01 |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
311 |
#define NVREG_WAKEUPFLAGS_ACCEPT_WAKEUPPAT 0x02 |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
312 |
#define NVREG_WAKEUPFLAGS_ACCEPT_LINKCHANGE 0x04 |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
313 |
#define NVREG_WAKEUPFLAGS_ENABLE 0x1111 |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
314 |
|
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
315 |
NvRegPatternCRC = 0x204, |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
316 |
NvRegPatternMask = 0x208, |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
317 |
NvRegPowerCap = 0x268, |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
318 |
#define NVREG_POWERCAP_D3SUPP (1<<30) |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
319 |
#define NVREG_POWERCAP_D2SUPP (1<<26) |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
320 |
#define NVREG_POWERCAP_D1SUPP (1<<25) |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
321 |
NvRegPowerState = 0x26c, |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
322 |
#define NVREG_POWERSTATE_POWEREDUP 0x8000 |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
323 |
#define NVREG_POWERSTATE_VALID 0x0100 |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
324 |
#define NVREG_POWERSTATE_MASK 0x0003 |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
325 |
#define NVREG_POWERSTATE_D0 0x0000 |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
326 |
#define NVREG_POWERSTATE_D1 0x0001 |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
327 |
#define NVREG_POWERSTATE_D2 0x0002 |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
328 |
#define NVREG_POWERSTATE_D3 0x0003 |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
329 |
NvRegVlanControl = 0x300, |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
330 |
#define NVREG_VLANCONTROL_ENABLE 0x2000 |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
331 |
NvRegMSIXMap0 = 0x3e0, |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
332 |
NvRegMSIXMap1 = 0x3e4, |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
333 |
NvRegMSIXIrqStatus = 0x3f0, |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
334 |
|
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
335 |
NvRegPowerState2 = 0x600, |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
336 |
#define NVREG_POWERSTATE2_POWERUP_MASK 0x0F11 |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
337 |
#define NVREG_POWERSTATE2_POWERUP_REV_A3 0x0001 |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
338 |
}; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
339 |
|
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
340 |
/* Big endian: should work, but is untested */ |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
341 |
struct ring_desc { |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
342 |
u32 PacketBuffer; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
343 |
u32 FlagLen; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
344 |
}; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
345 |
|
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
346 |
struct ring_desc_ex { |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
347 |
u32 PacketBufferHigh; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
348 |
u32 PacketBufferLow; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
349 |
u32 TxVlan; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
350 |
u32 FlagLen; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
351 |
}; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
352 |
|
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
353 |
typedef union _ring_type { |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
354 |
struct ring_desc* orig; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
355 |
struct ring_desc_ex* ex; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
356 |
} ring_type; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
357 |
|
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
358 |
#define FLAG_MASK_V1 0xffff0000 |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
359 |
#define FLAG_MASK_V2 0xffffc000 |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
360 |
#define LEN_MASK_V1 (0xffffffff ^ FLAG_MASK_V1) |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
361 |
#define LEN_MASK_V2 (0xffffffff ^ FLAG_MASK_V2) |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
362 |
|
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
363 |
#define NV_TX_LASTPACKET (1<<16) |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
364 |
#define NV_TX_RETRYERROR (1<<19) |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
365 |
#define NV_TX_FORCED_INTERRUPT (1<<24) |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
366 |
#define NV_TX_DEFERRED (1<<26) |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
367 |
#define NV_TX_CARRIERLOST (1<<27) |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
368 |
#define NV_TX_LATECOLLISION (1<<28) |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
369 |
#define NV_TX_UNDERFLOW (1<<29) |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
370 |
#define NV_TX_ERROR (1<<30) |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
371 |
#define NV_TX_VALID (1<<31) |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
372 |
|
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
373 |
#define NV_TX2_LASTPACKET (1<<29) |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
374 |
#define NV_TX2_RETRYERROR (1<<18) |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
375 |
#define NV_TX2_FORCED_INTERRUPT (1<<30) |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
376 |
#define NV_TX2_DEFERRED (1<<25) |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
377 |
#define NV_TX2_CARRIERLOST (1<<26) |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
378 |
#define NV_TX2_LATECOLLISION (1<<27) |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
379 |
#define NV_TX2_UNDERFLOW (1<<28) |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
380 |
/* error and valid are the same for both */ |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
381 |
#define NV_TX2_ERROR (1<<30) |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
382 |
#define NV_TX2_VALID (1<<31) |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
383 |
#define NV_TX2_TSO (1<<28) |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
384 |
#define NV_TX2_TSO_SHIFT 14 |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
385 |
#define NV_TX2_TSO_MAX_SHIFT 14 |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
386 |
#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
|
387 |
#define NV_TX2_CHECKSUM_L3 (1<<27) |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
388 |
#define NV_TX2_CHECKSUM_L4 (1<<26) |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
389 |
|
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
390 |
#define NV_TX3_VLAN_TAG_PRESENT (1<<18) |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
391 |
|
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
392 |
#define NV_RX_DESCRIPTORVALID (1<<16) |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
393 |
#define NV_RX_MISSEDFRAME (1<<17) |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
394 |
#define NV_RX_SUBSTRACT1 (1<<18) |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
395 |
#define NV_RX_ERROR1 (1<<23) |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
396 |
#define NV_RX_ERROR2 (1<<24) |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
397 |
#define NV_RX_ERROR3 (1<<25) |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
398 |
#define NV_RX_ERROR4 (1<<26) |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
399 |
#define NV_RX_CRCERR (1<<27) |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
400 |
#define NV_RX_OVERFLOW (1<<28) |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
401 |
#define NV_RX_FRAMINGERR (1<<29) |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
402 |
#define NV_RX_ERROR (1<<30) |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
403 |
#define NV_RX_AVAIL (1<<31) |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
404 |
|
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
405 |
#define NV_RX2_CHECKSUMMASK (0x1C000000) |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
406 |
#define NV_RX2_CHECKSUMOK1 (0x10000000) |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
407 |
#define NV_RX2_CHECKSUMOK2 (0x14000000) |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
408 |
#define NV_RX2_CHECKSUMOK3 (0x18000000) |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
409 |
#define NV_RX2_DESCRIPTORVALID (1<<29) |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
410 |
#define NV_RX2_SUBSTRACT1 (1<<25) |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
411 |
#define NV_RX2_ERROR1 (1<<18) |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
412 |
#define NV_RX2_ERROR2 (1<<19) |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
413 |
#define NV_RX2_ERROR3 (1<<20) |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
414 |
#define NV_RX2_ERROR4 (1<<21) |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
415 |
#define NV_RX2_CRCERR (1<<22) |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
416 |
#define NV_RX2_OVERFLOW (1<<23) |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
417 |
#define NV_RX2_FRAMINGERR (1<<24) |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
418 |
/* error and avail are the same for both */ |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
419 |
#define NV_RX2_ERROR (1<<30) |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
420 |
#define NV_RX2_AVAIL (1<<31) |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
421 |
|
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
422 |
#define NV_RX3_VLAN_TAG_PRESENT (1<<16) |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
423 |
#define NV_RX3_VLAN_TAG_MASK (0x0000FFFF) |
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 |
/* Miscelaneous hardware related defines: */ |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
426 |
#define NV_PCI_REGSZ_VER1 0x270 |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
427 |
#define NV_PCI_REGSZ_VER2 0x604 |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
428 |
|
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
429 |
/* various timeout delays: all in usec */ |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
430 |
#define NV_TXRX_RESET_DELAY 4 |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
431 |
#define NV_TXSTOP_DELAY1 10 |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
432 |
#define NV_TXSTOP_DELAY1MAX 500000 |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
433 |
#define NV_TXSTOP_DELAY2 100 |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
434 |
#define NV_RXSTOP_DELAY1 10 |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
435 |
#define NV_RXSTOP_DELAY1MAX 500000 |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
436 |
#define NV_RXSTOP_DELAY2 100 |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
437 |
#define NV_SETUP5_DELAY 5 |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
438 |
#define NV_SETUP5_DELAYMAX 50000 |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
439 |
#define NV_POWERUP_DELAY 5 |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
440 |
#define NV_POWERUP_DELAYMAX 5000 |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
441 |
#define NV_MIIBUSY_DELAY 50 |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
442 |
#define NV_MIIPHY_DELAY 10 |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
443 |
#define NV_MIIPHY_DELAYMAX 10000 |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
444 |
#define NV_MAC_RESET_DELAY 64 |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
445 |
|
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
446 |
#define NV_WAKEUPPATTERNS 5 |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
447 |
#define NV_WAKEUPMASKENTRIES 4 |
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 |
/* General driver defaults */ |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
450 |
#define NV_WATCHDOG_TIMEO (5*HZ) |
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 |
#define RX_RING 128 |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
453 |
#define TX_RING 256 |
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 |
* 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
|
456 |
* 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
|
457 |
* 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
|
458 |
* implement - probably a disassembly error. |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
459 |
*/ |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
460 |
#define TX_LIMIT_STOP 255 |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
461 |
#define TX_LIMIT_START 254 |
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 |
/* rx/tx mac addr + type + vlan + align + slack*/ |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
464 |
#define NV_RX_HEADERS (64) |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
465 |
/* even more slack. */ |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
466 |
#define NV_RX_ALLOC_PAD (64) |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
467 |
|
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
468 |
/* maximum mtu size */ |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
469 |
#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
|
470 |
#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
|
471 |
|
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
472 |
#define OOM_REFILL (1+HZ/20) |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
473 |
#define POLL_WAIT (1+HZ/100) |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
474 |
#define LINK_TIMEOUT (3*HZ) |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
475 |
|
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
476 |
/* |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
477 |
* desc_ver values: |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
478 |
* The nic supports three different descriptor types: |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
479 |
* - DESC_VER_1: Original |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
480 |
* - DESC_VER_2: support for jumbo frames. |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
481 |
* - DESC_VER_3: 64-bit format. |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
482 |
*/ |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
483 |
#define DESC_VER_1 1 |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
484 |
#define DESC_VER_2 2 |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
485 |
#define DESC_VER_3 3 |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
486 |
|
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
487 |
/* PHY defines */ |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
488 |
#define PHY_OUI_MARVELL 0x5043 |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
489 |
#define PHY_OUI_CICADA 0x03f1 |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
490 |
#define PHYID1_OUI_MASK 0x03ff |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
491 |
#define PHYID1_OUI_SHFT 6 |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
492 |
#define PHYID2_OUI_MASK 0xfc00 |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
493 |
#define PHYID2_OUI_SHFT 10 |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
494 |
#define PHY_INIT1 0x0f000 |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
495 |
#define PHY_INIT2 0x0e00 |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
496 |
#define PHY_INIT3 0x01000 |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
497 |
#define PHY_INIT4 0x0200 |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
498 |
#define PHY_INIT5 0x0004 |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
499 |
#define PHY_INIT6 0x02000 |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
500 |
#define PHY_GIGABIT 0x0100 |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
501 |
|
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
502 |
#define PHY_TIMEOUT 0x1 |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
503 |
#define PHY_ERROR 0x2 |
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_100 0x1 |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
506 |
#define PHY_1000 0x2 |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
507 |
#define PHY_HALF 0x100 |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
508 |
|
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
509 |
/* 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
|
510 |
#define MII_1000BT_CR 0x09 |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
511 |
#define MII_1000BT_SR 0x0a |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
512 |
#define ADVERTISE_1000FULL 0x0200 |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
513 |
#define ADVERTISE_1000HALF 0x0100 |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
514 |
#define LPA_1000FULL 0x0800 |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
515 |
#define LPA_1000HALF 0x0400 |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
516 |
|
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
517 |
/* MSI/MSI-X defines */ |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
518 |
#define NV_MSI_X_MAX_VECTORS 8 |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
519 |
#define NV_MSI_X_VECTORS_MASK 0x000f |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
520 |
#define NV_MSI_CAPABLE 0x0010 |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
521 |
#define NV_MSI_X_CAPABLE 0x0020 |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
522 |
#define NV_MSI_ENABLED 0x0040 |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
523 |
#define NV_MSI_X_ENABLED 0x0080 |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
524 |
|
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
525 |
#define NV_MSI_X_VECTOR_ALL 0x0 |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
526 |
#define NV_MSI_X_VECTOR_RX 0x0 |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
527 |
#define NV_MSI_X_VECTOR_TX 0x1 |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
528 |
#define NV_MSI_X_VECTOR_OTHER 0x2 |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
529 |
|
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
530 |
/* |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
531 |
* SMP locking: |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
532 |
* 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
|
533 |
* critical parts: |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
534 |
* - 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
|
535 |
* by the arch code for interrupts. |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
536 |
* - 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
|
537 |
* needs dev->priv->lock :-( |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
538 |
* - 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
|
539 |
*/ |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
540 |
|
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
541 |
/* in dev: base, irq */ |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
542 |
struct fe_priv { |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
543 |
spinlock_t lock; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
544 |
|
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
545 |
/* General data: |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
546 |
* Locking: spin_lock(&np->lock); */ |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
547 |
struct net_device_stats stats; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
548 |
int in_shutdown; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
549 |
u32 linkspeed; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
550 |
int duplex; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
551 |
int autoneg; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
552 |
int fixed_mode; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
553 |
int phyaddr; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
554 |
int wolenabled; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
555 |
unsigned int phy_oui; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
556 |
u16 gigabit; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
557 |
|
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
558 |
/* General data: RO fields */ |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
559 |
dma_addr_t ring_addr; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
560 |
struct pci_dev *pci_dev; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
561 |
u32 orig_mac[2]; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
562 |
u32 irqmask; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
563 |
u32 desc_ver; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
564 |
u32 txrxctl_bits; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
565 |
u32 vlanctl_bits; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
566 |
u32 driver_data; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
567 |
u32 register_size; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
568 |
|
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
569 |
void __iomem *base; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
570 |
|
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
571 |
/* rx specific fields. |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
572 |
* 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
|
573 |
*/ |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
574 |
ring_type rx_ring; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
575 |
unsigned int cur_rx, refill_rx; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
576 |
struct sk_buff *rx_skbuff[RX_RING]; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
577 |
dma_addr_t rx_dma[RX_RING]; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
578 |
unsigned int rx_buf_sz; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
579 |
unsigned int pkt_limit; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
580 |
struct timer_list oom_kick; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
581 |
struct timer_list nic_poll; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
582 |
u32 nic_poll_irq; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
583 |
|
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
584 |
/* media detection workaround. |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
585 |
* 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
|
586 |
*/ |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
587 |
int need_linktimer; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
588 |
unsigned long link_timeout; |
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 |
* tx specific fields. |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
591 |
*/ |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
592 |
ring_type tx_ring; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
593 |
unsigned int next_tx, nic_tx; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
594 |
struct sk_buff *tx_skbuff[TX_RING]; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
595 |
dma_addr_t tx_dma[TX_RING]; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
596 |
unsigned int tx_dma_len[TX_RING]; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
597 |
u32 tx_flags; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
598 |
|
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
599 |
/* vlan fields */ |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
600 |
struct vlan_group *vlangrp; |
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 |
/* msi/msi-x fields */ |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
603 |
u32 msi_flags; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
604 |
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
|
605 |
}; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
606 |
|
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
607 |
/* |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
608 |
* 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
|
609 |
* is stuck. Overridable with module param. |
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 |
static int max_interrupt_work = 5; |
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 |
/* |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
614 |
* 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
|
615 |
* |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
616 |
* 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
|
617 |
* CPU Mode: Interrupts are controlled by a timer. |
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 |
#define NV_OPTIMIZATION_MODE_THROUGHPUT 0 |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
620 |
#define NV_OPTIMIZATION_MODE_CPU 1 |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
621 |
static int optimization_mode = NV_OPTIMIZATION_MODE_THROUGHPUT; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
622 |
|
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 |
* Poll interval for timer irq |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
625 |
* |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
626 |
* 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
|
627 |
* 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
|
628 |
* Min = 0, and Max = 65535 |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
629 |
*/ |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
630 |
static int poll_interval = -1; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
631 |
|
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
632 |
/* |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
633 |
* Disable MSI interrupts |
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 disable_msi = 0; |
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 MSIX 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_msix = 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 |
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
|
643 |
{ |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
644 |
return netdev_priv(dev); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
645 |
} |
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 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
|
648 |
{ |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
649 |
return ((struct fe_priv *)netdev_priv(dev))->base; |
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 |
|
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
652 |
static inline void pci_push(u8 __iomem *base) |
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 |
/* force out pending posted writes */ |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
655 |
readl(base); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
656 |
} |
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 |
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
|
659 |
{ |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
660 |
return le32_to_cpu(prd->FlagLen) |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
661 |
& ((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
|
662 |
} |
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 |
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
|
665 |
{ |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
666 |
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
|
667 |
} |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
668 |
|
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
669 |
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
|
670 |
int delay, int delaymax, const char *msg) |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
671 |
{ |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
672 |
u8 __iomem *base = get_hwbase(dev); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
673 |
|
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
674 |
pci_push(base); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
675 |
do { |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
676 |
udelay(delay); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
677 |
delaymax -= delay; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
678 |
if (delaymax < 0) { |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
679 |
if (msg) |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
680 |
printk(msg); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
681 |
return 1; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
682 |
} |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
683 |
} while ((readl(base + offset) & mask) != target); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
684 |
return 0; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
685 |
} |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
686 |
|
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
687 |
#define NV_SETUP_RX_RING 0x01 |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
688 |
#define NV_SETUP_TX_RING 0x02 |
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 |
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
|
691 |
{ |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
692 |
struct fe_priv *np = get_nvpriv(dev); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
693 |
u8 __iomem *base = get_hwbase(dev); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
694 |
|
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
695 |
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
|
696 |
if (rxtx_flags & NV_SETUP_RX_RING) { |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
697 |
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
|
698 |
} |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
699 |
if (rxtx_flags & NV_SETUP_TX_RING) { |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
700 |
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
|
701 |
} |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
702 |
} else { |
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 |
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
|
706 |
} |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
707 |
if (rxtx_flags & NV_SETUP_TX_RING) { |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
708 |
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
|
709 |
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
|
710 |
} |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
711 |
} |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
712 |
} |
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 |
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
|
715 |
{ |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
716 |
struct fe_priv *np = get_nvpriv(dev); |
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 |
if (!(np->msi_flags & NV_MSI_X_ENABLED) || |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
719 |
((np->msi_flags & NV_MSI_X_ENABLED) && |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
720 |
((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
|
721 |
return 0; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
722 |
else |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
723 |
return 1; |
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 |
|
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
726 |
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
|
727 |
{ |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
728 |
struct fe_priv *np = get_nvpriv(dev); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
729 |
|
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
730 |
if (!using_multi_irqs(dev)) { |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
731 |
if (np->msi_flags & NV_MSI_X_ENABLED) |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
732 |
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
|
733 |
else |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
734 |
enable_irq(dev->irq); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
735 |
} else { |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
736 |
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
|
737 |
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
|
738 |
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
|
739 |
} |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
740 |
} |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
741 |
|
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
742 |
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
|
743 |
{ |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
744 |
struct fe_priv *np = get_nvpriv(dev); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
745 |
|
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
746 |
if (!using_multi_irqs(dev)) { |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
747 |
if (np->msi_flags & NV_MSI_X_ENABLED) |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
748 |
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
|
749 |
else |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
750 |
disable_irq(dev->irq); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
751 |
} else { |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
752 |
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
|
753 |
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
|
754 |
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
|
755 |
} |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
756 |
} |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
757 |
|
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
758 |
/* 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
|
759 |
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
|
760 |
{ |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
761 |
u8 __iomem *base = get_hwbase(dev); |
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 |
writel(mask, base + NvRegIrqMask); |
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 |
|
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
766 |
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
|
767 |
{ |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
768 |
struct fe_priv *np = get_nvpriv(dev); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
769 |
u8 __iomem *base = get_hwbase(dev); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
770 |
|
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
771 |
if (np->msi_flags & NV_MSI_X_ENABLED) { |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
772 |
writel(mask, base + NvRegIrqMask); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
773 |
} else { |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
774 |
if (np->msi_flags & NV_MSI_ENABLED) |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
775 |
writel(0, base + NvRegMSIIrqMask); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
776 |
writel(0, base + NvRegIrqMask); |
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 |
} |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
779 |
|
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
780 |
#define MII_READ (-1) |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
781 |
/* 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
|
782 |
* |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
783 |
* Caller must guarantee serialization |
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 |
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
|
786 |
{ |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
787 |
u8 __iomem *base = get_hwbase(dev); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
788 |
u32 reg; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
789 |
int retval; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
790 |
|
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
791 |
writel(NVREG_MIISTAT_MASK, base + NvRegMIIStatus); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
792 |
|
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
793 |
reg = readl(base + NvRegMIIControl); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
794 |
if (reg & NVREG_MIICTL_INUSE) { |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
795 |
writel(NVREG_MIICTL_INUSE, base + NvRegMIIControl); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
796 |
udelay(NV_MIIBUSY_DELAY); |
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 |
|
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
799 |
reg = (addr << NVREG_MIICTL_ADDRSHIFT) | miireg; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
800 |
if (value != MII_READ) { |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
801 |
writel(value, base + NvRegMIIData); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
802 |
reg |= NVREG_MIICTL_WRITE; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
803 |
} |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
804 |
writel(reg, base + NvRegMIIControl); |
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 |
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
|
807 |
NV_MIIPHY_DELAY, NV_MIIPHY_DELAYMAX, NULL)) { |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
808 |
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
|
809 |
dev->name, miireg, addr); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
810 |
retval = -1; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
811 |
} else if (value != MII_READ) { |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
812 |
/* 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
|
813 |
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
|
814 |
dev->name, value, miireg, addr); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
815 |
retval = 0; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
816 |
} else if (readl(base + NvRegMIIStatus) & NVREG_MIISTAT_ERROR) { |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
817 |
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
|
818 |
dev->name, miireg, addr); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
819 |
retval = -1; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
820 |
} else { |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
821 |
retval = readl(base + NvRegMIIData); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
822 |
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
|
823 |
dev->name, miireg, addr, retval); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
824 |
} |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
825 |
|
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
826 |
return retval; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
827 |
} |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
828 |
|
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
829 |
static int phy_reset(struct net_device *dev) |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
830 |
{ |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
831 |
struct fe_priv *np = netdev_priv(dev); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
832 |
u32 miicontrol; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
833 |
unsigned int tries = 0; |
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 |
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
|
836 |
miicontrol |= BMCR_RESET; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
837 |
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
|
838 |
return -1; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
839 |
} |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
840 |
|
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
841 |
/* wait for 500ms */ |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
842 |
msleep(500); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
843 |
|
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
844 |
/* must wait till reset is deasserted */ |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
845 |
while (miicontrol & BMCR_RESET) { |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
846 |
msleep(10); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
847 |
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
|
848 |
/* FIXME: 100 tries seem excessive */ |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
849 |
if (tries++ > 100) |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
850 |
return -1; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
851 |
} |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
852 |
return 0; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
853 |
} |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
854 |
|
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
855 |
static int phy_init(struct net_device *dev) |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
856 |
{ |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
857 |
struct fe_priv *np = get_nvpriv(dev); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
858 |
u8 __iomem *base = get_hwbase(dev); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
859 |
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
|
860 |
|
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
861 |
/* set advertise register */ |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
862 |
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
|
863 |
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
|
864 |
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
|
865 |
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
|
866 |
return PHY_ERROR; |
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 |
|
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
869 |
/* get phy interface type */ |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
870 |
phyinterface = readl(base + NvRegPhyInterface); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
871 |
|
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
872 |
/* see if gigabit phy */ |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
873 |
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
|
874 |
if (mii_status & PHY_GIGABIT) { |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
875 |
np->gigabit = PHY_GIGABIT; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
876 |
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
|
877 |
mii_control_1000 &= ~ADVERTISE_1000HALF; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
878 |
if (phyinterface & PHY_RGMII) |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
879 |
mii_control_1000 |= ADVERTISE_1000FULL; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
880 |
else |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
881 |
mii_control_1000 &= ~ADVERTISE_1000FULL; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
882 |
|
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
883 |
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
|
884 |
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
|
885 |
return PHY_ERROR; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
886 |
} |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
887 |
} |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
888 |
else |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
889 |
np->gigabit = 0; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
890 |
|
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
891 |
/* reset the phy */ |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
892 |
if (phy_reset(dev)) { |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
893 |
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
|
894 |
return PHY_ERROR; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
895 |
} |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
896 |
|
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
897 |
/* phy vendor specific configuration */ |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
898 |
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
|
899 |
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
|
900 |
phy_reserved &= ~(PHY_INIT1 | PHY_INIT2); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
901 |
phy_reserved |= (PHY_INIT3 | PHY_INIT4); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
902 |
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
|
903 |
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
|
904 |
return PHY_ERROR; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
905 |
} |
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_NCONFIG, MII_READ); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
907 |
phy_reserved |= PHY_INIT5; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
908 |
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
|
909 |
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
|
910 |
return PHY_ERROR; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
911 |
} |
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 |
if (np->phy_oui == PHY_OUI_CICADA) { |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
914 |
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
|
915 |
phy_reserved |= PHY_INIT6; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
916 |
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
|
917 |
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
|
918 |
return PHY_ERROR; |
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 |
} |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
921 |
|
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
922 |
/* restart auto negotiation */ |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
923 |
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
|
924 |
mii_control |= (BMCR_ANRESTART | BMCR_ANENABLE); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
925 |
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
|
926 |
return PHY_ERROR; |
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 |
return 0; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
930 |
} |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
931 |
|
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
932 |
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
|
933 |
{ |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
934 |
struct fe_priv *np = netdev_priv(dev); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
935 |
u8 __iomem *base = get_hwbase(dev); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
936 |
|
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
937 |
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
|
938 |
/* Already running? Stop it. */ |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
939 |
if (readl(base + NvRegReceiverControl) & NVREG_RCVCTL_START) { |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
940 |
writel(0, base + NvRegReceiverControl); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
941 |
pci_push(base); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
942 |
} |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
943 |
writel(np->linkspeed, base + NvRegLinkSpeed); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
944 |
pci_push(base); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
945 |
writel(NVREG_RCVCTL_START, base + NvRegReceiverControl); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
946 |
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
|
947 |
dev->name, np->duplex, np->linkspeed); |
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 |
|
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
951 |
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
|
952 |
{ |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
953 |
u8 __iomem *base = get_hwbase(dev); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
954 |
|
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
955 |
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
|
956 |
writel(0, base + NvRegReceiverControl); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
957 |
reg_delay(dev, NvRegReceiverStatus, NVREG_RCVSTAT_BUSY, 0, |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
958 |
NV_RXSTOP_DELAY1, NV_RXSTOP_DELAY1MAX, |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
959 |
KERN_INFO "nv_stop_rx: ReceiverStatus remained busy"); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
960 |
|
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
961 |
udelay(NV_RXSTOP_DELAY2); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
962 |
writel(0, base + NvRegLinkSpeed); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
963 |
} |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
964 |
|
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
965 |
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
|
966 |
{ |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
967 |
u8 __iomem *base = get_hwbase(dev); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
968 |
|
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
969 |
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
|
970 |
writel(NVREG_XMITCTL_START, base + NvRegTransmitterControl); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
971 |
pci_push(base); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
972 |
} |
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 |
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
|
975 |
{ |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
976 |
u8 __iomem *base = get_hwbase(dev); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
977 |
|
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
978 |
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
|
979 |
writel(0, base + NvRegTransmitterControl); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
980 |
reg_delay(dev, NvRegTransmitterStatus, NVREG_XMITSTAT_BUSY, 0, |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
981 |
NV_TXSTOP_DELAY1, NV_TXSTOP_DELAY1MAX, |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
982 |
KERN_INFO "nv_stop_tx: TransmitterStatus remained busy"); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
983 |
|
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
984 |
udelay(NV_TXSTOP_DELAY2); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
985 |
writel(0, base + NvRegUnknownTransmitterReg); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
986 |
} |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
987 |
|
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
988 |
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
|
989 |
{ |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
990 |
struct fe_priv *np = netdev_priv(dev); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
991 |
u8 __iomem *base = get_hwbase(dev); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
992 |
|
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
993 |
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
|
994 |
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
|
995 |
pci_push(base); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
996 |
udelay(NV_TXRX_RESET_DELAY); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
997 |
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
|
998 |
pci_push(base); |
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 |
|
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1001 |
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
|
1002 |
{ |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1003 |
struct fe_priv *np = netdev_priv(dev); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1004 |
u8 __iomem *base = get_hwbase(dev); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1005 |
|
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1006 |
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
|
1007 |
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
|
1008 |
pci_push(base); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1009 |
writel(NVREG_MAC_RESET_ASSERT, base + NvRegMacReset); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1010 |
pci_push(base); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1011 |
udelay(NV_MAC_RESET_DELAY); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1012 |
writel(0, base + NvRegMacReset); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1013 |
pci_push(base); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1014 |
udelay(NV_MAC_RESET_DELAY); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1015 |
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
|
1016 |
pci_push(base); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1017 |
} |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1018 |
|
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1019 |
/* |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1020 |
* nv_get_stats: dev->get_stats function |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1021 |
* Get latest stats value from the nic. |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1022 |
* 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
|
1023 |
* only synchronized against unregister_netdevice. |
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 |
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
|
1026 |
{ |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1027 |
struct fe_priv *np = netdev_priv(dev); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1028 |
|
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1029 |
/* 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
|
1030 |
* 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
|
1031 |
* are already up to date. |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1032 |
*/ |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1033 |
return &np->stats; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1034 |
} |
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 |
/* |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1037 |
* nv_alloc_rx: fill rx ring entries. |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1038 |
* 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
|
1039 |
* rx engine is without Available descriptors |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1040 |
*/ |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1041 |
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
|
1042 |
{ |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1043 |
struct fe_priv *np = netdev_priv(dev); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1044 |
unsigned int refill_rx = np->refill_rx; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1045 |
int nr; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1046 |
|
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1047 |
while (np->cur_rx != refill_rx) { |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1048 |
struct sk_buff *skb; |
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 |
nr = refill_rx % RX_RING; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1051 |
if (np->rx_skbuff[nr] == NULL) { |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1052 |
|
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1053 |
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
|
1054 |
if (!skb) |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1055 |
break; |
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 |
skb->dev = dev; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1058 |
np->rx_skbuff[nr] = skb; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1059 |
} else { |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1060 |
skb = np->rx_skbuff[nr]; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1061 |
} |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1062 |
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
|
1063 |
skb->end-skb->data, PCI_DMA_FROMDEVICE); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1064 |
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
|
1065 |
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
|
1066 |
wmb(); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1067 |
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
|
1068 |
} else { |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1069 |
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
|
1070 |
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
|
1071 |
wmb(); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1072 |
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
|
1073 |
} |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1074 |
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
|
1075 |
dev->name, refill_rx); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1076 |
refill_rx++; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1077 |
} |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1078 |
np->refill_rx = refill_rx; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1079 |
if (np->cur_rx - refill_rx == RX_RING) |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1080 |
return 1; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1081 |
return 0; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1082 |
} |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1083 |
|
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1084 |
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
|
1085 |
{ |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1086 |
struct net_device *dev = (struct net_device *) data; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1087 |
struct fe_priv *np = netdev_priv(dev); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1088 |
|
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1089 |
if (!using_multi_irqs(dev)) { |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1090 |
if (np->msi_flags & NV_MSI_X_ENABLED) |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1091 |
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
|
1092 |
else |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1093 |
disable_irq(dev->irq); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1094 |
} else { |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1095 |
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
|
1096 |
} |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1097 |
if (nv_alloc_rx(dev)) { |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1098 |
spin_lock_irq(&np->lock); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1099 |
if (!np->in_shutdown) |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1100 |
mod_timer(&np->oom_kick, jiffies + OOM_REFILL); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1101 |
spin_unlock_irq(&np->lock); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1102 |
} |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1103 |
if (!using_multi_irqs(dev)) { |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1104 |
if (np->msi_flags & NV_MSI_X_ENABLED) |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1105 |
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
|
1106 |
else |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1107 |
enable_irq(dev->irq); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1108 |
} else { |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1109 |
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
|
1110 |
} |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1111 |
} |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1112 |
|
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1113 |
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
|
1114 |
{ |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1115 |
struct fe_priv *np = netdev_priv(dev); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1116 |
int i; |
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 |
np->cur_rx = RX_RING; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1119 |
np->refill_rx = 0; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1120 |
for (i = 0; i < RX_RING; i++) |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1121 |
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
|
1122 |
np->rx_ring.orig[i].FlagLen = 0; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1123 |
else |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1124 |
np->rx_ring.ex[i].FlagLen = 0; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1125 |
} |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1126 |
|
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1127 |
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
|
1128 |
{ |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1129 |
struct fe_priv *np = netdev_priv(dev); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1130 |
int i; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1131 |
|
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1132 |
np->next_tx = np->nic_tx = 0; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1133 |
for (i = 0; i < TX_RING; i++) { |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1134 |
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
|
1135 |
np->tx_ring.orig[i].FlagLen = 0; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1136 |
else |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1137 |
np->tx_ring.ex[i].FlagLen = 0; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1138 |
np->tx_skbuff[i] = NULL; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1139 |
np->tx_dma[i] = 0; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1140 |
} |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1141 |
} |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1142 |
|
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1143 |
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
|
1144 |
{ |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1145 |
nv_init_tx(dev); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1146 |
nv_init_rx(dev); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1147 |
return nv_alloc_rx(dev); |
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_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
|
1151 |
{ |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1152 |
struct fe_priv *np = netdev_priv(dev); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1153 |
|
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1154 |
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
|
1155 |
dev->name, skbnr); |
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 |
if (np->tx_dma[skbnr]) { |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1158 |
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
|
1159 |
np->tx_dma_len[skbnr], |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1160 |
PCI_DMA_TODEVICE); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1161 |
np->tx_dma[skbnr] = 0; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1162 |
} |
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_skbuff[skbnr]) { |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1165 |
dev_kfree_skb_any(np->tx_skbuff[skbnr]); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1166 |
np->tx_skbuff[skbnr] = NULL; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1167 |
return 1; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1168 |
} else { |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1169 |
return 0; |
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 |
} |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1172 |
|
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1173 |
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
|
1174 |
{ |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1175 |
struct fe_priv *np = netdev_priv(dev); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1176 |
unsigned int i; |
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 |
for (i = 0; i < TX_RING; i++) { |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1179 |
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
|
1180 |
np->tx_ring.orig[i].FlagLen = 0; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1181 |
else |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1182 |
np->tx_ring.ex[i].FlagLen = 0; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1183 |
if (nv_release_txskb(dev, i)) |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1184 |
np->stats.tx_dropped++; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1185 |
} |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1186 |
} |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1187 |
|
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1188 |
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
|
1189 |
{ |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1190 |
struct fe_priv *np = netdev_priv(dev); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1191 |
int i; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1192 |
for (i = 0; i < RX_RING; i++) { |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1193 |
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
|
1194 |
np->rx_ring.orig[i].FlagLen = 0; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1195 |
else |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1196 |
np->rx_ring.ex[i].FlagLen = 0; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1197 |
wmb(); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1198 |
if (np->rx_skbuff[i]) { |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1199 |
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
|
1200 |
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
|
1201 |
PCI_DMA_FROMDEVICE); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1202 |
dev_kfree_skb(np->rx_skbuff[i]); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1203 |
np->rx_skbuff[i] = NULL; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1204 |
} |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1205 |
} |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1206 |
} |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1207 |
|
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1208 |
static void drain_ring(struct net_device *dev) |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1209 |
{ |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1210 |
nv_drain_tx(dev); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1211 |
nv_drain_rx(dev); |
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 |
* nv_start_xmit: dev->hard_start_xmit function |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1216 |
* Called with dev->xmit_lock held. |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1217 |
*/ |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1218 |
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
|
1219 |
{ |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1220 |
struct fe_priv *np = netdev_priv(dev); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1221 |
u32 tx_flags = 0; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1222 |
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
|
1223 |
unsigned int fragments = skb_shinfo(skb)->nr_frags; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1224 |
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
|
1225 |
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
|
1226 |
unsigned int i; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1227 |
u32 offset = 0; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1228 |
u32 bcnt; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1229 |
u32 size = skb->len-skb->data_len; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1230 |
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
|
1231 |
u32 tx_flags_vlan = 0; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1232 |
|
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1233 |
/* add fragments to entries count */ |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1234 |
for (i = 0; i < fragments; i++) { |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1235 |
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
|
1236 |
((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
|
1237 |
} |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1238 |
|
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1239 |
spin_lock_irq(&np->lock); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1240 |
|
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1241 |
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
|
1242 |
spin_unlock_irq(&np->lock); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1243 |
netif_stop_queue(dev); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1244 |
return NETDEV_TX_BUSY; |
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 |
|
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1247 |
/* setup the header buffer */ |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1248 |
do { |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1249 |
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
|
1250 |
nr = (nr + 1) % TX_RING; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1251 |
|
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1252 |
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
|
1253 |
PCI_DMA_TODEVICE); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1254 |
np->tx_dma_len[nr] = bcnt; |
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 |
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
|
1257 |
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
|
1258 |
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
|
1259 |
} else { |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1260 |
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
|
1261 |
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
|
1262 |
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
|
1263 |
} |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1264 |
tx_flags = np->tx_flags; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1265 |
offset += bcnt; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1266 |
size -= bcnt; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1267 |
} while(size); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1268 |
|
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1269 |
/* setup the fragments */ |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1270 |
for (i = 0; i < fragments; i++) { |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1271 |
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
|
1272 |
u32 size = frag->size; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1273 |
offset = 0; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1274 |
|
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1275 |
do { |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1276 |
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
|
1277 |
nr = (nr + 1) % TX_RING; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1278 |
|
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1279 |
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
|
1280 |
PCI_DMA_TODEVICE); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1281 |
np->tx_dma_len[nr] = bcnt; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1282 |
|
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1283 |
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
|
1284 |
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
|
1285 |
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
|
1286 |
} else { |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1287 |
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
|
1288 |
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
|
1289 |
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
|
1290 |
} |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1291 |
offset += bcnt; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1292 |
size -= bcnt; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1293 |
} while (size); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1294 |
} |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1295 |
|
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1296 |
/* set last fragment flag */ |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1297 |
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
|
1298 |
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
|
1299 |
} else { |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1300 |
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
|
1301 |
} |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1302 |
|
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1303 |
np->tx_skbuff[nr] = skb; |
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 |
#ifdef NETIF_F_TSO |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1306 |
if (skb_shinfo(skb)->tso_size) |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1307 |
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
|
1308 |
else |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1309 |
#endif |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1310 |
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
|
1311 |
|
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1312 |
/* vlan tag */ |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1313 |
if (np->vlangrp && vlan_tx_tag_present(skb)) { |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1314 |
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
|
1315 |
} |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1316 |
|
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1317 |
/* set tx flags */ |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1318 |
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
|
1319 |
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
|
1320 |
} else { |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1321 |
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
|
1322 |
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
|
1323 |
} |
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 |
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
|
1326 |
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
|
1327 |
{ |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1328 |
int j; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1329 |
for (j=0; j<64; j++) { |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1330 |
if ((j%16) == 0) |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1331 |
dprintk("\n%03x:", j); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1332 |
dprintk(" %02x", ((unsigned char*)skb->data)[j]); |
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("\n"); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1335 |
} |
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 |
np->next_tx += entries; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1338 |
|
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1339 |
dev->trans_start = jiffies; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1340 |
spin_unlock_irq(&np->lock); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1341 |
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
|
1342 |
pci_push(get_hwbase(dev)); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1343 |
return NETDEV_TX_OK; |
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 |
/* |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1347 |
* 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
|
1348 |
* |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1349 |
* Caller must own np->lock. |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1350 |
*/ |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1351 |
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
|
1352 |
{ |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1353 |
struct fe_priv *np = netdev_priv(dev); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1354 |
u32 Flags; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1355 |
unsigned int i; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1356 |
struct sk_buff *skb; |
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 |
while (np->nic_tx != np->next_tx) { |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1359 |
i = np->nic_tx % TX_RING; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1360 |
|
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1361 |
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
|
1362 |
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
|
1363 |
else |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1364 |
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
|
1365 |
|
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1366 |
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
|
1367 |
dev->name, np->nic_tx, Flags); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1368 |
if (Flags & NV_TX_VALID) |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1369 |
break; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1370 |
if (np->desc_ver == DESC_VER_1) { |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1371 |
if (Flags & NV_TX_LASTPACKET) { |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1372 |
skb = np->tx_skbuff[i]; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1373 |
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
|
1374 |
NV_TX_UNDERFLOW|NV_TX_ERROR)) { |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1375 |
if (Flags & NV_TX_UNDERFLOW) |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1376 |
np->stats.tx_fifo_errors++; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1377 |
if (Flags & NV_TX_CARRIERLOST) |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1378 |
np->stats.tx_carrier_errors++; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1379 |
np->stats.tx_errors++; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1380 |
} else { |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1381 |
np->stats.tx_packets++; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1382 |
np->stats.tx_bytes += skb->len; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1383 |
} |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1384 |
} |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1385 |
} else { |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1386 |
if (Flags & NV_TX2_LASTPACKET) { |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1387 |
skb = np->tx_skbuff[i]; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1388 |
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
|
1389 |
NV_TX2_UNDERFLOW|NV_TX2_ERROR)) { |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1390 |
if (Flags & NV_TX2_UNDERFLOW) |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1391 |
np->stats.tx_fifo_errors++; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1392 |
if (Flags & NV_TX2_CARRIERLOST) |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1393 |
np->stats.tx_carrier_errors++; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1394 |
np->stats.tx_errors++; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1395 |
} else { |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1396 |
np->stats.tx_packets++; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1397 |
np->stats.tx_bytes += skb->len; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1398 |
} |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1399 |
} |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1400 |
} |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1401 |
nv_release_txskb(dev, i); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1402 |
np->nic_tx++; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1403 |
} |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1404 |
if (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
|
1405 |
netif_wake_queue(dev); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1406 |
} |
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 |
* nv_tx_timeout: dev->tx_timeout function |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1410 |
* Called with dev->xmit_lock held. |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1411 |
*/ |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1412 |
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
|
1413 |
{ |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1414 |
struct fe_priv *np = netdev_priv(dev); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1415 |
u8 __iomem *base = get_hwbase(dev); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1416 |
u32 status; |
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 |
if (np->msi_flags & NV_MSI_X_ENABLED) |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1419 |
status = readl(base + NvRegMSIXIrqStatus) & NVREG_IRQSTAT_MASK; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1420 |
else |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1421 |
status = readl(base + NvRegIrqStatus) & NVREG_IRQSTAT_MASK; |
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 |
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
|
1424 |
|
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1425 |
{ |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1426 |
int i; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1427 |
|
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1428 |
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
|
1429 |
dev->name, (unsigned long)np->ring_addr, |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1430 |
np->next_tx, np->nic_tx); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1431 |
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
|
1432 |
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
|
1433 |
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
|
1434 |
i, |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1435 |
readl(base + i + 0), readl(base + i + 4), |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1436 |
readl(base + i + 8), readl(base + i + 12), |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1437 |
readl(base + i + 16), readl(base + i + 20), |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1438 |
readl(base + i + 24), readl(base + i + 28)); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1439 |
} |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1440 |
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
|
1441 |
for (i=0;i<TX_RING;i+= 4) { |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1442 |
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
|
1443 |
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
|
1444 |
i, |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1445 |
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
|
1446 |
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
|
1447 |
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
|
1448 |
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
|
1449 |
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
|
1450 |
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
|
1451 |
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
|
1452 |
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
|
1453 |
} else { |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1454 |
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
|
1455 |
i, |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1456 |
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
|
1457 |
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
|
1458 |
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
|
1459 |
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
|
1460 |
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
|
1461 |
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
|
1462 |
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
|
1463 |
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
|
1464 |
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
|
1465 |
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
|
1466 |
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
|
1467 |
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
|
1468 |
} |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1469 |
} |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1470 |
} |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1471 |
|
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1472 |
spin_lock_irq(&np->lock); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1473 |
|
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1474 |
/* 1) stop tx engine */ |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1475 |
nv_stop_tx(dev); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1476 |
|
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1477 |
/* 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
|
1478 |
nv_tx_done(dev); |
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 |
/* 3) if there are dead entries: clear everything */ |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1481 |
if (np->next_tx != np->nic_tx) { |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1482 |
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
|
1483 |
nv_drain_tx(dev); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1484 |
np->next_tx = np->nic_tx = 0; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1485 |
setup_hw_rings(dev, NV_SETUP_TX_RING); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1486 |
netif_wake_queue(dev); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1487 |
} |
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 |
/* 4) restart tx engine */ |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1490 |
nv_start_tx(dev); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1491 |
spin_unlock_irq(&np->lock); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1492 |
} |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1493 |
|
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1494 |
/* |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1495 |
* 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
|
1496 |
* 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
|
1497 |
*/ |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1498 |
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
|
1499 |
{ |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1500 |
int hdrlen; /* length of the 802 header */ |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1501 |
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
|
1502 |
|
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1503 |
/* 1) calculate len according to header */ |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1504 |
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
|
1505 |
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
|
1506 |
hdrlen = VLAN_HLEN; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1507 |
} else { |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1508 |
protolen = ntohs( ((struct ethhdr *)packet)->h_proto); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1509 |
hdrlen = ETH_HLEN; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1510 |
} |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1511 |
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
|
1512 |
dev->name, datalen, protolen, hdrlen); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1513 |
if (protolen > ETH_DATA_LEN) |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1514 |
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
|
1515 |
|
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1516 |
protolen += hdrlen; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1517 |
/* consistency checks: */ |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1518 |
if (datalen > ETH_ZLEN) { |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1519 |
if (datalen >= protolen) { |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1520 |
/* 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
|
1521 |
* additional data. |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1522 |
*/ |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1523 |
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
|
1524 |
dev->name, protolen); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1525 |
return protolen; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1526 |
} else { |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1527 |
/* less data on wire than mentioned in header. |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1528 |
* Discard the packet. |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1529 |
*/ |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1530 |
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
|
1531 |
dev->name); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1532 |
return -1; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1533 |
} |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1534 |
} else { |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1535 |
/* 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
|
1536 |
if (protolen > ETH_ZLEN) { |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1537 |
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
|
1538 |
dev->name); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1539 |
return -1; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1540 |
} |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1541 |
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
|
1542 |
dev->name, datalen); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1543 |
return datalen; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1544 |
} |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1545 |
} |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1546 |
|
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1547 |
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
|
1548 |
{ |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1549 |
struct fe_priv *np = netdev_priv(dev); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1550 |
u32 Flags; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1551 |
u32 vlanflags = 0; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1552 |
|
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 |
for (;;) { |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1555 |
struct sk_buff *skb; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1556 |
int len; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1557 |
int i; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1558 |
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
|
1559 |
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
|
1560 |
|
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1561 |
i = np->cur_rx % RX_RING; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1562 |
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
|
1563 |
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
|
1564 |
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
|
1565 |
} else { |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1566 |
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
|
1567 |
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
|
1568 |
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
|
1569 |
} |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1570 |
|
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1571 |
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
|
1572 |
dev->name, np->cur_rx, Flags); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1573 |
|
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1574 |
if (Flags & NV_RX_AVAIL) |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1575 |
break; /* still owned by hardware, */ |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1576 |
|
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1577 |
/* |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1578 |
* 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
|
1579 |
* 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
|
1580 |
* the performance. |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1581 |
*/ |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1582 |
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
|
1583 |
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
|
1584 |
PCI_DMA_FROMDEVICE); |
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 |
int j; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1588 |
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
|
1589 |
for (j=0; j<64; j++) { |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1590 |
if ((j%16) == 0) |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1591 |
dprintk("\n%03x:", j); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1592 |
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
|
1593 |
} |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1594 |
dprintk("\n"); |
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 |
/* look at what we actually got: */ |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1597 |
if (np->desc_ver == DESC_VER_1) { |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1598 |
if (!(Flags & NV_RX_DESCRIPTORVALID)) |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1599 |
goto next_pkt; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1600 |
|
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1601 |
if (Flags & NV_RX_ERROR) { |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1602 |
if (Flags & NV_RX_MISSEDFRAME) { |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1603 |
np->stats.rx_missed_errors++; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1604 |
np->stats.rx_errors++; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1605 |
goto next_pkt; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1606 |
} |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1607 |
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
|
1608 |
np->stats.rx_errors++; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1609 |
goto next_pkt; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1610 |
} |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1611 |
if (Flags & NV_RX_CRCERR) { |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1612 |
np->stats.rx_crc_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_OVERFLOW) { |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1617 |
np->stats.rx_over_errors++; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1618 |
np->stats.rx_errors++; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1619 |
goto next_pkt; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1620 |
} |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1621 |
if (Flags & NV_RX_ERROR4) { |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1622 |
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
|
1623 |
if (len < 0) { |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1624 |
np->stats.rx_errors++; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1625 |
goto next_pkt; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1626 |
} |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1627 |
} |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1628 |
/* framing errors are soft errors. */ |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1629 |
if (Flags & NV_RX_FRAMINGERR) { |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1630 |
if (Flags & NV_RX_SUBSTRACT1) { |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1631 |
len--; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1632 |
} |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1633 |
} |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1634 |
} |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1635 |
} else { |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1636 |
if (!(Flags & NV_RX2_DESCRIPTORVALID)) |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1637 |
goto next_pkt; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1638 |
|
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1639 |
if (Flags & NV_RX2_ERROR) { |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1640 |
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
|
1641 |
np->stats.rx_errors++; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1642 |
goto next_pkt; |
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 |
if (Flags & NV_RX2_CRCERR) { |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1645 |
np->stats.rx_crc_errors++; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1646 |
np->stats.rx_errors++; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1647 |
goto next_pkt; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1648 |
} |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1649 |
if (Flags & NV_RX2_OVERFLOW) { |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1650 |
np->stats.rx_over_errors++; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1651 |
np->stats.rx_errors++; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1652 |
goto next_pkt; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1653 |
} |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1654 |
if (Flags & NV_RX2_ERROR4) { |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1655 |
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
|
1656 |
if (len < 0) { |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1657 |
np->stats.rx_errors++; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1658 |
goto next_pkt; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1659 |
} |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1660 |
} |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1661 |
/* framing errors are soft errors */ |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1662 |
if (Flags & NV_RX2_FRAMINGERR) { |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1663 |
if (Flags & NV_RX2_SUBSTRACT1) { |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1664 |
len--; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1665 |
} |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1666 |
} |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1667 |
} |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1668 |
Flags &= NV_RX2_CHECKSUMMASK; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1669 |
if (Flags == NV_RX2_CHECKSUMOK1 || |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1670 |
Flags == NV_RX2_CHECKSUMOK2 || |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1671 |
Flags == NV_RX2_CHECKSUMOK3) { |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1672 |
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
|
1673 |
np->rx_skbuff[i]->ip_summed = CHECKSUM_UNNECESSARY; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1674 |
} else { |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1675 |
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
|
1676 |
} |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1677 |
} |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1678 |
/* 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
|
1679 |
skb = np->rx_skbuff[i]; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1680 |
np->rx_skbuff[i] = NULL; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1681 |
|
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1682 |
skb_put(skb, len); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1683 |
skb->protocol = eth_type_trans(skb, dev); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1684 |
dprintk(KERN_DEBUG "%s: nv_rx_process: packet %d with %d bytes, proto %d accepted.\n", |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1685 |
dev->name, np->cur_rx, len, skb->protocol); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1686 |
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
|
1687 |
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
|
1688 |
} else { |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1689 |
netif_rx(skb); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1690 |
} |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1691 |
dev->last_rx = jiffies; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1692 |
np->stats.rx_packets++; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1693 |
np->stats.rx_bytes += len; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1694 |
next_pkt: |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1695 |
np->cur_rx++; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1696 |
} |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1697 |
} |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1698 |
|
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1699 |
static void set_bufsize(struct net_device *dev) |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1700 |
{ |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1701 |
struct fe_priv *np = netdev_priv(dev); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1702 |
|
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1703 |
if (dev->mtu <= ETH_DATA_LEN) |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1704 |
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
|
1705 |
else |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1706 |
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
|
1707 |
} |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1708 |
|
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1709 |
/* |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1710 |
* nv_change_mtu: dev->change_mtu function |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1711 |
* Called with dev_base_lock held for read. |
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 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
|
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 |
int old_mtu; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1717 |
|
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1718 |
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
|
1719 |
return -EINVAL; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1720 |
|
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1721 |
old_mtu = dev->mtu; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1722 |
dev->mtu = new_mtu; |
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 |
/* 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
|
1725 |
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
|
1726 |
return 0; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1727 |
if (old_mtu == new_mtu) |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1728 |
return 0; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1729 |
|
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1730 |
/* synchronized against open : rtnl_lock() held by caller */ |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1731 |
if (netif_running(dev)) { |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1732 |
u8 __iomem *base = get_hwbase(dev); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1733 |
/* |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1734 |
* 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
|
1735 |
* internal buffer. The procedure for flushing everything is |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1736 |
* guessed, there is probably a simpler approach. |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1737 |
* 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
|
1738 |
*/ |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1739 |
nv_disable_irq(dev); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1740 |
spin_lock_bh(&dev->xmit_lock); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1741 |
spin_lock(&np->lock); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1742 |
/* stop engines */ |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1743 |
nv_stop_rx(dev); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1744 |
nv_stop_tx(dev); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1745 |
nv_txrx_reset(dev); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1746 |
/* drain rx queue */ |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1747 |
nv_drain_rx(dev); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1748 |
nv_drain_tx(dev); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1749 |
/* reinit driver view of the rx queue */ |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1750 |
nv_init_rx(dev); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1751 |
nv_init_tx(dev); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1752 |
/* alloc new rx buffers */ |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1753 |
set_bufsize(dev); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1754 |
if (nv_alloc_rx(dev)) { |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1755 |
if (!np->in_shutdown) |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1756 |
mod_timer(&np->oom_kick, jiffies + OOM_REFILL); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1757 |
} |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1758 |
/* reinit nic view of the rx queue */ |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1759 |
writel(np->rx_buf_sz, base + NvRegOffloadConfig); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1760 |
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
|
1761 |
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
|
1762 |
base + NvRegRingSizes); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1763 |
pci_push(base); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1764 |
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
|
1765 |
pci_push(base); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1766 |
|
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1767 |
/* restart rx engine */ |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1768 |
nv_start_rx(dev); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1769 |
nv_start_tx(dev); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1770 |
spin_unlock(&np->lock); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1771 |
spin_unlock_bh(&dev->xmit_lock); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1772 |
nv_enable_irq(dev); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1773 |
} |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1774 |
return 0; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1775 |
} |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1776 |
|
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1777 |
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
|
1778 |
{ |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1779 |
u8 __iomem *base = get_hwbase(dev); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1780 |
u32 mac[2]; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1781 |
|
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1782 |
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
|
1783 |
(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
|
1784 |
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
|
1785 |
|
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1786 |
writel(mac[0], base + NvRegMacAddrA); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1787 |
writel(mac[1], base + NvRegMacAddrB); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1788 |
} |
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 |
* 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
|
1792 |
* Called with rtnl_lock() held. |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1793 |
*/ |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1794 |
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
|
1795 |
{ |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1796 |
struct fe_priv *np = netdev_priv(dev); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1797 |
struct sockaddr *macaddr = (struct sockaddr*)addr; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1798 |
|
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1799 |
if(!is_valid_ether_addr(macaddr->sa_data)) |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1800 |
return -EADDRNOTAVAIL; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1801 |
|
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1802 |
/* synchronized against open : rtnl_lock() held by caller */ |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1803 |
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
|
1804 |
|
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1805 |
if (netif_running(dev)) { |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1806 |
spin_lock_bh(&dev->xmit_lock); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1807 |
spin_lock_irq(&np->lock); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1808 |
|
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1809 |
/* stop rx engine */ |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1810 |
nv_stop_rx(dev); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1811 |
|
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1812 |
/* set mac address */ |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1813 |
nv_copy_mac_to_hw(dev); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1814 |
|
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1815 |
/* restart rx engine */ |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1816 |
nv_start_rx(dev); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1817 |
spin_unlock_irq(&np->lock); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1818 |
spin_unlock_bh(&dev->xmit_lock); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1819 |
} else { |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1820 |
nv_copy_mac_to_hw(dev); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1821 |
} |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1822 |
return 0; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1823 |
} |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1824 |
|
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 |
* nv_set_multicast: dev->set_multicast function |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1827 |
* Called with dev->xmit_lock held. |
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 |
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
|
1830 |
{ |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1831 |
struct fe_priv *np = netdev_priv(dev); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1832 |
u8 __iomem *base = get_hwbase(dev); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1833 |
u32 addr[2]; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1834 |
u32 mask[2]; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1835 |
u32 pff; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1836 |
|
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1837 |
memset(addr, 0, sizeof(addr)); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1838 |
memset(mask, 0, sizeof(mask)); |
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 |
if (dev->flags & IFF_PROMISC) { |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1841 |
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
|
1842 |
pff = NVREG_PFF_PROMISC; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1843 |
} else { |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1844 |
pff = NVREG_PFF_MYADDR; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1845 |
|
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1846 |
if (dev->flags & IFF_ALLMULTI || dev->mc_list) { |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1847 |
u32 alwaysOff[2]; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1848 |
u32 alwaysOn[2]; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1849 |
|
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1850 |
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
|
1851 |
if (dev->flags & IFF_ALLMULTI) { |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1852 |
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
|
1853 |
} else { |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1854 |
struct dev_mc_list *walk; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1855 |
|
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1856 |
walk = dev->mc_list; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1857 |
while (walk != NULL) { |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1858 |
u32 a, b; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1859 |
a = le32_to_cpu(*(u32 *) walk->dmi_addr); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1860 |
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
|
1861 |
alwaysOn[0] &= a; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1862 |
alwaysOff[0] &= ~a; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1863 |
alwaysOn[1] &= b; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1864 |
alwaysOff[1] &= ~b; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1865 |
walk = walk->next; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1866 |
} |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1867 |
} |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1868 |
addr[0] = alwaysOn[0]; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1869 |
addr[1] = alwaysOn[1]; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1870 |
mask[0] = alwaysOn[0] | alwaysOff[0]; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1871 |
mask[1] = alwaysOn[1] | alwaysOff[1]; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1872 |
} |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1873 |
} |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1874 |
addr[0] |= NVREG_MCASTADDRA_FORCE; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1875 |
pff |= NVREG_PFF_ALWAYS; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1876 |
spin_lock_irq(&np->lock); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1877 |
nv_stop_rx(dev); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1878 |
writel(addr[0], base + NvRegMulticastAddrA); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1879 |
writel(addr[1], base + NvRegMulticastAddrB); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1880 |
writel(mask[0], base + NvRegMulticastMaskA); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1881 |
writel(mask[1], base + NvRegMulticastMaskB); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1882 |
writel(pff, base + NvRegPacketFilterFlags); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1883 |
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
|
1884 |
dev->name); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1885 |
nv_start_rx(dev); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1886 |
spin_unlock_irq(&np->lock); |
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 |
|
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1889 |
/** |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1890 |
* 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
|
1891 |
* @dev: Network device to be configured |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1892 |
* |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1893 |
* 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
|
1894 |
* 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
|
1895 |
* set to 10 MBit HD. |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1896 |
* |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1897 |
* 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
|
1898 |
* a good link partner. |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1899 |
*/ |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1900 |
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
|
1901 |
{ |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1902 |
struct fe_priv *np = netdev_priv(dev); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1903 |
u8 __iomem *base = get_hwbase(dev); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1904 |
int adv, lpa; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1905 |
int newls = np->linkspeed; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1906 |
int newdup = np->duplex; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1907 |
int mii_status; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1908 |
int retval = 0; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1909 |
u32 control_1000, status_1000, phyreg; |
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 |
/* BMSR_LSTATUS is latched, read it twice: |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1912 |
* we want the current value. |
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 |
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
|
1915 |
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
|
1916 |
|
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1917 |
if (!(mii_status & BMSR_LSTATUS)) { |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1918 |
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
|
1919 |
dev->name); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1920 |
newls = NVREG_LINKSPEED_FORCE|NVREG_LINKSPEED_10; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1921 |
newdup = 0; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1922 |
retval = 0; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1923 |
goto set_speed; |
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 |
|
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1926 |
if (np->autoneg == 0) { |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1927 |
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
|
1928 |
dev->name, np->fixed_mode); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1929 |
if (np->fixed_mode & LPA_100FULL) { |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1930 |
newls = NVREG_LINKSPEED_FORCE|NVREG_LINKSPEED_100; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1931 |
newdup = 1; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1932 |
} else if (np->fixed_mode & LPA_100HALF) { |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1933 |
newls = NVREG_LINKSPEED_FORCE|NVREG_LINKSPEED_100; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1934 |
newdup = 0; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1935 |
} else if (np->fixed_mode & LPA_10FULL) { |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1936 |
newls = NVREG_LINKSPEED_FORCE|NVREG_LINKSPEED_10; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1937 |
newdup = 1; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1938 |
} else { |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1939 |
newls = NVREG_LINKSPEED_FORCE|NVREG_LINKSPEED_10; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1940 |
newdup = 0; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1941 |
} |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1942 |
retval = 1; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1943 |
goto set_speed; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1944 |
} |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1945 |
/* check auto negotiation is complete */ |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1946 |
if (!(mii_status & BMSR_ANEGCOMPLETE)) { |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1947 |
/* 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
|
1948 |
newls = NVREG_LINKSPEED_FORCE|NVREG_LINKSPEED_10; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1949 |
newdup = 0; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1950 |
retval = 0; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1951 |
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
|
1952 |
goto set_speed; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1953 |
} |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1954 |
|
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1955 |
retval = 1; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1956 |
if (np->gigabit == PHY_GIGABIT) { |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1957 |
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
|
1958 |
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
|
1959 |
|
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1960 |
if ((control_1000 & ADVERTISE_1000FULL) && |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1961 |
(status_1000 & LPA_1000FULL)) { |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1962 |
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
|
1963 |
dev->name); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1964 |
newls = NVREG_LINKSPEED_FORCE|NVREG_LINKSPEED_1000; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1965 |
newdup = 1; |
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 |
|
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1970 |
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
|
1971 |
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
|
1972 |
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
|
1973 |
dev->name, adv, lpa); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1974 |
|
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1975 |
/* FIXME: handle parallel detection properly */ |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1976 |
lpa = lpa & adv; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1977 |
if (lpa & LPA_100FULL) { |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1978 |
newls = NVREG_LINKSPEED_FORCE|NVREG_LINKSPEED_100; |
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 |
} else if (lpa & LPA_100HALF) { |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1981 |
newls = NVREG_LINKSPEED_FORCE|NVREG_LINKSPEED_100; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1982 |
newdup = 0; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1983 |
} else if (lpa & LPA_10FULL) { |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1984 |
newls = NVREG_LINKSPEED_FORCE|NVREG_LINKSPEED_10; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1985 |
newdup = 1; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1986 |
} else if (lpa & LPA_10HALF) { |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1987 |
newls = NVREG_LINKSPEED_FORCE|NVREG_LINKSPEED_10; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1988 |
newdup = 0; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1989 |
} else { |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1990 |
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
|
1991 |
newls = NVREG_LINKSPEED_FORCE|NVREG_LINKSPEED_10; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1992 |
newdup = 0; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1993 |
} |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1994 |
|
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1995 |
set_speed: |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1996 |
if (np->duplex == newdup && np->linkspeed == newls) |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1997 |
return retval; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1998 |
|
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1999 |
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
|
2000 |
dev->name, np->linkspeed, np->duplex, newls, newdup); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2001 |
|
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2002 |
np->duplex = newdup; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2003 |
np->linkspeed = newls; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2004 |
|
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2005 |
if (np->gigabit == PHY_GIGABIT) { |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2006 |
phyreg = readl(base + NvRegRandomSeed); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2007 |
phyreg &= ~(0x3FF00); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2008 |
if ((np->linkspeed & 0xFFF) == NVREG_LINKSPEED_10) |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2009 |
phyreg |= NVREG_RNDSEED_FORCE3; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2010 |
else if ((np->linkspeed & 0xFFF) == NVREG_LINKSPEED_100) |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2011 |
phyreg |= NVREG_RNDSEED_FORCE2; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2012 |
else if ((np->linkspeed & 0xFFF) == NVREG_LINKSPEED_1000) |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2013 |
phyreg |= NVREG_RNDSEED_FORCE; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2014 |
writel(phyreg, base + NvRegRandomSeed); |
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 |
|
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2017 |
phyreg = readl(base + NvRegPhyInterface); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2018 |
phyreg &= ~(PHY_HALF|PHY_100|PHY_1000); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2019 |
if (np->duplex == 0) |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2020 |
phyreg |= PHY_HALF; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2021 |
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
|
2022 |
phyreg |= PHY_100; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2023 |
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
|
2024 |
phyreg |= PHY_1000; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2025 |
writel(phyreg, base + NvRegPhyInterface); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2026 |
|
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2027 |
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
|
2028 |
base + NvRegMisc1); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2029 |
pci_push(base); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2030 |
writel(np->linkspeed, base + NvRegLinkSpeed); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2031 |
pci_push(base); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2032 |
|
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2033 |
return retval; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2034 |
} |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2035 |
|
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2036 |
static void nv_linkchange(struct net_device *dev) |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2037 |
{ |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2038 |
if (nv_update_linkspeed(dev)) { |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2039 |
if (!netif_carrier_ok(dev)) { |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2040 |
netif_carrier_on(dev); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2041 |
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
|
2042 |
nv_start_rx(dev); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2043 |
} |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2044 |
} else { |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2045 |
if (netif_carrier_ok(dev)) { |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2046 |
netif_carrier_off(dev); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2047 |
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
|
2048 |
nv_stop_rx(dev); |
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 |
} |
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 |
|
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2053 |
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
|
2054 |
{ |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2055 |
u8 __iomem *base = get_hwbase(dev); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2056 |
u32 miistat; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2057 |
|
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2058 |
miistat = readl(base + NvRegMIIStatus); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2059 |
writel(NVREG_MIISTAT_MASK, base + NvRegMIIStatus); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2060 |
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
|
2061 |
|
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2062 |
if (miistat & (NVREG_MIISTAT_LINKCHANGE)) |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2063 |
nv_linkchange(dev); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2064 |
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
|
2065 |
} |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2066 |
|
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2067 |
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
|
2068 |
{ |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2069 |
struct net_device *dev = (struct net_device *) data; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2070 |
struct fe_priv *np = netdev_priv(dev); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2071 |
u8 __iomem *base = get_hwbase(dev); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2072 |
u32 events; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2073 |
int i; |
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 |
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
|
2076 |
|
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2077 |
for (i=0; ; i++) { |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2078 |
if (!(np->msi_flags & NV_MSI_X_ENABLED)) { |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2079 |
events = readl(base + NvRegIrqStatus) & NVREG_IRQSTAT_MASK; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2080 |
writel(NVREG_IRQSTAT_MASK, base + NvRegIrqStatus); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2081 |
} else { |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2082 |
events = readl(base + NvRegMSIXIrqStatus) & NVREG_IRQSTAT_MASK; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2083 |
writel(NVREG_IRQSTAT_MASK, base + NvRegMSIXIrqStatus); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2084 |
} |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2085 |
pci_push(base); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2086 |
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
|
2087 |
if (!(events & np->irqmask)) |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2088 |
break; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2089 |
|
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2090 |
spin_lock(&np->lock); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2091 |
nv_tx_done(dev); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2092 |
spin_unlock(&np->lock); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2093 |
|
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2094 |
nv_rx_process(dev); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2095 |
if (nv_alloc_rx(dev)) { |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2096 |
spin_lock(&np->lock); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2097 |
if (!np->in_shutdown) |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2098 |
mod_timer(&np->oom_kick, jiffies + OOM_REFILL); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2099 |
spin_unlock(&np->lock); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2100 |
} |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2101 |
|
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2102 |
if (events & NVREG_IRQ_LINK) { |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2103 |
spin_lock(&np->lock); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2104 |
nv_link_irq(dev); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2105 |
spin_unlock(&np->lock); |
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 |
if (np->need_linktimer && time_after(jiffies, np->link_timeout)) { |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2108 |
spin_lock(&np->lock); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2109 |
nv_linkchange(dev); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2110 |
spin_unlock(&np->lock); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2111 |
np->link_timeout = jiffies + LINK_TIMEOUT; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2112 |
} |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2113 |
if (events & (NVREG_IRQ_TX_ERR)) { |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2114 |
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
|
2115 |
dev->name, events); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2116 |
} |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2117 |
if (events & (NVREG_IRQ_UNKNOWN)) { |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2118 |
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
|
2119 |
dev->name, events); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2120 |
} |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2121 |
if (i > max_interrupt_work) { |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2122 |
spin_lock(&np->lock); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2123 |
/* disable interrupts on the nic */ |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2124 |
if (!(np->msi_flags & NV_MSI_X_ENABLED)) |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2125 |
writel(0, base + NvRegIrqMask); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2126 |
else |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2127 |
writel(np->irqmask, base + NvRegIrqMask); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2128 |
pci_push(base); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2129 |
|
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2130 |
if (!np->in_shutdown) { |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2131 |
np->nic_poll_irq = np->irqmask; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2132 |
mod_timer(&np->nic_poll, jiffies + POLL_WAIT); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2133 |
} |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2134 |
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
|
2135 |
spin_unlock(&np->lock); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2136 |
break; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2137 |
} |
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 |
} |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2140 |
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
|
2141 |
|
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2142 |
return IRQ_RETVAL(i); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2143 |
} |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2144 |
|
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2145 |
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
|
2146 |
{ |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2147 |
struct net_device *dev = (struct net_device *) data; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2148 |
struct fe_priv *np = netdev_priv(dev); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2149 |
u8 __iomem *base = get_hwbase(dev); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2150 |
u32 events; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2151 |
int i; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2152 |
|
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2153 |
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
|
2154 |
|
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2155 |
for (i=0; ; i++) { |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2156 |
events = readl(base + NvRegMSIXIrqStatus) & NVREG_IRQ_TX_ALL; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2157 |
writel(NVREG_IRQ_TX_ALL, base + NvRegMSIXIrqStatus); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2158 |
pci_push(base); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2159 |
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
|
2160 |
if (!(events & np->irqmask)) |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2161 |
break; |
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 |
spin_lock_irq(&np->lock); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2164 |
nv_tx_done(dev); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2165 |
spin_unlock_irq(&np->lock); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2166 |
|
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2167 |
if (events & (NVREG_IRQ_TX_ERR)) { |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2168 |
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
|
2169 |
dev->name, events); |
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 |
if (i > max_interrupt_work) { |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2172 |
spin_lock_irq(&np->lock); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2173 |
/* disable interrupts on the nic */ |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2174 |
writel(NVREG_IRQ_TX_ALL, base + NvRegIrqMask); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2175 |
pci_push(base); |
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 |
if (!np->in_shutdown) { |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2178 |
np->nic_poll_irq |= NVREG_IRQ_TX_ALL; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2179 |
mod_timer(&np->nic_poll, jiffies + POLL_WAIT); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2180 |
} |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2181 |
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
|
2182 |
spin_unlock_irq(&np->lock); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2183 |
break; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2184 |
} |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2185 |
|
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2186 |
} |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2187 |
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
|
2188 |
|
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2189 |
return IRQ_RETVAL(i); |
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 |
|
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2192 |
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
|
2193 |
{ |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2194 |
struct net_device *dev = (struct net_device *) data; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2195 |
struct fe_priv *np = netdev_priv(dev); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2196 |
u8 __iomem *base = get_hwbase(dev); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2197 |
u32 events; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2198 |
int i; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2199 |
|
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2200 |
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
|
2201 |
|
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2202 |
for (i=0; ; i++) { |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2203 |
events = readl(base + NvRegMSIXIrqStatus) & NVREG_IRQ_RX_ALL; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2204 |
writel(NVREG_IRQ_RX_ALL, base + NvRegMSIXIrqStatus); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2205 |
pci_push(base); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2206 |
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
|
2207 |
if (!(events & np->irqmask)) |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2208 |
break; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2209 |
|
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2210 |
nv_rx_process(dev); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2211 |
if (nv_alloc_rx(dev)) { |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2212 |
spin_lock_irq(&np->lock); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2213 |
if (!np->in_shutdown) |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2214 |
mod_timer(&np->oom_kick, jiffies + OOM_REFILL); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2215 |
spin_unlock_irq(&np->lock); |
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 |
if (i > max_interrupt_work) { |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2219 |
spin_lock_irq(&np->lock); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2220 |
/* disable interrupts on the nic */ |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2221 |
writel(NVREG_IRQ_RX_ALL, base + NvRegIrqMask); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2222 |
pci_push(base); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2223 |
|
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2224 |
if (!np->in_shutdown) { |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2225 |
np->nic_poll_irq |= NVREG_IRQ_RX_ALL; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2226 |
mod_timer(&np->nic_poll, jiffies + POLL_WAIT); |
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 |
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
|
2229 |
spin_unlock_irq(&np->lock); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2230 |
break; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2231 |
} |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2232 |
|
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2233 |
} |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2234 |
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
|
2235 |
|
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2236 |
return IRQ_RETVAL(i); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2237 |
} |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2238 |
|
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2239 |
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
|
2240 |
{ |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2241 |
struct net_device *dev = (struct net_device *) data; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2242 |
struct fe_priv *np = netdev_priv(dev); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2243 |
u8 __iomem *base = get_hwbase(dev); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2244 |
u32 events; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2245 |
int i; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2246 |
|
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2247 |
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
|
2248 |
|
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2249 |
for (i=0; ; i++) { |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2250 |
events = readl(base + NvRegMSIXIrqStatus) & NVREG_IRQ_OTHER; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2251 |
writel(NVREG_IRQ_OTHER, base + NvRegMSIXIrqStatus); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2252 |
pci_push(base); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2253 |
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
|
2254 |
if (!(events & np->irqmask)) |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2255 |
break; |
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 |
if (events & NVREG_IRQ_LINK) { |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2258 |
spin_lock_irq(&np->lock); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2259 |
nv_link_irq(dev); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2260 |
spin_unlock_irq(&np->lock); |
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 |
if (np->need_linktimer && time_after(jiffies, np->link_timeout)) { |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2263 |
spin_lock_irq(&np->lock); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2264 |
nv_linkchange(dev); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2265 |
spin_unlock_irq(&np->lock); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2266 |
np->link_timeout = jiffies + LINK_TIMEOUT; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2267 |
} |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2268 |
if (events & (NVREG_IRQ_UNKNOWN)) { |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2269 |
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
|
2270 |
dev->name, events); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2271 |
} |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2272 |
if (i > max_interrupt_work) { |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2273 |
spin_lock_irq(&np->lock); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2274 |
/* disable interrupts on the nic */ |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2275 |
writel(NVREG_IRQ_OTHER, base + NvRegIrqMask); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2276 |
pci_push(base); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2277 |
|
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2278 |
if (!np->in_shutdown) { |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2279 |
np->nic_poll_irq |= NVREG_IRQ_OTHER; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2280 |
mod_timer(&np->nic_poll, jiffies + POLL_WAIT); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2281 |
} |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2282 |
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
|
2283 |
spin_unlock_irq(&np->lock); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2284 |
break; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2285 |
} |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2286 |
|
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2287 |
} |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2288 |
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
|
2289 |
|
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2290 |
return IRQ_RETVAL(i); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2291 |
} |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2292 |
|
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2293 |
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
|
2294 |
{ |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2295 |
struct net_device *dev = (struct net_device *) data; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2296 |
struct fe_priv *np = netdev_priv(dev); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2297 |
u8 __iomem *base = get_hwbase(dev); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2298 |
u32 mask = 0; |
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 |
/* |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2301 |
* First disable irq(s) and then |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2302 |
* 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
|
2303 |
* 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
|
2304 |
*/ |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2305 |
|
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2306 |
if (!using_multi_irqs(dev)) { |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2307 |
if (np->msi_flags & NV_MSI_X_ENABLED) |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2308 |
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
|
2309 |
else |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2310 |
disable_irq(dev->irq); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2311 |
mask = np->irqmask; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2312 |
} else { |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2313 |
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
|
2314 |
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
|
2315 |
mask |= NVREG_IRQ_RX_ALL; |
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 |
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
|
2318 |
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
|
2319 |
mask |= NVREG_IRQ_TX_ALL; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2320 |
} |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2321 |
if (np->nic_poll_irq & NVREG_IRQ_OTHER) { |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2322 |
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
|
2323 |
mask |= NVREG_IRQ_OTHER; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2324 |
} |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2325 |
} |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2326 |
np->nic_poll_irq = 0; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2327 |
|
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2328 |
/* 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
|
2329 |
|
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2330 |
writel(mask, base + NvRegIrqMask); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2331 |
pci_push(base); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2332 |
|
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2333 |
if (!using_multi_irqs(dev)) { |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2334 |
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
|
2335 |
if (np->msi_flags & NV_MSI_X_ENABLED) |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2336 |
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
|
2337 |
else |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2338 |
enable_irq(dev->irq); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2339 |
} else { |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2340 |
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
|
2341 |
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
|
2342 |
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
|
2343 |
} |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2344 |
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
|
2345 |
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
|
2346 |
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
|
2347 |
} |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2348 |
if (np->nic_poll_irq & NVREG_IRQ_OTHER) { |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2349 |
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
|
2350 |
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
|
2351 |
} |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2352 |
} |
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 |
#ifdef CONFIG_NET_POLL_CONTROLLER |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2356 |
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
|
2357 |
{ |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2358 |
nv_do_nic_poll((unsigned long) dev); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2359 |
} |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2360 |
#endif |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2361 |
|
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2362 |
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
|
2363 |
{ |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2364 |
struct fe_priv *np = netdev_priv(dev); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2365 |
strcpy(info->driver, "forcedeth"); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2366 |
strcpy(info->version, FORCEDETH_VERSION); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2367 |
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
|
2368 |
} |
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 |
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
|
2371 |
{ |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2372 |
struct fe_priv *np = netdev_priv(dev); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2373 |
wolinfo->supported = WAKE_MAGIC; |
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 |
spin_lock_irq(&np->lock); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2376 |
if (np->wolenabled) |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2377 |
wolinfo->wolopts = WAKE_MAGIC; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2378 |
spin_unlock_irq(&np->lock); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2379 |
} |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2380 |
|
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2381 |
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
|
2382 |
{ |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2383 |
struct fe_priv *np = netdev_priv(dev); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2384 |
u8 __iomem *base = get_hwbase(dev); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2385 |
|
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2386 |
spin_lock_irq(&np->lock); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2387 |
if (wolinfo->wolopts == 0) { |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2388 |
writel(0, base + NvRegWakeUpFlags); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2389 |
np->wolenabled = 0; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2390 |
} |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2391 |
if (wolinfo->wolopts & WAKE_MAGIC) { |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2392 |
writel(NVREG_WAKEUPFLAGS_ENABLE, base + NvRegWakeUpFlags); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2393 |
np->wolenabled = 1; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2394 |
} |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2395 |
spin_unlock_irq(&np->lock); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2396 |
return 0; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2397 |
} |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2398 |
|
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2399 |
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
|
2400 |
{ |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2401 |
struct fe_priv *np = netdev_priv(dev); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2402 |
int adv; |
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 |
spin_lock_irq(&np->lock); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2405 |
ecmd->port = PORT_MII; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2406 |
if (!netif_running(dev)) { |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2407 |
/* 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
|
2408 |
* interface is disabled. Force a link check */ |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2409 |
nv_update_linkspeed(dev); |
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 |
switch(np->linkspeed & (NVREG_LINKSPEED_MASK)) { |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2412 |
case NVREG_LINKSPEED_10: |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2413 |
ecmd->speed = SPEED_10; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2414 |
break; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2415 |
case NVREG_LINKSPEED_100: |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2416 |
ecmd->speed = SPEED_100; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2417 |
break; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2418 |
case NVREG_LINKSPEED_1000: |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2419 |
ecmd->speed = SPEED_1000; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2420 |
break; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2421 |
} |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2422 |
ecmd->duplex = DUPLEX_HALF; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2423 |
if (np->duplex) |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2424 |
ecmd->duplex = DUPLEX_FULL; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2425 |
|
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2426 |
ecmd->autoneg = np->autoneg; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2427 |
|
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2428 |
ecmd->advertising = ADVERTISED_MII; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2429 |
if (np->autoneg) { |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2430 |
ecmd->advertising |= ADVERTISED_Autoneg; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2431 |
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
|
2432 |
} else { |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2433 |
adv = np->fixed_mode; |
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 |
if (adv & ADVERTISE_10HALF) |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2436 |
ecmd->advertising |= ADVERTISED_10baseT_Half; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2437 |
if (adv & ADVERTISE_10FULL) |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2438 |
ecmd->advertising |= ADVERTISED_10baseT_Full; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2439 |
if (adv & ADVERTISE_100HALF) |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2440 |
ecmd->advertising |= ADVERTISED_100baseT_Half; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2441 |
if (adv & ADVERTISE_100FULL) |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2442 |
ecmd->advertising |= ADVERTISED_100baseT_Full; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2443 |
if (np->autoneg && np->gigabit == PHY_GIGABIT) { |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2444 |
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
|
2445 |
if (adv & ADVERTISE_1000FULL) |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2446 |
ecmd->advertising |= ADVERTISED_1000baseT_Full; |
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 |
|
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2449 |
ecmd->supported = (SUPPORTED_Autoneg | |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2450 |
SUPPORTED_10baseT_Half | SUPPORTED_10baseT_Full | |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2451 |
SUPPORTED_100baseT_Half | SUPPORTED_100baseT_Full | |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2452 |
SUPPORTED_MII); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2453 |
if (np->gigabit == PHY_GIGABIT) |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2454 |
ecmd->supported |= SUPPORTED_1000baseT_Full; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2455 |
|
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2456 |
ecmd->phy_address = np->phyaddr; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2457 |
ecmd->transceiver = XCVR_EXTERNAL; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2458 |
|
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2459 |
/* ignore maxtxpkt, maxrxpkt for now */ |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2460 |
spin_unlock_irq(&np->lock); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2461 |
return 0; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2462 |
} |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2463 |
|
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2464 |
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
|
2465 |
{ |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2466 |
struct fe_priv *np = netdev_priv(dev); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2467 |
|
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2468 |
if (ecmd->port != PORT_MII) |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2469 |
return -EINVAL; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2470 |
if (ecmd->transceiver != XCVR_EXTERNAL) |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2471 |
return -EINVAL; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2472 |
if (ecmd->phy_address != np->phyaddr) { |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2473 |
/* TODO: support switching between multiple phys. Should be |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2474 |
* 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
|
2475 |
return -EINVAL; |
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 |
if (ecmd->autoneg == AUTONEG_ENABLE) { |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2478 |
u32 mask; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2479 |
|
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2480 |
mask = ADVERTISED_10baseT_Half | ADVERTISED_10baseT_Full | |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2481 |
ADVERTISED_100baseT_Half | ADVERTISED_100baseT_Full; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2482 |
if (np->gigabit == PHY_GIGABIT) |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2483 |
mask |= ADVERTISED_1000baseT_Full; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2484 |
|
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2485 |
if ((ecmd->advertising & mask) == 0) |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2486 |
return -EINVAL; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2487 |
|
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2488 |
} else if (ecmd->autoneg == AUTONEG_DISABLE) { |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2489 |
/* Note: autonegotiation disable, speed 1000 intentionally |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2490 |
* forbidden - noone should need that. */ |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2491 |
|
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2492 |
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
|
2493 |
return -EINVAL; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2494 |
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
|
2495 |
return -EINVAL; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2496 |
} else { |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2497 |
return -EINVAL; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2498 |
} |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2499 |
|
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2500 |
spin_lock_irq(&np->lock); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2501 |
if (ecmd->autoneg == AUTONEG_ENABLE) { |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2502 |
int adv, bmcr; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2503 |
|
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2504 |
np->autoneg = 1; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2505 |
|
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2506 |
/* advertise only what has been requested */ |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2507 |
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
|
2508 |
adv &= ~(ADVERTISE_ALL | ADVERTISE_100BASE4); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2509 |
if (ecmd->advertising & ADVERTISED_10baseT_Half) |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2510 |
adv |= ADVERTISE_10HALF; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2511 |
if (ecmd->advertising & ADVERTISED_10baseT_Full) |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2512 |
adv |= ADVERTISE_10FULL; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2513 |
if (ecmd->advertising & ADVERTISED_100baseT_Half) |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2514 |
adv |= ADVERTISE_100HALF; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2515 |
if (ecmd->advertising & ADVERTISED_100baseT_Full) |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2516 |
adv |= ADVERTISE_100FULL; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2517 |
mii_rw(dev, np->phyaddr, MII_ADVERTISE, adv); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2518 |
|
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2519 |
if (np->gigabit == PHY_GIGABIT) { |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2520 |
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
|
2521 |
adv &= ~ADVERTISE_1000FULL; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2522 |
if (ecmd->advertising & ADVERTISED_1000baseT_Full) |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2523 |
adv |= ADVERTISE_1000FULL; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2524 |
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
|
2525 |
} |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2526 |
|
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2527 |
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
|
2528 |
bmcr |= (BMCR_ANENABLE | BMCR_ANRESTART); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2529 |
mii_rw(dev, np->phyaddr, MII_BMCR, bmcr); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2530 |
|
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2531 |
} else { |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2532 |
int adv, bmcr; |
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 |
np->autoneg = 0; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2535 |
|
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2536 |
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
|
2537 |
adv &= ~(ADVERTISE_ALL | ADVERTISE_100BASE4); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2538 |
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
|
2539 |
adv |= ADVERTISE_10HALF; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2540 |
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
|
2541 |
adv |= ADVERTISE_10FULL; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2542 |
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
|
2543 |
adv |= ADVERTISE_100HALF; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2544 |
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
|
2545 |
adv |= ADVERTISE_100FULL; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2546 |
mii_rw(dev, np->phyaddr, MII_ADVERTISE, adv); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2547 |
np->fixed_mode = adv; |
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 |
if (np->gigabit == PHY_GIGABIT) { |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2550 |
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
|
2551 |
adv &= ~ADVERTISE_1000FULL; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2552 |
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
|
2553 |
} |
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 |
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
|
2556 |
bmcr |= ~(BMCR_ANENABLE|BMCR_SPEED100|BMCR_FULLDPLX); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2557 |
if (adv & (ADVERTISE_10FULL|ADVERTISE_100FULL)) |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2558 |
bmcr |= BMCR_FULLDPLX; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2559 |
if (adv & (ADVERTISE_100HALF|ADVERTISE_100FULL)) |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2560 |
bmcr |= BMCR_SPEED100; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2561 |
mii_rw(dev, np->phyaddr, MII_BMCR, bmcr); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2562 |
|
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2563 |
if (netif_running(dev)) { |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2564 |
/* Wait a bit and then reconfigure the nic. */ |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2565 |
udelay(10); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2566 |
nv_linkchange(dev); |
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 |
} |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2569 |
spin_unlock_irq(&np->lock); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2570 |
|
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2571 |
return 0; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2572 |
} |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2573 |
|
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2574 |
#define FORCEDETH_REGS_VER 1 |
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 |
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
|
2577 |
{ |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2578 |
struct fe_priv *np = netdev_priv(dev); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2579 |
return np->register_size; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2580 |
} |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2581 |
|
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2582 |
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
|
2583 |
{ |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2584 |
struct fe_priv *np = netdev_priv(dev); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2585 |
u8 __iomem *base = get_hwbase(dev); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2586 |
u32 *rbuf = buf; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2587 |
int i; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2588 |
|
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2589 |
regs->version = FORCEDETH_REGS_VER; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2590 |
spin_lock_irq(&np->lock); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2591 |
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
|
2592 |
rbuf[i] = readl(base + i*sizeof(u32)); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2593 |
spin_unlock_irq(&np->lock); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2594 |
} |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2595 |
|
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2596 |
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
|
2597 |
{ |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2598 |
struct fe_priv *np = netdev_priv(dev); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2599 |
int ret; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2600 |
|
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2601 |
spin_lock_irq(&np->lock); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2602 |
if (np->autoneg) { |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2603 |
int bmcr; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2604 |
|
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2605 |
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
|
2606 |
bmcr |= (BMCR_ANENABLE | BMCR_ANRESTART); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2607 |
mii_rw(dev, np->phyaddr, MII_BMCR, bmcr); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2608 |
|
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2609 |
ret = 0; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2610 |
} else { |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2611 |
ret = -EINVAL; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2612 |
} |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2613 |
spin_unlock_irq(&np->lock); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2614 |
|
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2615 |
return ret; |
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 |
#ifdef NETIF_F_TSO |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2619 |
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
|
2620 |
{ |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2621 |
struct fe_priv *np = netdev_priv(dev); |
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 |
if ((np->driver_data & DEV_HAS_CHECKSUM)) |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2624 |
return ethtool_op_set_tso(dev, value); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2625 |
else |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2626 |
return value ? -EOPNOTSUPP : 0; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2627 |
} |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2628 |
#endif |
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 |
static struct ethtool_ops ops = { |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2631 |
.get_drvinfo = nv_get_drvinfo, |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2632 |
.get_link = ethtool_op_get_link, |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2633 |
.get_wol = nv_get_wol, |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2634 |
.set_wol = nv_set_wol, |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2635 |
.get_settings = nv_get_settings, |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2636 |
.set_settings = nv_set_settings, |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2637 |
.get_regs_len = nv_get_regs_len, |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2638 |
.get_regs = nv_get_regs, |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2639 |
.nway_reset = nv_nway_reset, |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2640 |
.get_perm_addr = ethtool_op_get_perm_addr, |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2641 |
#ifdef NETIF_F_TSO |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2642 |
.get_tso = ethtool_op_get_tso, |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2643 |
.set_tso = nv_set_tso |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2644 |
#endif |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2645 |
}; |
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 |
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
|
2648 |
{ |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2649 |
struct fe_priv *np = get_nvpriv(dev); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2650 |
|
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2651 |
spin_lock_irq(&np->lock); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2652 |
|
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2653 |
/* save vlan group */ |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2654 |
np->vlangrp = grp; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2655 |
|
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2656 |
if (grp) { |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2657 |
/* enable vlan on MAC */ |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2658 |
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
|
2659 |
} else { |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2660 |
/* disable vlan on MAC */ |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2661 |
np->txrxctl_bits &= ~NVREG_TXRXCTL_VLANSTRIP; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2662 |
np->txrxctl_bits &= ~NVREG_TXRXCTL_VLANINS; |
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 |
|
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2665 |
writel(np->txrxctl_bits, get_hwbase(dev) + NvRegTxRxControl); |
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 |
spin_unlock_irq(&np->lock); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2668 |
}; |
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 |
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
|
2671 |
{ |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2672 |
/* nothing to do */ |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2673 |
}; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2674 |
|
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2675 |
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
|
2676 |
{ |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2677 |
u8 __iomem *base = get_hwbase(dev); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2678 |
int i; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2679 |
u32 msixmap = 0; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2680 |
|
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2681 |
/* 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
|
2682 |
* 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
|
2683 |
* the remaining 8 interrupts. |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2684 |
*/ |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2685 |
for (i = 0; i < 8; i++) { |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2686 |
if ((irqmask >> i) & 0x1) { |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2687 |
msixmap |= vector << (i << 2); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2688 |
} |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2689 |
} |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2690 |
writel(readl(base + NvRegMSIXMap0) | msixmap, base + NvRegMSIXMap0); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2691 |
|
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2692 |
msixmap = 0; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2693 |
for (i = 0; i < 8; i++) { |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2694 |
if ((irqmask >> (i + 8)) & 0x1) { |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2695 |
msixmap |= vector << (i << 2); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2696 |
} |
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 |
writel(readl(base + NvRegMSIXMap1) | msixmap, base + NvRegMSIXMap1); |
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 |
|
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2701 |
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
|
2702 |
{ |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2703 |
struct fe_priv *np = get_nvpriv(dev); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2704 |
u8 __iomem *base = get_hwbase(dev); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2705 |
int ret = 1; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2706 |
int i; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2707 |
|
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2708 |
if (np->msi_flags & NV_MSI_X_CAPABLE) { |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2709 |
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
|
2710 |
np->msi_x_entry[i].entry = i; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2711 |
} |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2712 |
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
|
2713 |
np->msi_flags |= NV_MSI_X_ENABLED; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2714 |
if (optimization_mode == NV_OPTIMIZATION_MODE_THROUGHPUT) { |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2715 |
/* Request irq for rx handling */ |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2716 |
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
|
2717 |
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
|
2718 |
pci_disable_msix(np->pci_dev); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2719 |
np->msi_flags &= ~NV_MSI_X_ENABLED; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2720 |
goto out_err; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2721 |
} |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2722 |
/* Request irq for tx handling */ |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2723 |
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
|
2724 |
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
|
2725 |
pci_disable_msix(np->pci_dev); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2726 |
np->msi_flags &= ~NV_MSI_X_ENABLED; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2727 |
goto out_free_rx; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2728 |
} |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2729 |
/* Request irq for link and timer handling */ |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2730 |
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
|
2731 |
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
|
2732 |
pci_disable_msix(np->pci_dev); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2733 |
np->msi_flags &= ~NV_MSI_X_ENABLED; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2734 |
goto out_free_tx; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2735 |
} |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2736 |
/* map interrupts to their respective vector */ |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2737 |
writel(0, base + NvRegMSIXMap0); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2738 |
writel(0, base + NvRegMSIXMap1); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2739 |
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
|
2740 |
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
|
2741 |
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
|
2742 |
} else { |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2743 |
/* Request irq for all interrupts */ |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2744 |
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
|
2745 |
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
|
2746 |
pci_disable_msix(np->pci_dev); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2747 |
np->msi_flags &= ~NV_MSI_X_ENABLED; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2748 |
goto out_err; |
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 |
|
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2751 |
/* map interrupts to vector 0 */ |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2752 |
writel(0, base + NvRegMSIXMap0); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2753 |
writel(0, base + NvRegMSIXMap1); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2754 |
} |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2755 |
} |
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 (ret != 0 && np->msi_flags & NV_MSI_CAPABLE) { |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2758 |
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
|
2759 |
np->msi_flags |= NV_MSI_ENABLED; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2760 |
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
|
2761 |
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
|
2762 |
pci_disable_msi(np->pci_dev); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2763 |
np->msi_flags &= ~NV_MSI_ENABLED; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2764 |
goto out_err; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2765 |
} |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2766 |
|
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2767 |
/* map interrupts to vector 0 */ |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2768 |
writel(0, base + NvRegMSIMap0); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2769 |
writel(0, base + NvRegMSIMap1); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2770 |
/* enable msi vector 0 */ |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2771 |
writel(NVREG_MSI_VECTOR_0_ENABLED, base + NvRegMSIIrqMask); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2772 |
} |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2773 |
} |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2774 |
if (ret != 0) { |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2775 |
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
|
2776 |
goto out_err; |
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 |
|
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2779 |
return 0; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2780 |
out_free_tx: |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2781 |
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
|
2782 |
out_free_rx: |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2783 |
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
|
2784 |
out_err: |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2785 |
return 1; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2786 |
} |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2787 |
|
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2788 |
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
|
2789 |
{ |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2790 |
struct fe_priv *np = get_nvpriv(dev); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2791 |
int i; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2792 |
|
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2793 |
if (np->msi_flags & NV_MSI_X_ENABLED) { |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2794 |
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
|
2795 |
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
|
2796 |
} |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2797 |
pci_disable_msix(np->pci_dev); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2798 |
np->msi_flags &= ~NV_MSI_X_ENABLED; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2799 |
} else { |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2800 |
free_irq(np->pci_dev->irq, dev); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2801 |
if (np->msi_flags & NV_MSI_ENABLED) { |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2802 |
pci_disable_msi(np->pci_dev); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2803 |
np->msi_flags &= ~NV_MSI_ENABLED; |
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 |
} |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2807 |
|
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2808 |
static int nv_open(struct net_device *dev) |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2809 |
{ |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2810 |
struct fe_priv *np = netdev_priv(dev); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2811 |
u8 __iomem *base = get_hwbase(dev); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2812 |
int ret = 1; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2813 |
int oom, i; |
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 |
dprintk(KERN_DEBUG "nv_open: begin\n"); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2816 |
|
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2817 |
/* 1) erase previous misconfiguration */ |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2818 |
if (np->driver_data & DEV_HAS_POWER_CNTRL) |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2819 |
nv_mac_reset(dev); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2820 |
/* 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
|
2821 |
writel(NVREG_MCASTADDRA_FORCE, base + NvRegMulticastAddrA); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2822 |
writel(0, base + NvRegMulticastAddrB); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2823 |
writel(0, base + NvRegMulticastMaskA); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2824 |
writel(0, base + NvRegMulticastMaskB); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2825 |
writel(0, base + NvRegPacketFilterFlags); |
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 |
writel(0, base + NvRegTransmitterControl); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2828 |
writel(0, base + NvRegReceiverControl); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2829 |
|
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2830 |
writel(0, base + NvRegAdapterControl); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2831 |
|
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2832 |
/* 2) initialize descriptor rings */ |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2833 |
set_bufsize(dev); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2834 |
oom = nv_init_ring(dev); |
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 |
writel(0, base + NvRegLinkSpeed); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2837 |
writel(0, base + NvRegUnknownTransmitterReg); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2838 |
nv_txrx_reset(dev); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2839 |
writel(0, base + NvRegUnknownSetupReg6); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2840 |
|
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2841 |
np->in_shutdown = 0; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2842 |
|
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2843 |
/* 3) set mac address */ |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2844 |
nv_copy_mac_to_hw(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 |
/* 4) give hw rings */ |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2847 |
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
|
2848 |
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
|
2849 |
base + NvRegRingSizes); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2850 |
|
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2851 |
/* 5) continue setup */ |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2852 |
writel(np->linkspeed, base + NvRegLinkSpeed); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2853 |
writel(NVREG_UNKSETUP3_VAL1, base + NvRegUnknownSetupReg3); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2854 |
writel(np->txrxctl_bits, base + NvRegTxRxControl); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2855 |
writel(np->vlanctl_bits, base + NvRegVlanControl); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2856 |
pci_push(base); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2857 |
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
|
2858 |
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
|
2859 |
NV_SETUP5_DELAY, NV_SETUP5_DELAYMAX, |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2860 |
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
|
2861 |
|
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2862 |
writel(0, base + NvRegUnknownSetupReg4); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2863 |
writel(NVREG_IRQSTAT_MASK, base + NvRegIrqStatus); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2864 |
writel(NVREG_MIISTAT_MASK2, base + NvRegMIIStatus); |
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 |
/* 6) continue setup */ |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2867 |
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
|
2868 |
writel(readl(base + NvRegTransmitterStatus), base + NvRegTransmitterStatus); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2869 |
writel(NVREG_PFF_ALWAYS, base + NvRegPacketFilterFlags); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2870 |
writel(np->rx_buf_sz, base + NvRegOffloadConfig); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2871 |
|
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2872 |
writel(readl(base + NvRegReceiverStatus), base + NvRegReceiverStatus); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2873 |
get_random_bytes(&i, sizeof(i)); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2874 |
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
|
2875 |
writel(NVREG_UNKSETUP1_VAL, base + NvRegUnknownSetupReg1); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2876 |
writel(NVREG_UNKSETUP2_VAL, base + NvRegUnknownSetupReg2); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2877 |
if (poll_interval == -1) { |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2878 |
if (optimization_mode == NV_OPTIMIZATION_MODE_THROUGHPUT) |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2879 |
writel(NVREG_POLL_DEFAULT_THROUGHPUT, base + NvRegPollingInterval); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2880 |
else |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2881 |
writel(NVREG_POLL_DEFAULT_CPU, base + NvRegPollingInterval); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2882 |
} |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2883 |
else |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2884 |
writel(poll_interval & 0xFFFF, base + NvRegPollingInterval); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2885 |
writel(NVREG_UNKSETUP6_VAL, base + NvRegUnknownSetupReg6); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2886 |
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
|
2887 |
base + NvRegAdapterControl); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2888 |
writel(NVREG_MIISPEED_BIT8|NVREG_MIIDELAY, base + NvRegMIISpeed); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2889 |
writel(NVREG_UNKSETUP4_VAL, base + NvRegUnknownSetupReg4); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2890 |
writel(NVREG_WAKEUPFLAGS_VAL, base + NvRegWakeUpFlags); |
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 |
i = readl(base + NvRegPowerState); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2893 |
if ( (i & NVREG_POWERSTATE_POWEREDUP) == 0) |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2894 |
writel(NVREG_POWERSTATE_POWEREDUP|i, base + NvRegPowerState); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2895 |
|
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2896 |
pci_push(base); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2897 |
udelay(10); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2898 |
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
|
2899 |
|
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2900 |
nv_disable_hw_interrupts(dev, np->irqmask); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2901 |
pci_push(base); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2902 |
writel(NVREG_MIISTAT_MASK2, base + NvRegMIIStatus); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2903 |
writel(NVREG_IRQSTAT_MASK, base + NvRegIrqStatus); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2904 |
pci_push(base); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2905 |
|
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2906 |
if (nv_request_irq(dev)) { |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2907 |
goto out_drain; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2908 |
} |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2909 |
|
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2910 |
/* ask for interrupts */ |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2911 |
nv_enable_hw_interrupts(dev, np->irqmask); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2912 |
|
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2913 |
spin_lock_irq(&np->lock); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2914 |
writel(NVREG_MCASTADDRA_FORCE, base + NvRegMulticastAddrA); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2915 |
writel(0, base + NvRegMulticastAddrB); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2916 |
writel(0, base + NvRegMulticastMaskA); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2917 |
writel(0, base + NvRegMulticastMaskB); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2918 |
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
|
2919 |
/* 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
|
2920 |
* 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
|
2921 |
*/ |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2922 |
{ |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2923 |
u32 miistat; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2924 |
miistat = readl(base + NvRegMIIStatus); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2925 |
writel(NVREG_MIISTAT_MASK, base + NvRegMIIStatus); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2926 |
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
|
2927 |
} |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2928 |
/* 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
|
2929 |
* to init hw */ |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2930 |
np->linkspeed = 0; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2931 |
ret = nv_update_linkspeed(dev); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2932 |
nv_start_rx(dev); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2933 |
nv_start_tx(dev); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2934 |
netif_start_queue(dev); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2935 |
if (ret) { |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2936 |
netif_carrier_on(dev); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2937 |
} else { |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2938 |
printk("%s: no link during initialization.\n", dev->name); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2939 |
netif_carrier_off(dev); |
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 |
if (oom) |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2942 |
mod_timer(&np->oom_kick, jiffies + OOM_REFILL); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2943 |
spin_unlock_irq(&np->lock); |
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 |
return 0; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2946 |
out_drain: |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2947 |
drain_ring(dev); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2948 |
return ret; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2949 |
} |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2950 |
|
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2951 |
static int nv_close(struct net_device *dev) |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2952 |
{ |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2953 |
struct fe_priv *np = netdev_priv(dev); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2954 |
u8 __iomem *base; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2955 |
|
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2956 |
spin_lock_irq(&np->lock); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2957 |
np->in_shutdown = 1; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2958 |
spin_unlock_irq(&np->lock); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2959 |
synchronize_irq(dev->irq); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2960 |
|
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2961 |
del_timer_sync(&np->oom_kick); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2962 |
del_timer_sync(&np->nic_poll); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2963 |
|
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2964 |
netif_stop_queue(dev); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2965 |
spin_lock_irq(&np->lock); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2966 |
nv_stop_tx(dev); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2967 |
nv_stop_rx(dev); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2968 |
nv_txrx_reset(dev); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2969 |
|
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2970 |
/* disable interrupts on the nic or we will lock up */ |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2971 |
base = get_hwbase(dev); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2972 |
nv_disable_hw_interrupts(dev, np->irqmask); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2973 |
pci_push(base); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2974 |
dprintk(KERN_INFO "%s: Irqmask is zero again\n", dev->name); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2975 |
|
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2976 |
spin_unlock_irq(&np->lock); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2977 |
|
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2978 |
nv_free_irq(dev); |
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 |
drain_ring(dev); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2981 |
|
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2982 |
if (np->wolenabled) |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2983 |
nv_start_rx(dev); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2984 |
|
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2985 |
/* 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
|
2986 |
* 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
|
2987 |
*/ |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2988 |
writel(np->orig_mac[0], base + NvRegMacAddrA); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2989 |
writel(np->orig_mac[1], base + NvRegMacAddrB); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2990 |
|
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2991 |
/* FIXME: power down nic */ |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2992 |
|
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2993 |
return 0; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2994 |
} |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2995 |
|
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2996 |
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
|
2997 |
{ |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2998 |
struct net_device *dev; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2999 |
struct fe_priv *np; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3000 |
unsigned long addr; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3001 |
u8 __iomem *base; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3002 |
int err, i; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3003 |
u32 powerstate; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3004 |
|
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3005 |
dev = alloc_etherdev(sizeof(struct fe_priv)); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3006 |
err = -ENOMEM; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3007 |
if (!dev) |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3008 |
goto out; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3009 |
|
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3010 |
np = netdev_priv(dev); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3011 |
np->pci_dev = pci_dev; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3012 |
spin_lock_init(&np->lock); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3013 |
SET_MODULE_OWNER(dev); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3014 |
SET_NETDEV_DEV(dev, &pci_dev->dev); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3015 |
|
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3016 |
init_timer(&np->oom_kick); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3017 |
np->oom_kick.data = (unsigned long) dev; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3018 |
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
|
3019 |
init_timer(&np->nic_poll); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3020 |
np->nic_poll.data = (unsigned long) dev; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3021 |
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
|
3022 |
|
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3023 |
err = pci_enable_device(pci_dev); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3024 |
if (err) { |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3025 |
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
|
3026 |
err, pci_name(pci_dev)); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3027 |
goto out_free; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3028 |
} |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3029 |
|
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3030 |
pci_set_master(pci_dev); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3031 |
|
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3032 |
err = pci_request_regions(pci_dev, DRV_NAME); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3033 |
if (err < 0) |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3034 |
goto out_disable; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3035 |
|
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3036 |
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
|
3037 |
np->register_size = NV_PCI_REGSZ_VER2; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3038 |
else |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3039 |
np->register_size = NV_PCI_REGSZ_VER1; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3040 |
|
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3041 |
err = -EINVAL; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3042 |
addr = 0; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3043 |
for (i = 0; i < DEVICE_COUNT_RESOURCE; i++) { |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3044 |
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
|
3045 |
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
|
3046 |
pci_resource_len(pci_dev, i), |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3047 |
pci_resource_flags(pci_dev, i)); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3048 |
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
|
3049 |
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
|
3050 |
addr = pci_resource_start(pci_dev, i); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3051 |
break; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3052 |
} |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3053 |
} |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3054 |
if (i == DEVICE_COUNT_RESOURCE) { |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3055 |
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
|
3056 |
pci_name(pci_dev)); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3057 |
goto out_relreg; |
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 |
/* copy of driver data */ |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3061 |
np->driver_data = id->driver_data; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3062 |
|
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3063 |
/* handle different descriptor versions */ |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3064 |
if (id->driver_data & DEV_HAS_HIGH_DMA) { |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3065 |
/* packet format 3: supports 40-bit addressing */ |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3066 |
np->desc_ver = DESC_VER_3; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3067 |
np->txrxctl_bits = NVREG_TXRXCTL_DESC_3; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3068 |
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
|
3069 |
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
|
3070 |
pci_name(pci_dev)); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3071 |
} else { |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3072 |
dev->features |= NETIF_F_HIGHDMA; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3073 |
printk(KERN_INFO "forcedeth: using HIGHDMA\n"); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3074 |
} |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3075 |
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
|
3076 |
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
|
3077 |
pci_name(pci_dev)); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3078 |
} |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3079 |
} else if (id->driver_data & DEV_HAS_LARGEDESC) { |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3080 |
/* packet format 2: supports jumbo frames */ |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3081 |
np->desc_ver = DESC_VER_2; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3082 |
np->txrxctl_bits = NVREG_TXRXCTL_DESC_2; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3083 |
} else { |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3084 |
/* original packet format */ |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3085 |
np->desc_ver = DESC_VER_1; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3086 |
np->txrxctl_bits = NVREG_TXRXCTL_DESC_1; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3087 |
} |
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 |
np->pkt_limit = NV_PKTLIMIT_1; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3090 |
if (id->driver_data & DEV_HAS_LARGEDESC) |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3091 |
np->pkt_limit = NV_PKTLIMIT_2; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3092 |
|
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3093 |
if (id->driver_data & DEV_HAS_CHECKSUM) { |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3094 |
np->txrxctl_bits |= NVREG_TXRXCTL_RXCHECK; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3095 |
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
|
3096 |
#ifdef NETIF_F_TSO |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3097 |
dev->features |= NETIF_F_TSO; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3098 |
#endif |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3099 |
} |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3100 |
|
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3101 |
np->vlanctl_bits = 0; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3102 |
if (id->driver_data & DEV_HAS_VLAN) { |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3103 |
np->vlanctl_bits = NVREG_VLANCONTROL_ENABLE; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3104 |
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
|
3105 |
dev->vlan_rx_register = nv_vlan_rx_register; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3106 |
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
|
3107 |
} |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3108 |
|
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3109 |
np->msi_flags = 0; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3110 |
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
|
3111 |
np->msi_flags |= NV_MSI_CAPABLE; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3112 |
} |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3113 |
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
|
3114 |
np->msi_flags |= NV_MSI_X_CAPABLE; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3115 |
} |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3116 |
|
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3117 |
err = -ENOMEM; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3118 |
np->base = ioremap(addr, np->register_size); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3119 |
if (!np->base) |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3120 |
goto out_relreg; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3121 |
dev->base_addr = (unsigned long)np->base; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3122 |
|
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3123 |
dev->irq = pci_dev->irq; |
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 |
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
|
3126 |
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
|
3127 |
sizeof(struct ring_desc) * (RX_RING + TX_RING), |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3128 |
&np->ring_addr); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3129 |
if (!np->rx_ring.orig) |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3130 |
goto out_unmap; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3131 |
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
|
3132 |
} else { |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3133 |
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
|
3134 |
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
|
3135 |
&np->ring_addr); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3136 |
if (!np->rx_ring.ex) |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3137 |
goto out_unmap; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3138 |
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
|
3139 |
} |
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 |
dev->open = nv_open; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3142 |
dev->stop = nv_close; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3143 |
dev->hard_start_xmit = nv_start_xmit; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3144 |
dev->get_stats = nv_get_stats; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3145 |
dev->change_mtu = nv_change_mtu; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3146 |
dev->set_mac_address = nv_set_mac_address; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3147 |
dev->set_multicast_list = nv_set_multicast; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3148 |
#ifdef CONFIG_NET_POLL_CONTROLLER |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3149 |
dev->poll_controller = nv_poll_controller; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3150 |
#endif |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3151 |
SET_ETHTOOL_OPS(dev, &ops); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3152 |
dev->tx_timeout = nv_tx_timeout; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3153 |
dev->watchdog_timeo = NV_WATCHDOG_TIMEO; |
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 |
pci_set_drvdata(pci_dev, dev); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3156 |
|
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3157 |
/* read the mac address */ |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3158 |
base = get_hwbase(dev); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3159 |
np->orig_mac[0] = readl(base + NvRegMacAddrA); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3160 |
np->orig_mac[1] = readl(base + NvRegMacAddrB); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3161 |
|
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3162 |
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
|
3163 |
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
|
3164 |
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
|
3165 |
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
|
3166 |
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
|
3167 |
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
|
3168 |
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
|
3169 |
|
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3170 |
if (!is_valid_ether_addr(dev->perm_addr)) { |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3171 |
/* |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3172 |
* 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
|
3173 |
* to 01:23:45:67:89:ab |
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 |
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
|
3176 |
pci_name(pci_dev), |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3177 |
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
|
3178 |
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
|
3179 |
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
|
3180 |
dev->dev_addr[0] = 0x00; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3181 |
dev->dev_addr[1] = 0x00; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3182 |
dev->dev_addr[2] = 0x6c; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3183 |
get_random_bytes(&dev->dev_addr[3], 3); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3184 |
} |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3185 |
|
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3186 |
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
|
3187 |
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
|
3188 |
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
|
3189 |
|
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3190 |
/* disable WOL */ |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3191 |
writel(0, base + NvRegWakeUpFlags); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3192 |
np->wolenabled = 0; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3193 |
|
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3194 |
if (id->driver_data & DEV_HAS_POWER_CNTRL) { |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3195 |
u8 revision_id; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3196 |
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
|
3197 |
|
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3198 |
/* 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
|
3199 |
powerstate = readl(base + NvRegPowerState2); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3200 |
powerstate &= ~NVREG_POWERSTATE2_POWERUP_MASK; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3201 |
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
|
3202 |
id->device == PCI_DEVICE_ID_NVIDIA_NVENET_13) && |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3203 |
revision_id >= 0xA3) |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3204 |
powerstate |= NVREG_POWERSTATE2_POWERUP_REV_A3; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3205 |
writel(powerstate, base + NvRegPowerState2); |
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 |
|
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3208 |
if (np->desc_ver == DESC_VER_1) { |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3209 |
np->tx_flags = NV_TX_VALID; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3210 |
} else { |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3211 |
np->tx_flags = NV_TX2_VALID; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3212 |
} |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3213 |
if (optimization_mode == NV_OPTIMIZATION_MODE_THROUGHPUT) { |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3214 |
np->irqmask = NVREG_IRQMASK_THROUGHPUT; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3215 |
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
|
3216 |
np->msi_flags |= 0x0003; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3217 |
} else { |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3218 |
np->irqmask = NVREG_IRQMASK_CPU; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3219 |
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
|
3220 |
np->msi_flags |= 0x0001; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3221 |
} |
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 |
if (id->driver_data & DEV_NEED_TIMERIRQ) |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3224 |
np->irqmask |= NVREG_IRQ_TIMER; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3225 |
if (id->driver_data & DEV_NEED_LINKTIMER) { |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3226 |
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
|
3227 |
np->need_linktimer = 1; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3228 |
np->link_timeout = jiffies + LINK_TIMEOUT; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3229 |
} else { |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3230 |
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
|
3231 |
np->need_linktimer = 0; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3232 |
} |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3233 |
|
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3234 |
/* find a suitable phy */ |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3235 |
for (i = 1; i <= 32; i++) { |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3236 |
int id1, id2; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3237 |
int phyaddr = i & 0x1F; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3238 |
|
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3239 |
spin_lock_irq(&np->lock); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3240 |
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
|
3241 |
spin_unlock_irq(&np->lock); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3242 |
if (id1 < 0 || id1 == 0xffff) |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3243 |
continue; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3244 |
spin_lock_irq(&np->lock); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3245 |
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
|
3246 |
spin_unlock_irq(&np->lock); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3247 |
if (id2 < 0 || id2 == 0xffff) |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3248 |
continue; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3249 |
|
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3250 |
id1 = (id1 & PHYID1_OUI_MASK) << PHYID1_OUI_SHFT; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3251 |
id2 = (id2 & PHYID2_OUI_MASK) >> PHYID2_OUI_SHFT; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3252 |
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
|
3253 |
pci_name(pci_dev), id1, id2, phyaddr); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3254 |
np->phyaddr = phyaddr; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3255 |
np->phy_oui = id1 | id2; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3256 |
break; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3257 |
} |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3258 |
if (i == 33) { |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3259 |
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
|
3260 |
pci_name(pci_dev)); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3261 |
goto out_freering; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3262 |
} |
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 |
/* reset it */ |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3265 |
phy_init(dev); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3266 |
|
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3267 |
/* set default link speed settings */ |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3268 |
np->linkspeed = NVREG_LINKSPEED_FORCE|NVREG_LINKSPEED_10; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3269 |
np->duplex = 0; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3270 |
np->autoneg = 1; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3271 |
|
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3272 |
err = register_netdev(dev); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3273 |
if (err) { |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3274 |
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
|
3275 |
goto out_freering; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3276 |
} |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3277 |
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
|
3278 |
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
|
3279 |
pci_name(pci_dev)); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3280 |
|
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3281 |
return 0; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3282 |
|
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3283 |
out_freering: |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3284 |
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
|
3285 |
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
|
3286 |
np->rx_ring.orig, np->ring_addr); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3287 |
else |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3288 |
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
|
3289 |
np->rx_ring.ex, np->ring_addr); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3290 |
pci_set_drvdata(pci_dev, NULL); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3291 |
out_unmap: |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3292 |
iounmap(get_hwbase(dev)); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3293 |
out_relreg: |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3294 |
pci_release_regions(pci_dev); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3295 |
out_disable: |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3296 |
pci_disable_device(pci_dev); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3297 |
out_free: |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3298 |
free_netdev(dev); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3299 |
out: |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3300 |
return err; |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3301 |
} |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3302 |
|
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3303 |
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
|
3304 |
{ |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3305 |
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
|
3306 |
struct fe_priv *np = netdev_priv(dev); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3307 |
|
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3308 |
unregister_netdev(dev); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3309 |
|
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3310 |
/* free all structures */ |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3311 |
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
|
3312 |
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
|
3313 |
else |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3314 |
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
|
3315 |
iounmap(get_hwbase(dev)); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3316 |
pci_release_regions(pci_dev); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3317 |
pci_disable_device(pci_dev); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3318 |
free_netdev(dev); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3319 |
pci_set_drvdata(pci_dev, NULL); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3320 |
} |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3321 |
|
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3322 |
static struct pci_device_id pci_tbl[] = { |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3323 |
{ /* nForce Ethernet Controller */ |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3324 |
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
|
3325 |
.driver_data = DEV_NEED_TIMERIRQ|DEV_NEED_LINKTIMER, |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3326 |
}, |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3327 |
{ /* nForce2 Ethernet Controller */ |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3328 |
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
|
3329 |
.driver_data = DEV_NEED_TIMERIRQ|DEV_NEED_LINKTIMER, |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3330 |
}, |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3331 |
{ /* nForce3 Ethernet Controller */ |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3332 |
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
|
3333 |
.driver_data = DEV_NEED_TIMERIRQ|DEV_NEED_LINKTIMER, |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3334 |
}, |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3335 |
{ /* nForce3 Ethernet Controller */ |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3336 |
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
|
3337 |
.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
|
3338 |
}, |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3339 |
{ /* nForce3 Ethernet Controller */ |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3340 |
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
|
3341 |
.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
|
3342 |
}, |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3343 |
{ /* nForce3 Ethernet Controller */ |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3344 |
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
|
3345 |
.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
|
3346 |
}, |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3347 |
{ /* nForce3 Ethernet Controller */ |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3348 |
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
|
3349 |
.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
|
3350 |
}, |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3351 |
{ /* CK804 Ethernet Controller */ |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3352 |
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
|
3353 |
.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
|
3354 |
}, |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3355 |
{ /* CK804 Ethernet Controller */ |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3356 |
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
|
3357 |
.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
|
3358 |
}, |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3359 |
{ /* MCP04 Ethernet Controller */ |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3360 |
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
|
3361 |
.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
|
3362 |
}, |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3363 |
{ /* MCP04 Ethernet Controller */ |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3364 |
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
|
3365 |
.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
|
3366 |
}, |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3367 |
{ /* MCP51 Ethernet Controller */ |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3368 |
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
|
3369 |
.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
|
3370 |
}, |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3371 |
{ /* MCP51 Ethernet Controller */ |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3372 |
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
|
3373 |
.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
|
3374 |
}, |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3375 |
{ /* MCP55 Ethernet Controller */ |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3376 |
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
|
3377 |
.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
|
3378 |
}, |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3379 |
{ /* MCP55 Ethernet Controller */ |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3380 |
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
|
3381 |
.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
|
3382 |
}, |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3383 |
{0,}, |
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 |
|
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3386 |
static struct pci_driver driver = { |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3387 |
.name = "forcedeth", |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3388 |
.id_table = pci_tbl, |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3389 |
.probe = nv_probe, |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3390 |
.remove = __devexit_p(nv_remove), |
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 |
|
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3393 |
|
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3394 |
static int __init init_nic(void) |
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 |
printk(KERN_INFO "forcedeth.c: Reverse Engineered nForce ethernet driver. Version %s.\n", FORCEDETH_VERSION); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3397 |
return pci_module_init(&driver); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3398 |
} |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3399 |
|
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3400 |
static void __exit exit_nic(void) |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3401 |
{ |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3402 |
pci_unregister_driver(&driver); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3403 |
} |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3404 |
|
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3405 |
module_param(max_interrupt_work, int, 0); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3406 |
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
|
3407 |
module_param(optimization_mode, int, 0); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3408 |
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
|
3409 |
module_param(poll_interval, int, 0); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3410 |
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
|
3411 |
module_param(disable_msi, int, 0); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3412 |
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
|
3413 |
module_param(disable_msix, int, 0); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3414 |
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
|
3415 |
|
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3416 |
MODULE_AUTHOR("Manfred Spraul <manfred@colorfullife.com>"); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3417 |
MODULE_DESCRIPTION("Reverse Engineered nForce ethernet driver"); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3418 |
MODULE_LICENSE("GPL"); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3419 |
|
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3420 |
MODULE_DEVICE_TABLE(pci, pci_tbl); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3421 |
|
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3422 |
module_init(init_nic); |
99623f8a8493
Added testing version of forcedeth driver.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3423 |
module_exit(exit_nic); |