]> git.karo-electronics.de Git - karo-tx-linux.git/blob - drivers/staging/et131x/et131x_adapter.h
staging: et131x: Remove unused xcvr_id in struct ce_stats
[karo-tx-linux.git] / drivers / staging / et131x / et131x_adapter.h
1 /*
2  * Agere Systems Inc.
3  * 10/100/1000 Base-T Ethernet Driver for the ET1301 and ET131x series MACs
4  *
5  * Copyright © 2005 Agere Systems Inc.
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  *
23  * Copyright © 2005 Agere Systems Inc.
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  *
44  * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
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  */
70 #define NUM_DESC_PER_RING_TX         512    /* TX Do not change these values */
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
80 #define TX_ERROR_PERIOD             1000
81
82 #define LO_MARK_PERCENT_FOR_PSR     15
83 #define LO_MARK_PERCENT_FOR_RX      15
84
85 /* RFD (Receive Frame Descriptor) */
86 struct rfd {
87         struct list_head list_node;
88         struct sk_buff *skb;
89         u32 len;        /* total size of receive frame */
90         u16 bufferindex;
91         u8 ringindex;
92 };
93
94 /* Flow Control */
95 #define FLOW_BOTH       0
96 #define FLOW_TXONLY     1
97 #define FLOW_RXONLY     2
98 #define FLOW_NONE       3
99
100 /* Struct to define some device statistics */
101 struct ce_stats {
102         /* MIB II variables
103          *
104          * NOTE: atomic_t types are only guaranteed to store 24-bits; if we
105          * MUST have 32, then we'll need another way to perform atomic
106          * operations
107          */
108         u32             unicast_pkts_rcvd;
109         atomic_t        unicast_pkts_xmtd;
110         u32             multicast_pkts_rcvd;
111         atomic_t        multicast_pkts_xmtd;
112         u32             broadcast_pkts_rcvd;
113         atomic_t        broadcast_pkts_xmtd;
114         u32             rcvd_pkts_dropped;
115
116         /* Transceiver state informations. */
117         u8              xcvr_addr;
118
119         /* Tx Statistics. */
120         u32             tx_underflows;
121
122         u32             tx_collisions;
123         u32             tx_excessive_collisions;
124         u32             tx_first_collisions;
125         u32             tx_late_collisions;
126         u32             tx_max_pkt_errs;
127         u32             tx_deferred;
128
129         /* Rx Statistics. */
130         u32             rx_overflows;
131
132         u32             rx_length_errs;
133         u32             rx_align_errs;
134         u32             rx_crc_errs;
135         u32             rx_code_violations;
136         u32             rx_other_errs;
137
138         u32             synchronous_iterations;
139         u32             interrupt_status;
140 };
141
142
143 /* The private adapter structure */
144 struct et131x_adapter {
145         struct net_device *netdev;
146         struct pci_dev *pdev;
147
148         struct work_struct task;
149
150         /* Flags that indicate current state of the adapter */
151         u32 flags;
152         u32 hw_errs;
153
154         /* Configuration  */
155         u8 rom_addr[ETH_ALEN];
156         u8 addr[ETH_ALEN];
157         bool has_eeprom;
158         u8 eeprom_data[2];
159
160         /* Spinlocks */
161         spinlock_t lock;
162
163         spinlock_t tcb_send_qlock;
164         spinlock_t tcb_ready_qlock;
165         spinlock_t send_hw_lock;
166
167         spinlock_t rcv_lock;
168         spinlock_t rcv_pend_lock;
169         spinlock_t fbr_lock;
170
171         spinlock_t phy_lock;
172
173         /* Packet Filter and look ahead size */
174         u32 packet_filter;
175         u32 linkspeed;
176         u32 duplex_mode;
177
178         /* multicast list */
179         u32 multicast_addr_count;
180         u8 multicast_list[NIC_MAX_MCAST_LIST][ETH_ALEN];
181
182         /* Pointer to the device's PCI register space */
183         struct address_map __iomem *regs;
184
185         /* Registry parameters */
186         u8 speed_duplex;        /* speed/duplex */
187         u8 wanted_flow;         /* Flow we want for 802.3x flow control */
188         u8 registry_phy_coma;   /* Phy Coma mode enable/disable */
189
190         u32 registry_rx_mem_end;        /* Size of internal rx memory */
191         u32 registry_jumbo_packet;      /* Max supported ethernet packet size */
192
193
194         /* Derived from the registry: */
195         u8 ai_force_duplex;     /* duplex setting */
196         u16 ai_force_speed;     /* 'Speed', user over-ride of line speed */
197         u8 flowcontrol;         /* flow control validated by the far-end */
198
199         /* Minimize init-time */
200         struct timer_list error_timer;
201
202         /* variable putting the phy into coma mode when boot up with no cable
203          * plugged in after 5 seconds
204          */
205         u8 boot_coma;
206
207         /* Next two used to save power information at power down. This
208          * information will be used during power up to set up parts of Power
209          * Management in JAGCore
210          */
211         u16 pdown_speed;
212         u8 pdown_duplex;
213
214         u32 cached_mask_value;
215
216         /* Xcvr status at last poll */
217         u16 bmsr;
218
219         /* Tx Memory Variables */
220         struct tx_ring tx_ring;
221
222         /* Rx Memory Variables */
223         struct rx_ring rx_ring;
224
225         /* Loopback specifics */
226         u8 replica_phy_loopbk;          /* Replica Enable */
227         u8 replica_phy_loopbk_passfail; /* Replica Enable Pass/Fail */
228
229         /* Stats */
230         struct ce_stats stats;
231
232         struct net_device_stats net_stats;
233 };
234
235 #endif /* __ET131X_ADAPTER_H__ */