00001 /*------------------------------------------------------------------------------ 00002 *------------------------- ATH5K Driver ----------------------- 00003 *------------------------------------------------------------------------------ 00004 * V1.0 08/02/2010 00005 * 00006 * 00007 * Feb 2010 - Samuel Cabrero <samuelcabrero@gmail.com> 00008 * Initial release 00009 * 00010 * ---------------------------------------------------------------------------- 00011 * Copyright (C) 2000-2010, Universidad de Zaragoza, SPAIN 00012 * 00013 * Autors: 00014 * Samuel Cabrero <samuelcabrero@gmail.com> 00015 * Danilo Tardioli <dantard@unizar.es> 00016 * Jose Luis Villarroel <jlvilla@unizar.es> 00017 * 00018 * This is a simplified version of the original ath5k driver. It should work 00019 * with all Atheros 5xxx WLAN cards. The 802.11 layer have been removed so it 00020 * just send and receive frames over the air, as if it were an Ethernet bus 00021 * interface. 00022 * 00023 * Please read ath5k_interface.h for instructions. 00024 * 00025 * This program is distributed under the terms of GPL version 2 and in the 00026 * hope that it will be useful, but WITHOUT ANY WARRANTY; without even the 00027 * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 00028 * See the GNU General Public License for more details. 00029 * 00030 *----------------------------------------------------------------------------*/ 00031 00032 /*- 00033 * Copyright (c) 2002-2007 Sam Leffler, Errno Consulting 00034 * All rights reserved. 00035 * 00036 * Redistribution and use in source and binary forms, with or without 00037 * modification, are permitted provided that the following conditions 00038 * are met: 00039 * 1. Redistributions of source code must retain the above copyright 00040 * notice, this list of conditions and the following disclaimer, 00041 * without modification. 00042 * 2. Redistributions in binary form must reproduce at minimum a disclaimer 00043 * similar to the "NO WARRANTY" disclaimer below ("Disclaimer") and any 00044 * redistribution must be conditioned upon including a substantially 00045 * similar Disclaimer requirement for further binary redistribution. 00046 * 3. Neither the names of the above-listed copyright holders nor the names 00047 * of any contributors may be used to endorse or promote products derived 00048 * from this software without specific prior written permission. 00049 * 00050 * Alternatively, this software may be distributed under the terms of the 00051 * GNU General Public License ("GPL") version 2 as published by the Free 00052 * Software Foundation. 00053 * 00054 * NO WARRANTY 00055 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 00056 * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 00057 * LIMITED TO, THE IMPLIED WARRANTIES OF NONINFRINGEMENT, MERCHANTIBILITY 00058 * AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL 00059 * THE COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, 00060 * OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 00061 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 00062 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER 00063 * IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 00064 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF 00065 * THE POSSIBILITY OF SUCH DAMAGES. 00066 * 00067 */ 00068 00069 /* 00070 * Defintions for the Atheros Wireless LAN controller driver. 00071 */ 00072 #ifndef _DEV_ATH_ATHVAR_H 00073 #define _DEV_ATH_ATHVAR_H 00074 00075 #include <misc/linux_list.h> 00076 #include "ath5k.h" 00077 #include "debug.h" 00078 #include "wifi_rx_queue.h" 00079 #include "ath5k_interface.h" 00080 00081 #define ATH_RXBUF 40 /* number of RX buffers */ 00082 #define ATH_TXBUF 200 /* number of TX buffers */ 00083 00084 struct ath5k_buf { 00085 struct list_head list; 00086 struct ath5k_desc *desc; /* virtual addr of desc */ 00087 struct sk_buff *skb; /* skbuff for buf */ 00088 }; 00089 00090 /* 00091 * Data transmit queue state. One of these exists for each 00092 * hardware transmit queue. Packets sent to us from above 00093 * are assigned to queues based on their priority. Not all 00094 * devices support a complete set of hardware transmit queues. 00095 * For those devices the array sc_ac2q will map multiple 00096 * priorities to fewer hardware queues (typically all to one 00097 * hardware queue). 00098 */ 00099 struct ath5k_txq { 00100 unsigned int qnum; /* hardware q number */ 00101 u32 *link; /* link ptr in last TX desc */ 00102 struct list_head q; /* transmit queue */ 00103 bool setup; 00104 }; 00105 00106 #define ATH_CHAN_MAX (26+26+26+200+200) 00107 00108 /* Software Carrier, keeps track of the driver state 00109 * associated with an instance of a device */ 00110 struct ath5k_softc { 00111 struct pci_device *pdev; /* for dma mapping */ 00112 void *iobase; /* address of the device */ 00113 00114 struct ieee80211_low_level_stats ll_stats; 00115 struct ieee80211_supported_band sbands[IEEE80211_NUM_BANDS]; 00116 struct ieee80211_channel channels[ATH_CHAN_MAX]; 00117 struct ieee80211_rate rates[IEEE80211_NUM_BANDS][AR5K_MAX_RATES]; 00118 struct ath5k_hw *ah; /* Atheros HW */ 00119 00120 struct ieee80211_supported_band *curband; 00121 00122 unsigned int debug_level; /* debug info */ 00123 00124 struct ath5k_buf *bufptr; /* allocated buffer ptr */ 00125 struct ath5k_desc *desc; /* TX/RX descriptors */ 00126 size_t desc_len; /* size of TX/RX descriptors */ 00127 u16 cachelsz; /* cache line size */ 00128 00129 DECLARE_BITMAP(status, 5); 00130 #define ATH_STAT_INVALID 0 /* disable hardware accesses */ 00131 #define ATH_STAT_MRRETRY 1 /* multi-rate retry support */ 00132 #define ATH_STAT_PROMISC 2 00133 #define ATH_STAT_LEDSOFT 3 /* enable LED gpio status */ 00134 #define ATH_STAT_STARTED 4 /* opened & irqs enabled */ 00135 00136 unsigned int filter_flags; /* HW flags, AR5K_RX_FILTER_* */ 00137 struct ieee80211_channel *curchan; /* current h/w channel */ 00138 00139 enum ath5k_int imask; /* interrupt mask copy */ 00140 00141 unsigned char bssidmask[ETH_ALEN]; 00142 00143 unsigned int rxbufsize; /* rx size based on mtu */ 00144 struct list_head rxbuf; /* receive buffer */ 00145 unsigned int *rxlink; /* link ptr in last RX desc */ 00146 wifi_ring_t rxring; 00147 00148 struct list_head txbuf; /* transmit buffer */ 00149 unsigned int txbuf_len; /* buf count in txbuf list */ 00150 struct ath5k_txq txqs[1]; /* beacon and tx */ 00151 struct ath5k_txq *txq; /* beacon and tx*/ 00152 struct ieee80211_tx_info tx_info; 00153 sem_t tx_sem; /* tx semaphore */ 00154 00155 int power_level; /* Requested tx power in dbm */ 00156 bool assoc; /* assocate state */ 00157 }; 00158 00159 #define ath5k_hw_hasbssidmask(_ah) \ 00160 (ath5k_hw_get_capability(_ah, AR5K_CAP_BSSIDMASK, 0, NULL) == 0) 00161 #define ath5k_hw_hasveol(_ah) \ 00162 (ath5k_hw_get_capability(_ah, AR5K_CAP_VEOL, 0, NULL) == 0) 00163 00164 #endif