58 #define ATH5K_CALIB_INTERVAL 10 59 #define ATH5K_RETRIES 4 60 #define ATH5K_DESC_ALIGN 16 88 #define ATH5K_SPMBL_NO 1 89 #define ATH5K_SPMBL_YES 2 90 #define ATH5K_SPMBL_BOTH 3 115 #define ATH5K_NR_RATES 15 226 const char *
name =
"xxxxx";
229 for (i = 0; i <
ARRAY_SIZE(srev_names); i++) {
230 if (srev_names[i].sr_type !=
type)
233 if ((
val & 0xf0) == srev_names[i].sr_val)
234 name = srev_names[i].sr_name;
236 if ((
val & 0xff) == srev_names[i].sr_val) {
237 name = srev_names[i].sr_name;
285 DBG(
"ath5k: cannot remap PCI memory region\n");
296 DBG(
"ath5k: cannot allocate 802.11 device\n");
308 DBG(
"ath5k: cannot allocate 802.11 hardware info structure\n");
334 goto err_free_hwinfo;
342 DBG(
"Atheros AR%s chip found (MAC: 0x%x, PHY: 0x%x)\n",
352 DBG(
"RF%s 2GHz radio found (0x%x)\n",
359 DBG(
"RF%s 5GHz radio found (0x%x)\n",
365 DBG(
"RF%s multiband radio found (0x%x)\n",
375 DBG(
"RF%s 5GHz radio found (0x%x)\n",
379 DBG(
"RF%s 2GHz radio found (0x%x)\n",
435 DBG(
"ath5k: can't get channels\n");
450 DBG(
"ath5k: can't allocate descriptors\n");
460 DBG(
"ath5k: can't setup xmit queue\n");
468 DBG(
"ath5k: unable to read address from EEPROM: 0x%04x\n",
478 DBG(
"ath5k: can't register ieee80211 hw\n");
515 return 2407 + 5 * chan;
519 return 2212 + 20 * chan;
520 return 5000 + 5 * chan;
526 unsigned int mode,
unsigned int max)
530 if (!(
ah->ah_modes & (1 << mode)))
550 for (i = 0,
count = 0; i < size && max > 0; i++) {
589 int max_c, count_c = 0;
602 for (i = 0; i < 12; i++)
617 for (i = 0; i < 4; i++)
634 for (i = 0; i < 8; i++)
665 DBG2(
"ath5k: resetting for channel change (%d -> %d MHz)\n",
714 DBG(
"ath5k: invalid rix %02x\n", hw_rix);
748 DBG(
"ath5k: can't alloc iobuf of size %d\n",
801 if (
ah->ah_setup_rx_desc(
ah,
ds,
804 DBG(
"ath5k: error setting up RX descriptor for %zd bytes\n",
iob_tailroom(iob));
821 unsigned int pktlen,
flags;
840 ret =
ah->ah_setup_tx_desc(
ah,
ds, pktlen,
882 DBG(
"ath5k: can't allocate descriptors\n");
894 DBG(
"ath5k: can't allocate buffer pointers\n");
901 for (i = 0; i <
ATH_RXBUF; i++, bf++,
ds++, da +=
sizeof(*ds)) {
909 for (i = 0; i <
ATH_TXBUF; i++, bf++,
ds++, da +=
sizeof(*ds)) {
978 DBG(
"ath5k: can't set up a TX queue\n");
1019 DBG(
"ath5k: txq [%d] %x, link %p\n",
1103 memset(&rs, 0,
sizeof(rs));
1106 DBG(
"ath5k: empty rx buf pool\n");
1140 DBG(
"ath5k: error in processing rx desc: %s\n",
1151 DBG(
"ath5k: unsupported fragmented rx\n");
1193 DBG(
"ath5k: dropping packet under memory pressure\n");
1235 memset(&ts, 0,
sizeof(ts));
1243 DBG(
"ath5k: error in processing tx desc: %s\n",
1254 DBG2(
"ath5k: tx %zd bytes complete, %d retries\n",
1381 unsigned int counter = 1000;
1401 DBG(
"ath5k: fatal error, resetting\n");
1404 DBG(
"ath5k: rx overrun, resetting\n");
1413 DBG(
"ath5k: rx EOL\n");
1418 DBG(
"ath5k: tx underrun\n");
1430 DBG(
"ath5k: too many interrupts, giving up for now\n");
1447 DBG(
"ath5k: resetting for calibration\n");
1451 DBG(
"ath5k: calibration of channel %d failed\n",
1473 DBG(
"ath5k: dropping packet because no tx bufs available\n");
1513 DBG(
"ath5k: can't reset hardware: %s\n",
strerror(ret));
1519 DBG(
"ath5k: can't start rx logic: %s\n",
strerror(ret));
1639 u32 mfilt[2], rfilt;
struct ath5k_capabilities ah_capabilities
static void ath5k_rxbuf_free(struct ath5k_softc *sc __unused, struct ath5k_buf *bf)
#define EINVAL
Invalid argument.
unsigned long membase
Memory base.
struct arbelprm_rc_send_wqe rc
static void ath5k_remove(struct pci_device *pdev)
#define PCI_CACHE_LINE_SIZE
PCI cache line size.
int modes
A bitwise OR of the 802.11x modes supported by this device.
void net80211_free(struct net80211_device *dev)
Free 802.11 device.
struct net80211_channel channels[NET80211_MAX_CHANNELS]
List of RF channels supported by the card.
static void ath5k_txq_cleanup(struct ath5k_softc *sc)
#define ath5k_hw_hasbssidmask(_ah)
#define iob_put(iobuf, len)
#define TICKS_PER_SEC
Number of ticks per second.
int ath5k_hw_stop_rx_dma(struct ath5k_hw *ah)
ath5k_hw_stop_rx_dma - Stop DMA receive
static struct io_buffer * ath5k_rx_iob_alloc(struct ath5k_softc *sc, u32 *iob_addr)
int(* ah_proc_tx_desc)(struct ath5k_hw *, struct ath5k_desc *, struct ath5k_tx_status *)
int ath5k_hw_reset_key(struct ath5k_hw *ah, u16 entry)
u8 channel
The channel currently in use, as an index into the channels array.
#define ATH5K_CALIB_INTERVAL
#define ATH5K_RATE_CODE_12M
#define ATH5K_RATE_CODE_36M
#define PCI_LATENCY_TIMER
PCI latency timer.
uint32_t next
Next descriptor address.
struct list_head * next
Next list entry.
#define ATH5K_RATE_CODE_11M
static int ath5k_config(struct net80211_device *dev, int changed)
static void ath5k_detach(struct net80211_device *dev)
#define ATH5K_RATE_CODE_2M
static int ath5k_hw_rix_to_bitrate(int hw_rix)
int ath5k_hw_set_lladdr(struct ath5k_hw *ah, const u8 *mac)
ath5k_hw_set_lladdr - Set station id
int ath5k_hw_phy_disable(struct ath5k_hw *ah)
unsigned long driver_data
Arbitrary driver data.
void net80211_rx_err(struct net80211_device *dev, struct io_buffer *iob, int rc)
Indicate an error in receiving a packet.
#define AR5K_KEYTABLE_SIZE
void free_iob(struct io_buffer *iobuf)
Free I/O buffer.
struct pci_device_id * ids
PCI ID table.
void net80211_rx(struct net80211_device *dev, struct io_buffer *iob, int signal, u16 rate)
Handle receipt of 802.11 frame.
uint32_t type
Operating system type.
u8 rtscts_rate
The rate to use for RTS/CTS transmissions.
static int ath5k_txq_setup(struct ath5k_softc *sc, int qtype, int subtype)
void ath5k_rfkill_hw_stop(struct ath5k_hw *ah)
uint8_t size
Entry size (in 32-bit words)
void net80211_unregister(struct net80211_device *dev)
Unregister 802.11 device from network stack.
static void ath5k_handle_tx(struct ath5k_softc *sc)
#define AR5K_TXQ_USEDEFAULT
static void ath5k_poll(struct net80211_device *dev)
int ath5k_hw_set_txdp(struct ath5k_hw *ah, unsigned int queue, u32 phys_addr)
ath5k_hw_set_txdp - Set TX Descriptor's address for a specific queue
static void *__malloc malloc_phys(size_t size, size_t phys_align)
Allocate memory with specified physical alignment.
u32 ath5k_hw_get_txdp(struct ath5k_hw *ah, unsigned int queue)
ath5k_hw_get_txdp - Get TX Descriptor's address for a specific queue
static int ath5k_reset_wake(struct ath5k_softc *sc)
static int ath5k_txbuf_setup(struct ath5k_softc *sc, struct ath5k_buf *bf)
unsigned signal_max
Maximum signal in arbitrary cases.
void ath5k_hw_set_ack_bitrate_high(struct ath5k_hw *ah, int high)
ath5k_hw_set_ack_bitrate - set bitrate for ACKs
uint8_t mac[ETH_ALEN]
MAC address.
#define ATH5K_RATE_CODE_6M
enum net80211_hw_info::@630 signal_type
Signal strength information that can be provided by the device.
static struct pci_device_id ath5k_nics[]
void ath5k_hw_set_associd(struct ath5k_hw *ah, const u8 *bssid, u16 assoc_id)
ath5k_hw_set_associd - Set BSSID for association
void adjust_pci_device(struct pci_device *pci)
Enable PCI device.
struct io_buffer * alloc_iob(size_t len)
Allocate I/O buffer.
u16 ah_radio_5ghz_revision
void ath5k_hw_start_rx_dma(struct ath5k_hw *ah)
ath5k_hw_start_rx_dma - Start DMA receive
ath5k_hw_get_isr - Get interrupt status
void ath5k_rfkill_hw_start(struct ath5k_hw *ah)
#define ECANCELED
Operation canceled.
#define AR5K_RXERR_DECRYPT
static int ath5k_chan_set(struct ath5k_softc *sc, struct net80211_channel *chan)
int(* open)(struct net80211_device *dev)
Open 802.11 device.
#define NET80211_BAND_BIT_5GHZ
Bitmask for the 5GHz band.
Dynamic memory allocation.
#define list_empty(list)
Test whether a list is empty.
#define AR5K_RXKEYIX_INVALID
#define NET80211_BAND_2GHZ
The 2.4 GHz ISM band, unlicensed in most countries.
#define ATH5K_RATE_CODE_18M
u16 rates[NET80211_NR_BANDS][NET80211_MAX_RATES]
List of transmission rates supported by the card, indexed by band.
#define list_del(list)
Delete an entry from a list.
static struct net80211_device_operations ath5k_ops
int ath5k_hw_start_tx_dma(struct ath5k_hw *ah, unsigned int queue)
ath5k_hw_start_tx_dma - Start DMA transmit for a specific queue
static void pci_set_drvdata(struct pci_device *pci, void *priv)
Set PCI driver-private data.
static short ath5k_ieee2mhz(short chan)
Operations that must be implemented by an 802.11 driver.
#define ENOMEM
Not enough space.
int ath5k_channel_ok(struct ath5k_hw *ah, u16 freq, unsigned int flags)
void * memcpy(void *dest, const void *src, size_t len) __nonnull
struct pci_driver ath5k_pci_driver __pci_driver
u16 hw_value
Hardware channel value.
static __always_inline unsigned long virt_to_bus(volatile const void *addr)
Convert virtual address to a bus address.
uint16_t device
Device ID.
void ath5k_hw_set_rx_filter(struct ath5k_hw *ah, u32 filter)
ath5k_hw_set_rx_filter - Set rx filter
#define AR5K_TXDESC_INTREQ
assert((readw(&hdr->flags) &(GTF_reading|GTF_writing))==0)
u8 hwaddr[ETH_ALEN]
Default hardware MAC address.
u8 maxpower
Maximum allowable transmit power, in dBm.
int ath5k_hw_is_intr_pending(struct ath5k_hw *ah)
ath5k_hw_is_intr_pending - Check if we have pending interrupts
#define list_for_each_entry(pos, head, member)
Iterate over entries in a list.
#define IEEE80211_TYP_FRAME_HEADER_LEN
Frame header length for frames we might work with.
#define __unused
Declare a variable or data structure as unused.
#define list_add_tail(new, head)
Add a new entry to the tail of a list.
struct ath5k_buf * bufptr
int nr_rates[NET80211_NR_BANDS]
Number of supported rates, indexed by band.
static int ath5k_rx_start(struct ath5k_softc *sc)
void ath5k_hw_set_rxdp(struct ath5k_hw *ah, u32 phys_addr)
ath5k_hw_set_rxdp - Set RX Descriptor's address
static void *__malloc calloc(size_t nmemb, size_t size)
Allocate cleared memory.
int ath5k_hw_reset(struct ath5k_hw *ah, struct net80211_channel *channel, int change_channel)
static void ath5k_txq_release(struct ath5k_softc *sc)
uint16_t count
Number of entries.
static int ath5k_stop_hw(struct ath5k_softc *sc)
void ath5k_hw_start_rx_pcu(struct ath5k_hw *ah)
ath5k_hw_start_rx_pcu - Start RX engine
#define NET80211_BAND_5GHZ
The band from 4.9 GHz to 5.7 GHz, which tends to be more restricted.
#define list_for_each_entry_safe(pos, tmp, head, member)
Iterate over entries in a list, safe against deletion of the current entry.
void * priv
Driver private data.
#define NET80211_PHY_USE_SHORT_PREAMBLE
Whether to use 802.11b short preamble operation.
enum ath5k_tx_queue_subtype tqi_subtype
#define EINPROGRESS
Operation in progress.
#define NET80211_PHY_USE_PROTECTION
Whether to use RTS/CTS or CTS-to-self protection for transmissions.
struct net80211_device * net80211_alloc(size_t priv_size)
Allocate 802.11 device.
char * strerror(int errno)
Retrieve string representation of error number.
u16 duration
Microseconds to reserve link.
static void(* free)(struct refcnt *refcnt))
int pci_write_config_byte(struct pci_device *pci, unsigned int where, uint8_t value)
Write byte to PCI configuration space.
void * zalloc(size_t size)
Allocate cleared memory.
u16 center_freq
The center frequency for this channel.
uint8_t subtype
Slow protocols subtype.
static int ath5k_start(struct net80211_device *dev)
u8 band
The band with which this channel is associated.
static int ath5k_reset(struct ath5k_softc *sc, struct net80211_channel *chan)
#define NET80211_CFG_PHY_PARAMS
Low-level link parameters (short preamble, protection, etc) have changed.
void ath5k_hw_release_tx_queue(struct ath5k_hw *ah)
static size_t iob_len(struct io_buffer *iobuf)
Calculate length of data in an I/O buffer.
#define NET80211_ASSOCIATED
Whether we have successfully associated with the network.
Structure encapsulating the complete state of an 802.11 device.
#define AR5K_SET_SHORT_PREAMBLE
static void ath5k_desc_free(struct ath5k_softc *sc)
static size_t iob_tailroom(struct io_buffer *iobuf)
Calculate available space at end of an I/O buffer.
#define ATH5K_RATE_CODE_48M
enum ath5k_int ath5k_hw_set_imr(struct ath5k_hw *ah, enum ath5k_int new_mask)
ath5k_hw_set_imr - Set interrupt mask
struct net80211_channel * curchan
static void ath5k_hw_reg_write(struct ath5k_hw *ah, u32 val, u16 reg)
static void ath5k_txq_drainq(struct ath5k_softc *sc, struct ath5k_txq *txq)
#define AR5K_RX_FILTER_BEACON
#define AR5K_TXQ_FLAG_TXEOLINT_ENABLE
void ath5k_hw_stop_rx_pcu(struct ath5k_hw *ah)
at5k_hw_stop_rx_pcu - Stop RX engine
unsigned int filter_flags
static void ath5k_handle_rx(struct ath5k_softc *sc)
#define NET80211_MODE_B
802.11b: 1-11 Mbps operation using DSSS/CCK signaling on the 2.4GHz band
void net80211_tx_complete(struct net80211_device *dev, struct io_buffer *iob, int retries, int rc)
Indicate the completed transmission of a packet.
A PCI device ID list entry.
u16 ah_radio_2ghz_revision
#define AR5K_TXKEYIX_INVALID
u16 rates[NET80211_MAX_RATES]
A list of all possible TX rates we might use.
static void ath5k_setcurmode(struct ath5k_softc *sc, unsigned int mode)
static int ath5k_probe(struct pci_device *pdev)
int phy_flags
Physical layer options.
int ath5k_hw_get_isr(struct ath5k_hw *ah, enum ath5k_int *interrupt_mask)
int(* ah_proc_rx_desc)(struct ath5k_hw *, struct ath5k_desc *, struct ath5k_rx_status *)
struct device * dev
Underlying hardware device.
int ath5k_hw_attach(struct ath5k_softc *sc, u8 mac_version, struct ath5k_hw **ah)
ath5k_hw_attach - Check if hw is supported and init the needed structs
static unsigned int ath5k_copy_channels(struct ath5k_hw *ah, struct net80211_channel *channels, unsigned int mode, unsigned int max)
#define AR5K_TXDESC_CLRDMASK
#define AR5K_RX_FILTER_BCAST
Network device management.
struct ieee80211_ie_channels_channel_band channels[0]
List of (start, length) channel bands we can use.
static int ath5k_rxbuf_setup(struct ath5k_softc *sc, struct ath5k_buf *bf)
static void * pci_get_drvdata(struct pci_device *pci)
Get PCI driver-private data.
struct net_device * netdev
The net_device that wraps us.
#define iob_reserve(iobuf, len)
#define INIT_LIST_HEAD(list)
Initialise a list head.
static int ath5k_setup_bands(struct net80211_device *dev)
struct net80211_hw_info * hwinfo
struct list_head list
List of which this buffer is a member.
int ath5k_hw_set_opmode(struct ath5k_hw *ah)
ath5k_hw_set_opmode - Set PCU operating mode
int ath5k_hw_set_bssid_mask(struct ath5k_hw *ah, const u8 *mask)
ath5k_hw_set_bssid_mask - filter out bssids we listen
#define AR5K_TXDESC_CTSENA
#define ENOBUFS
No buffer space available.
struct list_head * prev
Previous list entry.
static int ath5k_desc_alloc(struct ath5k_softc *sc)
void ath5k_hw_set_mcast_filter(struct ath5k_hw *ah, u32 filter0, u32 filter1)
#define AR5K_RX_FILTER_UCAST
#define NET80211_BAND_BIT_2GHZ
Bitmask for the 2GHz band.
void * data
Start of data.
int nr_channels
Number of supported channels.
#define EIO
Input/output error.
struct net80211_channel channels[NET80211_MAX_CHANNELS]
A list of all possible channels we might use.
enum net80211_hw_info::@629 flags
A set of flags indicating peculiarities of this device.
struct pci_device_id * id
Driver device ID.
int ath5k_bitrate_to_hw_rix(int bitrate)
#define ATH5K_RATE_CODE_5_5M
int ath5k_hw_update_tx_triglevel(struct ath5k_hw *ah, int increase)
ath5k_hw_update_tx_triglevel - Update tx trigger level
void iounmap(volatile const void *io_addr)
Unmap I/O address.
#define ATH5K_RATE_CODE_24M
#define ATH5K_RATE_CODE_1M
#define AR5K_TXQ_FLAG_TXDESCINT_ENABLE
#define NET80211_CFG_RATE
Requested transmission rate (dev->rate) has changed.
int ath5k_eeprom_read_mac(struct ath5k_hw *ah, u8 *mac)
enum ath5k_rfgain ath5k_hw_gainf_calibrate(struct ath5k_hw *ah)
static void free_phys(void *ptr, size_t size)
Free memory allocated with malloc_phys()
static const struct @9 ath5k_rates[]
void mb(void)
Memory barrier.
static u16 net80211_cts_duration(struct net80211_device *dev, int size)
Calculate duration field for a CTS control frame.
struct net80211_device * dev
#define NET80211_CFG_CHANNEL
Channel choice (dev->channel) or regulatory parameters have changed.
int bands
A bitwise OR of the bands on which this device can communicate.
static int ath5k_init(struct ath5k_softc *sc)
u8 bssid[ETH_ALEN]
MAC address of the access point most recently associated.
static void ath5k_irq(struct net80211_device *dev, int enable)
u16 state
State of our association to the network.
uint8_t ll_addr[MAX_LL_ADDR_LEN]
Link-layer address.
unsigned long currticks(void)
Get current system time in ticks.
#define DBG(...)
Print a debugging message.
void * pci_ioremap(struct pci_device *pci, unsigned long bus_addr, size_t len)
Map PCI bus address as an I/O address.
u8 channel_nr
A channel number interpreted according to the band.
#define list_entry(list, type, member)
Get the container of a list entry.
int ath5k_hw_stop_tx_dma(struct ath5k_hw *ah, unsigned int queue)
ath5k_hw_stop_tx_dma - Stop DMA transmit on a specific queue
#define NULL
NULL pointer (VOID *)
unsigned channel_change_time
Estimate of the time required to change channels, in microseconds.
#define NET80211_CFG_ASSOC
Association has been established with a new BSS (dev->bssid)
#define PCI_ROM(_vendor, _device, _name, _description, _data)
int ath5k_hw_phy_calibrate(struct ath5k_hw *ah, struct net80211_channel *channel)
static int ath5k_attach(struct net80211_device *dev)
#define ATH5K_RATE_CODE_54M
void ath5k_hw_detach(struct ath5k_hw *ah)
ath5k_hw_detach - Free the ath5k_hw struct
u8 rate
The rate currently in use, as an index into the rates array.
struct bofm_section_header done
#define NET80211_MODE_G
802.11g: 54 Mbps operation using ERP/OFDM signaling on the 2.4GHz band
ath5k_int
enum ath5k_int - Hardware interrupt masks helpers
#define ATH5K_RATE_CODE_9M
int net80211_register(struct net80211_device *dev, struct net80211_device_operations *ops, struct net80211_hw_info *hw)
Register 802.11 device with network stack.
int ath5k_hw_setup_tx_queue(struct ath5k_hw *ah, enum ath5k_tx_queue queue_type, struct ath5k_txq_info *queue_info)
#define NET80211_MODE_A
802.11a: 54 Mbps operation using OFDM signaling on the 5GHz band
static void ath5k_txbuf_free(struct ath5k_softc *sc, struct ath5k_buf *bf)
static void ath5k_stop(struct net80211_device *dev)
static void ath5k_mode_setup(struct ath5k_softc *sc)
#define AR5K_RX_FILTER_MCAST
static void ath5k_rx_stop(struct ath5k_softc *sc)
static int ath5k_tx(struct net80211_device *dev, struct io_buffer *skb)
#define IEEE80211_MAX_LEN
void * memset(void *dest, int character, size_t len) __nonnull
int pci_read_config_byte(struct pci_device *pci, unsigned int where, uint8_t *value)
Read byte from PCI configuration space.
static void ath5k_configure_filter(struct ath5k_softc *sc)
static void ath5k_calibrate(struct ath5k_softc *sc)
static void ath5k_tx_processq(struct ath5k_softc *sc, struct ath5k_txq *txq)