ath9k: remove bfs_seqno from struct ath_buf_state
PATCH 6/13 ath9k: remove bfs_al from struct ath_buf_state
In reply to Felix Fietkau--- drivers/net/wireless/ath/ath9k/ath9k.h | 4 +-- drivers/net/wireless/ath/ath9k/xmit.c | 34 ++++++++++++++++---------------- 2 files changed, 18 insertions(+), 20 deletions(-)
drivers/net/wireless/ath/ath9k/ath9k.h +1 -3
@@ -102,7 +102,6 @@ enum buffer_type { };#define bf_nframes bf_state.bfs_nframes -#define bf_al bf_state.bfs_al#define bf_frmlen bf_state.bfs_frmlen#define bf_retries bf_state.bfs_retries#define bf_isht (bf) (bf->bf_state.bf_type & BUF_HT)
@@ -215,11 +214,10 @@ struct ath_atx_ac {struct ath_buf_state {int bfs_nframes; -u16 bfs_al; -u16 bfs_frmlen;int bfs_retries;u8 bf_type;u8 bfs_paprd; +u16 bfs_frmlen;enum ath9k_internal_frame_type bfs_ftype; };
drivers/net/wireless/ath/ath9k/xmit.c +17 -17
@@ -56,7 +56,7 @@ static void ath_tx_complete_buf(struct ath_softc *sc, struct ath_buf *bf, 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); +static void ath_buf_set_rate (struct ath_softc *sc,struct ath_buf *bf,int len);static int ath_tx_num_badfrms (struct ath_softc *sc,struct ath_buf *bf,struct ath_tx_status *ts,int txok); static void ath_tx_rc_status(struct ath_buf *bf, struct ath_tx_status *ts,
@@ -674,7 +674,8 @@ static int ath_compute_num_delims(struct ath_softc *sc, struct ath_atx_tid *tid,static enum ATH_AGGR_STATUS ath_tx_form_aggr (struct ath_softc *sc,struct ath_txq *txq,struct ath_atx_tid *tid, -struct list_head *bf_q) +struct list_head *bf_q, +int *aggr_len) {#define PADBYTES (_len) ((4 - ((_len) % 4)) % 4)struct ath_buf *bf, *bf_first, *bf_prev =NULL ;
@@ -750,7 +751,7 @@ static enum ATH_AGGR_STATUS ath_tx_form_aggr(struct ath_softc *sc, }while (!list_empty (&tid->buf_q)); - bf_first->bf_al = al; + *aggr_len = al; bf_first->bf_nframes = nframes;return status;
@@ -763,6 +764,7 @@ static void ath_tx_sched_aggr(struct ath_softc *sc, struct ath_txq *txq,struct ath_buf *bf;enum ATH_AGGR_STATUS status;struct list_head bf_q; +int aggr_len; do { if (list_empty(&tid->buf_q))
@@ -770,7 +772,7 @@ static void ath_tx_sched_aggr(struct ath_softc *sc, struct ath_txq *txq,INIT_LIST_HEAD (&bf_q); - status =ath_tx_form_aggr (sc, txq, tid, &bf_q); + status =ath_tx_form_aggr (sc, txq, tid, &bf_q, &aggr_len);/* * no frames picked up to be aggregated;
@@ -786,15 +788,15 @@ static void ath_tx_sched_aggr(struct ath_softc *sc, struct ath_txq *txq,if (bf->bf_nframes ==1 ) { bf->bf_state.bf_type &= ~BUF_AGGR ;ath9k_hw_clr11n_aggr (sc->sc_ah, bf->bf_desc); -ath_buf_set_rate (sc, bf); +ath_buf_set_rate (sc, bf, bf->bf_frmlen);ath_tx_txqaddbuf (sc, txq, &bf_q);continue ; }/* setup first desc of aggregate */ bf->bf_state.bf_type |=BUF_AGGR ; -ath_buf_set_rate (sc, bf); -ath9k_hw_set11n_aggr_first (sc->sc_ah, bf->bf_desc, bf->bf_al); +ath_buf_set_rate (sc, bf, aggr_len); +ath9k_hw_set11n_aggr_first (sc->sc_ah, bf->bf_desc, aggr_len);/* anchor last desc of aggregate */ ath9k_hw_set11n_aggr_last (sc->sc_ah, bf->bf_lastbf->bf_desc);
@@ -1333,7 +1335,7 @@ static void ath_tx_send_ampdu(struct ath_softc *sc, struct ath_atx_tid *tid,/* Queue to h/w without aggregation */ bf->bf_nframes =1 ; bf->bf_lastbf = bf; -ath_buf_set_rate (sc, bf); +ath_buf_set_rate (sc, bf, bf->bf_frmlen);ath_tx_txqaddbuf (sc, txctl->txq, bf_head); }
@@ -1352,7 +1354,7 @@ static void ath_tx_send_normal(struct ath_softc *sc, struct ath_txq *txq, bf->bf_nframes =1 ; bf->bf_lastbf = bf; -ath_buf_set_rate (sc, bf); +ath_buf_set_rate (sc, bf, bf->bf_frmlen);ath_tx_txqaddbuf (sc, txq, bf_head);TX_STAT_INC (txq->axq_qnum, queued); }
@@ -1430,13 +1432,11 @@ static int setup_tx_flags(struct sk_buff *skb)* width - 0 for 20 MHz, 1 for 40 MHz * half_gi - to use 4us v/s 3.6 us for symbol time */ -static u32 ath_pkt_duration (struct ath_softc *sc,u8 rix,struct ath_buf *bf, +static u32 ath_pkt_duration (struct ath_softc *sc,u8 rix,int pktlen,int width,int half_gi,bool shortPreamble) {u32 nbits, nsymbits, duration, nsymbols; -int streams, pktlen; - - pktlen =bf_isaggr (bf) ? bf->bf_al : bf->bf_frmlen; +int streams;/* find number of symbols: PLCP + data */ streams =HT_RC_2_STREAMS (rix);
@@ -1455,7 +1455,7 @@ static u32 ath_pkt_duration(struct ath_softc *sc, u8 rix, struct ath_buf *bf,return duration; } -static void ath_buf_set_rate (struct ath_softc *sc,struct ath_buf *bf) +static void ath_buf_set_rate (struct ath_softc *sc,struct ath_buf *bf,int len) {struct ath_common *common =ath9k_hw_common (sc->sc_ah);struct ath9k_11n_rate_series series[4 ];
@@ -1518,7 +1518,7 @@ static void ath_buf_set_rate(struct ath_softc *sc, struct ath_buf *bf)if (rates[i].flags &IEEE80211_TX_RC_MCS ) {/* MCS rates */ series[i].Rate = rix |0x80 ; - series[i].PktDuration =ath_pkt_duration (sc, rix, bf, + series[i].PktDuration =ath_pkt_duration (sc, rix, len, is_40, is_sgi, is_sp);if (rix <8 && (tx_info->flags &IEEE80211_TX_CTL_STBC )) series[i].RateFlags |=ATH9K_RATESERIES_STBC ;
@@ -1542,11 +1542,11 @@ static void ath_buf_set_rate(struct ath_softc *sc, struct ath_buf *bf) } series[i].PktDuration =ath9k_hw_computetxtime (sc->sc_ah, - phy, rate->bitrate *100 , bf->bf_frmlen, rix, is_sp); + phy, rate->bitrate *100 , len, rix, is_sp); }/* For AR5416 - RTS cannot be followed by a frame larger than 8K */ -if (bf_isaggr (bf) && (bf->bf_al > sc->sc_ah->caps.rts_aggr_limit)) +if (bf_isaggr (bf) && (len > sc->sc_ah->caps.rts_aggr_limit)) flags &= ~ATH9K_TXDESC_RTSENA ;/* ATH9K_TXDESC_RTSENA and ATH9K_TXDESC_CTSENA are mutually exclusive. */
Signature · 1 line
1.7.3.2
PATCH 7/13 ath9k: remove bfs_nframes from struct ath_buf_state
--- drivers/net/wireless/ath/ath9k/ath9k.h | 2 - drivers/net/wireless/ath/ath9k/xmit.c | 97 +++++++++++++++---------------- 2 files changed, 47 insertions(+), 52 deletions(-)
drivers/net/wireless/ath/ath9k/ath9k.h +0 -2
@@ -101,7 +101,6 @@ enum buffer_type { BUF_XRETRY = BIT(5), }; -#define bf_nframes bf_state.bfs_nframes#define bf_frmlen bf_state.bfs_frmlen#define bf_retries bf_state.bfs_retries#define bf_isht (bf) (bf->bf_state.bf_type & BUF_HT)
@@ -213,7 +212,6 @@ struct ath_atx_ac { };struct ath_buf_state { -int bfs_nframes;int bfs_retries;u8 bf_type;u8 bfs_paprd;
drivers/net/wireless/ath/ath9k/xmit.c +47 -50
192 lines not on this page · raw message
Signature · 1 line
1.7.3.2
PATCH 12/13 ath9k: more tx setup cleanups
In reply to Felix Fietkau- remove the BUF_HT flag, and instead check for IEEE80211_TX_CTL_AMPDU before calling ath_tx_send_ampdu.
- remove a few unused variables
- calculate frame length before adding the frame padding
- merge the misnamed ath_tx_start_dma function into ath_tx_start
- remove an unused argument for assign_aggr_tid_seqno
--- drivers/net/wireless/ath/ath9k/ath9k.h | 4 +- drivers/net/wireless/ath/ath9k/xmit.c | 129 ++++++++++++++----------------- 2 files changed, 59 insertions(+), 74 deletions(-)
drivers/net/wireless/ath/ath9k/ath9k.h +1 -3
@@ -86,7 +86,6 @@ struct ath_config {/** * enum buffer_type - Buffer type flags * -* @BUF_HT: Send this buffer using HT capabilities * @BUF_AMPDU: This buffer is an ampdu, as part of an aggregate (during TX) * @BUF_AGGR: Indicates whether the buffer can be aggregated * (used in aggregation scheduling)
@@ -94,7 +93,6 @@ struct ath_config {* @BUF_XRETRY: To denote excessive retries of the buffer */ enum buffer_type { -BUF_HT =BIT (1 ),BUF_AMPDU =BIT (2 ),BUF_AGGR =BIT (3 ),BUF_RETRY =BIT (4 ),
@@ -102,7 +100,6 @@ enum buffer_type { };#define bf_retries bf_state.bfs_retries -#define bf_isht (bf) (bf->bf_state.bf_type & BUF_HT)#define bf_isampdu (bf) (bf->bf_state.bf_type & BUF_AMPDU)#define bf_isaggr (bf) (bf->bf_state.bf_type & BUF_AGGR)#define bf_isretried (bf) (bf->bf_state.bf_type & BUF_RETRY)
@@ -265,6 +262,7 @@ struct ath_tx_control {struct ath_txq *txq;int if_id;enum ath9k_internal_frame_type frame_type; +int frmlen;u8 paprd; };
drivers/net/wireless/ath/ath9k/xmit.c +58 -71
229 lines not on this page · raw message
Signature · 1 line
1.7.3.2
PATCH 2/13 ath9k: remove bfs_tidno from struct ath_buf_state
In reply to Felix Fietkau--- drivers/net/wireless/ath/ath9k/ath9k.h | 2 -- drivers/net/wireless/ath/ath9k/xmit.c | 25 +++++++++++++------------ 2 files changed, 13 insertions(+), 14 deletions(-)
drivers/net/wireless/ath/ath9k/ath9k.h +0 -2
@@ -105,7 +105,6 @@ enum buffer_type {#define bf_al bf_state.bfs_al#define bf_frmlen bf_state.bfs_frmlen#define bf_retries bf_state.bfs_retries -#define bf_tidno bf_state.bfs_tidno#define bf_keyix bf_state.bfs_keyix#define bf_keytype bf_state.bfs_keytype#define bf_isht (bf) (bf->bf_state.bf_type & BUF_HT)
@@ -220,7 +219,6 @@ struct ath_buf_state {int bfs_nframes;u16 bfs_al;u16 bfs_frmlen; -int bfs_tidno;int bfs_retries;u8 bf_type;u8 bfs_paprd;
drivers/net/wireless/ath/ath9k/xmit.c +13 -12
@@ -323,6 +323,7 @@ static void ath_tx_complete_aggr(struct ath_softc *sc, struct ath_txq *txq,struct ieee80211_tx_rate rates[4 ];u16 bf_seqno;int nframes; +u8 tidno; skb = bf->bf_mpdu; hdr = (struct ieee80211_hdr *)skb->data;
@@ -358,14 +359,15 @@ static void ath_tx_complete_aggr(struct ath_softc *sc, struct ath_txq *txq, } an = (struct ath_node *)sta->drv_priv; - tid =ATH_AN_2_TID (an, bf->bf_tidno); + tidno =ieee80211_get_qos_ctl (hdr)[0 ] &IEEE80211_QOS_CTL_TID_MASK ; + tid =ATH_AN_2_TID (an, tidno);/* * The hardware occasionally sends a tx status for the wrong TID. * In this case, the BA status cannot be considered valid and all * subframes need to be retransmitted */ -if (bf->bf_tidno != ts->tid) +if (tidno != ts->tid) txok = false; isaggr =bf_isaggr (bf);
@@ -1386,7 +1388,7 @@ static void assign_aggr_tid_seqno(struct sk_buff *skb,struct ath_node *an;struct ath_atx_tid *tid;__le16 fc; -u8 *qc; +u8 tidno;if (!tx_info->control.sta)return ;
@@ -1394,18 +1396,13 @@ static void assign_aggr_tid_seqno(struct sk_buff *skb, an = (struct ath_node *)tx_info->control.sta->drv_priv; hdr = (struct ieee80211_hdr *)skb->data; fc = hdr->frame_control; - -if (ieee80211_is_data_qos (fc)) { - qc =ieee80211_get_qos_ctl (hdr); - bf->bf_tidno = qc[0 ] &0xf ; - } + tidno =ieee80211_get_qos_ctl (hdr)[0 ] &IEEE80211_QOS_CTL_TID_MASK ;/* -* For HT capable stations, we save tidno for later use. -* We also override seqno set by upper layer with the one +* Override seqno set by upper layer with the one * in tx aggregation state. */ - tid =ATH_AN_2_TID (an, bf->bf_tidno); + tid =ATH_AN_2_TID (an, tidno); hdr->seq_ctrl =cpu_to_le16 (tid->seq_next <<IEEE80211_SEQ_SEQ_SHIFT );INCR (tid->seq_next,IEEE80211_SEQ_MAX ); }
@@ -1647,6 +1644,7 @@ static void ath_tx_start_dma(struct ath_softc *sc, struct ath_buf *bf,struct ath_hw *ah = sc->sc_ah;int frm_type;__le16 fc; +u8 tidno; frm_type =get_hw_packet_type (skb); fc = hdr->frame_control;
@@ -1673,7 +1671,10 @@ static void ath_tx_start_dma(struct ath_softc *sc, struct ath_buf *bf,if (bf_isht (bf) && (sc->sc_flags &SC_OP_TXAGGR ) && tx_info->control.sta) { an = (struct ath_node *)tx_info->control.sta->drv_priv; - tid =ATH_AN_2_TID (an, bf->bf_tidno); + tidno =ieee80211_get_qos_ctl (hdr)[0 ] & +IEEE80211_QOS_CTL_TID_MASK ; + tid =ATH_AN_2_TID (an, tidno); +WARN_ON (tid->ac->txq != txctl->txq);if (tx_info->flags &IEEE80211_TX_CTL_AMPDU ) {
Signature · 1 line
1.7.3.2
PATCH 4/13 ath9k: remove bfs_paprd_timestamp from struct ath_buf_state
In reply to Felix Fietkau--- drivers/net/wireless/ath/ath9k/ath9k.h | 2 +- drivers/net/wireless/ath/ath9k/main.c | 2 ++ drivers/net/wireless/ath/ath9k/xmit.c | 7 +------ 3 files changed, 4 insertions(+), 7 deletions(-)
drivers/net/wireless/ath/ath9k/ath9k.h +1 -1
@@ -221,7 +221,6 @@ struct ath_buf_state {int bfs_retries;u8 bf_type;u8 bfs_paprd; -unsigned long bfs_paprd_timestamp;u32 bfs_keyix;enum ath9k_internal_frame_type bfs_ftype; };
@@ -598,6 +597,7 @@ struct ath_softc {struct work_struct paprd_work;struct work_struct hw_check_work;struct completion paprd_complete; +bool paprd_pending;u32 intrstatus;u32 sc_flags;/* SC_OP_* */
drivers/net/wireless/ath/ath9k/main.c +2 -0
@@ -380,6 +380,7 @@ void ath_paprd_calibrate(struct work_struct *work) }init_completion (&sc->paprd_complete); + sc->paprd_pending = true;ar9003_paprd_setup_gain_table (ah, chain); txctl.paprd =BIT (chain);if (ath_tx_start (hw, skb, &txctl) !=0 )
@@ -387,6 +388,7 @@ void ath_paprd_calibrate(struct work_struct *work) time_left =wait_for_completion_timeout (&sc->paprd_complete,msecs_to_jiffies (ATH_PAPRD_TIMEOUT )); + sc->paprd_pending = false;if (!time_left) {ath_print (ath9k_hw_common (ah),ATH_DBG_CALIBRATE , "Timeout waiting for paprd training on "
drivers/net/wireless/ath/ath9k/xmit.c +1 -6
@@ -1698,9 +1698,6 @@ static void ath_tx_start_dma(struct ath_softc *sc, struct ath_buf *bf,if (bf->bf_state.bfs_paprd)ar9003_hw_set_paprd_txdesc (ah, ds, bf->bf_state.bfs_paprd); -if (txctl->paprd) - bf->bf_state.bfs_paprd_timestamp = jiffies; -ath_tx_send_normal (sc, txctl->txq,NULL , &bf_head); }
@@ -1874,9 +1871,7 @@ static void ath_tx_complete_buf(struct ath_softc *sc, struct ath_buf *bf, bf->bf_buf_addr =0 ;if (bf->bf_state.bfs_paprd) { -if (time_after (jiffies, - bf->bf_state.bfs_paprd_timestamp + -msecs_to_jiffies (ATH_PAPRD_TIMEOUT ))) +if (!sc->paprd_pending)dev_kfree_skb_any (skb);else complete (&sc->paprd_complete);
Signature · 1 line
1.7.3.2
PATCH 5/13 ath9k: remove bfs_keyix from struct ath_buf_state
--- drivers/net/wireless/ath/ath9k/ath9k.h | 2 -- drivers/net/wireless/ath/ath9k/xmit.c | 14 ++++++++------ 2 files changed, 8 insertions(+), 8 deletions(-)
drivers/net/wireless/ath/ath9k/ath9k.h +0 -2
@@ -105,7 +105,6 @@ enum buffer_type {#define bf_al bf_state.bfs_al#define bf_frmlen bf_state.bfs_frmlen#define bf_retries bf_state.bfs_retries -#define bf_keyix bf_state.bfs_keyix#define bf_isht (bf) (bf->bf_state.bf_type & BUF_HT)#define bf_isampdu (bf) (bf->bf_state.bf_type & BUF_AMPDU)#define bf_isaggr (bf) (bf->bf_state.bf_type & BUF_AGGR)
@@ -221,7 +220,6 @@ struct ath_buf_state {int bfs_retries;u8 bf_type;u8 bfs_paprd; -u32 bfs_keyix;enum ath9k_internal_frame_type bfs_ftype; };
drivers/net/wireless/ath/ath9k/xmit.c +8 -6
@@ -1604,12 +1604,8 @@ static struct ath_buf *ath_tx_setup_buffer(struct ieee80211_hw *hw, bf->bf_flags =setup_tx_flags (skb); -if (tx_info->control.hw_key) { +if (tx_info->control.hw_key) bf->bf_frmlen += tx_info->control.hw_key->icv_len; - bf->bf_keyix = tx_info->control.hw_key->hw_key_idx; - }else { - bf->bf_keyix =ATH9K_TXKEYIX_INVALID ; - } bf->bf_mpdu = skb;
@@ -1642,6 +1638,7 @@ static void ath_tx_start_dma(struct ath_softc *sc, struct ath_buf *bf,struct ath_atx_tid *tid;struct ath_hw *ah = sc->sc_ah;enum ath9k_key_type keytype; +u32 keyix;int frm_type;__le16 fc;u8 tidno;
@@ -1656,8 +1653,13 @@ static void ath_tx_start_dma(struct ath_softc *sc, struct ath_buf *bf,ath9k_hw_set_desc_link (ah, ds,0 ); keytype =ath9k_cmn_get_hw_crypto_keytype (skb); +if (tx_info->control.hw_key) + keyix = tx_info->control.hw_key->hw_key_idx; +else + keyix =ATH9K_TXKEYIX_INVALID ; +ath9k_hw_set11n_txdesc (ah, ds, bf->bf_frmlen, frm_type,MAX_RATE_POWER , - bf->bf_keyix, keytype, bf->bf_flags); + keyix, keytype, bf->bf_flags); ath9k_hw_filltxdesc(ah, ds, skb->len, /* segment length */
Signature · 1 line
1.7.3.2
PATCH 11/13 ath9k: block new AMPDU sessions if SC_OP_TXAGGR is not set
In reply to Felix FietkauThis makes further tx path cleanups easier
--- drivers/net/wireless/ath/ath9k/main.c | 3 +++ 1 files changed, 3 insertions(+), 0 deletions(-)
drivers/net/wireless/ath/ath9k/main.c +3 -0
@@ -1992,6 +1992,9 @@ static int ath9k_ampdu_action(struct ieee80211_hw *hw,case IEEE80211_AMPDU_RX_STOP :break ;case IEEE80211_AMPDU_TX_START : +if (!(sc->sc_flags &SC_OP_TXAGGR )) +return -EOPNOTSUPP ; +ath9k_ps_wakeup (sc); ret =ath_tx_aggr_start (sc, sta, tid, ssn);if (!ret)
Signature · 1 line
1.7.3.2
PATCH 8/13 ath9k: remove bfs_frmlen from struct ath_buf_state
In reply to Felix Fietkau--- drivers/net/wireless/ath/ath9k/ath9k.h | 2 - drivers/net/wireless/ath/ath9k/xmit.c | 63 +++++++++++++++++++------------- 2 files changed, 38 insertions(+), 27 deletions(-)
drivers/net/wireless/ath/ath9k/ath9k.h +0 -2
@@ -101,7 +101,6 @@ enum buffer_type { BUF_XRETRY = BIT(5), }; -#define bf_frmlen bf_state.bfs_frmlen#define bf_retries bf_state.bfs_retries#define bf_isht (bf) (bf->bf_state.bf_type & BUF_HT)#define bf_isampdu (bf) (bf->bf_state.bf_type & BUF_AMPDU)
@@ -215,7 +214,6 @@ struct ath_buf_state {int bfs_retries;u8 bf_type;u8 bfs_paprd; -u16 bfs_frmlen;enum ath9k_internal_frame_type bfs_ftype; };
drivers/net/wireless/ath/ath9k/xmit.c +38 -25
179 lines not on this page · raw message
Signature · 1 line
1.7.3.2
PATCH 9/13 ath9k: remove bf_tx_aborted from struct ath_buf
--- drivers/net/wireless/ath/ath9k/ath9k.h | 1 - drivers/net/wireless/ath/ath9k/xmit.c | 23 +++++++++-------------- 2 files changed, 9 insertions(+), 15 deletions(-)
drivers/net/wireless/ath/ath9k/ath9k.h +0 -1
@@ -227,7 +227,6 @@ struct ath_buf {dma_addr_t bf_daddr;/* physical addr of desc */ dma_addr_t bf_buf_addr;/* physical addr of data buffer, for DMA */ bool bf_stale; -bool bf_tx_aborted;u16 bf_flags;struct ath_buf_state bf_state;struct ath_wiphy *aphy;
drivers/net/wireless/ath/ath9k/xmit.c +9 -14
@@ -334,9 +334,6 @@ static void ath_tx_count_frames(struct ath_softc *sc, struct ath_buf *bf, *nbad =0 ; *nframes =0 ; -if (bf->bf_lastbf->bf_tx_aborted) -return ; - isaggr =bf_isaggr (bf);if (isaggr) { seq_st = ts->ts_seqnum;
@@ -357,7 +354,7 @@ static void ath_tx_count_frames(struct ath_softc *sc, struct ath_buf *bf,static void ath_tx_complete_aggr (struct ath_softc *sc,struct ath_txq *txq,struct ath_buf *bf,struct list_head *bf_q, -struct ath_tx_status *ts,int txok) +struct ath_tx_status *ts,int txok,bool retry) {struct ath_node *an =NULL ;struct sk_buff *skb;
@@ -461,8 +458,7 @@ static void ath_tx_complete_aggr(struct ath_softc *sc, struct ath_txq *txq,/* transmit completion */ acked_cnt++; }else { -if (!(tid->state &AGGR_CLEANUP ) && - !bf_last->bf_tx_aborted) { +if (!(tid->state &AGGR_CLEANUP ) && retry) {if (bf->bf_retries <ATH_MAX_SW_RETRIES ) {ath_tx_set_retry (sc, txq, bf); txpending =1 ;
@@ -1132,8 +1128,6 @@ void ath_draintxq(struct ath_softc *sc, struct ath_txq *txq, bool retry_tx) } lastbf = bf->bf_lastbf; -if (!retry_tx) - lastbf->bf_tx_aborted = true;if (sc->sc_ah->caps.hw_caps &ATH9K_HW_CAP_EDMA ) { list_cut_position(&bf_head,
@@ -1150,7 +1144,8 @@ void ath_draintxq(struct ath_softc *sc, struct ath_txq *txq, bool retry_tx)spin_unlock_bh (&txq->axq_lock);if (bf_isampdu (bf)) -ath_tx_complete_aggr (sc, txq, bf, &bf_head, &ts,0 ); +ath_tx_complete_aggr (sc, txq, bf, &bf_head, &ts,0 , + retry_tx);else ath_tx_complete_buf (sc, bf, txq, &bf_head, &ts,0 ,0 ); }
@@ -1171,7 +1166,7 @@ void ath_draintxq(struct ath_softc *sc, struct ath_txq *txq, bool retry_tx)if (bf_isampdu (bf))ath_tx_complete_aggr (sc, txq, bf, &bf_head, - &ts,0 ); + &ts,0 , retry_tx);else ath_tx_complete_buf (sc, bf, txq, &bf_head, &ts,0 ,0 );
@@ -1657,8 +1652,6 @@ static struct ath_buf *ath_tx_setup_buffer(struct ieee80211_hw *hw,return NULL ; } - bf->bf_tx_aborted = false; -return bf; }
@@ -2094,7 +2087,8 @@ static void ath_tx_processq(struct ath_softc *sc, struct ath_txq *txq) qnum =skb_get_queue_mapping (bf->bf_mpdu);if (bf_isampdu (bf)) -ath_tx_complete_aggr (sc, txq, bf, &bf_head, &ts, txok); +ath_tx_complete_aggr (sc, txq, bf, &bf_head, &ts, txok, + true);else ath_tx_complete_buf (sc, bf, txq, &bf_head, &ts, txok,0 );
@@ -2216,7 +2210,8 @@ void ath_tx_edma_tasklet(struct ath_softc *sc) qnum =skb_get_queue_mapping (bf->bf_mpdu);if (bf_isampdu (bf)) -ath_tx_complete_aggr (sc, txq, bf, &bf_head, &txs, txok); +ath_tx_complete_aggr (sc, txq, bf, &bf_head, &txs, + txok, true);else ath_tx_complete_buf (sc, bf, txq, &bf_head, &txs, txok,0 );
Signature · 1 line
1.7.3.2
PATCH 10/13 ath9k: clean up code duplication around ath_tx_start
Merge initial processing for the CAB queue and regular tx. Also move ath_tx_cabq() to beacon.c and make it static.
--- drivers/net/wireless/ath/ath9k/ath9k.h | 1 - drivers/net/wireless/ath/ath9k/beacon.c | 19 +++++++++ drivers/net/wireless/ath/ath9k/main.c | 25 ----------- drivers/net/wireless/ath/ath9k/xmit.c | 67 +++++++++--------------------- 4 files changed, 39 insertions(+), 73 deletions(-)
drivers/net/wireless/ath/ath9k/ath9k.h +0 -1
@@ -323,7 +323,6 @@ int ath_tx_start(struct ieee80211_hw *hw, struct sk_buff *skb, struct ath_tx_control *txctl);void ath_tx_tasklet (struct ath_softc *sc);void ath_tx_edma_tasklet (struct ath_softc *sc); -void ath_tx_cabq (struct ieee80211_hw *hw,struct sk_buff *skb);int ath_tx_aggr_start (struct ath_softc *sc,struct ieee80211_sta *sta,u16 tid,u16 *ssn);void ath_tx_aggr_stop (struct ath_softc *sc,struct ieee80211_sta *sta,u16 tid);
drivers/net/wireless/ath/ath9k/beacon.c +19 -0
@@ -109,6 +109,25 @@ static void ath_beacon_setup(struct ath_softc *sc, struct ath_vif *avp, series, 4, 0); } +static void ath_tx_cabq (struct ieee80211_hw *hw,struct sk_buff *skb) +{ +struct ath_wiphy *aphy = hw->priv; +struct ath_softc *sc = aphy->sc; +struct ath_common *common =ath9k_hw_common (sc->sc_ah); +struct ath_tx_control txctl; + +memset (&txctl,0 ,sizeof (struct ath_tx_control )); + txctl.txq = sc->beacon.cabq; + +ath_print (common,ATH_DBG_XMIT , +"transmitting CABQ packet, skb: %p\n" , skb); + +if (ath_tx_start (hw, skb, &txctl) !=0 ) { +ath_print (common,ATH_DBG_XMIT ,"CABQ TX failed\n" ); +dev_kfree_skb_any (skb); + } +} +static struct ath_buf *ath_beacon_generate (struct ieee80211_hw *hw,struct ieee80211_vif *vif) {
drivers/net/wireless/ath/ath9k/main.c +0 -25
@@ -1195,12 +1195,10 @@ mutex_unlock:static int ath9k_tx (struct ieee80211_hw *hw,struct sk_buff *skb) { -struct ieee80211_tx_info *info =IEEE80211_SKB_CB (skb);struct ath_wiphy *aphy = hw->priv;struct ath_softc *sc = aphy->sc;struct ath_common *common =ath9k_hw_common (sc->sc_ah);struct ath_tx_control txctl; -int padpos, padsize;struct ieee80211_hdr *hdr = (struct ieee80211_hdr *) skb->data;if (aphy->state !=ATH_WIPHY_ACTIVE && aphy->state !=ATH_WIPHY_SCAN ) {
@@ -1251,29 +1249,6 @@ static int ath9k_tx(struct ieee80211_hw *hw, }memset (&txctl,0 ,sizeof (struct ath_tx_control )); - -/* -* As a temporary workaround, assign seq# here; this will likely need -* to be cleaned up to work better with Beacon transmission and virtual -* BSSes. -*/ -if (info->flags &IEEE80211_TX_CTL_ASSIGN_SEQ ) { -if (info->flags &IEEE80211_TX_CTL_FIRST_FRAGMENT ) - sc->tx.seq_no +=0x10 ; - hdr->seq_ctrl &=cpu_to_le16 (IEEE80211_SCTL_FRAG ); - hdr->seq_ctrl |=cpu_to_le16 (sc->tx.seq_no); - } - -/* Add the padding after the header if this is not already done */ - padpos =ath9k_cmn_padpos (hdr->frame_control); - padsize = padpos &3 ; -if (padsize && skb->len>padpos) { -if (skb_headroom (skb) < padsize) -return -1 ; -skb_push (skb, padsize); -memmove (skb->data, skb->data + padsize, padpos); - } - txctl.txq = sc->tx.txq_map[skb_get_queue_mapping (skb)];ath_print (common,ATH_DBG_XMIT ,"transmitting packet, skb: %p\n" , skb);
drivers/net/wireless/ath/ath9k/xmit.c +20 -47
91 lines not on this page · raw message
Signature · 1 line
1.7.3.2
PATCH 13/13 ath9k: store frame information used by aggregation inside the skb tx info
In reply to Felix FietkauSince the pointers after the rates in the tx info cannot be used anymore after frames have been queued, this area can be used to store information that was previously stored in the ath_buf. With these changes, we can delay the ath_buf assignment in the aggregation code until aggregates are formed.
That will not only make it possible to simplify DMA descriptor setup to do less rewriting of uncached memory, but will also make it easier to move aggregation out of the core of the ath9k tx path.
--- drivers/net/wireless/ath/ath9k/ath9k.h | 15 ++- drivers/net/wireless/ath/ath9k/xmit.c | 203 ++++++++++++++++---------------- 2 files changed, 109 insertions(+), 109 deletions(-)
drivers/net/wireless/ath/ath9k/ath9k.h +9 -6
@@ -89,20 +89,16 @@ struct ath_config {* @BUF_AMPDU: This buffer is an ampdu, as part of an aggregate (during TX) * @BUF_AGGR: Indicates whether the buffer can be aggregated * (used in aggregation scheduling) -* @BUF_RETRY: Indicates whether the buffer is retried * @BUF_XRETRY: To denote excessive retries of the buffer */ enum buffer_type {BUF_AMPDU =BIT (2 ),BUF_AGGR =BIT (3 ), -BUF_RETRY =BIT (4 ),BUF_XRETRY =BIT (5 ), }; -#define bf_retries bf_state.bfs_retries#define bf_isampdu (bf) (bf->bf_state.bf_type & BUF_AMPDU)#define bf_isaggr (bf) (bf->bf_state.bf_type & BUF_AGGR) -#define bf_isretried (bf) (bf->bf_state.bf_type & BUF_RETRY)#define bf_isxretried (bf) (bf->bf_state.bf_type & BUF_XRETRY)#define ATH_TXSTATUS_RING_SIZE 64
@@ -207,8 +203,15 @@ struct ath_atx_ac {struct list_head tid_q; }; +struct ath_frame_info { +int framelen; +u32 keyix; +enum ath9k_key_type keytype; +u8 retries; +u16 seqno; +}; +struct ath_buf_state { -int bfs_retries;u8 bf_type;u8 bfs_paprd;enum ath9k_internal_frame_type bfs_ftype;
@@ -260,9 +263,9 @@ struct ath_node {struct ath_tx_control {struct ath_txq *txq; +struct ath_node *an;int if_id;enum ath9k_internal_frame_type frame_type; -int frmlen;u8 paprd; };
drivers/net/wireless/ath/ath9k/xmit.c +100 -103
473 lines not on this page · raw message
Signature · 1 line
1.7.3.2
PATCH 1/13 ath9k: remove bfs_seqno from struct ath_buf_state
--- drivers/net/wireless/ath/ath9k/ath9k.h | 2 - drivers/net/wireless/ath/ath9k/xmit.c | 44 ++++++++++++++++++++----------- 2 files changed, 28 insertions(+), 18 deletions(-)
drivers/net/wireless/ath/ath9k/ath9k.h +0 -2
@@ -105,7 +105,6 @@ enum buffer_type {#define bf_al bf_state.bfs_al#define bf_frmlen bf_state.bfs_frmlen#define bf_retries bf_state.bfs_retries -#define bf_seqno bf_state.bfs_seqno#define bf_tidno bf_state.bfs_tidno#define bf_keyix bf_state.bfs_keyix#define bf_keytype bf_state.bfs_keytype
@@ -221,7 +220,6 @@ struct ath_buf_state {int bfs_nframes;u16 bfs_al;u16 bfs_frmlen; -int bfs_seqno;int bfs_tidno;int bfs_retries;u8 bf_type;
drivers/net/wireless/ath/ath9k/xmit.c +28 -16
156 lines not on this page · raw message
Signature · 1 line
1.7.3.2
PATCH 3/13 ath9k: remove bfs_keytype from struct ath_buf_state
In reply to Felix Fietkau--- drivers/net/wireless/ath/ath9k/ath9k.h | 2 -- drivers/net/wireless/ath/ath9k/xmit.c | 9 +++++---- 2 files changed, 5 insertions(+), 6 deletions(-)
drivers/net/wireless/ath/ath9k/ath9k.h +0 -2
@@ -106,7 +106,6 @@ enum buffer_type {#define bf_frmlen bf_state.bfs_frmlen#define bf_retries bf_state.bfs_retries#define bf_keyix bf_state.bfs_keyix -#define bf_keytype bf_state.bfs_keytype#define bf_isht (bf) (bf->bf_state.bf_type & BUF_HT)#define bf_isampdu (bf) (bf->bf_state.bf_type & BUF_AMPDU)#define bf_isaggr (bf) (bf->bf_state.bf_type & BUF_AGGR)
@@ -224,7 +223,6 @@ struct ath_buf_state {u8 bfs_paprd;unsigned long bfs_paprd_timestamp;u32 bfs_keyix; -enum ath9k_key_type bfs_keytype;enum ath9k_internal_frame_type bfs_ftype; };
drivers/net/wireless/ath/ath9k/xmit.c +5 -4
@@ -630,7 +630,7 @@ static int ath_compute_num_delims(struct ath_softc *sc, struct ath_atx_tid *tid,* TODO - this could be improved to be dependent on the rate. * The hardware can keep up at lower rates, but not higher rates */ -if (bf->bf_keytype !=ATH9K_KEY_TYPE_CLEAR ) +if (tx_info->control.hw_key) ndelim +=ATH_AGGR_ENCRYPTDELIM ;/*
@@ -1604,8 +1604,7 @@ static struct ath_buf *ath_tx_setup_buffer(struct ieee80211_hw *hw, bf->bf_flags =setup_tx_flags (skb); - bf->bf_keytype =ath9k_cmn_get_hw_crypto_keytype (skb); -if (bf->bf_keytype !=ATH9K_KEY_TYPE_CLEAR ) { +if (tx_info->control.hw_key) { bf->bf_frmlen += tx_info->control.hw_key->icv_len; bf->bf_keyix = tx_info->control.hw_key->hw_key_idx; }else {
@@ -1642,6 +1641,7 @@ static void ath_tx_start_dma(struct ath_softc *sc, struct ath_buf *bf,struct ath_desc *ds;struct ath_atx_tid *tid;struct ath_hw *ah = sc->sc_ah; +enum ath9k_key_type keytype;int frm_type;__le16 fc;u8 tidno;
@@ -1655,8 +1655,9 @@ static void ath_tx_start_dma(struct ath_softc *sc, struct ath_buf *bf, ds = bf->bf_desc;ath9k_hw_set_desc_link (ah, ds,0 ); + keytype =ath9k_cmn_get_hw_crypto_keytype (skb);ath9k_hw_set11n_txdesc (ah, ds, bf->bf_frmlen, frm_type,MAX_RATE_POWER , - bf->bf_keyix, bf->bf_keytype, bf->bf_flags); + bf->bf_keyix, keytype, bf->bf_flags); ath9k_hw_filltxdesc(ah, ds, skb->len, /* segment length */
Signature · 1 line
1.7.3.2
Re: [PATCH 11/13] ath9k: block new AMPDU sessions if SC_OP_TXAGGR is not set
In reply to Felix FietkauQuoted 12 lines · Felix Fietkau
This makes further tx path cleanups easier
Signed-off-by Felix Fietkau <[email protected]>--- drivers/net/wireless/ath/ath9k/main.c | 3 +++ 1 files changed, 3 insertions(+), 0 deletions(-)drivers/net/wireless/ath/ath9k/main.c +0
-0
drivers/net/wireless/ath/ath9k/main.c static int ath9k_ampdu_action(struct ieee80211_hw *hw, · line 1996
Quoted 5 lines
drivers/net/wireless/ath/ath9k/main.c +2
-0@@ -1992,6 +1992,9 @@ static int ath9k_ampdu_action(struct ieee80211_hw *hw,case IEEE80211_AMPDU_RX_STOP :break ;case IEEE80211_AMPDU_TX_START : +if (!(sc->sc_flags &SC_OP_TXAGGR )) +return -EOPNOTSUPP ;
SC_OP_TXAGGR is set when the hw supports tx AMPDU, I think mac80211 does not call drv_ampdu_action() if hw does not support AMPDU.
Vasanth
Re: [PATCH 11/13] ath9k: block new AMPDU sessions if SC_OP_TXAGGR is not set
Quoted 8 lines · Vasanthakumar Thiagarajan
Quoted 7 lines · Felix Fietkau
This makes further tx path cleanups easier
Signed-off-by Felix Fietkau <[email protected]>--- drivers/net/wireless/ath/ath9k/main.c | 3 +++ 1 files changed, 3 insertions(+), 0 deletions(-)
Quoted 14 lines
drivers/net/wireless/ath/ath9k/main.c static int ath9k_ampdu_action(struct ieee80211_hw *hw, · line 1996
Quoted 10 lines
drivers/net/wireless/ath/ath9k/main.c +2
-0@@ -1992,6 +1992,9 @@ static int ath9k_ampdu_action(struct ieee80211_hw *hw,case IEEE80211_AMPDU_RX_STOP :break ;case IEEE80211_AMPDU_TX_START : +if (!(sc->sc_flags &SC_OP_TXAGGR )) +return -EOPNOTSUPP ;
SC_OP_TXAGGRis set when the hw supports tx AMPDU, I think mac80211 does not calldrv_ampdu_action()if hw does not support AMPDU.
You're right, I took another look at the code and while AMPDU is not disabled based on SC_OP_TXAGGR, it is disabled based on the same condition that gets checked before SC_OP_TXAGGR is even set. Maybe I'll clean that up later...
- Felix