staging: brcm80211: remove brcms_b_dotxstatus wrapper function
[zen-stable.git] / drivers / staging / et131x / et131x_adapter.h
blobb062e6dc585c2f73f82087d4af631b52c3c5e823
1 /*
2 * Agere Systems Inc.
3 * 10/100/1000 Base-T Ethernet Driver for the ET1301 and ET131x series MACs
5 * Copyright © 2005 Agere Systems Inc.
6 * All rights reserved.
7 * http://www.agere.com
9 * Copyright (c) 2011 Mark Einon <mark.einon@gmail.com>
11 *------------------------------------------------------------------------------
13 * et131x_adapter.h - Header which includes the private adapter structure, along
14 * with related support structures, macros, definitions, etc.
16 *------------------------------------------------------------------------------
18 * SOFTWARE LICENSE
20 * This software is provided subject to the following terms and conditions,
21 * which you should read carefully before using the software. Using this
22 * software indicates your acceptance of these terms and conditions. If you do
23 * not agree with these terms and conditions, do not use the software.
25 * Copyright © 2005 Agere Systems Inc.
26 * All rights reserved.
28 * Redistribution and use in source or binary forms, with or without
29 * modifications, are permitted provided that the following conditions are met:
31 * . Redistributions of source code must retain the above copyright notice, this
32 * list of conditions and the following Disclaimer as comments in the code as
33 * well as in the documentation and/or other materials provided with the
34 * distribution.
36 * . Redistributions in binary form must reproduce the above copyright notice,
37 * this list of conditions and the following Disclaimer in the documentation
38 * and/or other materials provided with the distribution.
40 * . Neither the name of Agere Systems Inc. nor the names of the contributors
41 * may be used to endorse or promote products derived from this software
42 * without specific prior written permission.
44 * Disclaimer
46 * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
47 * INCLUDING, BUT NOT LIMITED TO, INFRINGEMENT AND THE IMPLIED WARRANTIES OF
48 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. ANY
49 * USE, MODIFICATION OR DISTRIBUTION OF THIS SOFTWARE IS SOLELY AT THE USERS OWN
50 * RISK. IN NO EVENT SHALL AGERE SYSTEMS INC. OR CONTRIBUTORS BE LIABLE FOR ANY
51 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
52 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
53 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
54 * ON ANY THEORY OF LIABILITY, INCLUDING, BUT NOT LIMITED TO, CONTRACT, STRICT
55 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
56 * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
57 * DAMAGE.
61 #ifndef __ET131X_ADAPTER_H__
62 #define __ET131X_ADAPTER_H__
64 #include "et1310_address_map.h"
65 #include "et1310_tx.h"
66 #include "et1310_rx.h"
69 * Do not change these values: if changed, then change also in respective
70 * TXdma and Rxdma engines
72 #define NUM_DESC_PER_RING_TX 512 /* TX Do not change these values */
73 #define NUM_TCB 64
76 * These values are all superseded by registry entries to facilitate tuning.
77 * Once the desired performance has been achieved, the optimal registry values
78 * should be re-populated to these #defines:
80 #define NUM_TRAFFIC_CLASSES 1
82 #define TX_ERROR_PERIOD 1000
84 #define LO_MARK_PERCENT_FOR_PSR 15
85 #define LO_MARK_PERCENT_FOR_RX 15
87 /* RFD (Receive Frame Descriptor) */
88 struct rfd {
89 struct list_head list_node;
90 struct sk_buff *skb;
91 u32 len; /* total size of receive frame */
92 u16 bufferindex;
93 u8 ringindex;
96 /* Flow Control */
97 #define FLOW_BOTH 0
98 #define FLOW_TXONLY 1
99 #define FLOW_RXONLY 2
100 #define FLOW_NONE 3
102 /* Struct to define some device statistics */
103 struct ce_stats {
104 /* MIB II variables
106 * NOTE: atomic_t types are only guaranteed to store 24-bits; if we
107 * MUST have 32, then we'll need another way to perform atomic
108 * operations
110 u32 unicast_pkts_rcvd;
111 atomic_t unicast_pkts_xmtd;
112 u32 multicast_pkts_rcvd;
113 atomic_t multicast_pkts_xmtd;
114 u32 broadcast_pkts_rcvd;
115 atomic_t broadcast_pkts_xmtd;
116 u32 rcvd_pkts_dropped;
118 /* Tx Statistics. */
119 u32 tx_underflows;
121 u32 tx_collisions;
122 u32 tx_excessive_collisions;
123 u32 tx_first_collisions;
124 u32 tx_late_collisions;
125 u32 tx_max_pkt_errs;
126 u32 tx_deferred;
128 /* Rx Statistics. */
129 u32 rx_overflows;
131 u32 rx_length_errs;
132 u32 rx_align_errs;
133 u32 rx_crc_errs;
134 u32 rx_code_violations;
135 u32 rx_other_errs;
137 u32 synchronous_iterations;
138 u32 interrupt_status;
141 /* The private adapter structure */
142 struct et131x_adapter {
143 struct net_device *netdev;
144 struct pci_dev *pdev;
145 struct mii_bus *mii_bus;
146 struct phy_device *phydev;
147 struct work_struct task;
149 /* Flags that indicate current state of the adapter */
150 u32 flags;
152 /* local link state, to determine if a state change has occurred */
153 int link;
155 /* Configuration */
156 u8 rom_addr[ETH_ALEN];
157 u8 addr[ETH_ALEN];
158 bool has_eeprom;
159 u8 eeprom_data[2];
161 /* Spinlocks */
162 spinlock_t lock;
164 spinlock_t tcb_send_qlock;
165 spinlock_t tcb_ready_qlock;
166 spinlock_t send_hw_lock;
168 spinlock_t rcv_lock;
169 spinlock_t rcv_pend_lock;
170 spinlock_t fbr_lock;
172 spinlock_t phy_lock;
174 /* Packet Filter and look ahead size */
175 u32 packet_filter;
177 /* multicast list */
178 u32 multicast_addr_count;
179 u8 multicast_list[NIC_MAX_MCAST_LIST][ETH_ALEN];
181 /* Pointer to the device's PCI register space */
182 struct address_map __iomem *regs;
184 /* Registry parameters */
185 u8 wanted_flow; /* Flow we want for 802.3x flow control */
186 u32 registry_jumbo_packet; /* Max supported ethernet packet size */
188 /* Derived from the registry: */
189 u8 flowcontrol; /* flow control validated by the far-end */
191 /* Minimize init-time */
192 struct timer_list error_timer;
194 /* variable putting the phy into coma mode when boot up with no cable
195 * plugged in after 5 seconds
197 u8 boot_coma;
199 /* Next two used to save power information at power down. This
200 * information will be used during power up to set up parts of Power
201 * Management in JAGCore
203 u16 pdown_speed;
204 u8 pdown_duplex;
206 /* Tx Memory Variables */
207 struct tx_ring tx_ring;
209 /* Rx Memory Variables */
210 struct rx_ring rx_ring;
212 /* Stats */
213 struct ce_stats stats;
215 struct net_device_stats net_stats;
218 #endif /* __ET131X_ADAPTER_H__ */