]> git.proxmox.com Git - mirror_ubuntu-artful-kernel.git/blame - drivers/staging/et131x/et131x_adapter.h
Merge branch 'for-3.1/core' of git://git.kernel.dk/linux-block
[mirror_ubuntu-artful-kernel.git] / drivers / staging / et131x / et131x_adapter.h
CommitLineData
cfb739b4
GKH
1/*
2 * Agere Systems Inc.
3 * 10/100/1000 Base-T Ethernet Driver for the ET1301 and ET131x series MACs
4 *
64f93036 5 * Copyright © 2005 Agere Systems Inc.
cfb739b4
GKH
6 * All rights reserved.
7 * http://www.agere.com
8 *
9 *------------------------------------------------------------------------------
10 *
11 * et131x_adapter.h - Header which includes the private adapter structure, along
12 * with related support structures, macros, definitions, etc.
13 *
14 *------------------------------------------------------------------------------
15 *
16 * SOFTWARE LICENSE
17 *
18 * This software is provided subject to the following terms and conditions,
19 * which you should read carefully before using the software. Using this
20 * software indicates your acceptance of these terms and conditions. If you do
21 * not agree with these terms and conditions, do not use the software.
22 *
64f93036 23 * Copyright © 2005 Agere Systems Inc.
cfb739b4
GKH
24 * All rights reserved.
25 *
26 * Redistribution and use in source or binary forms, with or without
27 * modifications, are permitted provided that the following conditions are met:
28 *
29 * . Redistributions of source code must retain the above copyright notice, this
30 * list of conditions and the following Disclaimer as comments in the code as
31 * well as in the documentation and/or other materials provided with the
32 * distribution.
33 *
34 * . Redistributions in binary form must reproduce the above copyright notice,
35 * this list of conditions and the following Disclaimer in the documentation
36 * and/or other materials provided with the distribution.
37 *
38 * . Neither the name of Agere Systems Inc. nor the names of the contributors
39 * may be used to endorse or promote products derived from this software
40 * without specific prior written permission.
41 *
42 * Disclaimer
43 *
64f93036 44 * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
cfb739b4
GKH
45 * INCLUDING, BUT NOT LIMITED TO, INFRINGEMENT AND THE IMPLIED WARRANTIES OF
46 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. ANY
47 * USE, MODIFICATION OR DISTRIBUTION OF THIS SOFTWARE IS SOLELY AT THE USERS OWN
48 * RISK. IN NO EVENT SHALL AGERE SYSTEMS INC. OR CONTRIBUTORS BE LIABLE FOR ANY
49 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
50 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
51 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
52 * ON ANY THEORY OF LIABILITY, INCLUDING, BUT NOT LIMITED TO, CONTRACT, STRICT
53 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
54 * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
55 * DAMAGE.
56 *
57 */
58
59#ifndef __ET131X_ADAPTER_H__
60#define __ET131X_ADAPTER_H__
61
62#include "et1310_address_map.h"
63#include "et1310_tx.h"
64#include "et1310_rx.h"
65
66/*
67 * Do not change these values: if changed, then change also in respective
68 * TXdma and Rxdma engines
69 */
64f93036 70#define NUM_DESC_PER_RING_TX 512 /* TX Do not change these values */
cfb739b4
GKH
71#define NUM_TCB 64
72
73/*
74 * These values are all superseded by registry entries to facilitate tuning.
75 * Once the desired performance has been achieved, the optimal registry values
76 * should be re-populated to these #defines:
77 */
78#define NUM_TRAFFIC_CLASSES 1
79
cfb739b4 80#define TX_ERROR_PERIOD 1000
cfb739b4
GKH
81
82#define LO_MARK_PERCENT_FOR_PSR 15
83#define LO_MARK_PERCENT_FOR_RX 15
84
cfb739b4 85/* RFD (Receive Frame Descriptor) */
ae3e5f0e 86struct rfd {
cfb739b4 87 struct list_head list_node;
ae3e5f0e
AC
88 struct sk_buff *skb;
89 u32 len; /* total size of receive frame */
9fa81099
AC
90 u16 bufferindex;
91 u8 ringindex;
ae3e5f0e 92};
cfb739b4 93
ae3a08aa
AC
94/* Flow Control */
95#define FLOW_BOTH 0
96#define FLOW_TXONLY 1
97#define FLOW_RXONLY 2
98#define FLOW_NONE 3
cfb739b4
GKH
99
100/* Struct to define some device statistics */
101typedef struct _ce_stats_t {
102 /* Link Input/Output stats */
64f93036
AC
103 uint64_t ipackets; /* # of in packets */
104 uint64_t opackets; /* # of out packets */
cfb739b4
GKH
105
106 /* MIB II variables
107 *
108 * NOTE: atomic_t types are only guaranteed to store 24-bits; if we
109 * MUST have 32, then we'll need another way to perform atomic
110 * operations
111 */
64f93036
AC
112 u32 unircv; /* # multicast packets received */
113 atomic_t unixmt; /* # multicast packets for Tx */
114 u32 multircv; /* # multicast packets received */
115 atomic_t multixmt; /* # multicast packets for Tx */
116 u32 brdcstrcv; /* # broadcast packets received */
117 atomic_t brdcstxmt; /* # broadcast packets for Tx */
118 u32 norcvbuf; /* # Rx packets discarded */
119 u32 noxmtbuf; /* # Tx packets discarded */
cfb739b4
GKH
120
121 /* Transciever state informations. */
122 u8 xcvr_addr;
123 u32 xcvr_id;
124
125 /* Tx Statistics. */
64f93036 126 u32 tx_uflo; /* Tx Underruns */
cfb739b4
GKH
127
128 u32 collisions;
129 u32 excessive_collisions;
130 u32 first_collision;
131 u32 late_collisions;
132 u32 max_pkt_error;
133 u32 tx_deferred;
134
135 /* Rx Statistics. */
bbc9a991 136 u32 rx_ov_flow; /* Rx Overflow */
cfb739b4
GKH
137
138 u32 length_err;
139 u32 alignment_err;
140 u32 crc_err;
141 u32 code_violations;
142 u32 other_errors;
143
cfb739b4 144 u32 SynchrounousIterations;
2211b732 145 u32 InterruptStatus;
cfb739b4
GKH
146} CE_STATS_t, *PCE_STATS_t;
147
69ea5fcb 148
cfb739b4
GKH
149/* The private adapter structure */
150struct et131x_adapter {
151 struct net_device *netdev;
152 struct pci_dev *pdev;
153
154 struct work_struct task;
155
156 /* Flags that indicate current state of the adapter */
157 u32 Flags;
158 u32 HwErrCount;
159
160 /* Configuration */
072e9f60
AC
161 u8 rom_addr[ETH_ALEN];
162 u8 addr[ETH_ALEN];
9fa81099 163 bool has_eeprom;
072e9f60 164 u8 eeprom_data[2];
cfb739b4
GKH
165
166 /* Spinlocks */
167 spinlock_t Lock;
168
169 spinlock_t TCBSendQLock;
170 spinlock_t TCBReadyQLock;
072e9f60 171 spinlock_t send_hw_lock;
cfb739b4 172
ae3a08aa 173 spinlock_t rcv_lock;
cfb739b4
GKH
174 spinlock_t RcvPendLock;
175 spinlock_t FbrLock;
176
177 spinlock_t PHYLock;
178
179 /* Packet Filter and look ahead size */
180 u32 PacketFilter;
9fa81099
AC
181 u32 linkspeed;
182 u32 duplex_mode;
cfb739b4
GKH
183
184 /* multicast list */
185 u32 MCAddressCount;
186 u8 MCList[NIC_MAX_MCAST_LIST][ETH_ALEN];
187
cfb739b4 188 /* Pointer to the device's PCI register space */
f3f415a3 189 ADDRESS_MAP_t __iomem *regs;
cfb739b4 190
cfb739b4 191 /* Registry parameters */
64f93036 192 u8 SpeedDuplex; /* speed/duplex */
ae3a08aa 193 u8 wanted_flow; /* Flow we want for 802.3x flow control */
64f93036 194 u8 RegistryPhyComa; /* Phy Coma mode enable/disable */
cfb739b4 195
64f93036 196 u32 RegistryRxMemEnd; /* Size of internal rx memory */
64f93036 197 u32 RegistryJumboPacket; /* Max supported ethernet packet size */
cfb739b4 198
cfb739b4
GKH
199
200 /* Derived from the registry: */
64f93036 201 u8 AiForceDpx; /* duplex setting */
ae3a08aa
AC
202 u16 AiForceSpeed; /* 'Speed', user over-ride of line speed */
203 u8 flowcontrol; /* flow control validated by the far-end */
cfb739b4
GKH
204 enum {
205 NETIF_STATUS_INVALID = 0,
206 NETIF_STATUS_MEDIA_CONNECT,
207 NETIF_STATUS_MEDIA_DISCONNECT,
208 NETIF_STATUS_MAX
209 } MediaState;
cfb739b4
GKH
210
211 /* Minimize init-time */
cfb739b4 212 struct timer_list ErrorTimer;
64b72831
AC
213
214 /* variable putting the phy into coma mode when boot up with no cable
215 * plugged in after 5 seconds
216 */
217 u8 boot_coma;
218
219 /* Next two used to save power information at power down. This
220 * information will be used during power up to set up parts of Power
221 * Management in JAGCore
222 */
223 u16 pdown_speed;
224 u8 pdown_duplex;
225
2211b732 226 u32 CachedMaskValue;
cfb739b4 227
cfb739b4
GKH
228 /* Xcvr status at last poll */
229 MI_BMSR_t Bmsr;
230
231 /* Tx Memory Variables */
b711b2e0 232 struct tx_ring tx_ring;
cfb739b4
GKH
233
234 /* Rx Memory Variables */
8f12785d 235 struct rx_ring rx_ring;
cfb739b4 236
cfb739b4 237 /* Loopback specifics */
64f93036
AC
238 u8 ReplicaPhyLoopbk; /* Replica Enable */
239 u8 ReplicaPhyLoopbkPF; /* Replica Enable Pass/Fail */
cfb739b4
GKH
240
241 /* Stats */
242 CE_STATS_t Stats;
243
244 struct net_device_stats net_stats;
245 struct net_device_stats net_stats_prev;
246};
247
cfb739b4 248#endif /* __ET131X_ADAPTER_H__ */