ath9k: split out access to tx status information
PATCH 1/3 ath9k: split out access to tx status information
This patch passes in a pointer to the ath_tx_status data structure for functions that need it, instead of letting them grab it directly from the ath_desc struct. This is useful for making it possible to allocate the intermediate tx status data separately.
---
drivers/net/wireless/ath/ath9k/mac.c +38 -37
@@ -246,79 +246,80 @@ void ath9k_hw_cleartxdesc(struct ath_hw }EXPORT_SYMBOL (ath9k_hw_cleartxdesc); -int ath9k_hw_txprocdesc (struct ath_hw *ah,struct ath_desc *ds) +int ath9k_hw_txprocdesc (struct ath_hw *ah,struct ath_desc *ds, +struct ath_tx_status *ts) {struct ar5416_desc *ads =AR5416DESC (ds);if ((ads->ds_txstatus9 & AR_TxDone) ==0 )return -EINPROGRESS ; - ds->ds_txstat.ts_seqnum =MS (ads->ds_txstatus9, AR_SeqNum); - ds->ds_txstat.ts_tstamp = ads->AR_SendTimestamp; - ds->ds_txstat.ts_status =0 ; - ds->ds_txstat.ts_flags =0 ; + ts->ts_seqnum =MS (ads->ds_txstatus9, AR_SeqNum); + ts->ts_tstamp = ads->AR_SendTimestamp; + ts->ts_status =0 ; + ts->ts_flags =0 ;if (ads->ds_txstatus1 & AR_FrmXmitOK) - ds->ds_txstat.ts_status |=ATH9K_TX_ACKED ; + ts->ts_status |=ATH9K_TX_ACKED ;if (ads->ds_txstatus1 & AR_ExcessiveRetries) - ds->ds_txstat.ts_status |=ATH9K_TXERR_XRETRY ; + ts->ts_status |=ATH9K_TXERR_XRETRY ;if (ads->ds_txstatus1 & AR_Filtered) - ds->ds_txstat.ts_status |=ATH9K_TXERR_FILT ; + ts->ts_status |=ATH9K_TXERR_FILT ;if (ads->ds_txstatus1 & AR_FIFOUnderrun) { - ds->ds_txstat.ts_status |=ATH9K_TXERR_FIFO ; + ts->ts_status |=ATH9K_TXERR_FIFO ;ath9k_hw_updatetxtriglevel (ah, true); }if (ads->ds_txstatus9 & AR_TxOpExceeded) - ds->ds_txstat.ts_status |=ATH9K_TXERR_XTXOP ; + ts->ts_status |=ATH9K_TXERR_XTXOP ;if (ads->ds_txstatus1 & AR_TxTimerExpired) - ds->ds_txstat.ts_status |=ATH9K_TXERR_TIMER_EXPIRED ; + ts->ts_status |=ATH9K_TXERR_TIMER_EXPIRED ;if (ads->ds_txstatus1 & AR_DescCfgErr) - ds->ds_txstat.ts_flags |=ATH9K_TX_DESC_CFG_ERR ; + ts->ts_flags |=ATH9K_TX_DESC_CFG_ERR ;if (ads->ds_txstatus1 & AR_TxDataUnderrun) { - ds->ds_txstat.ts_flags |=ATH9K_TX_DATA_UNDERRUN ; + ts->ts_flags |=ATH9K_TX_DATA_UNDERRUN ;ath9k_hw_updatetxtriglevel (ah, true); }if (ads->ds_txstatus1 & AR_TxDelimUnderrun) { - ds->ds_txstat.ts_flags |=ATH9K_TX_DELIM_UNDERRUN ; + ts->ts_flags |=ATH9K_TX_DELIM_UNDERRUN ;ath9k_hw_updatetxtriglevel (ah, true); }if (ads->ds_txstatus0 & AR_TxBaStatus) { - ds->ds_txstat.ts_flags |=ATH9K_TX_BA ; - ds->ds_txstat.ba_low = ads->AR_BaBitmapLow; - ds->ds_txstat.ba_high = ads->AR_BaBitmapHigh; + ts->ts_flags |=ATH9K_TX_BA ; + ts->ba_low = ads->AR_BaBitmapLow; + ts->ba_high = ads->AR_BaBitmapHigh; } - ds->ds_txstat.ts_rateindex =MS (ads->ds_txstatus9, AR_FinalTxIdx); -switch (ds->ds_txstat.ts_rateindex) { + ts->ts_rateindex =MS (ads->ds_txstatus9, AR_FinalTxIdx); +switch (ts->ts_rateindex) {case 0 : - ds->ds_txstat.ts_ratecode =MS (ads->ds_ctl3, AR_XmitRate0); + ts->ts_ratecode =MS (ads->ds_ctl3, AR_XmitRate0);break ;case 1 : - ds->ds_txstat.ts_ratecode =MS (ads->ds_ctl3, AR_XmitRate1); + ts->ts_ratecode =MS (ads->ds_ctl3, AR_XmitRate1);break ;case 2 : - ds->ds_txstat.ts_ratecode =MS (ads->ds_ctl3, AR_XmitRate2); + ts->ts_ratecode =MS (ads->ds_ctl3, AR_XmitRate2);break ;case 3 : - ds->ds_txstat.ts_ratecode =MS (ads->ds_ctl3, AR_XmitRate3); + ts->ts_ratecode =MS (ads->ds_ctl3, AR_XmitRate3);break ; } - ds->ds_txstat.ts_rssi =MS (ads->ds_txstatus5, AR_TxRSSICombined); - ds->ds_txstat.ts_rssi_ctl0 =MS (ads->ds_txstatus0, AR_TxRSSIAnt00); - ds->ds_txstat.ts_rssi_ctl1 =MS (ads->ds_txstatus0, AR_TxRSSIAnt01); - ds->ds_txstat.ts_rssi_ctl2 =MS (ads->ds_txstatus0, AR_TxRSSIAnt02); - ds->ds_txstat.ts_rssi_ext0 =MS (ads->ds_txstatus5, AR_TxRSSIAnt10); - ds->ds_txstat.ts_rssi_ext1 =MS (ads->ds_txstatus5, AR_TxRSSIAnt11); - ds->ds_txstat.ts_rssi_ext2 =MS (ads->ds_txstatus5, AR_TxRSSIAnt12); - ds->ds_txstat.evm0 = ads->AR_TxEVM0; - ds->ds_txstat.evm1 = ads->AR_TxEVM1; - ds->ds_txstat.evm2 = ads->AR_TxEVM2; - ds->ds_txstat.ts_shortretry =MS (ads->ds_txstatus1, AR_RTSFailCnt); - ds->ds_txstat.ts_longretry =MS (ads->ds_txstatus1, AR_DataFailCnt); - ds->ds_txstat.ts_virtcol =MS (ads->ds_txstatus1, AR_VirtRetryCnt); - ds->ds_txstat.ts_antenna =0 ; + ts->ts_rssi =MS (ads->ds_txstatus5, AR_TxRSSICombined); + ts->ts_rssi_ctl0 =MS (ads->ds_txstatus0, AR_TxRSSIAnt00); + ts->ts_rssi_ctl1 =MS (ads->ds_txstatus0, AR_TxRSSIAnt01); + ts->ts_rssi_ctl2 =MS (ads->ds_txstatus0, AR_TxRSSIAnt02); + ts->ts_rssi_ext0 =MS (ads->ds_txstatus5, AR_TxRSSIAnt10); + ts->ts_rssi_ext1 =MS (ads->ds_txstatus5, AR_TxRSSIAnt11); + ts->ts_rssi_ext2 =MS (ads->ds_txstatus5, AR_TxRSSIAnt12); + ts->evm0 = ads->AR_TxEVM0; + ts->evm1 = ads->AR_TxEVM1; + ts->evm2 = ads->AR_TxEVM2; + ts->ts_shortretry =MS (ads->ds_txstatus1, AR_RTSFailCnt); + ts->ts_longretry =MS (ads->ds_txstatus1, AR_DataFailCnt); + ts->ts_virtcol =MS (ads->ds_txstatus1, AR_VirtRetryCnt); + ts->ts_antenna =0 ;return 0 ; }
drivers/net/wireless/ath/ath9k/mac.h +2 -2
@@ -241,7 +241,6 @@ struct ath_desc {void *ds_vdata; } __packed; -#define ds_txstat ds_us.tx#define ds_rxstat ds_us.rx#define ds_stat ds_us.stats
@@ -702,7 +701,8 @@ void ath9k_hw_filltxdesc(struct ath_hw * u32 segLen, bool firstSeg, bool lastSeg, const struct ath_desc *ds0);void ath9k_hw_cleartxdesc (struct ath_hw *ah,struct ath_desc *ds); -int ath9k_hw_txprocdesc (struct ath_hw *ah,struct ath_desc *ds); +int ath9k_hw_txprocdesc (struct ath_hw *ah,struct ath_desc *ds, +struct ath_tx_status *ts);void ath9k_hw_set11n_txdesc (struct ath_hw *ah,struct ath_desc *ds,u32 pktLen,enum ath9k_pkt_type type,u32 txPower,u32 keyIx,enum ath9k_key_type keyType,u32 flags);
drivers/net/wireless/ath/ath9k/xmit.c +56 -51
298 lines not on this page · raw message
drivers/net/wireless/ath/ath9k/debug.c +7 -9
@@ -640,10 +640,8 @@ static ssize_t read_file_xmit(struct fil }void ath_debug_stat_tx (struct ath_softc *sc,struct ath_txq *txq, -struct ath_buf *bf) +struct ath_buf *bf,struct ath_tx_status *ts) { -struct ath_desc *ds = bf->bf_desc; -if (bf_isampdu (bf)) {if (bf_isxretried (bf))TX_STAT_INC (txq->axq_qnum, a_xretries);
@@ -653,17 +651,17 @@ void ath_debug_stat_tx(struct ath_softcTX_STAT_INC (txq->axq_qnum, completed); } -if (ds->ds_txstat.ts_status &ATH9K_TXERR_FIFO ) +if (ts->ts_status &ATH9K_TXERR_FIFO )TX_STAT_INC (txq->axq_qnum, fifo_underrun); -if (ds->ds_txstat.ts_status &ATH9K_TXERR_XTXOP ) +if (ts->ts_status &ATH9K_TXERR_XTXOP )TX_STAT_INC (txq->axq_qnum, xtxop); -if (ds->ds_txstat.ts_status &ATH9K_TXERR_TIMER_EXPIRED ) +if (ts->ts_status &ATH9K_TXERR_TIMER_EXPIRED )TX_STAT_INC (txq->axq_qnum, timer_exp); -if (ds->ds_txstat.ts_flags &ATH9K_TX_DESC_CFG_ERR ) +if (ts->ts_flags &ATH9K_TX_DESC_CFG_ERR )TX_STAT_INC (txq->axq_qnum, desc_cfg_err); -if (ds->ds_txstat.ts_flags &ATH9K_TX_DATA_UNDERRUN ) +if (ts->ts_flags &ATH9K_TX_DATA_UNDERRUN )TX_STAT_INC (txq->axq_qnum, data_underrun); -if (ds->ds_txstat.ts_flags &ATH9K_TX_DELIM_UNDERRUN ) +if (ts->ts_flags &ATH9K_TX_DELIM_UNDERRUN )TX_STAT_INC (txq->axq_qnum, delim_underrun); }
drivers/net/wireless/ath/ath9k/debug.h +1 -1
@@ -172,7 +172,7 @@ void ath9k_debug_remove_root(void);void ath_debug_stat_interrupt (struct ath_softc *sc,enum ath9k_int status);void ath_debug_stat_rc (struct ath_softc *sc,int final_rate);void ath_debug_stat_tx (struct ath_softc *sc,struct ath_txq *txq, -struct ath_buf *bf); +struct ath_buf *bf,struct ath_tx_status *ts);void ath_debug_stat_rx (struct ath_softc *sc,struct ath_buf *bf);void ath_debug_stat_retries (struct ath_softc *sc,int rix,int xretries,int retries,u8 per);
drivers/net/wireless/ath/ath9k/ath9k.h +0 -3
@@ -178,9 +178,6 @@ void ath_descdma_cleanup(struct ath_soft#define BAW_WITHIN (_start, _bawsz, _seqno) \ ((((_seqno) - (_start)) & 4095) < (_bawsz)) -#define ATH_DS_BA_SEQ (_ds) ((_ds)->ds_us.tx.ts_seqnum) -#define ATH_DS_BA_BITMAP (_ds) (&(_ds)->ds_us.tx.ba_low) -#define ATH_DS_TX_BA (_ds) ((_ds)->ds_us.tx.ts_flags & ATH9K_TX_BA)#define ATH_AN_2_TID (_an, _tidno) (&(_an)->tid[(_tidno)])#define ATH_TX_COMPLETE_POLL_INT 1000
PATCH 2/3 ath9k: split out access to rx status information
This patch passes in a pointer to the ath_rx_status data structure for functions that need it, instead of letting them grab it directly from the ath_desc struct. This is useful for making it possible to allocate the intermediate rx status data separately.
---
drivers/net/wireless/ath/ath9k/mac.c +36 -36
@@ -859,7 +859,7 @@ bool ath9k_hw_resettxqueue(struct ath_hwEXPORT_SYMBOL (ath9k_hw_resettxqueue);int ath9k_hw_rxprocdesc (struct ath_hw *ah,struct ath_desc *ds, -u32 pa,struct ath_desc *nds,u64 tsf) +struct ath_rx_status *rs,u64 tsf) {struct ar5416_desc ads;struct ar5416_desc *adsp =AR5416DESC (ds);
@@ -870,70 +870,70 @@ int ath9k_hw_rxprocdesc(struct ath_hw *a ads.u.rx = adsp->u.rx; - ds->ds_rxstat.rs_status =0 ; - ds->ds_rxstat.rs_flags =0 ; + rs->rs_status =0 ; + rs->rs_flags =0 ; - ds->ds_rxstat.rs_datalen = ads.ds_rxstatus1 & AR_DataLen; - ds->ds_rxstat.rs_tstamp = ads.AR_RcvTimestamp; + rs->rs_datalen = ads.ds_rxstatus1 & AR_DataLen; + rs->rs_tstamp = ads.AR_RcvTimestamp;if (ads.ds_rxstatus8 & AR_PostDelimCRCErr) { - ds->ds_rxstat.rs_rssi =ATH9K_RSSI_BAD ; - ds->ds_rxstat.rs_rssi_ctl0 =ATH9K_RSSI_BAD ; - ds->ds_rxstat.rs_rssi_ctl1 =ATH9K_RSSI_BAD ; - ds->ds_rxstat.rs_rssi_ctl2 =ATH9K_RSSI_BAD ; - ds->ds_rxstat.rs_rssi_ext0 =ATH9K_RSSI_BAD ; - ds->ds_rxstat.rs_rssi_ext1 =ATH9K_RSSI_BAD ; - ds->ds_rxstat.rs_rssi_ext2 =ATH9K_RSSI_BAD ; + rs->rs_rssi =ATH9K_RSSI_BAD ; + rs->rs_rssi_ctl0 =ATH9K_RSSI_BAD ; + rs->rs_rssi_ctl1 =ATH9K_RSSI_BAD ; + rs->rs_rssi_ctl2 =ATH9K_RSSI_BAD ; + rs->rs_rssi_ext0 =ATH9K_RSSI_BAD ; + rs->rs_rssi_ext1 =ATH9K_RSSI_BAD ; + rs->rs_rssi_ext2 =ATH9K_RSSI_BAD ; }else { - ds->ds_rxstat.rs_rssi =MS (ads.ds_rxstatus4, AR_RxRSSICombined); - ds->ds_rxstat.rs_rssi_ctl0 =MS (ads.ds_rxstatus0, + rs->rs_rssi =MS (ads.ds_rxstatus4, AR_RxRSSICombined); + rs->rs_rssi_ctl0 =MS (ads.ds_rxstatus0, AR_RxRSSIAnt00); - ds->ds_rxstat.rs_rssi_ctl1 =MS (ads.ds_rxstatus0, + rs->rs_rssi_ctl1 =MS (ads.ds_rxstatus0, AR_RxRSSIAnt01); - ds->ds_rxstat.rs_rssi_ctl2 =MS (ads.ds_rxstatus0, + rs->rs_rssi_ctl2 =MS (ads.ds_rxstatus0, AR_RxRSSIAnt02); - ds->ds_rxstat.rs_rssi_ext0 =MS (ads.ds_rxstatus4, + rs->rs_rssi_ext0 =MS (ads.ds_rxstatus4, AR_RxRSSIAnt10); - ds->ds_rxstat.rs_rssi_ext1 =MS (ads.ds_rxstatus4, + rs->rs_rssi_ext1 =MS (ads.ds_rxstatus4, AR_RxRSSIAnt11); - ds->ds_rxstat.rs_rssi_ext2 =MS (ads.ds_rxstatus4, + rs->rs_rssi_ext2 =MS (ads.ds_rxstatus4, AR_RxRSSIAnt12); }if (ads.ds_rxstatus8 & AR_RxKeyIdxValid) - ds->ds_rxstat.rs_keyix =MS (ads.ds_rxstatus8, AR_KeyIdx); + rs->rs_keyix =MS (ads.ds_rxstatus8, AR_KeyIdx);else - ds->ds_rxstat.rs_keyix =ATH9K_RXKEYIX_INVALID ; + rs->rs_keyix =ATH9K_RXKEYIX_INVALID ; - ds->ds_rxstat.rs_rate =RXSTATUS_RATE (ah, (&ads)); - ds->ds_rxstat.rs_more = (ads.ds_rxstatus1 & AR_RxMore) ?1 :0 ; + rs->rs_rate =RXSTATUS_RATE (ah, (&ads)); + rs->rs_more = (ads.ds_rxstatus1 & AR_RxMore) ?1 :0 ; - ds->ds_rxstat.rs_isaggr = (ads.ds_rxstatus8 & AR_RxAggr) ?1 :0 ; - ds->ds_rxstat.rs_moreaggr = + rs->rs_isaggr = (ads.ds_rxstatus8 & AR_RxAggr) ?1 :0 ; + rs->rs_moreaggr = (ads.ds_rxstatus8 & AR_RxMoreAggr) ?1 :0 ; - ds->ds_rxstat.rs_antenna =MS (ads.ds_rxstatus3, AR_RxAntenna); - ds->ds_rxstat.rs_flags = + rs->rs_antenna =MS (ads.ds_rxstatus3, AR_RxAntenna); + rs->rs_flags = (ads.ds_rxstatus3 &AR_GI ) ?ATH9K_RX_GI :0 ; - ds->ds_rxstat.rs_flags |= + rs->rs_flags |= (ads.ds_rxstatus3 &AR_2040 ) ?ATH9K_RX_2040 :0 ;if (ads.ds_rxstatus8 & AR_PreDelimCRCErr) - ds->ds_rxstat.rs_flags |=ATH9K_RX_DELIM_CRC_PRE ; + rs->rs_flags |=ATH9K_RX_DELIM_CRC_PRE ;if (ads.ds_rxstatus8 & AR_PostDelimCRCErr) - ds->ds_rxstat.rs_flags |=ATH9K_RX_DELIM_CRC_POST ; + rs->rs_flags |=ATH9K_RX_DELIM_CRC_POST ;if (ads.ds_rxstatus8 & AR_DecryptBusyErr) - ds->ds_rxstat.rs_flags |=ATH9K_RX_DECRYPT_BUSY ; + rs->rs_flags |=ATH9K_RX_DECRYPT_BUSY ;if ((ads.ds_rxstatus8 & AR_RxFrameOK) ==0 ) {if (ads.ds_rxstatus8 & AR_CRCErr) - ds->ds_rxstat.rs_status |=ATH9K_RXERR_CRC ; + rs->rs_status |=ATH9K_RXERR_CRC ;else if (ads.ds_rxstatus8 & AR_PHYErr) { - ds->ds_rxstat.rs_status |=ATH9K_RXERR_PHY ; + rs->rs_status |=ATH9K_RXERR_PHY ; phyerr =MS (ads.ds_rxstatus8, AR_PHYErrCode); - ds->ds_rxstat.rs_phyerr = phyerr; + rs->rs_phyerr = phyerr; }else if (ads.ds_rxstatus8 & AR_DecryptCRCErr) - ds->ds_rxstat.rs_status |=ATH9K_RXERR_DECRYPT ; + rs->rs_status |=ATH9K_RXERR_DECRYPT ;else if (ads.ds_rxstatus8 & AR_MichaelErr) - ds->ds_rxstat.rs_status |=ATH9K_RXERR_MIC ; + rs->rs_status |=ATH9K_RXERR_MIC ; }return 0 ;
drivers/net/wireless/ath/ath9k/mac.h +1 -4
@@ -241,9 +241,6 @@ struct ath_desc {void *ds_vdata; } __packed; -#define ds_rxstat ds_us.rx -#define ds_stat ds_us.stats -#define ATH9K_TXDESC_CLRDMASK 0x0001#define ATH9K_TXDESC_NOACK 0x0002#define ATH9K_TXDESC_RTSENA 0x0004
@@ -732,7 +729,7 @@ int ath9k_hw_setuptxqueue(struct ath_hwbool ath9k_hw_releasetxqueue (struct ath_hw *ah,u32 q);bool ath9k_hw_resettxqueue (struct ath_hw *ah,u32 q);int ath9k_hw_rxprocdesc (struct ath_hw *ah,struct ath_desc *ds, -u32 pa,struct ath_desc *nds,u64 tsf); +struct ath_rx_status *rs,u64 tsf);void ath9k_hw_setuprxdesc (struct ath_hw *ah,struct ath_desc *ds,u32 size,u32 flags);bool ath9k_hw_setrxabort (struct ath_hw *ah,bool set);
drivers/net/wireless/ath/ath9k/recv.c +5 -9
@@ -506,6 +506,7 @@ int ath_rx_tasklet(struct ath_softc *sc, bf = list_first_entry(&sc->rx.rxbuf, struct ath_buf, list); ds = bf->bf_desc; + rx_stats = &ds->ds_us.rx;/* * Must provide the virtual address of the current
@@ -518,10 +519,7 @@ int ath_rx_tasklet(struct ath_softc *sc,* on. All this is necessary because of our use of * a self-linked list to avoid rx overruns. */ - retval =ath9k_hw_rxprocdesc (ah, ds, - bf->bf_daddr, -PA2DESC (sc, ds->ds_link), -0 ); + retval =ath9k_hw_rxprocdesc (ah, ds, rx_stats,0 );if (retval == -EINPROGRESS ) {struct ath_buf *tbf;struct ath_desc *tds;
@@ -545,8 +543,7 @@ int ath_rx_tasklet(struct ath_softc *sc,*/ tds = tbf->bf_desc; - retval =ath9k_hw_rxprocdesc (ah, tds, tbf->bf_daddr, -PA2DESC (sc, tds->ds_link),0 ); + retval =ath9k_hw_rxprocdesc (ah, tds, &tds->ds_us.rx,0 );if (retval == -EINPROGRESS ) {break ; }
@@ -569,9 +566,8 @@ int ath_rx_tasklet(struct ath_softc *sc, rxs =IEEE80211_SKB_RXCB (skb); hw =ath_get_virt_hw (sc, hdr); - rx_stats = &ds->ds_rxstat; -ath_debug_stat_rx (sc, bf); +ath_debug_stat_rx (sc, rx_stats);/* * If we're asked to flush receive queue, directly
@@ -626,7 +622,7 @@ int ath_rx_tasklet(struct ath_softc *sc,* change the default rx antenna if rx diversity chooses the * other antenna 3 times in a row. */ -if (sc->rx.defant != ds->ds_rxstat.rs_antenna) { +if (sc->rx.defant != rx_stats->rs_antenna) {if (++sc->rx.rxotherant >=3 )ath_setdefantenna (sc, rx_stats->rs_antenna); }else {
drivers/net/wireless/ath/ath9k/debug.c +9 -10
@@ -744,30 +744,29 @@ static ssize_t read_file_recv(struct fil#undef PHY_ERR } -void ath_debug_stat_rx (struct ath_softc *sc,struct ath_buf *bf) +void ath_debug_stat_rx (struct ath_softc *sc,struct ath_rx_status *rs) {#define RX_STAT_INC (c) sc->debug.stats.rxstats.c++#define RX_PHY_ERR_INC (c) sc->debug.stats.rxstats.phy_err_stats[c]++ -struct ath_desc *ds = bf->bf_desc;u32 phyerr; -if (ds->ds_rxstat.rs_status &ATH9K_RXERR_CRC ) +if (rs->rs_status &ATH9K_RXERR_CRC )RX_STAT_INC (crc_err); -if (ds->ds_rxstat.rs_status &ATH9K_RXERR_DECRYPT ) +if (rs->rs_status &ATH9K_RXERR_DECRYPT )RX_STAT_INC (decrypt_crc_err); -if (ds->ds_rxstat.rs_status &ATH9K_RXERR_MIC ) +if (rs->rs_status &ATH9K_RXERR_MIC )RX_STAT_INC (mic_err); -if (ds->ds_rxstat.rs_status &ATH9K_RX_DELIM_CRC_PRE ) +if (rs->rs_status &ATH9K_RX_DELIM_CRC_PRE )RX_STAT_INC (pre_delim_crc_err); -if (ds->ds_rxstat.rs_status &ATH9K_RX_DELIM_CRC_POST ) +if (rs->rs_status &ATH9K_RX_DELIM_CRC_POST )RX_STAT_INC (post_delim_crc_err); -if (ds->ds_rxstat.rs_status &ATH9K_RX_DECRYPT_BUSY ) +if (rs->rs_status &ATH9K_RX_DECRYPT_BUSY )RX_STAT_INC (decrypt_busy_err); -if (ds->ds_rxstat.rs_status &ATH9K_RXERR_PHY ) { +if (rs->rs_status &ATH9K_RXERR_PHY ) {RX_STAT_INC (phy_err); - phyerr = ds->ds_rxstat.rs_phyerr &0x24 ; + phyerr = rs->rs_phyerr &0x24 ;RX_PHY_ERR_INC (phyerr); }
drivers/net/wireless/ath/ath9k/debug.h +1 -1
@@ -173,7 +173,7 @@ void ath_debug_stat_interrupt(struct athvoid ath_debug_stat_rc (struct ath_softc *sc,int final_rate);void ath_debug_stat_tx (struct ath_softc *sc,struct ath_txq *txq,struct ath_buf *bf,struct ath_tx_status *ts); -void ath_debug_stat_rx (struct ath_softc *sc,struct ath_buf *bf); +void ath_debug_stat_rx (struct ath_softc *sc,struct ath_rx_status *rs);void ath_debug_stat_retries (struct ath_softc *sc,int rix,int xretries,int retries,u8 per);
PATCH 3/3 ath9k: allocate tx and rx status information on stack
ath_tx_status and ath_rx_status data are only necessary for a short time, until they have been processed and converted into mac80211 data structures.
Because of that, it makes no sense to keep them tied to the DMA descriptor, that only wastes precious memory.
This patch allocates the data on stack in the functions that call the conversion functions from ath9k_hw.
---
drivers/net/wireless/ath/ath9k/recv.c +12 -10
@@ -477,7 +477,6 @@ int ath_rx_tasklet(struct ath_softc *sc,struct ath_buf *bf;struct ath_desc *ds; -struct ath_rx_status *rx_stats;struct sk_buff *skb =NULL , *requeue_skb;struct ieee80211_rx_status *rxs;struct ath_hw *ah = sc->sc_ah;
@@ -491,6 +490,7 @@ int ath_rx_tasklet(struct ath_softc *sc,struct ieee80211_hdr *hdr;int retval;bool decrypt_error = false; +struct ath_rx_status rs;spin_lock_bh (&sc->rx.rxbuflock);
@@ -506,7 +506,6 @@ int ath_rx_tasklet(struct ath_softc *sc, bf = list_first_entry(&sc->rx.rxbuf, struct ath_buf, list); ds = bf->bf_desc; - rx_stats = &ds->ds_us.rx;/* * Must provide the virtual address of the current
@@ -519,11 +518,14 @@ int ath_rx_tasklet(struct ath_softc *sc,* on. All this is necessary because of our use of * a self-linked list to avoid rx overruns. */ - retval =ath9k_hw_rxprocdesc (ah, ds, rx_stats,0 ); +memset (&rs,0 ,sizeof (rs)); + retval =ath9k_hw_rxprocdesc (ah, ds, &rs,0 );if (retval == -EINPROGRESS ) { +struct ath_rx_status trs;struct ath_buf *tbf;struct ath_desc *tds; +memset (&trs,0 ,sizeof (trs));if (list_is_last (&bf->list, &sc->rx.rxbuf)) { sc->rx.rxlink =NULL ;break ;
@@ -543,7 +545,7 @@ int ath_rx_tasklet(struct ath_softc *sc,*/ tds = tbf->bf_desc; - retval =ath9k_hw_rxprocdesc (ah, tds, &tds->ds_us.rx,0 ); + retval =ath9k_hw_rxprocdesc (ah, tds, &trs,0 );if (retval == -EINPROGRESS ) {break ; }
@@ -567,7 +569,7 @@ int ath_rx_tasklet(struct ath_softc *sc, hw =ath_get_virt_hw (sc, hdr); -ath_debug_stat_rx (sc, rx_stats); +ath_debug_stat_rx (sc, &rs);/* * If we're asked to flush receive queue, directly
@@ -576,7 +578,7 @@ int ath_rx_tasklet(struct ath_softc *sc,if (flush) goto requeue; - retval =ath9k_cmn_rx_skb_preprocess (common, hw, skb, rx_stats, + retval =ath9k_cmn_rx_skb_preprocess (common, hw, skb, &rs, rxs, &decrypt_error);if (retval) goto requeue;
@@ -597,9 +599,9 @@ int ath_rx_tasklet(struct ath_softc *sc, common->rx_bufsize, DMA_FROM_DEVICE); -skb_put (skb, rx_stats->rs_datalen); +skb_put (skb, rs.rs_datalen); -ath9k_cmn_rx_skb_postprocess (common, skb, rx_stats, +ath9k_cmn_rx_skb_postprocess (common, skb, &rs, rxs, decrypt_error);/* We will now give hardware our shiny new allocated skb */
@@ -622,9 +624,9 @@ int ath_rx_tasklet(struct ath_softc *sc,* change the default rx antenna if rx diversity chooses the * other antenna 3 times in a row. */ -if (sc->rx.defant != rx_stats->rs_antenna) { +if (sc->rx.defant != rs.rs_antenna) {if (++sc->rx.rxotherant >=3 ) -ath_setdefantenna (sc, rx_stats->rs_antenna); +ath_setdefantenna (sc, rs.rs_antenna); }else { sc->rx.rxotherant =0 ; }
drivers/net/wireless/ath/ath9k/mac.h +0 -5
@@ -233,11 +233,6 @@ struct ath_desc {u32 ds_ctl0;u32 ds_ctl1;u32 ds_hw[20 ]; -union { -struct ath_tx_status tx; -struct ath_rx_status rx; -void *stats; - } ds_us;void *ds_vdata; } __packed;
drivers/net/wireless/ath/ath9k/xmit.c +10 -10
@@ -1981,7 +1981,7 @@ static void ath_tx_processq(struct ath_sstruct ath_buf *bf, *lastbf, *bf_held =NULL ;struct list_head bf_head;struct ath_desc *ds; -struct ath_tx_status *ts; +struct ath_tx_status ts;int txok;int status;
@@ -2020,9 +2020,9 @@ static void ath_tx_processq(struct ath_s lastbf = bf->bf_lastbf; ds = lastbf->bf_desc; - ts = &ds->ds_us.tx; - status =ath9k_hw_txprocdesc (ah, ds, ts); +memset (&ts,0 ,sizeof (ts)); + status =ath9k_hw_txprocdesc (ah, ds, &ts);if (status == -EINPROGRESS ) {spin_unlock_bh (&txq->axq_lock);break ;
@@ -2033,7 +2033,7 @@ static void ath_tx_processq(struct ath_s* can disable RX. */ if (bf->bf_isnullfunc && - (ts->ts_status &ATH9K_TX_ACKED )) { + (ts.ts_status &ATH9K_TX_ACKED )) {if ((sc->ps_flags &PS_ENABLED ))ath9k_enable_ps (sc);else
@@ -2052,7 +2052,7 @@ static void ath_tx_processq(struct ath_s &txq->axq_q, lastbf->list.prev); txq->axq_depth--; - txok = !(ts->ts_status &ATH9K_TXERR_MASK ); + txok = !(ts.ts_status &ATH9K_TXERR_MASK ); txq->axq_tx_inprogress = false;spin_unlock_bh (&txq->axq_lock);
@@ -2067,16 +2067,16 @@ static void ath_tx_processq(struct ath_s* This frame is sent out as a single frame. * Use hardware retry status for this frame. */ - bf->bf_retries = ts->ts_longretry; -if (ts->ts_status &ATH9K_TXERR_XRETRY ) + bf->bf_retries = ts.ts_longretry; +if (ts.ts_status &ATH9K_TXERR_XRETRY ) bf->bf_state.bf_type |=BUF_XRETRY ; -ath_tx_rc_status (bf, ts,0 , txok, true); +ath_tx_rc_status (bf, &ts,0 , txok, true); }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);else -ath_tx_complete_buf (sc, bf, txq, &bf_head, ts, txok,0 ); +ath_tx_complete_buf (sc, bf, txq, &bf_head, &ts, txok,0 );ath_wake_mac80211_queue (sc, txq);