iPXE
ath5k.c File Reference
#include <stdlib.h>
#include <ipxe/malloc.h>
#include <ipxe/timer.h>
#include <ipxe/netdevice.h>
#include <ipxe/pci.h>
#include <ipxe/pci_io.h>
#include "base.h"
#include "reg.h"

Go to the source code of this file.

Macros

#define ATH5K_CALIB_INTERVAL   10 /* Calibrate PHY every 10 seconds */
#define ATH5K_RETRIES   4 /* Number of times to retry packet sends */
#define ATH5K_DESC_ALIGN   16 /* Alignment for TX/RX descriptors */
#define ATH5K_SPMBL_NO   1
#define ATH5K_SPMBL_YES   2
#define ATH5K_SPMBL_BOTH   3
#define ATH5K_NR_RATES   15

Functions

 FILE_LICENCE (BSD3)
 FILE_SECBOOT (FORBIDDEN)
static int ath5k_probe (struct pci_device *pdev)
static void ath5k_remove (struct pci_device *pdev)
static int ath5k_tx (struct net80211_device *dev, struct io_buffer *skb)
static int ath5k_reset (struct ath5k_softc *sc, struct net80211_channel *chan)
static int ath5k_reset_wake (struct ath5k_softc *sc)
static int ath5k_start (struct net80211_device *dev)
static void ath5k_stop (struct net80211_device *dev)
static int ath5k_config (struct net80211_device *dev, int changed)
static void ath5k_poll (struct net80211_device *dev)
static void ath5k_irq (struct net80211_device *dev, int enable)
static int ath5k_attach (struct net80211_device *dev)
static void ath5k_detach (struct net80211_device *dev)
static unsigned int ath5k_copy_channels (struct ath5k_hw *ah, struct net80211_channel *channels, unsigned int mode, unsigned int max)
static int ath5k_setup_bands (struct net80211_device *dev)
static int ath5k_chan_set (struct ath5k_softc *sc, struct net80211_channel *chan)
static void ath5k_setcurmode (struct ath5k_softc *sc, unsigned int mode)
static void ath5k_mode_setup (struct ath5k_softc *sc)
static int ath5k_desc_alloc (struct ath5k_softc *sc)
static void ath5k_desc_free (struct ath5k_softc *sc)
static int ath5k_rxbuf_setup (struct ath5k_softc *sc, struct ath5k_buf *bf)
static int ath5k_txbuf_setup (struct ath5k_softc *sc, struct ath5k_buf *bf)
static void ath5k_txbuf_free (struct ath5k_softc *sc, struct ath5k_buf *bf)
static void ath5k_rxbuf_free (struct ath5k_softc *sc __unused, struct ath5k_buf *bf)
static int ath5k_txq_setup (struct ath5k_softc *sc, int qtype, int subtype)
static void ath5k_txq_drainq (struct ath5k_softc *sc, struct ath5k_txq *txq)
static void ath5k_txq_cleanup (struct ath5k_softc *sc)
static void ath5k_txq_release (struct ath5k_softc *sc)
static int ath5k_rx_start (struct ath5k_softc *sc)
static void ath5k_rx_stop (struct ath5k_softc *sc)
static void ath5k_tx_processq (struct ath5k_softc *sc, struct ath5k_txq *txq)
static int ath5k_init (struct ath5k_softc *sc)
static int ath5k_stop_hw (struct ath5k_softc *sc)
static void ath5k_calibrate (struct ath5k_softc *sc)
static void ath5k_configure_filter (struct ath5k_softc *sc)
static short ath5k_ieee2mhz (short chan)
static int ath5k_hw_rix_to_bitrate (int hw_rix)
int ath5k_bitrate_to_hw_rix (int bitrate)
static struct io_bufferath5k_rx_iob_alloc (struct ath5k_softc *sc, u32 *iob_addr)
static void ath5k_handle_rx (struct ath5k_softc *sc)
static void ath5k_handle_tx (struct ath5k_softc *sc)

Variables

static struct pci_device_id ath5k_nics []
struct { 
   u16   bitrate 
   u8   short_pmbl 
   u8   hw_code 
ath5k_rates []
struct pci_driver ath5k_pci_driver __pci_driver
static struct net80211_device_operations ath5k_ops

Macro Definition Documentation

◆ ATH5K_CALIB_INTERVAL

#define ATH5K_CALIB_INTERVAL   10 /* Calibrate PHY every 10 seconds */

Definition at line 59 of file ath5k.c.

Referenced by ath5k_poll().

◆ ATH5K_RETRIES

#define ATH5K_RETRIES   4 /* Number of times to retry packet sends */

Definition at line 60 of file ath5k.c.

Referenced by ath5k_txbuf_setup().

◆ ATH5K_DESC_ALIGN

#define ATH5K_DESC_ALIGN   16 /* Alignment for TX/RX descriptors */

Definition at line 61 of file ath5k.c.

Referenced by ath5k_desc_alloc().

◆ ATH5K_SPMBL_NO

#define ATH5K_SPMBL_NO   1

Definition at line 89 of file ath5k.c.

Referenced by ath5k_config().

◆ ATH5K_SPMBL_YES

#define ATH5K_SPMBL_YES   2

Definition at line 90 of file ath5k.c.

Referenced by ath5k_config().

◆ ATH5K_SPMBL_BOTH

#define ATH5K_SPMBL_BOTH   3

Definition at line 91 of file ath5k.c.

◆ ATH5K_NR_RATES

#define ATH5K_NR_RATES   15

Definition at line 116 of file ath5k.c.

Referenced by ath5k_bitrate_to_hw_rix(), ath5k_config(), and ath5k_hw_rix_to_bitrate().

Function Documentation

◆ FILE_LICENCE()

FILE_LICENCE ( BSD3 )

◆ FILE_SECBOOT()

FILE_SECBOOT ( FORBIDDEN )

◆ ath5k_probe()

int ath5k_probe ( struct pci_device * pdev)
static

Definition at line 247 of file ath5k.c.

248{
249 void *mem;
250 struct ath5k_softc *sc;
251 struct net80211_device *dev;
252 int ret;
253 u8 csz;
254
255 adjust_pci_device(pdev);
256
257 /*
258 * Cache line size is used to size and align various
259 * structures used to communicate with the hardware.
260 */
262 if (csz == 0) {
263 /*
264 * We must have this setup properly for rx buffer
265 * DMA to work so force a reasonable value here if it
266 * comes up zero.
267 */
268 csz = 16;
270 }
271 /*
272 * The default setting of latency timer yields poor results,
273 * set it to the value used by other systems. It may be worth
274 * tweaking this setting more.
275 */
277
278 /*
279 * Disable the RETRY_TIMEOUT register (0x41) to keep
280 * PCI Tx retries from interfering with C3 CPU state.
281 */
282 pci_write_config_byte(pdev, 0x41, 0);
283
284 mem = pci_ioremap(pdev, pdev->membase, 0x10000);
285 if (!mem) {
286 DBG("ath5k: cannot remap PCI memory region\n");
287 ret = -EIO;
288 goto err;
289 }
290
291 /*
292 * Allocate dev (net80211 main struct)
293 * and dev->priv (driver private data)
294 */
295 dev = net80211_alloc(sizeof(*sc));
296 if (!dev) {
297 DBG("ath5k: cannot allocate 802.11 device\n");
298 ret = -ENOMEM;
299 goto err_map;
300 }
301
302 /* Initialize driver private data */
303 sc = dev->priv;
304 sc->dev = dev;
305 sc->pdev = pdev;
306
307 sc->hwinfo = zalloc(sizeof(*sc->hwinfo));
308 if (!sc->hwinfo) {
309 DBG("ath5k: cannot allocate 802.11 hardware info structure\n");
310 ret = -ENOMEM;
311 goto err_free;
312 }
313
314 sc->hwinfo->flags = NET80211_HW_RX_HAS_FCS;
315 sc->hwinfo->signal_type = NET80211_SIGNAL_DB;
316 sc->hwinfo->signal_max = 40; /* 35dB should give perfect 54Mbps */
317 sc->hwinfo->channel_change_time = 5000;
318
319 /* Avoid working with the device until setup is complete */
321
322 sc->iobase = mem;
323 sc->cachelsz = csz * 4; /* convert to bytes */
324
325 DBG("ath5k: register base at %p (%08lx)\n", sc->iobase, pdev->membase);
326 DBG("ath5k: cache line size %d\n", sc->cachelsz);
327
328 /* Set private data */
329 pci_set_drvdata(pdev, dev);
330 dev->netdev->dev = (struct device *)pdev;
331
332 /* Initialize device */
333 ret = ath5k_hw_attach(sc, pdev->id->driver_data, &sc->ah);
334 if (ret)
335 goto err_free_hwinfo;
336
337 /* Finish private driver data initialization */
338 ret = ath5k_attach(dev);
339 if (ret)
340 goto err_ah;
341
342#if DBGLVL_MAX
343 DBG("Atheros AR%s chip found (MAC: 0x%x, PHY: 0x%x)\n",
344 ath5k_chip_name(AR5K_VERSION_MAC, sc->ah->ah_mac_srev),
345 sc->ah->ah_mac_srev, sc->ah->ah_phy_revision);
346
347 if (!sc->ah->ah_single_chip) {
348 /* Single chip radio (!RF5111) */
349 if (sc->ah->ah_radio_5ghz_revision &&
351 /* No 5GHz support -> report 2GHz radio */
353 DBG("RF%s 2GHz radio found (0x%x)\n",
354 ath5k_chip_name(AR5K_VERSION_RAD,
357 /* No 2GHz support (5110 and some
358 * 5Ghz only cards) -> report 5Ghz radio */
359 } else if (!(sc->ah->ah_capabilities.cap_mode & AR5K_MODE_BIT_11B)) {
360 DBG("RF%s 5GHz radio found (0x%x)\n",
361 ath5k_chip_name(AR5K_VERSION_RAD,
364 /* Multiband radio */
365 } else {
366 DBG("RF%s multiband radio found (0x%x)\n",
367 ath5k_chip_name(AR5K_VERSION_RAD,
370 }
371 }
372 /* Multi chip radio (RF5111 - RF2111) ->
373 * report both 2GHz/5GHz radios */
374 else if (sc->ah->ah_radio_5ghz_revision &&
376 DBG("RF%s 5GHz radio found (0x%x)\n",
377 ath5k_chip_name(AR5K_VERSION_RAD,
380 DBG("RF%s 2GHz radio found (0x%x)\n",
381 ath5k_chip_name(AR5K_VERSION_RAD,
384 }
385 }
386#endif
387
388 /* Ready to go */
390
391 return 0;
392err_ah:
393 ath5k_hw_detach(sc->ah);
394err_free_hwinfo:
395 free(sc->hwinfo);
396err_free:
397 net80211_free(dev);
398err_map:
399 iounmap(mem);
400err:
401 return ret;
402}
static int ath5k_attach(struct net80211_device *dev)
Definition ath5k.c:422
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
void ath5k_hw_detach(struct ath5k_hw *ah)
ath5k_hw_detach - Free the ath5k_hw struct
@ AR5K_VERSION_MAC
Definition ath5k.h:278
@ AR5K_VERSION_RAD
Definition ath5k.h:279
@ AR5K_MODE_BIT_11B
Definition ath5k.h:405
@ AR5K_MODE_BIT_11A
Definition ath5k.h:403
#define ATH_STAT_INVALID
Definition base.h:105
#define DBG(...)
Print a debugging message.
Definition compiler.h:498
struct net80211_device * net80211_alloc(size_t priv_size)
Allocate 802.11 device.
Definition net80211.c:755
void net80211_free(struct net80211_device *dev)
Free 802.11 device.
Definition net80211.c:839
#define ENOMEM
Not enough space.
Definition errno.h:535
#define EIO
Input/output error.
Definition errno.h:434
#define u8
Definition igbvf_osdep.h:40
void iounmap(volatile const void *io_addr)
Unmap I/O address.
void * pci_ioremap(struct pci_device *pci, unsigned long bus_addr, size_t len)
Map PCI bus address as an I/O address.
int pci_write_config_byte(struct pci_device *pci, unsigned int where, uint8_t value)
Write byte to PCI configuration space.
int pci_read_config_byte(struct pci_device *pci, unsigned int where, uint8_t *value)
Read byte from PCI configuration space.
void * zalloc(size_t size)
Allocate cleared memory.
Definition malloc.c:662
void adjust_pci_device(struct pci_device *pci)
Enable PCI device.
Definition pci.c:241
static void pci_set_drvdata(struct pci_device *pci, void *priv)
Set PCI driver-private data.
Definition pci.h:366
#define PCI_CACHE_LINE_SIZE
PCI cache line size.
Definition pci.h:48
#define PCI_LATENCY_TIMER
PCI latency timer.
Definition pci.h:51
static void(* free)(struct refcnt *refcnt))
Definition refcnt.h:55
u16 ah_radio_5ghz_revision
Definition ath5k.h:973
int ah_single_chip
Definition ath5k.h:966
u32 ah_mac_srev
Definition ath5k.h:969
struct ath5k_capabilities ah_capabilities
Definition ath5k.h:1009
u16 ah_phy_revision
Definition ath5k.h:972
u16 ah_radio_2ghz_revision
Definition ath5k.h:974
int status
Definition base.h:104
struct ath5k_hw * ah
Definition base.h:93
struct net80211_device * dev
Definition base.h:92
struct net80211_hw_info * hwinfo
Definition base.h:94
struct pci_device * pdev
Definition base.h:90
u16 cachelsz
Definition base.h:102
void * iobase
Definition base.h:91
A hardware device.
Definition device.h:77
Structure encapsulating the complete state of an 802.11 device.
Definition net80211.h:787
struct net_device * netdev
The net_device that wraps us.
Definition net80211.h:789
void * priv
Driver private data.
Definition net80211.h:798
enum net80211_hw_info::@277203366166200071173154201003141076360026365126 flags
A set of flags indicating peculiarities of this device.
unsigned channel_change_time
Estimate of the time required to change channels, in microseconds.
Definition net80211.h:518
unsigned signal_max
Maximum signal in arbitrary cases.
Definition net80211.h:495
enum net80211_hw_info::@160150106134320172247032061203111226300065160315 signal_type
Signal strength information that can be provided by the device.
struct device * dev
Underlying hardware device.
Definition netdevice.h:365
unsigned long driver_data
Arbitrary driver data.
Definition pci.h:183
unsigned long membase
Memory base.
Definition pci.h:220
struct pci_device_id * id
Driver device ID.
Definition pci.h:248

References adjust_pci_device(), ath5k_softc::ah, ath5k_hw::ah_capabilities, ath5k_hw::ah_mac_srev, ath5k_hw::ah_phy_revision, ath5k_hw::ah_radio_2ghz_revision, ath5k_hw::ah_radio_5ghz_revision, ath5k_hw::ah_single_chip, AR5K_MODE_BIT_11A, AR5K_MODE_BIT_11B, AR5K_VERSION_MAC, AR5K_VERSION_RAD, ath5k_attach(), ath5k_hw_attach(), ath5k_hw_detach(), ATH_STAT_INVALID, ath5k_softc::cachelsz, ath5k_capabilities::cap_mode, net80211_hw_info::channel_change_time, DBG, ath5k_softc::dev, net_device::dev, pci_device_id::driver_data, EIO, ENOMEM, net80211_hw_info::flags, free, ath5k_softc::hwinfo, pci_device::id, ath5k_softc::iobase, iounmap(), pci_device::membase, net80211_alloc(), net80211_free(), net80211_device::netdev, PCI_CACHE_LINE_SIZE, pci_ioremap(), PCI_LATENCY_TIMER, pci_read_config_byte(), pci_set_drvdata(), pci_write_config_byte(), ath5k_softc::pdev, net80211_device::priv, net80211_hw_info::signal_max, net80211_hw_info::signal_type, ath5k_softc::status, u8, and zalloc().

◆ ath5k_remove()

void ath5k_remove ( struct pci_device * pdev)
static

Definition at line 404 of file ath5k.c.

405{
406 struct net80211_device *dev = pci_get_drvdata(pdev);
407 struct ath5k_softc *sc = dev->priv;
408
410 ath5k_hw_detach(sc->ah);
411 iounmap(sc->iobase);
412 free(sc->hwinfo);
414}
static void ath5k_detach(struct net80211_device *dev)
Definition ath5k.c:493
static void * pci_get_drvdata(struct pci_device *pci)
Get PCI driver-private data.
Definition pci.h:376

References ath5k_softc::ah, ath5k_detach(), ath5k_hw_detach(), ath5k_softc::dev, free, ath5k_softc::hwinfo, ath5k_softc::iobase, iounmap(), net80211_free(), pci_get_drvdata(), and net80211_device::priv.

◆ ath5k_tx()

int ath5k_tx ( struct net80211_device * dev,
struct io_buffer * skb )
static

Definition at line 1462 of file ath5k.c.

1463{
1464 struct ath5k_softc *sc = dev->priv;
1465 struct ath5k_buf *bf;
1466 int rc;
1467
1468 /*
1469 * The hardware expects the header padded to 4 byte boundaries.
1470 * iPXE only ever sends 24-byte headers, so no action necessary.
1471 */
1472
1473 if (list_empty(&sc->txbuf)) {
1474 DBG("ath5k: dropping packet because no tx bufs available\n");
1475 return -ENOBUFS;
1476 }
1477
1478 bf = list_entry(sc->txbuf.next, struct ath5k_buf, list);
1479 list_del(&bf->list);
1480 sc->txbuf_len--;
1481
1482 bf->iob = iob;
1483
1484 if ((rc = ath5k_txbuf_setup(sc, bf)) != 0) {
1485 bf->iob = NULL;
1486 list_add_tail(&bf->list, &sc->txbuf);
1487 sc->txbuf_len++;
1488 return rc;
1489 }
1490 return 0;
1491}
#define NULL
NULL pointer (VOID *)
Definition Base.h:322
struct arbelprm_rc_send_wqe rc
Definition arbel.h:3
static int ath5k_txbuf_setup(struct ath5k_softc *sc, struct ath5k_buf *bf)
Definition ath5k.c:816
#define ENOBUFS
No buffer space available.
Definition errno.h:499
#define list_entry(list, type, member)
Get the container of a list entry.
Definition list.h:322
#define list_add_tail(new, head)
Add a new entry to the tail of a list.
Definition list.h:94
#define list_del(list)
Delete an entry from a list.
Definition list.h:120
#define list_empty(list)
Test whether a list is empty.
Definition list.h:137
struct list_head list
Definition base.h:57
struct io_buffer * iob
Definition base.h:61
struct list_head txbuf
Definition base.h:123
unsigned int txbuf_len
Definition base.h:124
struct list_head * next
Next list entry.
Definition list.h:21

References ath5k_txbuf_setup(), DBG, ath5k_softc::dev, ENOBUFS, ath5k_buf::iob, ath5k_buf::list, list_add_tail, list_del, list_empty, list_entry, list_head::next, NULL, net80211_device::priv, rc, ath5k_softc::txbuf, and ath5k_softc::txbuf_len.

◆ ath5k_reset()

int ath5k_reset ( struct ath5k_softc * sc,
struct net80211_channel * chan )
static

Definition at line 1498 of file ath5k.c.

1499{
1500 struct ath5k_hw *ah = sc->ah;
1501 int ret;
1502
1503 if (chan) {
1504 ath5k_hw_set_imr(ah, 0);
1506 ath5k_rx_stop(sc);
1507
1508 sc->curchan = chan;
1509 sc->curband = chan->band;
1510 }
1511
1512 ret = ath5k_hw_reset(ah, sc->curchan, 1);
1513 if (ret) {
1514 DBG("ath5k: can't reset hardware: %s\n", strerror(ret));
1515 return ret;
1516 }
1517
1518 ret = ath5k_rx_start(sc);
1519 if (ret) {
1520 DBG("ath5k: can't start rx logic: %s\n", strerror(ret));
1521 return ret;
1522 }
1523
1524 /*
1525 * Change channels and update the h/w rate map if we're switching;
1526 * e.g. 11a to 11b/g.
1527 *
1528 * We may be doing a reset in response to an ioctl that changes the
1529 * channel so update any state that might change as a result.
1530 *
1531 * XXX needed?
1532 */
1533/* ath5k_chan_change(sc, c); */
1534
1535 /* Reenable interrupts if necessary */
1536 ath5k_irq(sc->dev, sc->irq_ena);
1537
1538 return 0;
1539}
static void ath5k_irq(struct net80211_device *dev, int enable)
Definition ath5k.c:1282
static int ath5k_rx_start(struct ath5k_softc *sc)
Definition ath5k.c:1051
static void ath5k_rx_stop(struct ath5k_softc *sc)
Definition ath5k.c:1083
static void ath5k_txq_cleanup(struct ath5k_softc *sc)
Definition ath5k.c:1012
enum ath5k_int ath5k_hw_set_imr(struct ath5k_hw *ah, enum ath5k_int new_mask)
ath5k_hw_set_imr - Set interrupt mask
Definition ath5k_dma.c:549
int ath5k_hw_reset(struct ath5k_hw *ah, struct net80211_channel *channel, int change_channel)
uint8_t ah
Definition registers.h:1
char * strerror(int errno)
Retrieve string representation of error number.
Definition strerror.c:79
ath5k_hw_get_isr - Get interrupt status
Definition ath5k.h:955
int curband
Definition base.h:95
int irq_ena
Definition base.h:96
struct net80211_channel * curchan
Definition base.h:113
u8 band
The band with which this channel is associated.
Definition net80211.h:388

References ah, ath5k_softc::ah, ath5k_hw_reset(), ath5k_hw_set_imr(), ath5k_irq(), ath5k_rx_start(), ath5k_rx_stop(), ath5k_txq_cleanup(), net80211_channel::band, ath5k_softc::curband, ath5k_softc::curchan, DBG, ath5k_softc::dev, ath5k_softc::irq_ena, and strerror().

Referenced by ath5k_chan_set(), ath5k_init(), and ath5k_reset_wake().

◆ ath5k_reset_wake()

int ath5k_reset_wake ( struct ath5k_softc * sc)
static

Definition at line 1541 of file ath5k.c.

1542{
1543 return ath5k_reset(sc, sc->curchan);
1544}
static int ath5k_reset(struct ath5k_softc *sc, struct net80211_channel *chan)
Definition ath5k.c:1498

References ath5k_reset(), and ath5k_softc::curchan.

Referenced by ath5k_calibrate(), and ath5k_poll().

◆ ath5k_start()

int ath5k_start ( struct net80211_device * dev)
static

Definition at line 1546 of file ath5k.c.

1547{
1548 struct ath5k_softc *sc = dev->priv;
1549 int ret;
1550
1551 if ((ret = ath5k_init(sc)) != 0)
1552 return ret;
1553
1554 sc->assoc = 0;
1557
1558 return 0;
1559}
static int ath5k_init(struct ath5k_softc *sc)
Definition ath5k.c:1295
static void ath5k_configure_filter(struct ath5k_softc *sc)
Definition ath5k.c:1637
int ath5k_hw_set_lladdr(struct ath5k_hw *ah, const u8 *mac)
ath5k_hw_set_lladdr - Set station id
Definition ath5k_pcu.c:201
int assoc
Definition base.h:135
uint8_t ll_addr[MAX_LL_ADDR_LEN]
Link-layer address.
Definition netdevice.h:388

References ath5k_softc::ah, ath5k_softc::assoc, ath5k_configure_filter(), ath5k_hw_set_lladdr(), ath5k_init(), ath5k_softc::dev, net_device::ll_addr, net80211_device::netdev, and net80211_device::priv.

◆ ath5k_stop()

void ath5k_stop ( struct net80211_device * dev)
static

Definition at line 1561 of file ath5k.c.

1562{
1563 struct ath5k_softc *sc = dev->priv;
1564 u8 mac[ETH_ALEN] = {};
1565
1567
1568 ath5k_stop_hw(sc);
1569}
static int ath5k_stop_hw(struct ath5k_softc *sc)
Definition ath5k.c:1341
uint8_t mac[ETH_ALEN]
MAC address.
Definition ena.h:13
#define ETH_ALEN
Definition if_ether.h:9

References ath5k_softc::ah, ath5k_hw_set_lladdr(), ath5k_stop_hw(), ath5k_softc::dev, ETH_ALEN, mac, net80211_device::priv, and u8.

◆ ath5k_config()

int ath5k_config ( struct net80211_device * dev,
int changed )
static

Definition at line 1572 of file ath5k.c.

1573{
1574 struct ath5k_softc *sc = dev->priv;
1575 struct ath5k_hw *ah = sc->ah;
1576 struct net80211_channel *chan = &dev->channels[dev->channel];
1577 int ret;
1578
1579 if (changed & NET80211_CFG_CHANNEL) {
1580 sc->power_level = chan->maxpower;
1581 if ((ret = ath5k_chan_set(sc, chan)) != 0)
1582 return ret;
1583 }
1584
1585 if ((changed & NET80211_CFG_RATE) ||
1586 (changed & NET80211_CFG_PHY_PARAMS)) {
1587 int spmbl = ATH5K_SPMBL_NO;
1588 u16 rate = dev->rates[dev->rate];
1589 u16 slowrate = dev->rates[dev->rtscts_rate];
1590 int i;
1591
1593 spmbl = ATH5K_SPMBL_YES;
1594
1595 for (i = 0; i < ATH5K_NR_RATES; i++) {
1596 if (ath5k_rates[i].bitrate == rate &&
1597 (ath5k_rates[i].short_pmbl & spmbl))
1598 sc->hw_rate = ath5k_rates[i].hw_code;
1599
1600 if (ath5k_rates[i].bitrate == slowrate &&
1601 (ath5k_rates[i].short_pmbl & spmbl))
1602 sc->hw_rtscts_rate = ath5k_rates[i].hw_code;
1603 }
1604 }
1605
1606 if (changed & NET80211_CFG_ASSOC) {
1607 sc->assoc = !!(dev->state & NET80211_ASSOCIATED);
1608 if (sc->assoc) {
1609 memcpy(ah->ah_bssid, dev->bssid, ETH_ALEN);
1610 } else {
1611 memset(ah->ah_bssid, 0xff, ETH_ALEN);
1612 }
1613 ath5k_hw_set_associd(ah, ah->ah_bssid, 0);
1614 }
1615
1616 return 0;
1617}
#define ATH5K_NR_RATES
Definition ath5k.c:116
static const struct @243101324066276276010153053027305146200053303005 ath5k_rates[]
#define ATH5K_SPMBL_NO
Definition ath5k.c:89
u16 bitrate
Definition ath5k.c:94
static int ath5k_chan_set(struct ath5k_softc *sc, struct net80211_channel *chan)
Definition ath5k.c:656
#define ATH5K_SPMBL_YES
Definition ath5k.c:90
u8 short_pmbl
Definition ath5k.c:95
void ath5k_hw_set_associd(struct ath5k_hw *ah, const u8 *bssid, u16 assoc_id)
ath5k_hw_set_associd - Set BSSID for association
Definition ath5k_pcu.c:229
#define NET80211_CFG_ASSOC
Association has been established with a new BSS (dev->bssid)
Definition net80211.h:87
#define NET80211_CFG_CHANNEL
Channel choice (dev->channel) or regulatory parameters have changed.
Definition net80211.h:81
#define NET80211_CFG_RATE
Requested transmission rate (dev->rate) has changed.
Definition net80211.h:84
#define NET80211_CFG_PHY_PARAMS
Low-level link parameters (short preamble, protection, etc) have changed.
Definition net80211.h:90
#define NET80211_PHY_USE_SHORT_PREAMBLE
Whether to use 802.11b short preamble operation.
Definition net80211.h:260
#define NET80211_ASSOCIATED
Whether we have successfully associated with the network.
Definition net80211.h:201
void * memcpy(void *dest, const void *src, size_t len) __nonnull
void * memset(void *dest, int character, size_t len) __nonnull
int hw_rate
Definition base.h:137
int hw_rtscts_rate
Definition base.h:138
int power_level
Definition base.h:134
An 802.11 RF channel.
Definition net80211.h:386
u8 maxpower
Maximum allowable transmit power, in dBm.
Definition net80211.h:425
u16 rates[NET80211_MAX_RATES]
A list of all possible TX rates we might use.
Definition net80211.h:818
struct net80211_channel channels[NET80211_MAX_CHANNELS]
A list of all possible channels we might use.
Definition net80211.h:806
u8 rtscts_rate
The rate to use for RTS/CTS transmissions.
Definition net80211.h:831
u16 state
State of our association to the network.
Definition net80211.h:921
u8 channel
The channel currently in use, as an index into the channels array.
Definition net80211.h:812
int phy_flags
Physical layer options.
Definition net80211.h:983
u8 bssid[ETH_ALEN]
MAC address of the access point most recently associated.
Definition net80211.h:954
u8 rate
The rate currently in use, as an index into the rates array.
Definition net80211.h:824
#define u16
Definition vga.h:20

References ah, ath5k_softc::ah, ath5k_softc::assoc, ath5k_chan_set(), ath5k_hw_set_associd(), ATH5K_NR_RATES, ath5k_rates, ATH5K_SPMBL_NO, ATH5K_SPMBL_YES, bitrate, net80211_device::bssid, net80211_device::channel, net80211_device::channels, ath5k_softc::dev, ETH_ALEN, ath5k_softc::hw_rate, ath5k_softc::hw_rtscts_rate, net80211_channel::maxpower, memcpy(), memset(), NET80211_ASSOCIATED, NET80211_CFG_ASSOC, NET80211_CFG_CHANNEL, NET80211_CFG_PHY_PARAMS, NET80211_CFG_RATE, NET80211_PHY_USE_SHORT_PREAMBLE, net80211_device::phy_flags, ath5k_softc::power_level, net80211_device::priv, net80211_device::rate, net80211_device::rates, net80211_device::rtscts_rate, short_pmbl, net80211_device::state, and u16.

◆ ath5k_poll()

void ath5k_poll ( struct net80211_device * dev)
static

Definition at line 1377 of file ath5k.c.

1378{
1379 struct ath5k_softc *sc = dev->priv;
1380 struct ath5k_hw *ah = sc->ah;
1381 enum ath5k_int status;
1382 unsigned int counter = 1000;
1383
1384 if (currticks() - sc->last_calib_ticks >
1386 ath5k_calibrate(sc);
1388 }
1389
1390 if ((sc->status & ATH_STAT_INVALID) ||
1392 return;
1393
1394 do {
1395 ath5k_hw_get_isr(ah, &status); /* NB: clears IRQ too */
1396 DBGP("ath5k: status %#x/%#x\n", status, sc->imask);
1397 if (status & AR5K_INT_FATAL) {
1398 /*
1399 * Fatal errors are unrecoverable.
1400 * Typically these are caused by DMA errors.
1401 */
1402 DBG("ath5k: fatal error, resetting\n");
1403 ath5k_reset_wake(sc);
1404 } else if (status & AR5K_INT_RXORN) {
1405 DBG("ath5k: rx overrun, resetting\n");
1406 ath5k_reset_wake(sc);
1407 } else {
1408 if (status & AR5K_INT_RXEOL) {
1409 /*
1410 * NB: the hardware should re-read the link when
1411 * RXE bit is written, but it doesn't work at
1412 * least on older hardware revs.
1413 */
1414 DBG("ath5k: rx EOL\n");
1415 sc->rxlink = NULL;
1416 }
1417 if (status & AR5K_INT_TXURN) {
1418 /* bump tx trigger level */
1419 DBG("ath5k: tx underrun\n");
1421 }
1423 ath5k_handle_rx(sc);
1426 ath5k_handle_tx(sc);
1427 }
1428 } while (ath5k_hw_is_intr_pending(ah) && counter-- > 0);
1429
1430 if (!counter)
1431 DBG("ath5k: too many interrupts, giving up for now\n");
1432}
static void ath5k_handle_rx(struct ath5k_softc *sc)
Definition ath5k.c:1095
static void ath5k_calibrate(struct ath5k_softc *sc)
Definition ath5k.c:1439
#define ATH5K_CALIB_INTERVAL
Definition ath5k.c:59
static int ath5k_reset_wake(struct ath5k_softc *sc)
Definition ath5k.c:1541
static void ath5k_handle_tx(struct ath5k_softc *sc)
Definition ath5k.c:1271
int ath5k_hw_update_tx_triglevel(struct ath5k_hw *ah, int increase)
ath5k_hw_update_tx_triglevel - Update tx trigger level
Definition ath5k_dma.c:340
int ath5k_hw_get_isr(struct ath5k_hw *ah, enum ath5k_int *interrupt_mask)
Definition ath5k_dma.c:413
ath5k_int
enum ath5k_int - Hardware interrupt masks helpers
Definition ath5k.h:806
@ AR5K_INT_FATAL
Definition ath5k.h:826
@ AR5K_INT_TXDESC
Definition ath5k.h:814
@ AR5K_INT_TXERR
Definition ath5k.h:815
@ AR5K_INT_RXORN
Definition ath5k.h:812
@ AR5K_INT_TXEOL
Definition ath5k.h:817
@ AR5K_INT_RXOK
Definition ath5k.h:807
@ AR5K_INT_TXOK
Definition ath5k.h:813
@ AR5K_INT_RXERR
Definition ath5k.h:809
@ AR5K_INT_TXURN
Definition ath5k.h:818
@ AR5K_INT_RXEOL
Definition ath5k.h:811
int ath5k_hw_is_intr_pending(struct ath5k_hw *ah)
ath5k_hw_is_intr_pending - Check if we have pending interrupts
Definition ath5k_dma.c:392
uint8_t status
Status.
Definition ena.h:5
#define DBGP(...)
Definition compiler.h:532
#define TICKS_PER_SEC
Number of ticks per second.
Definition timer.h:16
int last_calib_ticks
Definition base.h:132
u32 * rxlink
Definition base.h:121
enum ath5k_int imask
Definition base.h:115
unsigned long currticks(void)
Get current system time in ticks.
Definition timer.c:43

References ah, ath5k_softc::ah, AR5K_INT_FATAL, AR5K_INT_RXEOL, AR5K_INT_RXERR, AR5K_INT_RXOK, AR5K_INT_RXORN, AR5K_INT_TXDESC, AR5K_INT_TXEOL, AR5K_INT_TXERR, AR5K_INT_TXOK, AR5K_INT_TXURN, ATH5K_CALIB_INTERVAL, ath5k_calibrate(), ath5k_handle_rx(), ath5k_handle_tx(), ath5k_hw_get_isr(), ath5k_hw_is_intr_pending(), ath5k_hw_update_tx_triglevel(), ath5k_reset_wake(), ATH_STAT_INVALID, currticks(), DBG, DBGP, ath5k_softc::dev, ath5k_softc::imask, ath5k_softc::irq_ena, ath5k_softc::last_calib_ticks, NULL, net80211_device::priv, ath5k_softc::rxlink, ath5k_softc::status, status, and TICKS_PER_SEC.

◆ ath5k_irq()

void ath5k_irq ( struct net80211_device * dev,
int enable )
static

Definition at line 1282 of file ath5k.c.

1283{
1284 struct ath5k_softc *sc = dev->priv;
1285 struct ath5k_hw *ah = sc->ah;
1286
1287 sc->irq_ena = enable;
1288 ah->ah_ier = enable ? AR5K_IER_ENABLE : AR5K_IER_DISABLE;
1289
1290 ath5k_hw_reg_write(ah, ah->ah_ier, AR5K_IER);
1292}
#define AR5K_IER_DISABLE
Definition reg.h:93
#define AR5K_IER_ENABLE
Definition reg.h:94
#define AR5K_IER
Definition reg.h:92
static void ath5k_hw_reg_write(struct ath5k_hw *ah, u32 val, u16 reg)
Definition ath5k.h:1224

References ah, ath5k_softc::ah, AR5K_IER, AR5K_IER_DISABLE, AR5K_IER_ENABLE, ath5k_hw_reg_write(), ath5k_hw_set_imr(), ath5k_softc::dev, ath5k_softc::imask, ath5k_softc::irq_ena, and net80211_device::priv.

Referenced by ath5k_reset().

◆ ath5k_attach()

int ath5k_attach ( struct net80211_device * dev)
static

Definition at line 422 of file ath5k.c.

423{
424 struct ath5k_softc *sc = dev->priv;
425 struct ath5k_hw *ah = sc->ah;
426 int ret;
427
428 /*
429 * Collect the channel list. The 802.11 layer
430 * is resposible for filtering this list based
431 * on settings like the phy mode and regulatory
432 * domain restrictions.
433 */
434 ret = ath5k_setup_bands(dev);
435 if (ret) {
436 DBG("ath5k: can't get channels\n");
437 goto err;
438 }
439
440 /* NB: setup here so ath5k_rate_update is happy */
441 if (ah->ah_modes & AR5K_MODE_BIT_11A)
443 else
445
446 /*
447 * Allocate tx+rx descriptors and populate the lists.
448 */
449 ret = ath5k_desc_alloc(sc);
450 if (ret) {
451 DBG("ath5k: can't allocate descriptors\n");
452 goto err;
453 }
454
455 /*
456 * Allocate hardware transmit queues. Note that hw functions
457 * handle reseting these queues at the needed time.
458 */
460 if (ret) {
461 DBG("ath5k: can't setup xmit queue\n");
462 goto err_desc;
463 }
464
466
468 if (ret) {
469 DBG("ath5k: unable to read address from EEPROM: 0x%04x\n",
470 sc->pdev->device);
471 goto err_queues;
472 }
473
474 memset(sc->bssidmask, 0xff, ETH_ALEN);
476
477 ret = net80211_register(sc->dev, &ath5k_ops, sc->hwinfo);
478 if (ret) {
479 DBG("ath5k: can't register ieee80211 hw\n");
480 goto err_queues;
481 }
482
483 return 0;
484err_queues:
486err_desc:
487 ath5k_desc_free(sc);
488err:
489 return ret;
490}
static struct net80211_device_operations ath5k_ops
Definition ath5k.c:145
static int ath5k_setup_bands(struct net80211_device *dev)
Definition ath5k.c:586
static void ath5k_desc_free(struct ath5k_softc *sc)
Definition ath5k.c:926
static void ath5k_txq_release(struct ath5k_softc *sc)
Definition ath5k.c:1032
static int ath5k_txq_setup(struct ath5k_softc *sc, int qtype, int subtype)
Definition ath5k.c:951
static void ath5k_setcurmode(struct ath5k_softc *sc, unsigned int mode)
Definition ath5k.c:675
static int ath5k_desc_alloc(struct ath5k_softc *sc)
Definition ath5k.c:871
int ath5k_hw_set_bssid_mask(struct ath5k_hw *ah, const u8 *mask)
ath5k_hw_set_bssid_mask - filter out bssids we listen
Definition ath5k_pcu.c:349
@ AR5K_MODE_11B
Definition ath5k.h:396
@ AR5K_MODE_11A
Definition ath5k.h:394
@ AR5K_WME_AC_BE
Definition ath5k.h:464
int ath5k_eeprom_read_mac(struct ath5k_hw *ah, u8 *mac)
@ AR5K_TX_QUEUE_DATA
Definition ath5k.h:448
int net80211_register(struct net80211_device *dev, struct net80211_device_operations *ops, struct net80211_hw_info *hw)
Register 802.11 device with network stack.
Definition net80211.c:792
u8 bssidmask[ETH_ALEN]
Definition base.h:117
u8 hwaddr[ETH_ALEN]
Default hardware MAC address.
Definition net80211.h:447
uint16_t device
Device ID.
Definition pci.h:230

References ah, ath5k_softc::ah, AR5K_MODE_11A, AR5K_MODE_11B, AR5K_MODE_BIT_11A, AR5K_TX_QUEUE_DATA, AR5K_WME_AC_BE, ath5k_desc_alloc(), ath5k_desc_free(), ath5k_eeprom_read_mac(), ath5k_hw_set_bssid_mask(), ath5k_ops, ath5k_setcurmode(), ath5k_setup_bands(), ath5k_txq_release(), ath5k_txq_setup(), ath5k_softc::bssidmask, currticks(), DBG, ath5k_softc::dev, pci_device::device, ETH_ALEN, net80211_hw_info::hwaddr, ath5k_softc::hwinfo, ath5k_softc::last_calib_ticks, memset(), net80211_register(), ath5k_softc::pdev, and net80211_device::priv.

Referenced by ath5k_probe().

◆ ath5k_detach()

void ath5k_detach ( struct net80211_device * dev)
static

Definition at line 493 of file ath5k.c.

494{
495 struct ath5k_softc *sc = dev->priv;
496
498 ath5k_desc_free(sc);
500}
void net80211_unregister(struct net80211_device *dev)
Unregister 802.11 device from network stack.
Definition net80211.c:825

References ath5k_desc_free(), ath5k_txq_release(), ath5k_softc::dev, net80211_unregister(), and net80211_device::priv.

Referenced by ath5k_remove().

◆ ath5k_copy_channels()

unsigned int ath5k_copy_channels ( struct ath5k_hw * ah,
struct net80211_channel * channels,
unsigned int mode,
unsigned int max )
static

Definition at line 525 of file ath5k.c.

528{
529 unsigned int i, count, size, chfreq, freq, ch;
530
531 if (!(ah->ah_modes & (1 << mode)))
532 return 0;
533
534 switch (mode) {
535 case AR5K_MODE_11A:
537 /* 1..220, but 2GHz frequencies are filtered by check_channel */
538 size = 220;
539 chfreq = CHANNEL_5GHZ;
540 break;
541 case AR5K_MODE_11B:
542 case AR5K_MODE_11G:
544 size = 26;
545 chfreq = CHANNEL_2GHZ;
546 break;
547 default:
548 return 0;
549 }
550
551 for (i = 0, count = 0; i < size && max > 0; i++) {
552 ch = i + 1 ;
553 freq = ath5k_ieee2mhz(ch);
554
555 /* Check if channel is supported by the chipset */
556 if (!ath5k_channel_ok(ah, freq, chfreq))
557 continue;
558
559 /* Write channel info and increment counter */
560 channels[count].center_freq = freq;
561 channels[count].maxpower = 0; /* use regulatory */
562 channels[count].band = (chfreq == CHANNEL_2GHZ) ?
564 switch (mode) {
565 case AR5K_MODE_11A:
566 case AR5K_MODE_11G:
567 channels[count].hw_value = chfreq | CHANNEL_OFDM;
568 break;
571 channels[count].hw_value = chfreq |
573 break;
574 case AR5K_MODE_11B:
575 channels[count].hw_value = CHANNEL_B;
576 }
577
578 count++;
579 max--;
580 }
581
582 return count;
583}
static short ath5k_ieee2mhz(short chan)
Definition ath5k.c:513
#define CHANNEL_B
Definition ath5k.h:641
@ AR5K_MODE_11G_TURBO
Definition ath5k.h:398
@ AR5K_MODE_11A_TURBO
Definition ath5k.h:395
@ AR5K_MODE_11G
Definition ath5k.h:397
#define CHANNEL_5GHZ
Definition ath5k.h:635
#define CHANNEL_OFDM
Definition ath5k.h:633
#define CHANNEL_TURBO
Definition ath5k.h:631
int ath5k_channel_ok(struct ath5k_hw *ah, u16 freq, unsigned int flags)
Definition ath5k_phy.c:831
#define CHANNEL_2GHZ
Definition ath5k.h:634
#define max(x, y)
Definition ath.h:41
uint16_t mode
Acceleration mode.
Definition ena.h:15
uint16_t size
Buffer size.
Definition dwmac.h:3
static unsigned int count
Number of entries.
Definition dwmac.h:220
#define NET80211_BAND_2GHZ
The 2.4 GHz ISM band, unlicensed in most countries.
Definition net80211.h:45
#define NET80211_BAND_5GHZ
The band from 4.9 GHz to 5.7 GHz, which tends to be more restricted.
Definition net80211.h:47
struct ieee80211_ie_channels_channel_band channels[0]
List of (start, length) channel bands we can use.
Definition ieee80211.h:4
uint8_t ch
Definition registers.h:1

References ah, AR5K_MODE_11A, AR5K_MODE_11A_TURBO, AR5K_MODE_11B, AR5K_MODE_11G, AR5K_MODE_11G_TURBO, ath5k_channel_ok(), ath5k_ieee2mhz(), ch, CHANNEL_2GHZ, CHANNEL_5GHZ, CHANNEL_B, CHANNEL_OFDM, CHANNEL_TURBO, channels, count, max, mode, NET80211_BAND_2GHZ, NET80211_BAND_5GHZ, and size.

Referenced by ath5k_setup_bands().

◆ ath5k_setup_bands()

int ath5k_setup_bands ( struct net80211_device * dev)
static

Definition at line 586 of file ath5k.c.

587{
588 struct ath5k_softc *sc = dev->priv;
589 struct ath5k_hw *ah = sc->ah;
590 int max_c, count_c = 0;
591 int i;
592 int band;
593
594 max_c = sizeof(sc->hwinfo->channels) / sizeof(sc->hwinfo->channels[0]);
595
596 /* 2GHz band */
598 /* G mode */
599 band = NET80211_BAND_2GHZ;
602
603 for (i = 0; i < 12; i++)
604 sc->hwinfo->rates[band][i] = ath5k_rates[i].bitrate;
605 sc->hwinfo->nr_rates[band] = 12;
606
607 sc->hwinfo->nr_channels =
609 AR5K_MODE_11G, max_c);
610 count_c = sc->hwinfo->nr_channels;
611 max_c -= count_c;
612 } else if (sc->ah->ah_capabilities.cap_mode & AR5K_MODE_BIT_11B) {
613 /* B mode */
614 band = NET80211_BAND_2GHZ;
617
618 for (i = 0; i < 4; i++)
619 sc->hwinfo->rates[band][i] = ath5k_rates[i].bitrate;
620 sc->hwinfo->nr_rates[band] = 4;
621
622 sc->hwinfo->nr_channels =
624 AR5K_MODE_11B, max_c);
625 count_c = sc->hwinfo->nr_channels;
626 max_c -= count_c;
627 }
628
629 /* 5GHz band, A mode */
631 band = NET80211_BAND_5GHZ;
634
635 for (i = 0; i < 8; i++)
636 sc->hwinfo->rates[band][i] = ath5k_rates[i+4].bitrate;
637 sc->hwinfo->nr_rates[band] = 8;
638
639 sc->hwinfo->nr_channels =
641 AR5K_MODE_11B, max_c);
642 count_c = sc->hwinfo->nr_channels;
643 max_c -= count_c;
644 }
645
646 return 0;
647}
static unsigned int ath5k_copy_channels(struct ath5k_hw *ah, struct net80211_channel *channels, unsigned int mode, unsigned int max)
Definition ath5k.c:525
@ AR5K_MODE_BIT_11G
Definition ath5k.h:406
#define NET80211_BAND_BIT_2GHZ
Bitmask for the 2GHz band.
Definition net80211.h:52
#define NET80211_BAND_BIT_5GHZ
Bitmask for the 5GHz band.
Definition net80211.h:54
#define NET80211_MODE_A
802.11a: 54 Mbps operation using OFDM signaling on the 5GHz band
Definition net80211.h:63
#define NET80211_MODE_G
802.11g: 54 Mbps operation using ERP/OFDM signaling on the 2.4GHz band
Definition net80211.h:69
#define NET80211_MODE_B
802.11b: 1-11 Mbps operation using DSSS/CCK signaling on the 2.4GHz band
Definition net80211.h:66
int modes
A bitwise OR of the 802.11x modes supported by this device.
Definition net80211.h:450
int nr_rates[NET80211_NR_BANDS]
Number of supported rates, indexed by band.
Definition net80211.h:511
int bands
A bitwise OR of the bands on which this device can communicate.
Definition net80211.h:453
struct net80211_channel channels[NET80211_MAX_CHANNELS]
List of RF channels supported by the card.
Definition net80211.h:498
int nr_channels
Number of supported channels.
Definition net80211.h:501
u16 rates[NET80211_NR_BANDS][NET80211_MAX_RATES]
List of transmission rates supported by the card, indexed by band.
Definition net80211.h:508

References ah, ath5k_softc::ah, ath5k_hw::ah_capabilities, AR5K_MODE_11B, AR5K_MODE_11G, AR5K_MODE_BIT_11A, AR5K_MODE_BIT_11B, AR5K_MODE_BIT_11G, ath5k_copy_channels(), ath5k_rates, net80211_hw_info::bands, ath5k_capabilities::cap_mode, net80211_hw_info::channels, ath5k_softc::dev, ath5k_softc::hwinfo, net80211_hw_info::modes, NET80211_BAND_2GHZ, NET80211_BAND_5GHZ, NET80211_BAND_BIT_2GHZ, NET80211_BAND_BIT_5GHZ, NET80211_MODE_A, NET80211_MODE_B, NET80211_MODE_G, net80211_hw_info::nr_channels, net80211_hw_info::nr_rates, net80211_device::priv, and net80211_hw_info::rates.

Referenced by ath5k_attach().

◆ ath5k_chan_set()

int ath5k_chan_set ( struct ath5k_softc * sc,
struct net80211_channel * chan )
static

Definition at line 656 of file ath5k.c.

657{
658 if (chan->center_freq != sc->curchan->center_freq ||
659 chan->hw_value != sc->curchan->hw_value) {
660 /*
661 * To switch channels clear any pending DMA operations;
662 * wait long enough for the RX fifo to drain, reset the
663 * hardware at the new frequency, and then re-enable
664 * the relevant bits of the h/w.
665 */
666 DBG2("ath5k: resetting for channel change (%d -> %d MHz)\n",
667 sc->curchan->center_freq, chan->center_freq);
668 return ath5k_reset(sc, chan);
669 }
670
671 return 0;
672}
#define DBG2(...)
Definition compiler.h:515
u16 hw_value
Hardware channel value.
Definition net80211.h:414
u16 center_freq
The center frequency for this channel.
Definition net80211.h:411

References ath5k_reset(), net80211_channel::center_freq, ath5k_softc::curchan, DBG2, and net80211_channel::hw_value.

Referenced by ath5k_config().

◆ ath5k_setcurmode()

void ath5k_setcurmode ( struct ath5k_softc * sc,
unsigned int mode )
static

Definition at line 675 of file ath5k.c.

676{
677 sc->curmode = mode;
678
679 if (mode == AR5K_MODE_11A) {
681 } else {
683 }
684}
unsigned int curmode
Definition base.h:112

References AR5K_MODE_11A, ath5k_softc::curband, ath5k_softc::curmode, mode, NET80211_BAND_2GHZ, and NET80211_BAND_5GHZ.

Referenced by ath5k_attach().

◆ ath5k_mode_setup()

void ath5k_mode_setup ( struct ath5k_softc * sc)
static

Definition at line 687 of file ath5k.c.

688{
689 struct ath5k_hw *ah = sc->ah;
690 u32 rfilt;
691
692 /* configure rx filter */
693 rfilt = sc->filter_flags;
695
698
699 /* configure operational mode */
701
703}
void ath5k_hw_set_mcast_filter(struct ath5k_hw *ah, u32 filter0, u32 filter1)
Definition ath5k_pcu.c:407
int ath5k_hw_set_opmode(struct ath5k_hw *ah)
ath5k_hw_set_opmode - Set PCU operating mode
Definition ath5k_pcu.c:49
void ath5k_hw_set_rx_filter(struct ath5k_hw *ah, u32 filter)
ath5k_hw_set_rx_filter - Set rx filter
Definition ath5k_pcu.c:454
#define ath5k_hw_hasbssidmask(_ah)
Definition base.h:141
unsigned int filter_flags
Definition base.h:111
#define u32
Definition vga.h:21

References ah, ath5k_softc::ah, ath5k_hw_hasbssidmask, ath5k_hw_set_bssid_mask(), ath5k_hw_set_mcast_filter(), ath5k_hw_set_opmode(), ath5k_hw_set_rx_filter(), ath5k_softc::bssidmask, ath5k_softc::filter_flags, and u32.

Referenced by ath5k_rx_start().

◆ ath5k_desc_alloc()

int ath5k_desc_alloc ( struct ath5k_softc * sc)
static

Definition at line 871 of file ath5k.c.

872{
873 struct ath5k_desc *ds;
874 struct ath5k_buf *bf;
875 u32 da;
876 unsigned int i;
877 int ret;
878
879 /* allocate descriptors */
880 sc->desc_len = sizeof(struct ath5k_desc) * (ATH_TXBUF + ATH_RXBUF + 1);
882 if (sc->desc == NULL) {
883 DBG("ath5k: can't allocate descriptors\n");
884 ret = -ENOMEM;
885 goto err;
886 }
887 memset(sc->desc, 0, sc->desc_len);
888 sc->desc_daddr = virt_to_bus(sc->desc);
889
890 ds = sc->desc;
891 da = sc->desc_daddr;
892
893 bf = calloc(ATH_TXBUF + ATH_RXBUF + 1, sizeof(struct ath5k_buf));
894 if (bf == NULL) {
895 DBG("ath5k: can't allocate buffer pointers\n");
896 ret = -ENOMEM;
897 goto err_free;
898 }
899 sc->bufptr = bf;
900
901 INIT_LIST_HEAD(&sc->rxbuf);
902 for (i = 0; i < ATH_RXBUF; i++, bf++, ds++, da += sizeof(*ds)) {
903 bf->desc = ds;
904 bf->daddr = da;
905 list_add_tail(&bf->list, &sc->rxbuf);
906 }
907
908 INIT_LIST_HEAD(&sc->txbuf);
909 sc->txbuf_len = ATH_TXBUF;
910 for (i = 0; i < ATH_TXBUF; i++, bf++, ds++, da += sizeof(*ds)) {
911 bf->desc = ds;
912 bf->daddr = da;
913 list_add_tail(&bf->list, &sc->txbuf);
914 }
915
916 return 0;
917
918err_free:
919 free_phys(sc->desc, sc->desc_len);
920err:
921 sc->desc = NULL;
922 return ret;
923}
#define ATH5K_DESC_ALIGN
Definition ath5k.c:61
#define ATH_TXBUF
Definition base.h:54
#define ATH_RXBUF
Definition base.h:53
static __always_inline unsigned long virt_to_bus(volatile const void *addr)
Convert virtual address to a bus address.
Definition io.h:184
uint32_t ds
Definition librm.h:5
#define INIT_LIST_HEAD(list)
Initialise a list head.
Definition list.h:46
void * malloc_phys(size_t size, size_t phys_align)
Allocate memory with specified physical alignment.
Definition malloc.c:707
void free_phys(void *ptr, size_t size)
Free memory allocated with malloc_phys()
Definition malloc.c:723
static void *__malloc calloc(size_t nmemb, size_t size)
Allocate cleared memory.
Definition stdlib.h:46
struct ath5k_buf * bufptr
Definition base.h:98
u32 desc_daddr
Definition base.h:100
struct list_head rxbuf
Definition base.h:120
struct ath5k_desc * desc
Definition base.h:99
size_t desc_len
Definition base.h:101

References ATH5K_DESC_ALIGN, ATH_RXBUF, ATH_TXBUF, ath5k_softc::bufptr, calloc(), ath5k_buf::daddr, DBG, ath5k_buf::desc, ath5k_softc::desc, ath5k_softc::desc_daddr, ath5k_softc::desc_len, ds, ENOMEM, free_phys(), INIT_LIST_HEAD, ath5k_buf::list, list_add_tail, malloc_phys(), memset(), NULL, ath5k_softc::rxbuf, ath5k_softc::txbuf, ath5k_softc::txbuf_len, u32, and virt_to_bus().

Referenced by ath5k_attach().

◆ ath5k_desc_free()

void ath5k_desc_free ( struct ath5k_softc * sc)
static

Definition at line 926 of file ath5k.c.

927{
928 struct ath5k_buf *bf;
929
931 ath5k_txbuf_free(sc, bf);
933 ath5k_rxbuf_free(sc, bf);
934
935 /* Free memory associated with all descriptors */
936 free_phys(sc->desc, sc->desc_len);
937
938 free(sc->bufptr);
939 sc->bufptr = NULL;
940}
static void ath5k_txbuf_free(struct ath5k_softc *sc, struct ath5k_buf *bf)
Definition ath5k.c:179
static void ath5k_rxbuf_free(struct ath5k_softc *sc __unused, struct ath5k_buf *bf)
Definition ath5k.c:189
#define list_for_each_entry(pos, head, member)
Iterate over entries in a list.
Definition list.h:432

References ath5k_rxbuf_free(), ath5k_txbuf_free(), ath5k_softc::bufptr, ath5k_softc::desc, ath5k_softc::desc_len, free, free_phys(), ath5k_buf::list, list_for_each_entry, NULL, ath5k_softc::rxbuf, and ath5k_softc::txbuf.

Referenced by ath5k_attach(), and ath5k_detach().

◆ ath5k_rxbuf_setup()

int ath5k_rxbuf_setup ( struct ath5k_softc * sc,
struct ath5k_buf * bf )
static

Definition at line 771 of file ath5k.c.

772{
773 struct ath5k_hw *ah = sc->ah;
774 struct io_buffer *iob = bf->iob;
775 struct ath5k_desc *ds;
776
777 if (!iob) {
778 iob = ath5k_rx_iob_alloc(sc, &bf->iobaddr);
779 if (!iob)
780 return -ENOMEM;
781 bf->iob = iob;
782 }
783
784 /*
785 * Setup descriptors. For receive we always terminate
786 * the descriptor list with a self-linked entry so we'll
787 * not get overrun under high load (as can happen with a
788 * 5212 when ANI processing enables PHY error frames).
789 *
790 * To insure the last descriptor is self-linked we create
791 * each descriptor as self-linked and add it to the end. As
792 * each additional descriptor is added the previous self-linked
793 * entry is ``fixed'' naturally. This should be safe even
794 * if DMA is happening. When processing RX interrupts we
795 * never remove/process the last, self-linked, entry on the
796 * descriptor list. This insures the hardware always has
797 * someplace to write a new frame.
798 */
799 ds = bf->desc;
800 ds->ds_link = bf->daddr; /* link to self */
801 ds->ds_data = bf->iobaddr;
802 if (ah->ah_setup_rx_desc(ah, ds,
803 iob_tailroom(iob), /* buffer size */
804 0) != 0) {
805 DBG("ath5k: error setting up RX descriptor for %zd bytes\n", iob_tailroom(iob));
806 return -EINVAL;
807 }
808
809 if (sc->rxlink != NULL)
810 *sc->rxlink = bf->daddr;
811 sc->rxlink = &ds->ds_link;
812 return 0;
813}
static struct io_buffer * ath5k_rx_iob_alloc(struct ath5k_softc *sc, u32 *iob_addr)
Definition ath5k.c:737
#define EINVAL
Invalid argument.
Definition errno.h:429
static size_t iob_tailroom(struct io_buffer *iobuf)
Calculate available space at end of an I/O buffer.
Definition iobuf.h:180
u32 daddr
Definition base.h:60
u32 iobaddr
Definition base.h:62
struct ath5k_desc * desc
Definition base.h:59
A persistent I/O buffer.
Definition iobuf.h:38

References ah, ath5k_softc::ah, ath5k_rx_iob_alloc(), ath5k_buf::daddr, DBG, ath5k_buf::desc, ds, EINVAL, ENOMEM, ath5k_buf::iob, iob_tailroom(), ath5k_buf::iobaddr, NULL, and ath5k_softc::rxlink.

Referenced by ath5k_handle_rx(), and ath5k_rx_start().

◆ ath5k_txbuf_setup()

int ath5k_txbuf_setup ( struct ath5k_softc * sc,
struct ath5k_buf * bf )
static

Definition at line 816 of file ath5k.c.

817{
818 struct ath5k_hw *ah = sc->ah;
819 struct ath5k_txq *txq = &sc->txq;
820 struct ath5k_desc *ds = bf->desc;
821 struct io_buffer *iob = bf->iob;
822 unsigned int pktlen, flags;
823 int ret;
824 u16 duration = 0;
825 u16 cts_rate = 0;
826
828 bf->iobaddr = virt_to_bus(iob->data);
829 pktlen = iob_len(iob);
830
831 /* FIXME: If we are in g mode and rate is a CCK rate
832 * subtract ah->ah_txpower.txp_cck_ofdm_pwr_delta
833 * from tx power (value is in dB units already) */
835 struct net80211_device *dev = sc->dev;
836
838 cts_rate = sc->hw_rtscts_rate;
839 duration = net80211_cts_duration(dev, pktlen);
840 }
841 ret = ah->ah_setup_tx_desc(ah, ds, pktlen,
846 cts_rate, duration);
847 if (ret)
848 return ret;
849
850 ds->ds_link = 0;
851 ds->ds_data = bf->iobaddr;
852
853 list_add_tail(&bf->list, &txq->q);
854 if (txq->link == NULL) /* is this first packet? */
855 ath5k_hw_set_txdp(ah, txq->qnum, bf->daddr);
856 else /* no, so only link it */
857 *txq->link = bf->daddr;
858
859 txq->link = &ds->ds_link;
861 mb();
862
863 return 0;
864}
#define ATH5K_RETRIES
Definition ath5k.c:60
#define AR5K_TXKEYIX_INVALID
Definition ath5k.h:587
@ AR5K_PKT_TYPE_NORMAL
Definition ath5k.h:527
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
Definition ath5k_dma.c:128
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
Definition ath5k_dma.c:293
#define AR5K_TXDESC_CLRDMASK
Definition desc.h:328
#define AR5K_TXDESC_INTREQ
Definition desc.h:332
#define AR5K_TXDESC_CTSENA
Definition desc.h:331
uint8_t flags
Flags.
Definition ena.h:7
#define IEEE80211_TYP_FRAME_HEADER_LEN
Frame header length for frames we might work with.
Definition ieee80211.h:60
#define NET80211_PHY_USE_PROTECTION
Whether to use RTS/CTS or CTS-to-self protection for transmissions.
Definition net80211.h:251
u16 duration
Microseconds to reserve link.
Definition ieee80211.h:1
void mb(void)
Memory barrier.
static size_t iob_len(struct io_buffer *iobuf)
Calculate length of data in an I/O buffer.
Definition iobuf.h:160
static u16 net80211_cts_duration(struct net80211_device *dev, int size)
Calculate duration field for a CTS control frame.
Definition net80211.h:1179
struct ath5k_txq txq
Definition base.h:125
unsigned int qnum
Definition base.h:75
u32 * link
Definition base.h:76
struct list_head q
Definition base.h:77
void * data
Start of data.
Definition iobuf.h:53

References ah, ath5k_softc::ah, AR5K_PKT_TYPE_NORMAL, AR5K_TXDESC_CLRDMASK, AR5K_TXDESC_CTSENA, AR5K_TXDESC_INTREQ, AR5K_TXKEYIX_INVALID, ath5k_hw_set_txdp(), ath5k_hw_start_tx_dma(), ATH5K_RETRIES, ath5k_buf::daddr, io_buffer::data, ath5k_buf::desc, ath5k_softc::dev, ds, duration, flags, ath5k_softc::hw_rate, ath5k_softc::hw_rtscts_rate, IEEE80211_TYP_FRAME_HEADER_LEN, ath5k_buf::iob, iob_len(), ath5k_buf::iobaddr, ath5k_txq::link, ath5k_buf::list, list_add_tail, mb(), net80211_cts_duration(), NET80211_PHY_USE_PROTECTION, NULL, net80211_device::phy_flags, ath5k_softc::power_level, ath5k_txq::q, ath5k_txq::qnum, ath5k_softc::txq, u16, and virt_to_bus().

Referenced by ath5k_tx().

◆ ath5k_txbuf_free()

void ath5k_txbuf_free ( struct ath5k_softc * sc,
struct ath5k_buf * bf )
inlinestatic

Definition at line 179 of file ath5k.c.

181{
182 if (!bf->iob)
183 return;
184
186 bf->iob = NULL;
187}
void net80211_tx_complete(struct net80211_device *dev, struct io_buffer *iob, int retries, int rc)
Indicate the completed transmission of a packet.
Definition net80211.c:2809
#define ECANCELED
Operation canceled.
Definition errno.h:344

References ath5k_softc::dev, ECANCELED, ath5k_buf::iob, net80211_tx_complete(), and NULL.

Referenced by ath5k_desc_free(), and ath5k_txq_drainq().

◆ ath5k_rxbuf_free()

void ath5k_rxbuf_free ( struct ath5k_softc *sc __unused,
struct ath5k_buf * bf )
inlinestatic

Definition at line 189 of file ath5k.c.

191{
192 free_iob(bf->iob);
193 bf->iob = NULL;
194}
void free_iob(struct io_buffer *iobuf)
Free I/O buffer.
Definition iobuf.c:153

References __unused, free_iob(), ath5k_buf::iob, and NULL.

Referenced by ath5k_desc_free().

◆ ath5k_txq_setup()

int ath5k_txq_setup ( struct ath5k_softc * sc,
int qtype,
int subtype )
static

Definition at line 951 of file ath5k.c.

952{
953 struct ath5k_hw *ah = sc->ah;
954 struct ath5k_txq *txq;
955 struct ath5k_txq_info qi = {
956 .tqi_subtype = subtype,
957 .tqi_aifs = AR5K_TXQ_USEDEFAULT,
958 .tqi_cw_min = AR5K_TXQ_USEDEFAULT,
959 .tqi_cw_max = AR5K_TXQ_USEDEFAULT
960 };
961 int qnum;
962
963 /*
964 * Enable interrupts only for EOL and DESC conditions.
965 * We mark tx descriptors to receive a DESC interrupt
966 * when a tx queue gets deep; otherwise waiting for the
967 * EOL to reap descriptors. Note that this is done to
968 * reduce interrupt load and this only defers reaping
969 * descriptors, never transmitting frames. Aside from
970 * reducing interrupts this also permits more concurrency.
971 * The only potential downside is if the tx queue backs
972 * up in which case the top half of the kernel may backup
973 * due to a lack of tx descriptors.
974 */
977 qnum = ath5k_hw_setup_tx_queue(ah, qtype, &qi);
978 if (qnum < 0) {
979 DBG("ath5k: can't set up a TX queue\n");
980 return -EIO;
981 }
982
983 txq = &sc->txq;
984 if (!txq->setup) {
985 txq->qnum = qnum;
986 txq->link = NULL;
987 INIT_LIST_HEAD(&txq->q);
988 txq->setup = 1;
989 }
990 return 0;
991}
#define AR5K_TXQ_FLAG_TXDESCINT_ENABLE
Definition ath5k.h:493
#define AR5K_TXQ_FLAG_TXEOLINT_ENABLE
Definition ath5k.h:492
int ath5k_hw_setup_tx_queue(struct ath5k_hw *ah, enum ath5k_tx_queue queue_type, struct ath5k_txq_info *queue_info)
Definition ath5k_qcu.c:56
#define AR5K_TXQ_USEDEFAULT
Definition ath5k.h:250
uint8_t subtype
Slow protocols subtype.
Definition eth_slow.h:1
u16 tqi_flags
Definition ath5k.h:511
int setup
Definition base.h:78

References ah, ath5k_softc::ah, AR5K_TXQ_FLAG_TXDESCINT_ENABLE, AR5K_TXQ_FLAG_TXEOLINT_ENABLE, AR5K_TXQ_USEDEFAULT, ath5k_hw_setup_tx_queue(), DBG, EIO, INIT_LIST_HEAD, ath5k_txq::link, NULL, ath5k_txq::q, ath5k_txq::qnum, ath5k_txq::setup, subtype, ath5k_txq_info::tqi_flags, and ath5k_softc::txq.

Referenced by ath5k_attach().

◆ ath5k_txq_drainq()

void ath5k_txq_drainq ( struct ath5k_softc * sc,
struct ath5k_txq * txq )
static

Definition at line 994 of file ath5k.c.

995{
996 struct ath5k_buf *bf, *bf0;
997
998 list_for_each_entry_safe(bf, bf0, &txq->q, list) {
999 ath5k_txbuf_free(sc, bf);
1000
1001 list_del(&bf->list);
1002 list_add_tail(&bf->list, &sc->txbuf);
1003 sc->txbuf_len++;
1004 }
1005 txq->link = NULL;
1006}
#define list_for_each_entry_safe(pos, tmp, head, member)
Iterate over entries in a list, safe against deletion of the current entry.
Definition list.h:459

References ath5k_txbuf_free(), ath5k_txq::link, ath5k_buf::list, list_add_tail, list_del, list_for_each_entry_safe, NULL, ath5k_txq::q, ath5k_softc::txbuf, and ath5k_softc::txbuf_len.

Referenced by ath5k_txq_cleanup().

◆ ath5k_txq_cleanup()

void ath5k_txq_cleanup ( struct ath5k_softc * sc)
static

Definition at line 1012 of file ath5k.c.

1013{
1014 struct ath5k_hw *ah = sc->ah;
1015
1016 if (!(sc->status & ATH_STAT_INVALID)) {
1017 /* don't touch the hardware if marked invalid */
1018 if (sc->txq.setup) {
1020 DBG("ath5k: txq [%d] %x, link %p\n",
1021 sc->txq.qnum,
1023 sc->txq.link);
1024 }
1025 }
1026
1027 if (sc->txq.setup)
1028 ath5k_txq_drainq(sc, &sc->txq);
1029}
static void ath5k_txq_drainq(struct ath5k_softc *sc, struct ath5k_txq *txq)
Definition ath5k.c:994
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
Definition ath5k_dma.c:262
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
Definition ath5k_dma.c:168

References ah, ath5k_softc::ah, ath5k_hw_get_txdp(), ath5k_hw_stop_tx_dma(), ath5k_txq_drainq(), ATH_STAT_INVALID, DBG, ath5k_txq::link, ath5k_txq::qnum, ath5k_txq::setup, ath5k_softc::status, and ath5k_softc::txq.

Referenced by ath5k_reset(), and ath5k_stop_hw().

◆ ath5k_txq_release()

void ath5k_txq_release ( struct ath5k_softc * sc)
static

Definition at line 1032 of file ath5k.c.

1033{
1034 if (sc->txq.setup) {
1036 sc->txq.setup = 0;
1037 }
1038}
void ath5k_hw_release_tx_queue(struct ath5k_hw *ah)
Definition ath5k_qcu.c:87

References ath5k_softc::ah, ath5k_hw_release_tx_queue(), ath5k_txq::setup, and ath5k_softc::txq.

Referenced by ath5k_attach(), and ath5k_detach().

◆ ath5k_rx_start()

int ath5k_rx_start ( struct ath5k_softc * sc)
static

Definition at line 1051 of file ath5k.c.

1052{
1053 struct ath5k_hw *ah = sc->ah;
1054 struct ath5k_buf *bf;
1055 int ret;
1056
1058 if (sc->rxbufsize % sc->cachelsz != 0)
1059 sc->rxbufsize += sc->cachelsz - (sc->rxbufsize % sc->cachelsz);
1060
1061 sc->rxlink = NULL;
1062
1063 list_for_each_entry(bf, &sc->rxbuf, list) {
1064 ret = ath5k_rxbuf_setup(sc, bf);
1065 if (ret != 0)
1066 return ret;
1067 }
1068
1069 bf = list_entry(sc->rxbuf.next, struct ath5k_buf, list);
1070
1072 ath5k_hw_start_rx_dma(ah); /* enable recv descriptors */
1073 ath5k_mode_setup(sc); /* set filters, etc. */
1074 ath5k_hw_start_rx_pcu(ah); /* re-enable PCU/DMA engine */
1075
1076 return 0;
1077}
static void ath5k_mode_setup(struct ath5k_softc *sc)
Definition ath5k.c:687
static int ath5k_rxbuf_setup(struct ath5k_softc *sc, struct ath5k_buf *bf)
Definition ath5k.c:771
#define IEEE80211_MAX_LEN
Definition ath5k.h:160
void ath5k_hw_start_rx_dma(struct ath5k_hw *ah)
ath5k_hw_start_rx_dma - Start DMA receive
Definition ath5k_dma.c:55
void ath5k_hw_start_rx_pcu(struct ath5k_hw *ah)
ath5k_hw_start_rx_pcu - Start RX engine
Definition ath5k_pcu.c:385
void ath5k_hw_set_rxdp(struct ath5k_hw *ah, u32 phys_addr)
ath5k_hw_set_rxdp - Set RX Descriptor's address
Definition ath5k_dma.c:103
unsigned int rxbufsize
Definition base.h:119

References ah, ath5k_softc::ah, ath5k_hw_set_rxdp(), ath5k_hw_start_rx_dma(), ath5k_hw_start_rx_pcu(), ath5k_mode_setup(), ath5k_rxbuf_setup(), ath5k_softc::cachelsz, ath5k_buf::daddr, IEEE80211_MAX_LEN, ath5k_buf::list, list_entry, list_for_each_entry, list_head::next, NULL, ath5k_softc::rxbuf, ath5k_softc::rxbufsize, and ath5k_softc::rxlink.

Referenced by ath5k_reset().

◆ ath5k_rx_stop()

void ath5k_rx_stop ( struct ath5k_softc * sc)
static

Definition at line 1083 of file ath5k.c.

1084{
1085 struct ath5k_hw *ah = sc->ah;
1086
1087 ath5k_hw_stop_rx_pcu(ah); /* disable PCU */
1088 ath5k_hw_set_rx_filter(ah, 0); /* clear recv filter */
1089 ath5k_hw_stop_rx_dma(ah); /* disable DMA engine */
1090
1091 sc->rxlink = NULL; /* just in case */
1092}
int ath5k_hw_stop_rx_dma(struct ath5k_hw *ah)
ath5k_hw_stop_rx_dma - Stop DMA receive
Definition ath5k_dma.c:66
void ath5k_hw_stop_rx_pcu(struct ath5k_hw *ah)
at5k_hw_stop_rx_pcu - Stop RX engine
Definition ath5k_pcu.c:399

References ah, ath5k_softc::ah, ath5k_hw_set_rx_filter(), ath5k_hw_stop_rx_dma(), ath5k_hw_stop_rx_pcu(), NULL, and ath5k_softc::rxlink.

Referenced by ath5k_reset(), and ath5k_stop_hw().

◆ ath5k_tx_processq()

void ath5k_tx_processq ( struct ath5k_softc * sc,
struct ath5k_txq * txq )
static

Definition at line 1228 of file ath5k.c.

1229{
1230 struct ath5k_tx_status ts;
1231 struct ath5k_buf *bf, *bf0;
1232 struct ath5k_desc *ds;
1233 struct io_buffer *iob;
1234 int ret;
1235
1236 memset(&ts, 0, sizeof(ts));
1237
1238 list_for_each_entry_safe(bf, bf0, &txq->q, list) {
1239 ds = bf->desc;
1240
1241 ret = sc->ah->ah_proc_tx_desc(sc->ah, ds, &ts);
1242 if (ret) {
1243 if (ret != -EINPROGRESS) {
1244 DBG("ath5k: error in processing tx desc: %s\n",
1245 strerror(ret));
1246 } else {
1247 /* normal return, reached end of tx completions */
1248 }
1249 break;
1250 }
1251
1252 iob = bf->iob;
1253 bf->iob = NULL;
1254
1255 DBG2("ath5k: tx %zd bytes complete, %d retries\n",
1256 iob_len(iob), ts.ts_retry[0]);
1257
1258 net80211_tx_complete(sc->dev, iob, ts.ts_retry[0],
1259 ts.ts_status ? EIO : 0);
1260
1261 list_del(&bf->list);
1262 list_add_tail(&bf->list, &sc->txbuf);
1263 sc->txbuf_len++;
1264 }
1265
1266 if (list_empty(&txq->q))
1267 txq->link = NULL;
1268}
#define EINPROGRESS
Operation in progress.
Definition errno.h:419
int(* ah_proc_tx_desc)(struct ath5k_hw *, struct ath5k_desc *, struct ath5k_tx_status *)
Definition ath5k.h:1062
struct list_head list
List of which this buffer is a member.
Definition iobuf.h:45

References ath5k_softc::ah, ath5k_hw::ah_proc_tx_desc, DBG, DBG2, ath5k_buf::desc, ath5k_softc::dev, ds, EINPROGRESS, EIO, ath5k_buf::iob, iob_len(), ath5k_txq::link, ath5k_buf::list, io_buffer::list, list_add_tail, list_del, list_empty, list_for_each_entry_safe, memset(), net80211_tx_complete(), NULL, ath5k_txq::q, strerror(), ath5k_tx_status::ts_retry, ath5k_tx_status::ts_status, ath5k_softc::txbuf, and ath5k_softc::txbuf_len.

Referenced by ath5k_handle_tx().

◆ ath5k_init()

int ath5k_init ( struct ath5k_softc * sc)
static

Definition at line 1295 of file ath5k.c.

1296{
1297 struct ath5k_hw *ah = sc->ah;
1298 int ret, i;
1299
1300 /*
1301 * Stop anything previously setup. This is safe
1302 * no matter this is the first time through or not.
1303 */
1304 ath5k_stop_hw(sc);
1305
1306 /*
1307 * The basic interface to setting the hardware in a good
1308 * state is ``reset''. On return the hardware is known to
1309 * be powered up and with interrupts disabled. This must
1310 * be followed by initialization of the appropriate bits
1311 * and then setup of the interrupt mask.
1312 */
1313 sc->curchan = sc->dev->channels + sc->dev->channel;
1314 sc->curband = sc->curchan->band;
1318 ret = ath5k_reset(sc, NULL);
1319 if (ret)
1320 goto done;
1321
1323
1324 /*
1325 * Reset the key cache since some parts do not reset the
1326 * contents on initial power up or resume from suspend.
1327 */
1328 for (i = 0; i < AR5K_KEYTABLE_SIZE; i++)
1330
1331 /* Set ack to be sent at low bit-rates */
1333
1334 ret = 0;
1335done:
1336 mb();
1337 return ret;
1338}
#define AR5K_KEYTABLE_SIZE
Definition reg.h:1846
int ath5k_hw_reset_key(struct ath5k_hw *ah, u16 entry)
Definition ath5k_pcu.c:497
void ath5k_hw_set_ack_bitrate_high(struct ath5k_hw *ah, int high)
ath5k_hw_set_ack_bitrate - set bitrate for ACKs
Definition ath5k_pcu.c:96
@ AR5K_INT_GLOBAL
Definition ath5k.h:838
void ath5k_rfkill_hw_start(struct ath5k_hw *ah)
struct bofm_section_header done
Definition bofm_test.c:46

References ah, ath5k_softc::ah, AR5K_INT_FATAL, AR5K_INT_GLOBAL, AR5K_INT_RXEOL, AR5K_INT_RXERR, AR5K_INT_RXOK, AR5K_INT_RXORN, AR5K_INT_TXDESC, AR5K_INT_TXEOL, AR5K_KEYTABLE_SIZE, ath5k_hw_reset_key(), ath5k_hw_set_ack_bitrate_high(), ath5k_reset(), ath5k_rfkill_hw_start(), ath5k_stop_hw(), net80211_channel::band, net80211_device::channel, net80211_device::channels, ath5k_softc::curband, ath5k_softc::curchan, ath5k_softc::dev, done, ath5k_softc::imask, mb(), and NULL.

Referenced by ath5k_start().

◆ ath5k_stop_hw()

int ath5k_stop_hw ( struct ath5k_softc * sc)
static

Definition at line 1341 of file ath5k.c.

1342{
1343 struct ath5k_hw *ah = sc->ah;
1344
1345 /*
1346 * Shutdown the hardware and driver:
1347 * stop output from above
1348 * disable interrupts
1349 * turn off timers
1350 * turn off the radio
1351 * clear transmit machinery
1352 * clear receive machinery
1353 * drain and release tx queues
1354 * reclaim beacon resources
1355 * power down hardware
1356 *
1357 * Note that some of this work is not possible if the
1358 * hardware is gone (invalid).
1359 */
1360
1361 if (!(sc->status & ATH_STAT_INVALID)) {
1362 ath5k_hw_set_imr(ah, 0);
1363 }
1365 if (!(sc->status & ATH_STAT_INVALID)) {
1366 ath5k_rx_stop(sc);
1368 } else
1369 sc->rxlink = NULL;
1370
1372
1373 return 0;
1374}
void ath5k_rfkill_hw_stop(struct ath5k_hw *ah)
int ath5k_hw_phy_disable(struct ath5k_hw *ah)
Definition ath5k_phy.c:1359

References ah, ath5k_softc::ah, ath5k_hw_phy_disable(), ath5k_hw_set_imr(), ath5k_rfkill_hw_stop(), ath5k_rx_stop(), ath5k_txq_cleanup(), ATH_STAT_INVALID, NULL, ath5k_softc::rxlink, and ath5k_softc::status.

Referenced by ath5k_init(), and ath5k_stop().

◆ ath5k_calibrate()

void ath5k_calibrate ( struct ath5k_softc * sc)
static

Definition at line 1439 of file ath5k.c.

1440{
1441 struct ath5k_hw *ah = sc->ah;
1442
1444 /*
1445 * Rfgain is out of bounds, reset the chip
1446 * to load new gain values.
1447 */
1448 DBG("ath5k: resetting for calibration\n");
1449 ath5k_reset_wake(sc);
1450 }
1452 DBG("ath5k: calibration of channel %d failed\n",
1453 sc->curchan->channel_nr);
1454}
@ AR5K_RFGAIN_NEED_CHANGE
Definition ath5k.h:608
int ath5k_hw_phy_calibrate(struct ath5k_hw *ah, struct net80211_channel *channel)
Definition ath5k_phy.c:1346
enum ath5k_rfgain ath5k_hw_gainf_calibrate(struct ath5k_hw *ah)
Definition ath5k_phy.c:390
u8 channel_nr
A channel number interpreted according to the band.
Definition net80211.h:405

References ah, ath5k_softc::ah, AR5K_RFGAIN_NEED_CHANGE, ath5k_hw_gainf_calibrate(), ath5k_hw_phy_calibrate(), ath5k_reset_wake(), net80211_channel::channel_nr, ath5k_softc::curchan, and DBG.

Referenced by ath5k_poll().

◆ ath5k_configure_filter()

void ath5k_configure_filter ( struct ath5k_softc * sc)
static

Definition at line 1637 of file ath5k.c.

1638{
1639 struct ath5k_hw *ah = sc->ah;
1640 u32 mfilt[2], rfilt;
1641
1642 /* Enable all multicast */
1643 mfilt[0] = ~0;
1644 mfilt[1] = ~0;
1645
1646 /* Enable data frames and beacons */
1649
1650 /* Set filters */
1651 ath5k_hw_set_rx_filter(ah, rfilt);
1652
1653 /* Set multicast bits */
1654 ath5k_hw_set_mcast_filter(ah, mfilt[0], mfilt[1]);
1655
1656 /* Set the cached hw filter flags, this will alter actually
1657 * be set in HW */
1658 sc->filter_flags = rfilt;
1659}
#define AR5K_RX_FILTER_BEACON
Definition reg.h:1326
#define AR5K_RX_FILTER_BCAST
Definition reg.h:1324
#define AR5K_RX_FILTER_MCAST
Definition reg.h:1323
#define AR5K_RX_FILTER_UCAST
Definition reg.h:1322

References ah, ath5k_softc::ah, AR5K_RX_FILTER_BCAST, AR5K_RX_FILTER_BEACON, AR5K_RX_FILTER_MCAST, AR5K_RX_FILTER_UCAST, ath5k_hw_set_mcast_filter(), ath5k_hw_set_rx_filter(), ath5k_softc::filter_flags, and u32.

Referenced by ath5k_start().

◆ ath5k_ieee2mhz()

short ath5k_ieee2mhz ( short chan)
inlinestatic

Definition at line 513 of file ath5k.c.

514{
515 if (chan < 14)
516 return 2407 + 5 * chan;
517 if (chan == 14)
518 return 2484;
519 if (chan < 27)
520 return 2212 + 20 * chan;
521 return 5000 + 5 * chan;
522}

Referenced by ath5k_copy_channels().

◆ ath5k_hw_rix_to_bitrate()

int ath5k_hw_rix_to_bitrate ( int hw_rix)
inlinestatic

Definition at line 706 of file ath5k.c.

707{
708 int i;
709
710 for (i = 0; i < ATH5K_NR_RATES; i++) {
711 if (ath5k_rates[i].hw_code == hw_rix)
712 return ath5k_rates[i].bitrate;
713 }
714
715 DBG("ath5k: invalid rix %02x\n", hw_rix);
716 return 10; /* use lowest rate */
717}
u8 hw_code
Definition ath5k.c:96

References ATH5K_NR_RATES, ath5k_rates, DBG, and hw_code.

Referenced by ath5k_handle_rx().

◆ ath5k_bitrate_to_hw_rix()

int ath5k_bitrate_to_hw_rix ( int bitrate)

Definition at line 719 of file ath5k.c.

720{
721 int i;
722
723 for (i = 0; i < ATH5K_NR_RATES; i++) {
724 if (ath5k_rates[i].bitrate == bitrate)
725 return ath5k_rates[i].hw_code;
726 }
727
728 DBG("ath5k: invalid bitrate %d\n", bitrate);
729 return ATH5K_RATE_CODE_1M; /* use lowest rate */
730}
#define ATH5K_RATE_CODE_1M
Definition ath5k.h:708

References ATH5K_NR_RATES, ATH5K_RATE_CODE_1M, ath5k_rates, bitrate, and DBG.

Referenced by ath5k_hw_write_rate_duration().

◆ ath5k_rx_iob_alloc()

struct io_buffer * ath5k_rx_iob_alloc ( struct ath5k_softc * sc,
u32 * iob_addr )
static

Definition at line 737 of file ath5k.c.

738{
739 struct io_buffer *iob;
740 unsigned int off;
741
742 /*
743 * Allocate buffer with headroom_needed space for the
744 * fake physical layer header at the start.
745 */
746 iob = alloc_iob(sc->rxbufsize + sc->cachelsz - 1);
747
748 if (!iob) {
749 DBG("ath5k: can't alloc iobuf of size %d\n",
750 sc->rxbufsize + sc->cachelsz - 1);
751 return NULL;
752 }
753
754 *iob_addr = virt_to_bus(iob->data);
755
756 /*
757 * Cache-line-align. This is important (for the
758 * 5210 at least) as not doing so causes bogus data
759 * in rx'd frames.
760 */
761 off = *iob_addr % sc->cachelsz;
762 if (off != 0) {
763 iob_reserve(iob, sc->cachelsz - off);
764 *iob_addr += sc->cachelsz - off;
765 }
766
767 return iob;
768}
struct io_buffer * alloc_iob(size_t len)
Allocate I/O buffer.
Definition iobuf.c:131
#define iob_reserve(iobuf, len)
Definition iobuf.h:72

References alloc_iob(), ath5k_softc::cachelsz, io_buffer::data, DBG, iob_reserve, NULL, ath5k_softc::rxbufsize, u32, and virt_to_bus().

Referenced by ath5k_handle_rx(), and ath5k_rxbuf_setup().

◆ ath5k_handle_rx()

void ath5k_handle_rx ( struct ath5k_softc * sc)
static

Definition at line 1095 of file ath5k.c.

1096{
1097 struct ath5k_rx_status rs;
1098 struct io_buffer *iob, *next_iob;
1099 u32 next_iob_addr;
1100 struct ath5k_buf *bf, *bf_last;
1101 struct ath5k_desc *ds;
1102 int ret;
1103
1104 memset(&rs, 0, sizeof(rs));
1105
1106 if (list_empty(&sc->rxbuf)) {
1107 DBG("ath5k: empty rx buf pool\n");
1108 return;
1109 }
1110
1111 bf_last = list_entry(sc->rxbuf.prev, struct ath5k_buf, list);
1112
1113 do {
1114 bf = list_entry(sc->rxbuf.next, struct ath5k_buf, list);
1115 assert(bf->iob != NULL);
1116 iob = bf->iob;
1117 ds = bf->desc;
1118
1119 /*
1120 * last buffer must not be freed to ensure proper hardware
1121 * function. When the hardware finishes also a packet next to
1122 * it, we are sure, it doesn't use it anymore and we can go on.
1123 */
1124 if (bf_last == bf)
1125 bf->flags |= 1;
1126 if (bf->flags) {
1127 struct ath5k_buf *bf_next = list_entry(bf->list.next,
1128 struct ath5k_buf, list);
1129 ret = sc->ah->ah_proc_rx_desc(sc->ah, bf_next->desc,
1130 &rs);
1131 if (ret)
1132 break;
1133 bf->flags &= ~1;
1134 /* skip the overwritten one (even status is martian) */
1135 goto next;
1136 }
1137
1138 ret = sc->ah->ah_proc_rx_desc(sc->ah, ds, &rs);
1139 if (ret) {
1140 if (ret != -EINPROGRESS) {
1141 DBG("ath5k: error in processing rx desc: %s\n",
1142 strerror(ret));
1143 net80211_rx_err(sc->dev, NULL, -ret);
1144 } else {
1145 /* normal return, reached end of
1146 available descriptors */
1147 }
1148 return;
1149 }
1150
1151 if (rs.rs_more) {
1152 DBG("ath5k: unsupported fragmented rx\n");
1153 goto next;
1154 }
1155
1156 if (rs.rs_status) {
1157 if (rs.rs_status & AR5K_RXERR_PHY) {
1158 /* These are uncommon, and may indicate a real problem. */
1159 net80211_rx_err(sc->dev, NULL, EIO);
1160 goto next;
1161 }
1162 if (rs.rs_status & AR5K_RXERR_CRC) {
1163 /* These occur *all the time*. */
1164 goto next;
1165 }
1166 if (rs.rs_status & AR5K_RXERR_DECRYPT) {
1167 /*
1168 * Decrypt error. If the error occurred
1169 * because there was no hardware key, then
1170 * let the frame through so the upper layers
1171 * can process it. This is necessary for 5210
1172 * parts which have no way to setup a ``clear''
1173 * key cache entry.
1174 *
1175 * XXX do key cache faulting
1176 */
1177 if (rs.rs_keyix == AR5K_RXKEYIX_INVALID &&
1178 !(rs.rs_status & AR5K_RXERR_CRC))
1179 goto accept;
1180 }
1181
1182 /* any other error, unhandled */
1183 DBG("ath5k: packet rx status %x\n", rs.rs_status);
1184 goto next;
1185 }
1186accept:
1187 next_iob = ath5k_rx_iob_alloc(sc, &next_iob_addr);
1188
1189 /*
1190 * If we can't replace bf->iob with a new iob under memory
1191 * pressure, just skip this packet
1192 */
1193 if (!next_iob) {
1194 DBG("ath5k: dropping packet under memory pressure\n");
1195 goto next;
1196 }
1197
1198 iob_put(iob, rs.rs_datalen);
1199
1200 /* The MAC header is padded to have 32-bit boundary if the
1201 * packet payload is non-zero. However, iPXE only
1202 * supports standard 802.11 packets with 24-byte
1203 * header, so no padding correction should be needed.
1204 */
1205
1206 DBG2("ath5k: rx %d bytes, signal %d\n", rs.rs_datalen,
1207 rs.rs_rssi);
1208
1209 net80211_rx(sc->dev, iob, rs.rs_rssi,
1210 ath5k_hw_rix_to_bitrate(rs.rs_rate));
1211
1212 bf->iob = next_iob;
1213 bf->iobaddr = next_iob_addr;
1214next:
1215 list_del(&bf->list);
1216 list_add_tail(&bf->list, &sc->rxbuf);
1217 } while (ath5k_rxbuf_setup(sc, bf) == 0);
1218}
#define assert(condition)
Assert a condition at run-time.
Definition assert.h:50
static int ath5k_hw_rix_to_bitrate(int hw_rix)
Definition ath5k.c:706
#define AR5K_RXERR_CRC
Definition ath5k.h:581
#define AR5K_RXERR_PHY
Definition ath5k.h:582
#define AR5K_RXERR_DECRYPT
Definition ath5k.h:584
#define AR5K_RXKEYIX_INVALID
Definition ath5k.h:586
uint32_t next
Next descriptor address.
Definition dwmac.h:11
void net80211_rx_err(struct net80211_device *dev, struct io_buffer *iob, int rc)
Indicate an error in receiving a packet.
Definition net80211.c:2789
void net80211_rx(struct net80211_device *dev, struct io_buffer *iob, int signal, u16 rate)
Handle receipt of 802.11 frame.
Definition net80211.c:2690
#define iob_put(iobuf, len)
Definition iobuf.h:125
unsigned int flags
Definition base.h:58
int(* ah_proc_rx_desc)(struct ath5k_hw *, struct ath5k_desc *, struct ath5k_rx_status *)
Definition ath5k.h:1064
struct list_head * prev
Previous list entry.
Definition list.h:23

References ath5k_softc::ah, ath5k_hw::ah_proc_rx_desc, AR5K_RXERR_CRC, AR5K_RXERR_DECRYPT, AR5K_RXERR_PHY, AR5K_RXKEYIX_INVALID, assert, ath5k_hw_rix_to_bitrate(), ath5k_rx_iob_alloc(), ath5k_rxbuf_setup(), DBG, DBG2, ath5k_buf::desc, ath5k_softc::dev, ds, EINPROGRESS, EIO, ath5k_buf::flags, ath5k_buf::iob, iob_put, ath5k_buf::iobaddr, ath5k_buf::list, list_add_tail, list_del, list_empty, list_entry, memset(), net80211_rx(), net80211_rx_err(), list_head::next, next, NULL, list_head::prev, ath5k_rx_status::rs_datalen, ath5k_rx_status::rs_keyix, ath5k_rx_status::rs_more, ath5k_rx_status::rs_rate, ath5k_rx_status::rs_rssi, ath5k_rx_status::rs_status, ath5k_softc::rxbuf, strerror(), and u32.

Referenced by ath5k_poll().

◆ ath5k_handle_tx()

void ath5k_handle_tx ( struct ath5k_softc * sc)
static

Definition at line 1271 of file ath5k.c.

1272{
1273 ath5k_tx_processq(sc, &sc->txq);
1274}
static void ath5k_tx_processq(struct ath5k_softc *sc, struct ath5k_txq *txq)
Definition ath5k.c:1228

References ath5k_tx_processq(), and ath5k_softc::txq.

Referenced by ath5k_poll().

Variable Documentation

◆ ath5k_nics

struct pci_device_id ath5k_nics[]
static
Initial value:
= {
PCI_ROM(0x10b7, 0x0013, "rdag675", "3com 3CRDAG675", AR5K_AR5212),
PCI_ROM(0x168c, 0x0007, "ath5210", "Atheros 5210", AR5K_AR5210),
PCI_ROM(0x168c, 0x0011, "ath5311", "Atheros 5311 (AHB)", AR5K_AR5211),
PCI_ROM(0x168c, 0x0012, "ath5211", "Atheros 5211", AR5K_AR5211),
PCI_ROM(0x168c, 0x0013, "ath5212", "Atheros 5212", AR5K_AR5212),
PCI_ROM(0x168c, 0x0014, "ath5212x14", "Atheros 5212 x14", AR5K_AR5212),
PCI_ROM(0x168c, 0x0015, "ath5212x15", "Atheros 5212 x15", AR5K_AR5212),
PCI_ROM(0x168c, 0x0016, "ath5212x16", "Atheros 5212 x16", AR5K_AR5212),
PCI_ROM(0x168c, 0x0017, "ath5212x17", "Atheros 5212 x17", AR5K_AR5212),
PCI_ROM(0x168c, 0x0018, "ath5212x18", "Atheros 5212 x18", AR5K_AR5212),
PCI_ROM(0x168c, 0x0019, "ath5212x19", "Atheros 5212 x19", AR5K_AR5212),
PCI_ROM(0x168c, 0x001a, "ath2413", "Atheros 2413 Griffin", AR5K_AR5212),
PCI_ROM(0x168c, 0x001b, "ath5413", "Atheros 5413 Eagle", AR5K_AR5212),
PCI_ROM(0x168c, 0x001c, "ath5212e", "Atheros 5212 PCI-E", AR5K_AR5212),
PCI_ROM(0x168c, 0x001d, "ath2417", "Atheros 2417 Nala", AR5K_AR5212),
PCI_ROM(0x168c, 0x0207, "ath5210e", "Atheros 5210 early", AR5K_AR5210),
PCI_ROM(0x168c, 0x1014, "ath5212m", "Ath 5212 miniPCI", AR5K_AR5212),
PCI_ROM(0xa727, 0x0013, "ath5212c","3com Ath 5212", AR5K_AR5212),
}
@ AR5K_AR5210
Definition ath5k.h:256
@ AR5K_AR5212
Definition ath5k.h:258
@ AR5K_AR5211
Definition ath5k.h:257
#define PCI_ROM(_vendor, _device, _name, _description, _data)
Definition pci.h:308

Definition at line 68 of file ath5k.c.

68 {
69 PCI_ROM(0x10b7, 0x0013, "rdag675", "3com 3CRDAG675", AR5K_AR5212),
70 PCI_ROM(0x168c, 0x0007, "ath5210", "Atheros 5210", AR5K_AR5210),
71 PCI_ROM(0x168c, 0x0011, "ath5311", "Atheros 5311 (AHB)", AR5K_AR5211),
72 PCI_ROM(0x168c, 0x0012, "ath5211", "Atheros 5211", AR5K_AR5211),
73 PCI_ROM(0x168c, 0x0013, "ath5212", "Atheros 5212", AR5K_AR5212),
74 PCI_ROM(0x168c, 0x0014, "ath5212x14", "Atheros 5212 x14", AR5K_AR5212),
75 PCI_ROM(0x168c, 0x0015, "ath5212x15", "Atheros 5212 x15", AR5K_AR5212),
76 PCI_ROM(0x168c, 0x0016, "ath5212x16", "Atheros 5212 x16", AR5K_AR5212),
77 PCI_ROM(0x168c, 0x0017, "ath5212x17", "Atheros 5212 x17", AR5K_AR5212),
78 PCI_ROM(0x168c, 0x0018, "ath5212x18", "Atheros 5212 x18", AR5K_AR5212),
79 PCI_ROM(0x168c, 0x0019, "ath5212x19", "Atheros 5212 x19", AR5K_AR5212),
80 PCI_ROM(0x168c, 0x001a, "ath2413", "Atheros 2413 Griffin", AR5K_AR5212),
81 PCI_ROM(0x168c, 0x001b, "ath5413", "Atheros 5413 Eagle", AR5K_AR5212),
82 PCI_ROM(0x168c, 0x001c, "ath5212e", "Atheros 5212 PCI-E", AR5K_AR5212),
83 PCI_ROM(0x168c, 0x001d, "ath2417", "Atheros 2417 Nala", AR5K_AR5212),
84 PCI_ROM(0x168c, 0x0207, "ath5210e", "Atheros 5210 early", AR5K_AR5210),
85 PCI_ROM(0x168c, 0x1014, "ath5212m", "Ath 5212 miniPCI", AR5K_AR5212),
86 PCI_ROM(0xa727, 0x0013, "ath5212c","3com Ath 5212", AR5K_AR5212),
87};

◆ bitrate

u16 bitrate

Definition at line 94 of file ath5k.c.

Referenced by ath5k_bitrate_to_hw_rix(), and ath5k_config().

◆ short_pmbl

u8 short_pmbl

Definition at line 95 of file ath5k.c.

Referenced by ath5k_config().

◆ hw_code

u8 hw_code

Definition at line 96 of file ath5k.c.

Referenced by ath5k_hw_rix_to_bitrate().

◆ [struct]

const struct { ... } ath5k_rates[]
Initial value:
= {
{ 0, 0, 0 },
}
#define ATH5K_SPMBL_BOTH
Definition ath5k.c:91
#define ATH5K_RATE_CODE_6M
Definition ath5k.h:713
#define ATH5K_RATE_CODE_24M
Definition ath5k.h:717
#define ATH5K_RATE_CODE_5_5M
Definition ath5k.h:710
#define ATH5K_RATE_CODE_9M
Definition ath5k.h:714
#define ATH5K_RATE_CODE_36M
Definition ath5k.h:718
#define ATH5K_RATE_CODE_12M
Definition ath5k.h:715
#define ATH5K_RATE_CODE_48M
Definition ath5k.h:719
#define ATH5K_RATE_CODE_54M
Definition ath5k.h:720
#define ATH5K_RATE_CODE_18M
Definition ath5k.h:716
#define ATH5K_RATE_CODE_2M
Definition ath5k.h:709
#define AR5K_SET_SHORT_PREAMBLE
Definition ath5k.h:728
#define ATH5K_RATE_CODE_11M
Definition ath5k.h:711

Referenced by ath5k_bitrate_to_hw_rix(), ath5k_config(), ath5k_hw_rix_to_bitrate(), and ath5k_setup_bands().

◆ __pci_driver

struct pci_driver ath5k_pci_driver __pci_driver
Initial value:
= {
.ids = ath5k_nics,
.id_count = sizeof(ath5k_nics) / sizeof(ath5k_nics[0]),
.probe = ath5k_probe,
.remove = ath5k_remove,
}
static struct pci_device_id ath5k_nics[]
Definition ath5k.c:68
static int ath5k_probe(struct pci_device *pdev)
Definition ath5k.c:247
static void ath5k_remove(struct pci_device *pdev)
Definition ath5k.c:404

Definition at line 124 of file ath5k.c.

124 {
125 .ids = ath5k_nics,
126 .id_count = sizeof(ath5k_nics) / sizeof(ath5k_nics[0]),
127 .probe = ath5k_probe,
128 .remove = ath5k_remove,
129};

◆ ath5k_ops

struct net80211_device_operations ath5k_ops
static
Initial value:
= {
.open = ath5k_start,
.close = ath5k_stop,
.transmit = ath5k_tx,
.poll = ath5k_poll,
.irq = ath5k_irq,
.config = ath5k_config,
}
static int ath5k_tx(struct net80211_device *dev, struct io_buffer *skb)
Definition ath5k.c:1462
static void ath5k_poll(struct net80211_device *dev)
Definition ath5k.c:1377
static int ath5k_config(struct net80211_device *dev, int changed)
Definition ath5k.c:1572
static int ath5k_start(struct net80211_device *dev)
Definition ath5k.c:1546
static void ath5k_stop(struct net80211_device *dev)
Definition ath5k.c:1561

Definition at line 145 of file ath5k.c.

145 {
146 .open = ath5k_start,
147 .close = ath5k_stop,
148 .transmit = ath5k_tx,
149 .poll = ath5k_poll,
150 .irq = ath5k_irq,
151 .config = ath5k_config,
152};

Referenced by ath5k_attach().