iPXE
Macros | Enumerations | Functions
ath9k_xmit.c File Reference
#include <ipxe/io.h>
#include "ath9k.h"
#include "ar9003_mac.h"

Go to the source code of this file.

Macros

#define BITS_PER_BYTE   8
 
#define OFDM_PLCP_BITS   22
 
#define HT_RC_2_STREAMS(_rc)   ((((_rc) & 0x78) >> 3) + 1)
 
#define L_STF   8
 
#define L_LTF   8
 
#define L_SIG   4
 
#define HT_SIG   8
 
#define HT_STF   4
 
#define HT_LTF(_ns)   (4 * (_ns))
 
#define SYMBOL_TIME(_ns)   ((_ns) << 2) /* ns * 4 us */
 
#define SYMBOL_TIME_HALFGI(_ns)   (((_ns) * 18 + 4) / 5) /* ns * 3.6 us */
 
#define NUM_SYMBOLS_PER_USEC(_usec)   (_usec >> 2)
 
#define NUM_SYMBOLS_PER_USEC_HALFGI(_usec)   (((_usec*5)-4)/18)
 
#define IS_HT_RATE(_rate)   ((_rate) & 0x80)
 

Enumerations

enum  { MCS_HT20, MCS_HT20_SGI, MCS_HT40, MCS_HT40_SGI }
 

Functions

 FILE_SECBOOT (FORBIDDEN)
 
static void ath_tx_send_normal (struct ath_softc *sc, struct ath_txq *txq, struct ath_atx_tid *tid, struct list_head *bf_head)
 
static void ath_tx_complete_buf (struct ath_softc *sc, struct ath_buf *bf, struct ath_txq *txq, struct list_head *bf_q, struct ath_tx_status *ts, int txok, int sendbar)
 
static void ath_tx_txqaddbuf (struct ath_softc *sc, struct ath_txq *txq, struct list_head *head)
 
static void ath_buf_set_rate (struct ath_softc *sc, struct ath_buf *bf, int len)
 
static void ath_tx_queue_tid (struct ath_txq *txq, struct ath_atx_tid *tid)
 
static struct ath_bufath_tx_get_buffer (struct ath_softc *sc)
 
static void ath_tx_return_buffer (struct ath_softc *sc, struct ath_buf *bf)
 
struct ath_txqath_txq_setup (struct ath_softc *sc, int qtype, int subtype)
 
void ath_draintxq (struct ath_softc *sc, struct ath_txq *txq, int retry_tx __unused)
 
int ath_drain_all_txq (struct ath_softc *sc, int retry_tx)
 
void ath_tx_cleanupq (struct ath_softc *sc, struct ath_txq *txq)
 
void ath_txq_schedule (struct ath_softc *sc __unused, struct ath_txq *txq)
 
static enum ath9k_pkt_type get_hw_packet_type (struct io_buffer *iob)
 
static int setup_tx_flags (struct io_buffer *iob __unused)
 
u8 ath_txchainmask_reduction (struct ath_softc *sc, u8 chainmask, u32 rate)
 
static struct ath_bufath_tx_setup_buffer (struct net80211_device *dev, struct ath_txq *txq, struct io_buffer *iob)
 
static void ath_tx_start_dma (struct ath_softc *sc, struct ath_buf *bf, struct ath_tx_control *txctl)
 
int ath_tx_start (struct net80211_device *dev, struct io_buffer *iob, struct ath_tx_control *txctl)
 
static void ath_tx_complete (struct ath_softc *sc, struct io_buffer *iob, int tx_flags __unused, struct ath_tx_status *ts, struct ath_txq *txq)
 
static void ath_tx_processq (struct ath_softc *sc, struct ath_txq *txq)
 
static void ath_tx_complete_poll_work (struct ath_softc *sc)
 
void ath_tx_tasklet (struct ath_softc *sc)
 
int ath_tx_init (struct ath_softc *sc, int nbufs)
 
void ath_tx_cleanup (struct ath_softc *sc)
 

Macro Definition Documentation

◆ BITS_PER_BYTE

#define BITS_PER_BYTE   8

Definition at line 27 of file ath9k_xmit.c.

◆ OFDM_PLCP_BITS

#define OFDM_PLCP_BITS   22

Definition at line 28 of file ath9k_xmit.c.

◆ HT_RC_2_STREAMS

#define HT_RC_2_STREAMS (   _rc)    ((((_rc) & 0x78) >> 3) + 1)

Definition at line 29 of file ath9k_xmit.c.

◆ L_STF

#define L_STF   8

Definition at line 30 of file ath9k_xmit.c.

◆ L_LTF

#define L_LTF   8

Definition at line 31 of file ath9k_xmit.c.

◆ L_SIG

#define L_SIG   4

Definition at line 32 of file ath9k_xmit.c.

◆ HT_SIG

#define HT_SIG   8

Definition at line 33 of file ath9k_xmit.c.

◆ HT_STF

#define HT_STF   4

Definition at line 34 of file ath9k_xmit.c.

◆ HT_LTF

#define HT_LTF (   _ns)    (4 * (_ns))

Definition at line 35 of file ath9k_xmit.c.

◆ SYMBOL_TIME

#define SYMBOL_TIME (   _ns)    ((_ns) << 2) /* ns * 4 us */

Definition at line 36 of file ath9k_xmit.c.

◆ SYMBOL_TIME_HALFGI

#define SYMBOL_TIME_HALFGI (   _ns)    (((_ns) * 18 + 4) / 5) /* ns * 3.6 us */

Definition at line 37 of file ath9k_xmit.c.

◆ NUM_SYMBOLS_PER_USEC

#define NUM_SYMBOLS_PER_USEC (   _usec)    (_usec >> 2)

Definition at line 38 of file ath9k_xmit.c.

◆ NUM_SYMBOLS_PER_USEC_HALFGI

#define NUM_SYMBOLS_PER_USEC_HALFGI (   _usec)    (((_usec*5)-4)/18)

Definition at line 39 of file ath9k_xmit.c.

◆ IS_HT_RATE

#define IS_HT_RATE (   _rate)    ((_rate) & 0x80)

Definition at line 42 of file ath9k_xmit.c.

Enumeration Type Documentation

◆ anonymous enum

anonymous enum
Enumerator
MCS_HT20 
MCS_HT20_SGI 
MCS_HT40 
MCS_HT40_SGI 

Definition at line 54 of file ath9k_xmit.c.

54  {
55  MCS_HT20,
57  MCS_HT40,
59 };

Function Documentation

◆ FILE_SECBOOT()

FILE_SECBOOT ( FORBIDDEN  )

◆ ath_tx_send_normal()

static void ath_tx_send_normal ( struct ath_softc sc,
struct ath_txq txq,
struct ath_atx_tid tid,
struct list_head bf_head 
)
static

Definition at line 365 of file ath9k_xmit.c.

368 {
369  struct ath_buf *bf;
370 
371  bf = list_first_entry(bf_head, struct ath_buf, list);
372  bf->bf_state.bf_type &= ~BUF_AMPDU;
373 
374  /* update starting sequence number for subsequent ADDBA request */
375  if (tid)
376  INCR(tid->seq_start, IEEE80211_SEQ_MAX);
377 
378  bf->bf_lastbf = bf;
379  ath_buf_set_rate(sc, bf, iob_len(bf->bf_mpdu) + FCS_LEN);
380  ath_tx_txqaddbuf(sc, txq, bf_head);
381 }
struct io_buffer * bf_mpdu
Definition: ath9k.h:225
struct ath_buf_state bf_state
Definition: ath9k.h:231
static void ath_buf_set_rate(struct ath_softc *sc, struct ath_buf *bf, int len)
Definition: ath9k_xmit.c:423
#define INCR(_l, _sz)
Definition: ath9k.h:47
struct ib_mad_tid tid
Definition: ib_mad.h:18
#define list_first_entry(list, type, member)
Get the container of the first entry in a list.
Definition: list.h:334
#define FCS_LEN
Definition: ath5k_desc.c:37
static void ath_tx_txqaddbuf(struct ath_softc *sc, struct ath_txq *txq, struct list_head *head)
Definition: ath9k_xmit.c:325
Definition: ath9k.h:220
u8 bf_type
Definition: ath9k.h:215
static size_t iob_len(struct io_buffer *iobuf)
Calculate length of data in an I/O buffer.
Definition: iobuf.h:160
struct ath_buf * bf_lastbf
Definition: ath9k.h:222
struct list_head list
Definition: ath9k.h:221
#define IEEE80211_SEQ_MAX
Definition: ath9k.h:145

References ath_buf_set_rate(), ath_tx_txqaddbuf(), ath_buf::bf_lastbf, ath_buf::bf_mpdu, ath_buf::bf_state, ath_buf_state::bf_type, BUF_AMPDU, FCS_LEN, IEEE80211_SEQ_MAX, INCR, iob_len(), ath_buf::list, list_first_entry, and tid.

Referenced by ath_tx_start_dma().

◆ ath_tx_complete_buf()

static void ath_tx_complete_buf ( struct ath_softc sc,
struct ath_buf bf,
struct ath_txq txq,
struct list_head bf_q,
struct ath_tx_status ts,
int  txok,
int  sendbar 
)
static

Definition at line 625 of file ath9k_xmit.c.

628 {
629  struct io_buffer *iob = bf->bf_mpdu;
630  int tx_flags = 0;
631 
632  if (sendbar)
633  tx_flags = ATH_TX_BAR;
634 
635  if (!txok) {
636  tx_flags |= ATH_TX_ERROR;
637 
638  if (bf_isxretried(bf))
639  tx_flags |= ATH_TX_XRETRY;
640  }
641 
642  bf->bf_buf_addr = 0;
643 
644  ath_tx_complete(sc, iob, tx_flags,
645  ts, txq);
646 
647  /* At this point, iob (bf->bf_mpdu) is consumed...make sure we don't
648  * accidentally reference it later.
649  */
650  bf->bf_mpdu = NULL;
651 
652  /*
653  * Return the list of ath_buf of this mpdu to free queue
654  */
655  list_splice_tail_init(bf_q, &sc->tx.txbuf);
656 }
struct io_buffer * bf_mpdu
Definition: ath9k.h:225
#define bf_isxretried(bf)
Definition: ath9k.h:102
#define ATH_TX_XRETRY
Definition: ath9k.h:274
static void ath_tx_complete(struct ath_softc *sc, struct io_buffer *iob, int tx_flags __unused, struct ath_tx_status *ts, struct ath_txq *txq)
Definition: ath9k_xmit.c:603
u32 bf_buf_addr
Definition: ath9k.h:228
#define list_splice_tail_init(list, entry)
Move all entries from one list into another list and reinitialise empty list.
Definition: list.h:300
struct ath_tx tx
Definition: ath9k.h:477
struct list_head txbuf
Definition: ath9k.h:285
#define ATH_TX_BAR
Definition: ath9k.h:275
#define ATH_TX_ERROR
Definition: ath9k.h:273
#define NULL
NULL pointer (VOID *)
Definition: Base.h:322
A persistent I/O buffer.
Definition: iobuf.h:38

References ATH_TX_BAR, ath_tx_complete(), ATH_TX_ERROR, ATH_TX_XRETRY, ath_buf::bf_buf_addr, bf_isxretried, ath_buf::bf_mpdu, list_splice_tail_init, NULL, ath_softc::tx, and ath_tx::txbuf.

Referenced by ath_draintxq(), and ath_tx_processq().

◆ ath_tx_txqaddbuf()

static void ath_tx_txqaddbuf ( struct ath_softc sc,
struct ath_txq txq,
struct list_head head 
)
static

Definition at line 325 of file ath9k_xmit.c.

327 {
328  struct ath_hw *ah = sc->sc_ah;
329  struct ath_buf *bf;
330 
331  /*
332  * Insert the frame on the outbound list and
333  * pass it on to the hardware.
334  */
335 
336  if (list_empty(head))
337  return;
338 
339  bf = list_first_entry(head, struct ath_buf, list);
340 
341  DBGIO("ath9k: "
342  "qnum: %d, txq depth: %d\n", txq->axq_qnum, txq->axq_depth);
343 
345 
346  if (txq->axq_link == NULL) {
348  DBGIO("ath9k: TXDP[%d] = %llx (%p)\n",
349  txq->axq_qnum, ito64(bf->bf_daddr),
350  bf->bf_desc);
351  } else {
352  *txq->axq_link = bf->bf_daddr;
353  DBGIO("ath9k: "
354  "link[%d] (%p)=%llx (%p)\n",
355  txq->axq_qnum, txq->axq_link,
356  ito64(bf->bf_daddr), bf->bf_desc);
357  }
359  &txq->axq_link);
361 
362  txq->axq_depth++;
363 }
Definition: hw.h:657
void * bf_desc
Definition: ath9k.h:226
u32 * axq_link
Definition: ath9k.h:184
void ath9k_hw_puttxbuf(struct ath_hw *ah, u32 q, u32 txdp)
Definition: ath9k_mac.c:52
uint8_t head
Head number.
Definition: int13.h:34
struct list_head axq_q
Definition: ath9k.h:185
#define ito64(x)
Definition: ath9k.h:38
void ath9k_hw_txstart(struct ath_hw *ah, u32 q)
Definition: ath9k_mac.c:57
#define list_empty(list)
Test whether a list is empty.
Definition: list.h:137
u32 bf_daddr
Definition: ath9k.h:227
#define list_first_entry(list, type, member)
Get the container of the first entry in a list.
Definition: list.h:334
struct ath_hw * sc_ah
Definition: ath9k.h:455
#define DBGIO(...)
Definition: compiler.h:549
Definition: ath9k.h:220
#define list_splice_tail_init(list, entry)
Move all entries from one list into another list and reinitialise empty list.
Definition: list.h:300
struct ath_buf * bf_lastbf
Definition: ath9k.h:222
struct list_head list
Definition: ath9k.h:221
u32 axq_qnum
Definition: ath9k.h:183
static void ath9k_hw_get_desc_link(struct ath_hw *ah, void *ds, u32 **link)
Definition: hw-ops.h:45
u32 axq_depth
Definition: ath9k.h:186
uint8_t ah
Definition: registers.h:85
#define NULL
NULL pointer (VOID *)
Definition: Base.h:322

References ah, ath9k_hw_get_desc_link(), ath9k_hw_puttxbuf(), ath9k_hw_txstart(), ath_txq::axq_depth, ath_txq::axq_link, ath_txq::axq_q, ath_txq::axq_qnum, ath_buf::bf_daddr, ath_buf::bf_desc, ath_buf::bf_lastbf, DBGIO, head, ito64, ath_buf::list, list_empty, list_first_entry, list_splice_tail_init, NULL, and ath_softc::sc_ah.

Referenced by ath_tx_send_normal().

◆ ath_buf_set_rate()

static void ath_buf_set_rate ( struct ath_softc sc,
struct ath_buf bf,
int  len 
)
static

Definition at line 423 of file ath9k_xmit.c.

424 {
425  struct ath_common *common = ath9k_hw_common(sc->sc_ah);
426  struct ath9k_11n_rate_series series[4];
427  const struct ath9k_legacy_rate *rate;
428  int i, flags = 0;
429  u8 rix = 0, ctsrate = 0;
430  int is_pspoll;
431 
432  memset(series, 0, sizeof(struct ath9k_11n_rate_series) * 4);
433 
434  is_pspoll = 0;
435 
436  /*
437  * We check if Short Preamble is needed for the CTS rate by
438  * checking the BSS's global flag.
439  * But for the rate series, IEEE80211_TX_RC_USE_SHORT_PREAMBLE is used.
440  */
441  rate = &sc->rates[sc->hw_rix];
442  ctsrate = rate->hw_value;
443  if (sc->sc_flags & SC_OP_PREAMBLE_SHORT)
444  ctsrate |= rate->hw_value_short;
445 
446  for (i = 0; i < 4; i++) {
447  int is_40 __unused, is_sgi __unused, is_sp;
448  int phy;
449 
450  rix = sc->hw_rix;
451  series[i].Tries = ATH_TXMAXTRY;
452 
453  if (sc->sc_flags & SC_OP_PROTECT_ENABLE) {
454  series[i].RateFlags |= ATH9K_RATESERIES_RTS_CTS;
456  }
457 
458  is_sp = !!(rate->flags & IEEE80211_TX_RC_USE_SHORT_PREAMBLE);
459 
460  /* legacy rates */
461  if ((sc->dev->channels + sc->dev->channel)->band == NET80211_BAND_2GHZ)
462  phy = CHANNEL_CCK;
463  else
464  phy = CHANNEL_OFDM;
465 
466  series[i].Rate = rate->hw_value;
467  if (rate->hw_value_short && (sc->sc_flags & SC_OP_PREAMBLE_SHORT)) {
469  series[i].Rate |= rate->hw_value_short;
470  } else {
471  is_sp = 0;
472  }
473 
474  if (bf->bf_state.bfs_paprd)
475  series[i].ChSel = common->tx_chainmask;
476  else
477  series[i].ChSel = ath_txchainmask_reduction(sc,
478  common->tx_chainmask, series[i].Rate);
479 
480  series[i].PktDuration = ath9k_hw_computetxtime(sc->sc_ah,
481  phy, rate->bitrate * 100, len, rix, is_sp);
482  }
483 
484  /* For AR5416 - RTS cannot be followed by a frame larger than 8K */
485  if (bf_isaggr(bf) && (len > sc->sc_ah->caps.rts_aggr_limit))
487 
488  /* ATH9K_TXDESC_RTSENA and ATH9K_TXDESC_CTSENA are mutually exclusive. */
491 
492  /* set dur_update_en for l-sig computation except for PS-Poll frames */
494  bf->bf_lastbf->bf_desc,
495  !is_pspoll, ctsrate,
496  0, series, 4, flags);
497 
498 }
#define ATH9K_RATESERIES_RTS_CTS
Definition: mac.h:652
u16 hw_value_short
Definition: ath9k.h:394
void * bf_desc
Definition: ath9k.h:226
u8 ath_txchainmask_reduction(struct ath_softc *sc, u8 chainmask, u32 rate)
Definition: ath9k_xmit.c:411
u8 channel
The channel currently in use, as an index into the channels array.
Definition: net80211.h:812
#define ATH9K_TXDESC_CTSENA
Definition: mac.h:252
struct ath_buf_state bf_state
Definition: ath9k.h:231
u16 rts_aggr_limit
Definition: hw.h:201
u8 bfs_paprd
Definition: ath9k.h:216
static void ath9k_hw_set11n_ratescenario(struct ath_hw *ah, void *ds, void *lastds, u32 durUpdateEn, u32 rtsctsRate, u32 rtsctsDuration, struct ath9k_11n_rate_series series[], u32 nseries, u32 flags)
Definition: hw-ops.h:88
#define ATH_TXMAXTRY
Definition: ath9k.h:127
#define SC_OP_PREAMBLE_SHORT
Definition: ath9k.h:368
#define bf_isaggr(bf)
Definition: ath9k.h:101
#define CHANNEL_CCK
Definition: ath5k.h:632
#define NET80211_BAND_2GHZ
The 2.4 GHz ISM band, unlicensed in most countries.
Definition: net80211.h:45
struct net80211_device * dev
Definition: ath9k.h:446
struct ath_hw * sc_ah
Definition: ath9k.h:455
#define __unused
Declare a variable or data structure as unused.
Definition: compiler.h:573
ring len
Length.
Definition: dwmac.h:231
uint8_t flags
Flags.
Definition: ena.h:18
u16 ath9k_hw_computetxtime(struct ath_hw *ah, u8 phy, int kbps, u32 frameLen, u16 rateix, int shortPreamble)
Definition: ath9k_hw.c:139
struct ath_buf * bf_lastbf
Definition: ath9k.h:222
#define ATH9K_TXDESC_RTSENA
Definition: mac.h:251
static struct ath_common * ath9k_hw_common(struct ath_hw *ah)
Definition: hw.h:870
int hw_rix
Definition: ath9k.h:480
#define CHANNEL_OFDM
Definition: ath5k.h:633
struct ib_cm_common common
Definition: ib_mad.h:12
u32 sc_flags
Definition: ath9k.h:466
struct ath9k_hw_capabilities caps
Definition: hw.h:664
struct net80211_channel channels[NET80211_MAX_CHANNELS]
A list of all possible channels we might use.
Definition: net80211.h:806
struct ath9k_legacy_rate rates[NET80211_MAX_RATES]
Definition: ath9k.h:479
#define SC_OP_PROTECT_ENABLE
Definition: ath9k.h:369
uint8_t u8
Definition: stdint.h:20
void * memset(void *dest, int character, size_t len) __nonnull

References __unused, ath9k_hw_common(), ath9k_hw_computetxtime(), ath9k_hw_set11n_ratescenario(), ATH9K_RATESERIES_RTS_CTS, ATH9K_TXDESC_CTSENA, ATH9K_TXDESC_RTSENA, ath_txchainmask_reduction(), ATH_TXMAXTRY, ath_buf::bf_desc, bf_isaggr, ath_buf::bf_lastbf, ath_buf::bf_state, ath_buf_state::bfs_paprd, ath9k_legacy_rate::bitrate, ath_hw::caps, net80211_device::channel, CHANNEL_CCK, CHANNEL_OFDM, net80211_device::channels, ath9k_11n_rate_series::ChSel, common, ath_softc::dev, flags, ath9k_legacy_rate::flags, ath_softc::hw_rix, ath9k_legacy_rate::hw_value, ath9k_legacy_rate::hw_value_short, IEEE80211_TX_RC_USE_SHORT_PREAMBLE, len, memset(), NET80211_BAND_2GHZ, ath9k_11n_rate_series::PktDuration, ath9k_11n_rate_series::Rate, ath9k_11n_rate_series::RateFlags, ath_softc::rates, ath9k_hw_capabilities::rts_aggr_limit, ath_softc::sc_ah, ath_softc::sc_flags, SC_OP_PREAMBLE_SHORT, SC_OP_PROTECT_ENABLE, and ath9k_11n_rate_series::Tries.

Referenced by ath_tx_send_normal().

◆ ath_tx_queue_tid()

static void ath_tx_queue_tid ( struct ath_txq txq,
struct ath_atx_tid tid 
)
static

Definition at line 65 of file ath9k_xmit.c.

66 {
67  struct ath_atx_ac *ac = tid->ac;
68 
69  if (tid->paused)
70  return;
71 
72  if (tid->sched)
73  return;
74 
75  tid->sched = 1;
76  list_add_tail(&tid->list, &ac->tid_q);
77 
78  if (ac->sched)
79  return;
80 
81  ac->sched = 1;
82  list_add_tail(&ac->list, &txq->axq_acq);
83 }
struct ath_txq * txq
Definition: ath9k.h:199
struct ib_mad_tid tid
Definition: ib_mad.h:18
#define list_add_tail(new, head)
Add a new entry to the tail of a list.
Definition: list.h:94
struct list_head list
Definition: ath9k.h:201
int sched
Definition: ath9k.h:200
struct list_head axq_acq
Definition: ath9k.h:190
struct list_head tid_q
Definition: ath9k.h:202

References ath_txq::axq_acq, ath_atx_ac::list, list_add_tail, ath_atx_ac::sched, tid, ath_atx_ac::tid_q, and ath_atx_ac::txq.

Referenced by ath_txq_schedule().

◆ ath_tx_get_buffer()

static struct ath_buf* ath_tx_get_buffer ( struct ath_softc sc)
static

Definition at line 85 of file ath9k_xmit.c.

86 {
87  struct ath_buf *bf = NULL;
88 
89  if (list_empty(&sc->tx.txbuf)) {
90  return NULL;
91  }
92 
93  bf = list_first_entry(&sc->tx.txbuf, struct ath_buf, list);
94  list_del(&bf->list);
95 
96  return bf;
97 }
#define list_empty(list)
Test whether a list is empty.
Definition: list.h:137
#define list_first_entry(list, type, member)
Get the container of the first entry in a list.
Definition: list.h:334
#define list_del(list)
Delete an entry from a list.
Definition: list.h:120
Definition: ath9k.h:220
struct list_head list
Definition: ath9k.h:221
struct ath_tx tx
Definition: ath9k.h:477
struct list_head txbuf
Definition: ath9k.h:285
#define NULL
NULL pointer (VOID *)
Definition: Base.h:322

References ath_buf::list, list_del, list_empty, list_first_entry, NULL, ath_softc::tx, and ath_tx::txbuf.

Referenced by ath_tx_setup_buffer().

◆ ath_tx_return_buffer()

static void ath_tx_return_buffer ( struct ath_softc sc,
struct ath_buf bf 
)
static

Definition at line 99 of file ath9k_xmit.c.

100 {
101  list_add_tail(&bf->list, &sc->tx.txbuf);
102 }
#define list_add_tail(new, head)
Add a new entry to the tail of a list.
Definition: list.h:94
struct list_head list
Definition: ath9k.h:221
struct ath_tx tx
Definition: ath9k.h:477
struct list_head txbuf
Definition: ath9k.h:285

References ath_buf::list, list_add_tail, ath_softc::tx, and ath_tx::txbuf.

Referenced by ath_draintxq(), and ath_tx_processq().

◆ ath_txq_setup()

struct ath_txq* ath_txq_setup ( struct ath_softc sc,
int  qtype,
int  subtype 
)

Definition at line 108 of file ath9k_xmit.c.

109 {
110  struct ath_hw *ah = sc->sc_ah;
111  struct ath9k_tx_queue_info qi;
112  static const int subtype_txq_to_hwq[] = {
114  };
115  int axq_qnum, i;
116 
117  memset(&qi, 0, sizeof(qi));
118  qi.tqi_subtype = subtype_txq_to_hwq[subtype];
119  qi.tqi_aifs = ATH9K_TXQ_USEDEFAULT;
120  qi.tqi_cwmin = ATH9K_TXQ_USEDEFAULT;
121  qi.tqi_cwmax = ATH9K_TXQ_USEDEFAULT;
122  qi.tqi_physCompBuf = 0;
123 
124  /*
125  * Enable interrupts only for EOL and DESC conditions.
126  * We mark tx descriptors to receive a DESC interrupt
127  * when a tx queue gets deep; otherwise waiting for the
128  * EOL to reap descriptors. Note that this is done to
129  * reduce interrupt load and this only defers reaping
130  * descriptors, never transmitting frames. Aside from
131  * reducing interrupts this also permits more concurrency.
132  * The only potential downside is if the tx queue backs
133  * up in which case the top half of the kernel may backup
134  * due to a lack of tx descriptors.
135  *
136  * The UAPSD queue is an exception, since we take a desc-
137  * based intr on the EOSP frames.
138  */
139  qi.tqi_qflags = TXQ_FLAG_TXEOLINT_ENABLE |
141 
142  axq_qnum = ath9k_hw_setuptxqueue(ah, qtype, &qi);
143  if (axq_qnum == -1) {
144  /*
145  * NB: don't print a message, this happens
146  * normally on parts with too few tx queues
147  */
148  return NULL;
149  }
150  if ((unsigned int)axq_qnum >= ARRAY_SIZE(sc->tx.txq)) {
151  DBG("ath9k: qnum %d out of range, max %zd!\n",
152  axq_qnum, ARRAY_SIZE(sc->tx.txq));
153  ath9k_hw_releasetxqueue(ah, axq_qnum);
154  return NULL;
155  }
156  if (!ATH_TXQ_SETUP(sc, axq_qnum)) {
157  struct ath_txq *txq = &sc->tx.txq[axq_qnum];
158 
159  txq->axq_qnum = axq_qnum;
160  txq->mac80211_qnum = -1;
161  txq->axq_link = NULL;
162  INIT_LIST_HEAD(&txq->axq_q);
163  INIT_LIST_HEAD(&txq->axq_acq);
164  txq->axq_depth = 0;
165  txq->axq_ampdu_depth = 0;
166  txq->axq_tx_inprogress = 0;
167  sc->tx.txqsetup |= 1<<axq_qnum;
168 
169  txq->txq_headidx = txq->txq_tailidx = 0;
170  for (i = 0; i < ATH_TXFIFO_DEPTH; i++)
171  INIT_LIST_HEAD(&txq->txq_fifo[i]);
173  }
174  return &sc->tx.txq[axq_qnum];
175 }
Definition: hw.h:657
u8 txq_headidx
Definition: ath9k.h:193
u32 * axq_link
Definition: ath9k.h:184
int mac80211_qnum
Definition: ath9k.h:182
#define ATH_TXQ_SETUP(sc, i)
Definition: ath9k.h:63
u8 txq_tailidx
Definition: ath9k.h:194
struct ath_txq txq[ATH9K_NUM_TX_QUEUES]
Definition: ath9k.h:286
struct list_head axq_q
Definition: ath9k.h:185
#define WME_AC_BE
Definition: common.h:35
u32 axq_ampdu_depth
Definition: ath9k.h:187
Definition: ath9k.h:181
int ath9k_hw_releasetxqueue(struct ath_hw *ah, u32 q)
Definition: ath9k_mac.c:261
u32 txqsetup
Definition: ath9k.h:284
struct ath_hw * sc_ah
Definition: ath9k.h:455
#define ATH9K_TXQ_USEDEFAULT
Definition: mac.h:598
#define ATH_TXFIFO_DEPTH
Definition: ath9k.h:180
struct list_head txq_fifo[ATH_TXFIFO_DEPTH]
Definition: ath9k.h:191
uint8_t subtype
Slow protocols subtype.
Definition: eth_slow.h:13
int ath9k_hw_setuptxqueue(struct ath_hw *ah, enum ath9k_tx_queue type, const struct ath9k_tx_queue_info *qinfo)
Definition: ath9k_mac.c:218
u32 axq_qnum
Definition: ath9k.h:183
#define ARRAY_SIZE(x)
Definition: efx_common.h:43
struct ath_tx tx
Definition: ath9k.h:477
struct list_head axq_acq
Definition: ath9k.h:190
#define INIT_LIST_HEAD(list)
Initialise a list head.
Definition: list.h:46
u32 axq_depth
Definition: ath9k.h:186
uint8_t ah
Definition: registers.h:85
struct list_head txq_fifo_pending
Definition: ath9k.h:192
#define DBG(...)
Print a debugging message.
Definition: compiler.h:498
#define NULL
NULL pointer (VOID *)
Definition: Base.h:322
int axq_tx_inprogress
Definition: ath9k.h:189
void * memset(void *dest, int character, size_t len) __nonnull

References ah, ARRAY_SIZE, ath9k_hw_releasetxqueue(), ath9k_hw_setuptxqueue(), ATH9K_TXQ_USEDEFAULT, ATH_TXFIFO_DEPTH, ATH_TXQ_AC_BE, ATH_TXQ_SETUP, ath_txq::axq_acq, ath_txq::axq_ampdu_depth, ath_txq::axq_depth, ath_txq::axq_link, ath_txq::axq_q, ath_txq::axq_qnum, ath_txq::axq_tx_inprogress, DBG, INIT_LIST_HEAD, ath_txq::mac80211_qnum, memset(), NULL, ath_softc::sc_ah, subtype, ath9k_tx_queue_info::tqi_aifs, ath9k_tx_queue_info::tqi_cwmax, ath9k_tx_queue_info::tqi_cwmin, ath9k_tx_queue_info::tqi_physCompBuf, ath9k_tx_queue_info::tqi_qflags, ath9k_tx_queue_info::tqi_subtype, ath_softc::tx, ath_tx::txq, ath_txq::txq_fifo, ath_txq::txq_fifo_pending, TXQ_FLAG_TXDESCINT_ENABLE, TXQ_FLAG_TXEOLINT_ENABLE, ath_txq::txq_headidx, ath_txq::txq_tailidx, ath_tx::txqsetup, and WME_AC_BE.

Referenced by ath9k_init_queues().

◆ ath_draintxq()

void ath_draintxq ( struct ath_softc sc,
struct ath_txq txq,
int retry_tx  __unused 
)

Definition at line 183 of file ath9k_xmit.c.

184 {
185  struct ath_buf *bf, *lastbf __unused;
186  struct list_head bf_head;
187  struct ath_tx_status ts;
188 
189  memset(&ts, 0, sizeof(ts));
190  INIT_LIST_HEAD(&bf_head);
191 
192  for (;;) {
193  if (list_empty(&txq->axq_q)) {
194  txq->axq_link = NULL;
195  break;
196  }
197  bf = list_first_entry(&txq->axq_q, struct ath_buf,
198  list);
199 
200  if (bf->bf_stale) {
201  list_del(&bf->list);
202 
203  ath_tx_return_buffer(sc, bf);
204  continue;
205  }
206 
207  lastbf = bf->bf_lastbf;
208 
209  list_cut_position(&bf_head, &txq->axq_q, &lastbf->list);
210 
211  txq->axq_depth--;
212  ath_tx_complete_buf(sc, bf, txq, &bf_head, &ts, 0, 0);
213  }
214 
215  txq->axq_tx_inprogress = 0;
216 }
u32 * axq_link
Definition: ath9k.h:184
struct list_head axq_q
Definition: ath9k.h:185
A doubly-linked list entry (or list head)
Definition: list.h:19
#define list_empty(list)
Test whether a list is empty.
Definition: list.h:137
#define list_first_entry(list, type, member)
Get the container of the first entry in a list.
Definition: list.h:334
#define list_del(list)
Delete an entry from a list.
Definition: list.h:120
static void ath_tx_complete_buf(struct ath_softc *sc, struct ath_buf *bf, struct ath_txq *txq, struct list_head *bf_q, struct ath_tx_status *ts, int txok, int sendbar)
Definition: ath9k_xmit.c:625
int bf_stale
Definition: ath9k.h:229
#define __unused
Declare a variable or data structure as unused.
Definition: compiler.h:573
Definition: ath9k.h:220
struct ath_buf * bf_lastbf
Definition: ath9k.h:222
struct list_head list
Definition: ath9k.h:221
#define list_cut_position(new, list, entry)
Cut a list into two.
Definition: list.h:186
static void ath_tx_return_buffer(struct ath_softc *sc, struct ath_buf *bf)
Definition: ath9k_xmit.c:99
#define INIT_LIST_HEAD(list)
Initialise a list head.
Definition: list.h:46
u32 axq_depth
Definition: ath9k.h:186
#define NULL
NULL pointer (VOID *)
Definition: Base.h:322
int axq_tx_inprogress
Definition: ath9k.h:189
void * memset(void *dest, int character, size_t len) __nonnull

References __unused, ath_tx_complete_buf(), ath_tx_return_buffer(), ath_txq::axq_depth, ath_txq::axq_link, ath_txq::axq_q, ath_txq::axq_tx_inprogress, ath_buf::bf_lastbf, ath_buf::bf_stale, INIT_LIST_HEAD, ath_buf::list, list_cut_position, list_del, list_empty, list_first_entry, memset(), and NULL.

Referenced by ath_drain_all_txq().

◆ ath_drain_all_txq()

int ath_drain_all_txq ( struct ath_softc sc,
int  retry_tx 
)

Definition at line 218 of file ath9k_xmit.c.

219 {
220  struct ath_hw *ah = sc->sc_ah;
221  struct ath_txq *txq;
222  int i, npend = 0;
223 
224  if (sc->sc_flags & SC_OP_INVALID)
225  return 1;
226 
228 
229  /* Check if any queue remains active */
230  for (i = 0; i < ATH9K_NUM_TX_QUEUES; i++) {
231  if (!ATH_TXQ_SETUP(sc, i))
232  continue;
233 
234  npend += ath9k_hw_numtxpending(ah, sc->tx.txq[i].axq_qnum);
235  }
236 
237  if (npend)
238  DBG("ath9k: Failed to stop TX DMA!\n");
239 
240  for (i = 0; i < ATH9K_NUM_TX_QUEUES; i++) {
241  if (!ATH_TXQ_SETUP(sc, i))
242  continue;
243 
244  /*
245  * The caller will resume queues with ieee80211_wake_queues.
246  * Mark the queue as not stopped to prevent ath_tx_complete
247  * from waking the queue too early.
248  */
249  txq = &sc->tx.txq[i];
250  txq->stopped = 0;
251  ath_draintxq(sc, txq, retry_tx);
252  }
253 
254  return !npend;
255 }
Definition: hw.h:657
u32 ath9k_hw_numtxpending(struct ath_hw *ah, u32 q)
Definition: ath9k_mac.c:64
int stopped
Definition: ath9k.h:188
#define ATH_TXQ_SETUP(sc, i)
Definition: ath9k.h:63
struct ath_txq txq[ATH9K_NUM_TX_QUEUES]
Definition: ath9k.h:286
Definition: ath9k.h:181
struct ath_hw * sc_ah
Definition: ath9k.h:455
void ath9k_hw_abort_tx_dma(struct ath_hw *ah)
Definition: ath9k_mac.c:131
u32 axq_qnum
Definition: ath9k.h:183
#define ATH9K_NUM_TX_QUEUES
Definition: mac.h:581
struct ath_tx tx
Definition: ath9k.h:477
void ath_draintxq(struct ath_softc *sc, struct ath_txq *txq, int retry_tx __unused)
Definition: ath9k_xmit.c:183
u32 sc_flags
Definition: ath9k.h:466
#define SC_OP_INVALID
Definition: ath9k.h:363
uint8_t ah
Definition: registers.h:85
#define DBG(...)
Print a debugging message.
Definition: compiler.h:498

References ah, ath9k_hw_abort_tx_dma(), ath9k_hw_numtxpending(), ATH9K_NUM_TX_QUEUES, ath_draintxq(), ATH_TXQ_SETUP, ath_txq::axq_qnum, DBG, ath_softc::sc_ah, ath_softc::sc_flags, SC_OP_INVALID, ath_txq::stopped, ath_softc::tx, and ath_tx::txq.

Referenced by ath9k_stop(), ath_radio_disable(), ath_reset(), and ath_set_channel().

◆ ath_tx_cleanupq()

void ath_tx_cleanupq ( struct ath_softc sc,
struct ath_txq txq 
)

Definition at line 257 of file ath9k_xmit.c.

258 {
260  sc->tx.txqsetup &= ~(1<<txq->axq_qnum);
261 }
int ath9k_hw_releasetxqueue(struct ath_hw *ah, u32 q)
Definition: ath9k_mac.c:261
u32 txqsetup
Definition: ath9k.h:284
struct ath_hw * sc_ah
Definition: ath9k.h:455
u32 axq_qnum
Definition: ath9k.h:183
struct ath_tx tx
Definition: ath9k.h:477

References ath9k_hw_releasetxqueue(), ath_txq::axq_qnum, ath_softc::sc_ah, ath_softc::tx, and ath_tx::txqsetup.

Referenced by ath9k_deinit_softc(), and ath9k_init_softc().

◆ ath_txq_schedule()

void ath_txq_schedule ( struct ath_softc *sc  __unused,
struct ath_txq txq 
)

Definition at line 266 of file ath9k_xmit.c.

267 {
268  struct ath_atx_ac *ac, *ac_tmp, *last_ac;
269  struct ath_atx_tid *tid, *last_tid;
270 
271  if (list_empty(&txq->axq_acq) ||
273  return;
274 
275  ac = list_first_entry(&txq->axq_acq, struct ath_atx_ac, list);
276  last_ac = list_entry(txq->axq_acq.prev, struct ath_atx_ac, list);
277 
278  list_for_each_entry_safe(ac, ac_tmp, &txq->axq_acq, list) {
279  last_tid = list_entry(ac->tid_q.prev, struct ath_atx_tid, list);
280  list_del(&ac->list);
281  ac->sched = 0;
282 
283  while (!list_empty(&ac->tid_q)) {
285  list);
286  list_del(&tid->list);
287  tid->sched = 0;
288 
289  if (tid->paused)
290  continue;
291 
292  /*
293  * add tid to round-robin queue if more frames
294  * are pending for the tid
295  */
296  if (!list_empty(&tid->buf_q))
297  ath_tx_queue_tid(txq, tid);
298 
299  if (tid == last_tid ||
301  break;
302  }
303 
304  if (!list_empty(&ac->tid_q)) {
305  if (!ac->sched) {
306  ac->sched = 1;
307  list_add_tail(&ac->list, &txq->axq_acq);
308  }
309  }
310 
311  if (ac == last_ac ||
313  return;
314  }
315 }
#define ATH_AGGR_MIN_QDEPTH
Definition: ath9k.h:140
struct ib_mad_tid tid
Definition: ib_mad.h:18
static void ath_tx_queue_tid(struct ath_txq *txq, struct ath_atx_tid *tid)
Definition: ath9k_xmit.c:65
#define list_empty(list)
Test whether a list is empty.
Definition: list.h:137
u32 axq_ampdu_depth
Definition: ath9k.h:187
#define list_first_entry(list, type, member)
Get the container of the first entry in a list.
Definition: list.h:334
#define list_del(list)
Delete an entry from a list.
Definition: list.h:120
#define list_add_tail(new, head)
Add a new entry to the tail of a list.
Definition: list.h:94
struct list_head list
Definition: ath9k.h:201
#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
struct list_head list
Definition: ath9k.h:235
int sched
Definition: ath9k.h:200
struct list_head axq_acq
Definition: ath9k.h:190
struct list_head * prev
Previous list entry.
Definition: list.h:23
struct list_head tid_q
Definition: ath9k.h:202
#define list_entry(list, type, member)
Get the container of a list entry.
Definition: list.h:322
struct ath_atx_ac * ac
Definition: ath9k.h:238

References ath_atx_tid::ac, ATH_AGGR_MIN_QDEPTH, ath_tx_queue_tid(), ath_txq::axq_acq, ath_txq::axq_ampdu_depth, ath_atx_ac::list, ath_atx_tid::list, list_add_tail, list_del, list_empty, list_entry, list_first_entry, list_for_each_entry_safe, list_head::prev, ath_atx_ac::sched, tid, and ath_atx_ac::tid_q.

Referenced by ath_tx_processq().

◆ get_hw_packet_type()

static enum ath9k_pkt_type get_hw_packet_type ( struct io_buffer iob)
static

Definition at line 383 of file ath9k_xmit.c.

384 {
385  struct ieee80211_frame *hdr;
386  enum ath9k_pkt_type htype;
387  u16 fc;
388 
389  hdr = (struct ieee80211_frame *)iob->data;
390  fc = hdr->fc;
391 
393  htype = ATH9K_PKT_TYPE_BEACON;
396  else
397  htype = ATH9K_PKT_TYPE_NORMAL;
398 
399  return htype;
400 }
uint16_t u16
Definition: stdint.h:22
struct golan_inbox_hdr hdr
Message header.
Definition: CIB_PRM.h:28
u16 fc
802.11 Frame Control field
Definition: ieee80211.h:14
An 802.11 data or management frame without QoS or WDS header fields.
Definition: ieee80211.h:300
#define IEEE80211_FC_SUBTYPE
802.11 Frame Control field, Frame Subtype bitmask
Definition: ieee80211.h:110
#define IEEE80211_FC_TYPE
802.11 Frame Control field, Frame Type bitmask
Definition: ieee80211.h:97
#define IEEE80211_STYPE_PROBE_RESP
Subtype value for probe-response management frames.
Definition: ieee80211.h:157
void * data
Start of data.
Definition: iobuf.h:53
#define IEEE80211_STYPE_BEACON
Subtype value for beacon management frames.
Definition: ieee80211.h:168
ath9k_pkt_type
Definition: mac.h:605
#define IEEE80211_TYPE_MGMT
Type value for management (layer-2) frames.
Definition: ieee80211.h:100
if(natsemi->flags &NATSEMI_64BIT) return 1

References ATH9K_PKT_TYPE_BEACON, ATH9K_PKT_TYPE_NORMAL, ATH9K_PKT_TYPE_PROBE_RESP, io_buffer::data, fc, hdr, IEEE80211_FC_SUBTYPE, IEEE80211_FC_TYPE, IEEE80211_STYPE_BEACON, IEEE80211_STYPE_PROBE_RESP, IEEE80211_TYPE_MGMT, and if().

Referenced by ath_tx_setup_buffer().

◆ setup_tx_flags()

static int setup_tx_flags ( struct io_buffer *iob  __unused)
static

Definition at line 402 of file ath9k_xmit.c.

403 {
404  int flags = 0;
405 
407 
408  return flags;
409 }
#define ATH9K_TXDESC_INTREQ
Definition: mac.h:266
uint8_t flags
Flags.
Definition: ena.h:18

References ATH9K_TXDESC_INTREQ, and flags.

Referenced by ath_tx_setup_buffer().

◆ ath_txchainmask_reduction()

u8 ath_txchainmask_reduction ( struct ath_softc sc,
u8  chainmask,
u32  rate 
)

Definition at line 411 of file ath9k_xmit.c.

412 {
413  struct ath_hw *ah = sc->sc_ah;
414  struct ath9k_channel *curchan = ah->curchan;
415  if ((sc->sc_flags & SC_OP_ENABLE_APM) &&
416  (curchan->channelFlags & CHANNEL_5GHZ) &&
417  (chainmask == 0x7) && (rate < 0x90))
418  return 0x3;
419  else
420  return chainmask;
421 }
Definition: hw.h:657
u32 channelFlags
Definition: hw.h:351
struct ath_hw * sc_ah
Definition: ath9k.h:455
u32 sc_flags
Definition: ath9k.h:466
#define CHANNEL_5GHZ
Definition: ath5k.h:635
uint8_t ah
Definition: registers.h:85
#define SC_OP_ENABLE_APM
Definition: ath9k.h:377

References ah, CHANNEL_5GHZ, ath9k_channel::channelFlags, ath_softc::sc_ah, ath_softc::sc_flags, and SC_OP_ENABLE_APM.

Referenced by ath_buf_set_rate().

◆ ath_tx_setup_buffer()

static struct ath_buf* ath_tx_setup_buffer ( struct net80211_device dev,
struct ath_txq txq,
struct io_buffer iob 
)
static

Definition at line 500 of file ath9k_xmit.c.

503 {
504  struct ath_softc *sc = dev->priv;
505  struct ath_hw *ah = sc->sc_ah;
506  struct ath_buf *bf;
507  struct ath_desc *ds;
508  int frm_type;
509  static const enum ath9k_key_type net80211_keytype_to_ath[] = {
515  };
516 
517  bf = ath_tx_get_buffer(sc);
518  if (!bf) {
519  DBG("ath9k: TX buffers are full\n");
520  return NULL;
521  }
522 
523  ATH_TXBUF_RESET(bf);
524 
525  bf->bf_flags = setup_tx_flags(iob);
526  bf->bf_mpdu = iob;
527 
528  bf->bf_buf_addr = virt_to_bus(iob->data);
529 
530  frm_type = get_hw_packet_type(iob);
531 
532  ds = bf->bf_desc;
534 
536  ATH9K_TXKEYIX_INVALID, net80211_keytype_to_ath[dev->crypto->algorithm], bf->bf_flags);
537 
539  iob_len(iob), /* segment length */
540  1, /* first segment */
541  1, /* last segment */
542  ds, /* first descriptor */
543  bf->bf_buf_addr,
544  txq->axq_qnum);
545 
546 
547  return bf;
548 }
struct io_buffer * bf_mpdu
Definition: ath9k.h:225
Network protected with CCMP (AES-based system)
Definition: net80211.h:174
Definition: hw.h:657
void * bf_desc
Definition: ath9k.h:226
Dummy value used when the cryptosystem can't be detected.
Definition: net80211.h:177
static struct ath_buf * ath_tx_get_buffer(struct ath_softc *sc)
Definition: ath9k_xmit.c:85
#define ATH_TXBUF_RESET(_bf)
Definition: ath9k.h:74
static enum ath9k_pkt_type get_hw_packet_type(struct io_buffer *iob)
Definition: ath9k_xmit.c:383
Network protected with WEP (awful RC4-based system)
Definition: net80211.h:145
Definition: mac.h:241
struct net80211_device * dev
Definition: ath9k.h:446
u16 bf_flags
Definition: ath9k.h:230
enum net80211_crypto_alg algorithm
The cryptographic algorithm implemented.
Definition: net80211.h:692
static void ath9k_hw_set11n_txdesc(struct ath_hw *ah, void *ds, u32 pktLen, enum ath9k_pkt_type type, u32 txPower, u32 keyIx, enum ath9k_key_type keyType, u32 flags)
Definition: hw-ops.h:78
struct net80211_crypto * crypto
802.11 cryptosystem for our current network
Definition: net80211.h:940
static __always_inline unsigned long virt_to_bus(volatile const void *addr)
Convert virtual address to a bus address.
Definition: io.h:184
ath9k_key_type
Definition: mac.h:665
struct ath_hw * sc_ah
Definition: ath9k.h:455
u32 bf_buf_addr
Definition: ath9k.h:228
#define FCS_LEN
Definition: ath5k_desc.c:37
void * priv
Driver private data.
Definition: net80211.h:798
Definition: ath9k.h:220
static void ath9k_hw_filltxdesc(struct ath_hw *ah, void *ds, u32 seglen, int is_firstseg, int is_lastseg, const void *ds0, u32 buf_addr, unsigned int qcu)
Definition: hw-ops.h:63
static size_t iob_len(struct io_buffer *iobuf)
Calculate length of data in an I/O buffer.
Definition: iobuf.h:160
u32 axq_qnum
Definition: ath9k.h:183
No security, an "Open" network.
Definition: net80211.h:131
uint32_t ds
Definition: librm.h:140
static int setup_tx_flags(struct io_buffer *iob __unused)
Definition: ath9k_xmit.c:402
static void ath9k_hw_set_desc_link(struct ath_hw *ah, void *ds, u32 link)
Definition: hw-ops.h:39
void * data
Start of data.
Definition: iobuf.h:53
uint8_t ah
Definition: registers.h:85
Network protected with TKIP (better RC4-based system)
Definition: net80211.h:163
#define DBG(...)
Print a debugging message.
Definition: compiler.h:498
#define NULL
NULL pointer (VOID *)
Definition: Base.h:322
#define ATH9K_TXKEYIX_INVALID
Definition: mac.h:205
#define MAX_RATE_POWER
Definition: hw.h:145

References ah, net80211_crypto::algorithm, ath9k_hw_filltxdesc(), ath9k_hw_set11n_txdesc(), ath9k_hw_set_desc_link(), ATH9K_KEY_TYPE_AES, ATH9K_KEY_TYPE_CLEAR, ATH9K_KEY_TYPE_TKIP, ATH9K_KEY_TYPE_WEP, ATH9K_TXKEYIX_INVALID, ath_tx_get_buffer(), ATH_TXBUF_RESET, ath_txq::axq_qnum, ath_buf::bf_buf_addr, ath_buf::bf_desc, ath_buf::bf_flags, ath_buf::bf_mpdu, net80211_device::crypto, io_buffer::data, DBG, ath_softc::dev, ds, FCS_LEN, get_hw_packet_type(), iob_len(), MAX_RATE_POWER, NET80211_CRYPT_CCMP, NET80211_CRYPT_NONE, NET80211_CRYPT_TKIP, NET80211_CRYPT_UNKNOWN, NET80211_CRYPT_WEP, NULL, net80211_device::priv, ath_softc::sc_ah, setup_tx_flags(), and virt_to_bus().

Referenced by ath_tx_start().

◆ ath_tx_start_dma()

static void ath_tx_start_dma ( struct ath_softc sc,
struct ath_buf bf,
struct ath_tx_control txctl 
)
static

Definition at line 551 of file ath9k_xmit.c.

553 {
554  struct list_head bf_head;
555  struct ath_atx_tid *tid = NULL;
556 
557  INIT_LIST_HEAD(&bf_head);
558  list_add_tail(&bf->list, &bf_head);
559 
560  bf->bf_state.bfs_paprd = txctl->paprd;
561 
562  if (txctl->paprd)
564 
565  ath9k_hw_set_clrdmask(sc->sc_ah, bf->bf_desc, 1);
566 
567  ath_tx_send_normal(sc, txctl->txq, tid, &bf_head);
568 }
#define TICKS_PER_SEC
Number of ticks per second.
Definition: timer.h:16
static void ath9k_hw_set_clrdmask(struct ath_hw *ah, void *ds, int val)
Definition: hw-ops.h:122
void * bf_desc
Definition: ath9k.h:226
struct ath_buf_state bf_state
Definition: ath9k.h:231
struct ath_txq * txq
Definition: ath9k.h:267
u8 bfs_paprd
Definition: ath9k.h:216
struct ib_mad_tid tid
Definition: ib_mad.h:18
A doubly-linked list entry (or list head)
Definition: list.h:19
struct ath_hw * sc_ah
Definition: ath9k.h:455
unsigned long bfs_paprd_timestamp
Definition: ath9k.h:217
#define list_add_tail(new, head)
Add a new entry to the tail of a list.
Definition: list.h:94
struct list_head list
Definition: ath9k.h:221
static void ath_tx_send_normal(struct ath_softc *sc, struct ath_txq *txq, struct ath_atx_tid *tid, struct list_head *bf_head)
Definition: ath9k_xmit.c:365
#define INIT_LIST_HEAD(list)
Initialise a list head.
Definition: list.h:46
unsigned long currticks(void)
Get current system time in ticks.
Definition: timer.c:43
#define NULL
NULL pointer (VOID *)
Definition: Base.h:322

References ath9k_hw_set_clrdmask(), ath_tx_send_normal(), ath_buf::bf_desc, ath_buf::bf_state, ath_buf_state::bfs_paprd, ath_buf_state::bfs_paprd_timestamp, currticks(), INIT_LIST_HEAD, ath_buf::list, list_add_tail, NULL, ath_tx_control::paprd, ath_softc::sc_ah, TICKS_PER_SEC, tid, and ath_tx_control::txq.

Referenced by ath_tx_start().

◆ ath_tx_start()

int ath_tx_start ( struct net80211_device dev,
struct io_buffer iob,
struct ath_tx_control txctl 
)

Definition at line 571 of file ath9k_xmit.c.

573 {
574  struct ath_softc *sc = dev->priv;
575  struct ath_txq *txq = txctl->txq;
576  struct ath_buf *bf;
577  int q;
578 
579  /*
580  * At this point, the vif, hw_key and sta pointers in the tx control
581  * info are no longer valid (overwritten by the ath_frame_info data.
582  */
583 
584  bf = ath_tx_setup_buffer(dev, txctl->txq, iob);
585  if (!bf)
586  return -ENOMEM;
587 
588  q = 0;
589  if (txq == sc->tx.txq_map[q] &&
590  ++txq->pending_frames > ATH_MAX_QDEPTH && !txq->stopped) {
591  txq->stopped = 1;
592  }
593 
594  ath_tx_start_dma(sc, bf, txctl);
595 
596  return 0;
597 }
int pending_frames
Definition: ath9k.h:195
int stopped
Definition: ath9k.h:188
struct ath_txq * txq
Definition: ath9k.h:267
static void ath_tx_start_dma(struct ath_softc *sc, struct ath_buf *bf, struct ath_tx_control *txctl)
Definition: ath9k_xmit.c:551
struct net80211_device * dev
Definition: ath9k.h:446
#define ENOMEM
Not enough space.
Definition: errno.h:535
Definition: ath9k.h:181
void * priv
Driver private data.
Definition: net80211.h:798
Definition: ath9k.h:220
struct ath_tx tx
Definition: ath9k.h:477
#define ATH_MAX_QDEPTH
Definition: ath9k.h:126
struct ath_txq * txq_map[WME_NUM_AC]
Definition: ath9k.h:288
static struct ath_buf * ath_tx_setup_buffer(struct net80211_device *dev, struct ath_txq *txq, struct io_buffer *iob)
Definition: ath9k_xmit.c:500

References ATH_MAX_QDEPTH, ath_tx_setup_buffer(), ath_tx_start_dma(), ath_softc::dev, ENOMEM, ath_txq::pending_frames, net80211_device::priv, ath_txq::stopped, ath_softc::tx, ath_tx_control::txq, and ath_tx::txq_map.

Referenced by ath9k_tx().

◆ ath_tx_complete()

static void ath_tx_complete ( struct ath_softc sc,
struct io_buffer iob,
int tx_flags  __unused,
struct ath_tx_status ts,
struct ath_txq txq 
)
static

Definition at line 603 of file ath9k_xmit.c.

605 {
606  struct net80211_device *dev = sc->dev;
607  int q, padpos __unused, padsize __unused;
608 
609  DBGIO("ath9k: TX complete: iob: %p\n", iob);
610 
611  q = 0;
612  if (txq == sc->tx.txq_map[q]) {
613  if (--txq->pending_frames < 0)
614  txq->pending_frames = 0;
615 
616  if (txq->stopped && txq->pending_frames < ATH_MAX_QDEPTH) {
617  txq->stopped = 0;
618  }
619  }
620 
621  net80211_tx_complete(dev, iob, ts->ts_longretry,
622  (ts->ts_status & ATH9K_TXERR_MASK) ? EIO : 0);
623 }
u8 ts_longretry
Definition: mac.h:118
int pending_frames
Definition: ath9k.h:195
u8 ts_status
Definition: mac.h:114
int stopped
Definition: ath9k.h:188
#define ATH9K_TXERR_MASK
Definition: mac.h:90
struct net80211_device * dev
Definition: ath9k.h:446
#define __unused
Declare a variable or data structure as unused.
Definition: compiler.h:573
#define DBGIO(...)
Definition: compiler.h:549
Structure encapsulating the complete state of an 802.11 device.
Definition: net80211.h:786
struct ath_tx tx
Definition: ath9k.h:477
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 ATH_MAX_QDEPTH
Definition: ath9k.h:126
#define EIO
Input/output error.
Definition: errno.h:434
struct ath_txq * txq_map[WME_NUM_AC]
Definition: ath9k.h:288

References __unused, ATH9K_TXERR_MASK, ATH_MAX_QDEPTH, DBGIO, ath_softc::dev, EIO, net80211_tx_complete(), ath_txq::pending_frames, ath_txq::stopped, ath_tx_status::ts_longretry, ath_tx_status::ts_status, ath_softc::tx, and ath_tx::txq_map.

Referenced by ath_tx_complete_buf().

◆ ath_tx_processq()

static void ath_tx_processq ( struct ath_softc sc,
struct ath_txq txq 
)
static

Definition at line 658 of file ath9k_xmit.c.

659 {
660  struct ath_hw *ah = sc->sc_ah;
661  struct ath_buf *bf, *lastbf, *bf_held = NULL;
662  struct list_head bf_head;
663  struct ath_desc *ds;
664  struct ath_tx_status ts;
665  int txok;
666  int status;
667 
668  DBGIO("ath9k: tx queue %d (%x), link %p\n",
669  txq->axq_qnum, ath9k_hw_gettxbuf(sc->sc_ah, txq->axq_qnum),
670  txq->axq_link);
671 
672  for (;;) {
673  if (list_empty(&txq->axq_q)) {
674  txq->axq_link = NULL;
675  if (sc->sc_flags & SC_OP_TXAGGR)
676  ath_txq_schedule(sc, txq);
677  break;
678  }
679  bf = list_first_entry(&txq->axq_q, struct ath_buf, list);
680 
681  /*
682  * There is a race condition that a BH gets scheduled
683  * after sw writes TxE and before hw re-load the last
684  * descriptor to get the newly chained one.
685  * Software must keep the last DONE descriptor as a
686  * holding descriptor - software does so by marking
687  * it with the STALE flag.
688  */
689  bf_held = NULL;
690  if (bf->bf_stale) {
691  bf_held = bf;
692  if (list_is_last(&bf_held->list, &txq->axq_q)) {
693  break;
694  } else {
695  bf = list_entry(bf_held->list.next,
696  struct ath_buf, list);
697  }
698  }
699 
700  lastbf = bf->bf_lastbf;
701  ds = lastbf->bf_desc;
702 
703  memset(&ts, 0, sizeof(ts));
704  status = ath9k_hw_txprocdesc(ah, ds, &ts);
705  if (status == -EINPROGRESS) {
706  break;
707  }
708 
709  /*
710  * Remove ath_buf's of the same transmit unit from txq,
711  * however leave the last descriptor back as the holding
712  * descriptor for hw.
713  */
714  lastbf->bf_stale = 1;
715  INIT_LIST_HEAD(&bf_head);
716  if (!list_is_singular(&lastbf->list))
717  list_cut_position(&bf_head,
718  &txq->axq_q, lastbf->list.prev);
719 
720  txq->axq_depth--;
721  txok = !(ts.ts_status & ATH9K_TXERR_MASK);
722  txq->axq_tx_inprogress = 0;
723  if (bf_held)
724  list_del(&bf_held->list);
725 
726  if (bf_held)
727  ath_tx_return_buffer(sc, bf_held);
728 
729  /*
730  * This frame is sent out as a single frame.
731  * Use hardware retry status for this frame.
732  */
733  if (ts.ts_status & ATH9K_TXERR_XRETRY)
734  bf->bf_state.bf_type |= BUF_XRETRY;
735 
736  ath_tx_complete_buf(sc, bf, txq, &bf_head, &ts, txok, 0);
737 
738  if (sc->sc_flags & SC_OP_TXAGGR)
739  ath_txq_schedule(sc, txq);
740  }
741 }
Definition: hw.h:657
void * bf_desc
Definition: ath9k.h:226
struct ath_buf_state bf_state
Definition: ath9k.h:231
struct list_head * next
Next list entry.
Definition: list.h:21
u32 * axq_link
Definition: ath9k.h:184
#define ATH9K_TXERR_MASK
Definition: mac.h:90
u32 ath9k_hw_gettxbuf(struct ath_hw *ah, u32 q)
Definition: mac.h:241
struct list_head axq_q
Definition: ath9k.h:185
A doubly-linked list entry (or list head)
Definition: list.h:19
#define list_empty(list)
Test whether a list is empty.
Definition: list.h:137
#define list_first_entry(list, type, member)
Get the container of the first entry in a list.
Definition: list.h:334
#define list_del(list)
Delete an entry from a list.
Definition: list.h:120
static void ath_tx_complete_buf(struct ath_softc *sc, struct ath_buf *bf, struct ath_txq *txq, struct list_head *bf_q, struct ath_tx_status *ts, int txok, int sendbar)
Definition: ath9k_xmit.c:625
int bf_stale
Definition: ath9k.h:229
struct ath_hw * sc_ah
Definition: ath9k.h:455
#define DBGIO(...)
Definition: compiler.h:549
Definition: ath9k.h:220
#define EINPROGRESS
Operation in progress.
Definition: errno.h:419
u8 bf_type
Definition: ath9k.h:215
#define SC_OP_TXAGGR
Definition: ath9k.h:366
struct ath_buf * bf_lastbf
Definition: ath9k.h:222
struct list_head list
Definition: ath9k.h:221
u32 axq_qnum
Definition: ath9k.h:183
#define list_cut_position(new, list, entry)
Cut a list into two.
Definition: list.h:186
void ath_txq_schedule(struct ath_softc *sc __unused, struct ath_txq *txq)
Definition: ath9k_xmit.c:266
uint32_t ds
Definition: librm.h:140
u32 sc_flags
Definition: ath9k.h:466
uint8_t status
Status.
Definition: ena.h:16
static void ath_tx_return_buffer(struct ath_softc *sc, struct ath_buf *bf)
Definition: ath9k_xmit.c:99
#define INIT_LIST_HEAD(list)
Initialise a list head.
Definition: list.h:46
#define list_is_singular(list)
Test whether a list has just one entry.
Definition: list.h:150
u32 axq_depth
Definition: ath9k.h:186
struct list_head * prev
Previous list entry.
Definition: list.h:23
static int ath9k_hw_txprocdesc(struct ath_hw *ah, void *ds, struct ath_tx_status *ts)
Definition: hw-ops.h:72
uint8_t ah
Definition: registers.h:85
#define list_entry(list, type, member)
Get the container of a list entry.
Definition: list.h:322
#define ATH9K_TXERR_XRETRY
Definition: mac.h:84
#define list_is_last(list, head)
Test whether an entry is the last entry in list.
Definition: list.h:164
#define NULL
NULL pointer (VOID *)
Definition: Base.h:322
int axq_tx_inprogress
Definition: ath9k.h:189
void * memset(void *dest, int character, size_t len) __nonnull

References ah, ath9k_hw_gettxbuf(), ath9k_hw_txprocdesc(), ATH9K_TXERR_MASK, ATH9K_TXERR_XRETRY, ath_tx_complete_buf(), ath_tx_return_buffer(), ath_txq_schedule(), ath_txq::axq_depth, ath_txq::axq_link, ath_txq::axq_q, ath_txq::axq_qnum, ath_txq::axq_tx_inprogress, ath_buf::bf_desc, ath_buf::bf_lastbf, ath_buf::bf_stale, ath_buf::bf_state, ath_buf_state::bf_type, BUF_XRETRY, DBGIO, ds, EINPROGRESS, INIT_LIST_HEAD, ath_buf::list, list_cut_position, list_del, list_empty, list_entry, list_first_entry, list_is_last, list_is_singular, memset(), list_head::next, NULL, list_head::prev, ath_softc::sc_ah, ath_softc::sc_flags, SC_OP_TXAGGR, status, and ath_tx_status::ts_status.

Referenced by ath_tx_tasklet().

◆ ath_tx_complete_poll_work()

static void ath_tx_complete_poll_work ( struct ath_softc sc)
static

Definition at line 743 of file ath9k_xmit.c.

744 {
745  struct ath_txq *txq;
746  int i;
747  int needreset = 0;
748 
749  for (i = 0; i < ATH9K_NUM_TX_QUEUES; i++)
750  if (ATH_TXQ_SETUP(sc, i)) {
751  txq = &sc->tx.txq[i];
752  if (txq->axq_depth) {
753  if (txq->axq_tx_inprogress) {
754  needreset = 1;
755  break;
756  } else {
757  txq->axq_tx_inprogress = 1;
758  }
759  }
760  }
761 
762  if (needreset) {
763  DBG("ath9k: "
764  "tx hung, resetting the chip\n");
765  ath_reset(sc, 1);
766  }
767 
769 }
#define TICKS_PER_SEC
Number of ticks per second.
Definition: timer.h:16
unsigned long tx_complete_work_timer
Definition: ath9k.h:486
#define ATH_TXQ_SETUP(sc, i)
Definition: ath9k.h:63
struct ath_txq txq[ATH9K_NUM_TX_QUEUES]
Definition: ath9k.h:286
Definition: ath9k.h:181
#define ATH_TX_COMPLETE_POLL_INT
Definition: ath9k.h:172
#define ATH9K_NUM_TX_QUEUES
Definition: mac.h:581
struct ath_tx tx
Definition: ath9k.h:477
int ath_reset(struct ath_softc *sc, int retry_tx)
Definition: ath9k_main.c:513
u32 axq_depth
Definition: ath9k.h:186
unsigned long currticks(void)
Get current system time in ticks.
Definition: timer.c:43
#define DBG(...)
Print a debugging message.
Definition: compiler.h:498
int axq_tx_inprogress
Definition: ath9k.h:189

References ATH9K_NUM_TX_QUEUES, ath_reset(), ATH_TX_COMPLETE_POLL_INT, ATH_TXQ_SETUP, ath_txq::axq_depth, ath_txq::axq_tx_inprogress, currticks(), DBG, TICKS_PER_SEC, ath_softc::tx, ath_softc::tx_complete_work_timer, and ath_tx::txq.

Referenced by ath_tx_init().

◆ ath_tx_tasklet()

void ath_tx_tasklet ( struct ath_softc sc)

Definition at line 773 of file ath9k_xmit.c.

774 {
775  int i;
776  u32 qcumask = ((1 << ATH9K_NUM_TX_QUEUES) - 1);
777 
778  ath9k_hw_gettxintrtxqs(sc->sc_ah, &qcumask);
779 
780  for (i = 0; i < ATH9K_NUM_TX_QUEUES; i++) {
781  if (ATH_TXQ_SETUP(sc, i) && (qcumask & (1 << i)))
782  ath_tx_processq(sc, &sc->tx.txq[i]);
783  }
784 }
#define ATH_TXQ_SETUP(sc, i)
Definition: ath9k.h:63
struct ath_txq txq[ATH9K_NUM_TX_QUEUES]
Definition: ath9k.h:286
struct ath_hw * sc_ah
Definition: ath9k.h:455
void ath9k_hw_gettxintrtxqs(struct ath_hw *ah, u32 *txqs)
Definition: ath9k_mac.c:158
static void ath_tx_processq(struct ath_softc *sc, struct ath_txq *txq)
Definition: ath9k_xmit.c:658
#define ATH9K_NUM_TX_QUEUES
Definition: mac.h:581
struct ath_tx tx
Definition: ath9k.h:477
uint32_t u32
Definition: stdint.h:24

References ath9k_hw_gettxintrtxqs(), ATH9K_NUM_TX_QUEUES, ath_tx_processq(), ATH_TXQ_SETUP, ath_softc::sc_ah, ath_softc::tx, and ath_tx::txq.

Referenced by ath9k_tasklet().

◆ ath_tx_init()

int ath_tx_init ( struct ath_softc sc,
int  nbufs 
)

Definition at line 790 of file ath9k_xmit.c.

791 {
792  int error = 0;
793 
794  error = ath_descdma_setup(sc, &sc->tx.txdma, &sc->tx.txbuf,
795  "tx", nbufs, 1, 1);
796  if (error != 0) {
797  DBG("ath9k: "
798  "Failed to allocate tx descriptors: %d\n", error);
799  goto err;
800  }
801 
803 
804 err:
805  if (error != 0)
806  ath_tx_cleanup(sc);
807 
808  return error;
809 }
struct ath_descdma txdma
Definition: ath9k.h:287
struct arbelprm_completion_with_error error
Definition: arbel.h:12
int ath_descdma_setup(struct ath_softc *sc, struct ath_descdma *dd, struct list_head *head, const char *name, int nbuf, int ndesc, int is_tx)
Definition: ath9k_init.c:181
void(* tx_complete_work)(struct ath_softc *sc)
Definition: ath9k.h:485
static void ath_tx_complete_poll_work(struct ath_softc *sc)
Definition: ath9k_xmit.c:743
void ath_tx_cleanup(struct ath_softc *sc)
Definition: ath9k_xmit.c:811
struct ath_tx tx
Definition: ath9k.h:477
struct list_head txbuf
Definition: ath9k.h:285
#define DBG(...)
Print a debugging message.
Definition: compiler.h:498

References ath_descdma_setup(), ath_tx_cleanup(), ath_tx_complete_poll_work(), DBG, error, ath_softc::tx, ath_softc::tx_complete_work, ath_tx::txbuf, and ath_tx::txdma.

Referenced by ath9k_init_device().

◆ ath_tx_cleanup()

void ath_tx_cleanup ( struct ath_softc sc)

Definition at line 811 of file ath9k_xmit.c.

812 {
813  if (sc->tx.txdma.dd_desc_len != 0)
814  ath_descdma_cleanup(sc, &sc->tx.txdma, &sc->tx.txbuf);
815 }
struct ath_descdma txdma
Definition: ath9k.h:287
void ath_descdma_cleanup(struct ath_softc *sc, struct ath_descdma *dd, struct list_head *head)
struct ath_tx tx
Definition: ath9k.h:477
struct list_head txbuf
Definition: ath9k.h:285
u32 dd_desc_len
Definition: ath9k.h:109

References ath_descdma_cleanup(), ath_descdma::dd_desc_len, ath_softc::tx, ath_tx::txbuf, and ath_tx::txdma.

Referenced by ath9k_deinit_device(), ath9k_init_device(), and ath_tx_init().