ath9k: remove the unnecessary private xretry tx flag
PATCH 1/5 ath9k: remove the unnecessary private xretry tx flag
Signed-off-by Felix Fietkau <[email protected]>
--- drivers/net/wireless/ath/ath9k/rc.c | 2 +- drivers/net/wireless/ath/ath9k/rc.h | 1 - drivers/net/wireless/ath/ath9k/xmit.c | 3 --- 3 files changed, 1 insertions(+), 5 deletions(-)
drivers/net/wireless/ath/ath9k/rc.c +1 -1
@@ -1370,7 +1370,7 @@ static void ath_tx_status(void *priv, struct ieee80211_supported_band *sband, is_underrun =1 ; } -if (tx_info->pad[0 ] &ATH_TX_INFO_XRETRY ) +if (!(tx_info->flags &IEEE80211_TX_STAT_ACK )) tx_status =1 ; ath_rc_tx_status(sc, ath_rc_priv, tx_info, final_ts_idx, tx_status,
drivers/net/wireless/ath/ath9k/rc.h +0 -1
@@ -227,7 +227,6 @@ struct ath_rate_priv {#define ATH_TX_INFO_FRAME_TYPE_INTERNAL (1 << 0)#define ATH_TX_INFO_FRAME_TYPE_PAUSE (1 << 1) -#define ATH_TX_INFO_XRETRY (1 << 3)#define ATH_TX_INFO_UNDERRUN (1 << 4)enum ath9k_internal_frame_type {
drivers/net/wireless/ath/ath9k/xmit.c +0 -3
@@ -1993,9 +1993,6 @@ static void ath_tx_rc_status(struct ath_buf *bf, struct ath_tx_status *ts,if (ts->ts_flags & (ATH9K_TX_DATA_UNDERRUN |ATH9K_TX_DELIM_UNDERRUN )) tx_info->pad[0 ] |=ATH_TX_INFO_UNDERRUN ; -if ((ts->ts_status &ATH9K_TXERR_XRETRY ) || - (ts->ts_status &ATH9K_TXERR_FIFO )) - tx_info->pad[0 ] |=ATH_TX_INFO_XRETRY ; } }
Signature · 1 line
1.7.2.2
PATCH 2/5 ath9k: handle tx underrun in the driver instead of rate control
Signed-off-by Felix Fietkau <[email protected]>
--- drivers/net/wireless/ath/ath9k/rc.c | 18 ------------------ drivers/net/wireless/ath/ath9k/rc.h | 2 -- drivers/net/wireless/ath/ath9k/xmit.c | 25 ++++++++++++++++++++----- 3 files changed, 20 insertions(+), 25 deletions(-)
drivers/net/wireless/ath/ath9k/rc.c +0 -18
@@ -1354,22 +1354,6 @@ static void ath_tx_status(void *priv, struct ieee80211_supported_band *sband, tx_info->status.ampdu_len =1 ; } -/* -* If an underrun error is seen assume it as an excessive retry only -* if max frame trigger level has been reached (2 KB for singel stream, -* and 4 KB for dual stream). Adjust the long retry as if the frame was -* tried hw->max_rate_tries times to affect how ratectrl updates PER for -* the failed rate. In case of congestion on the bus penalizing these -* type of underruns should help hardware actually transmit new frames -* successfully by eventually preferring slower rates. This itself -* should also alleviate congestion on the bus. -*/ -if ((tx_info->pad[0 ] &ATH_TX_INFO_UNDERRUN ) && - (sc->sc_ah->tx_trig_level >= ath_rc_priv->tx_triglevel_max)) { - tx_status =1 ; - is_underrun =1 ; - } -if (!(tx_info->flags &IEEE80211_TX_STAT_ACK )) tx_status =1 ;
@@ -1596,8 +1580,6 @@ static void *ath_rate_alloc_sta(void *priv, struct ieee80211_sta *sta, gfp_t gfpreturn NULL ; } - rate_priv->tx_triglevel_max = sc->sc_ah->caps.tx_triglevel_max; -return rate_priv; }
drivers/net/wireless/ath/ath9k/rc.h +0 -2
@@ -215,7 +215,6 @@ struct ath_rate_priv {u32 per_down_time;u32 probe_interval;u32 prev_data_rix; -u32 tx_triglevel_max;struct ath_rateset neg_rates;struct ath_rateset neg_ht_rates;struct ath_rate_softc *asc;
@@ -227,7 +226,6 @@ struct ath_rate_priv {#define ATH_TX_INFO_FRAME_TYPE_INTERNAL (1 << 0)#define ATH_TX_INFO_FRAME_TYPE_PAUSE (1 << 1) -#define ATH_TX_INFO_UNDERRUN (1 << 4)enum ath9k_internal_frame_type {ATH9K_IFT_NOT_INTERNAL ,
drivers/net/wireless/ath/ath9k/xmit.c +20 -5
@@ -1968,6 +1968,8 @@ static void ath_tx_rc_status(struct ath_buf *bf, struct ath_tx_status *ts,struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)skb->data;struct ieee80211_tx_info *tx_info =IEEE80211_SKB_CB (skb);struct ieee80211_hw *hw = bf->aphy->hw; +struct ath_softc *sc = bf->aphy->sc; +struct ath_hw *ah = sc->sc_ah;u8 i, tx_rateindex;if (txok)
@@ -1989,11 +1991,24 @@ static void ath_tx_rc_status(struct ath_buf *bf, struct ath_tx_status *ts,if ((ts->ts_status &ATH9K_TXERR_FILT ) ==0 && (bf->bf_flags &ATH9K_TXDESC_NOACK ) ==0 && update_rc) { -if (ieee80211_is_data (hdr->frame_control)) { -if (ts->ts_flags & - (ATH9K_TX_DATA_UNDERRUN |ATH9K_TX_DELIM_UNDERRUN )) - tx_info->pad[0 ] |=ATH_TX_INFO_UNDERRUN ; - } +/* +* If an underrun error is seen assume it as an excessive +* retry only if max frame trigger level has been reached +* (2 KB for single stream, and 4 KB for dual stream). +* Adjust the long retry as if the frame was tried +* hw->max_rate_tries times to affect how rate control updates +* PER for the failed rate. +* In case of congestion on the bus penalizing this type of +* underruns should help hardware actually transmit new frames +* successfully by eventually preferring slower rates. +* This itself should also alleviate congestion on the bus. +*/ +if (ieee80211_is_data (hdr->frame_control) && + (ts->ts_flags & (ATH9K_TX_DATA_UNDERRUN | +ATH9K_TX_DELIM_UNDERRUN )) && + ah->tx_trig_level >= sc->sc_ah->caps.tx_triglevel_max) + tx_info->status.rates[tx_rateindex].count = + hw->max_rate_tries; }for (i = tx_rateindex +1 ; i < hw->max_rates; i++) {
Signature · 1 line
1.7.2.2
PATCH 3/5 ath9k: remove the tx info padding byte abuse
Signed-off-by Felix Fietkau <[email protected]>
--- drivers/net/wireless/ath/ath9k/ath9k.h | 3 ++- drivers/net/wireless/ath/ath9k/rc.h | 3 --- drivers/net/wireless/ath/ath9k/virtual.c | 5 ++--- drivers/net/wireless/ath/ath9k/xmit.c | 21 ++++++--------------- 4 files changed, 10 insertions(+), 22 deletions(-)
drivers/net/wireless/ath/ath9k/ath9k.h +2 -1
@@ -229,6 +229,7 @@ struct ath_buf_state {unsigned long bfs_paprd_timestamp;u32 bfs_keyix;enum ath9k_key_type bfs_keytype; +enum ath9k_internal_frame_type bfs_ftype; };struct ath_buf {
@@ -712,7 +713,7 @@ void ath9k_ps_restore(struct ath_softc *sc);void ath9k_set_bssid_mask (struct ieee80211_hw *hw,struct ieee80211_vif *vif);int ath9k_wiphy_add (struct ath_softc *sc);int ath9k_wiphy_del (struct ath_wiphy *aphy); -void ath9k_tx_status (struct ieee80211_hw *hw,struct sk_buff *skb); +void ath9k_tx_status (struct ieee80211_hw *hw,struct sk_buff *skb,int ftype);int ath9k_wiphy_pause (struct ath_wiphy *aphy);int ath9k_wiphy_unpause (struct ath_wiphy *aphy);int ath9k_wiphy_select (struct ath_wiphy *aphy);
drivers/net/wireless/ath/ath9k/rc.h +0 -3
@@ -224,9 +224,6 @@ struct ath_rate_priv {struct ath_rc_stats rcstats[RATE_TABLE_SIZE ]; }; -#define ATH_TX_INFO_FRAME_TYPE_INTERNAL (1 << 0) -#define ATH_TX_INFO_FRAME_TYPE_PAUSE (1 << 1) -enum ath9k_internal_frame_type {ATH9K_IFT_NOT_INTERNAL ,ATH9K_IFT_PAUSE ,
drivers/net/wireless/ath/ath9k/virtual.c +2 -3
@@ -305,13 +305,12 @@ void ath9k_wiphy_chan_work(struct work_struct *work)* ath9k version of ieee80211_tx_status() for TX frames that are generated * internally in the driver. */ -void ath9k_tx_status (struct ieee80211_hw *hw,struct sk_buff *skb) +void ath9k_tx_status (struct ieee80211_hw *hw,struct sk_buff *skb,int ftype) {struct ath_wiphy *aphy = hw->priv;struct ieee80211_tx_info *tx_info =IEEE80211_SKB_CB (skb); -if ((tx_info->pad[0 ] &ATH_TX_INFO_FRAME_TYPE_PAUSE ) && - aphy->state ==ATH_WIPHY_PAUSING ) { +if (ftype ==ATH9K_IFT_PAUSE && aphy->state ==ATH_WIPHY_PAUSING ) {if (!(tx_info->flags &IEEE80211_TX_STAT_ACK )) {printk (KERN_DEBUG "ath9k: %s: no ACK for pause " "frame\n" ,wiphy_name (hw->wiphy));
drivers/net/wireless/ath/ath9k/xmit.c +6 -15
@@ -1580,17 +1580,6 @@ static int ath_tx_setup_buffer(struct ieee80211_hw *hw, struct ath_buf *bf,int padpos, padsize;bool use_ldpc = false; - tx_info->pad[0 ] =0 ; -switch (txctl->frame_type) { -case ATH9K_IFT_NOT_INTERNAL : -break ; -case ATH9K_IFT_PAUSE : - tx_info->pad[0 ] |=ATH_TX_INFO_FRAME_TYPE_PAUSE ; -/* fall through */ -case ATH9K_IFT_UNPAUSE : - tx_info->pad[0 ] |=ATH_TX_INFO_FRAME_TYPE_INTERNAL ; -break ; - } hdrlen =ieee80211_get_hdrlen_from_skb (skb); fc = hdr->frame_control;
@@ -1711,6 +1700,7 @@ static void ath_tx_start_dma(struct ath_softc *sc, struct ath_buf *bf, tid, &bf_head); } }else { + bf->bf_state.bfs_ftype = txctl->frame_type;ath_tx_send_normal (sc, txctl->txq, &bf_head); }
@@ -1828,7 +1818,7 @@ exit:/*****************/ static void ath_tx_complete (struct ath_softc *sc,struct sk_buff *skb, -struct ath_wiphy *aphy,int tx_flags, +struct ath_wiphy *aphy,int tx_flags,int ftype,struct ath_txq *txq) {struct ieee80211_hw *hw = sc->hw;
@@ -1872,8 +1862,8 @@ static void ath_tx_complete(struct ath_softc *sc, struct sk_buff *skb, PS_WAIT_FOR_TX_ACK)); } -if (unlikely (tx_info->pad[0 ] &ATH_TX_INFO_FRAME_TYPE_INTERNAL )) -ath9k_tx_status (hw, skb); +if (unlikely (ftype)) +ath9k_tx_status (hw, skb, ftype);else { q =skb_get_queue_mapping (skb);if (txq == sc->tx.txq_map[q]) {
@@ -1917,7 +1907,8 @@ static void ath_tx_complete_buf(struct ath_softc *sc, struct ath_buf *bf,complete (&sc->paprd_complete); }else {ath_debug_stat_tx (sc, bf, ts); -ath_tx_complete (sc, skb, bf->aphy, tx_flags, txq); +ath_tx_complete (sc, skb, bf->aphy, tx_flags, + bf->bf_state.bfs_ftype, txq); }/* At this point, skb (bf->bf_mpdu) is consumed...make sure we don't * accidentally reference it later.
Signature · 1 line
1.7.2.2
PATCH 4/5 ath9k: clean up tx buffer setup
Merge ath_tx_send_normal and ath_tx_send_ht_normal. Move the paprd state initialization and sequence number assignment to reduce the number of redundant checks.
This not only simplifies buffer allocation error handling, but also removes a small inconsistency in the buffer HT flag. This flag should only be set if the frame is also a QoS data frame.
Signed-off-by Felix Fietkau <[email protected]>
--- drivers/net/wireless/ath/ath9k/xmit.c | 117 +++++++++++---------------------- 1 files changed, 39 insertions(+), 78 deletions(-)
drivers/net/wireless/ath/ath9k/xmit.c +39 -78
@@ -48,9 +48,9 @@ static u16 bits_per_symbol[][2] = {#define IS_HT_RATE (_rate) ((_rate) & 0x80) -static void ath_tx_send_ht_normal (struct ath_softc *sc,struct ath_txq *txq, -struct ath_atx_tid *tid, -struct list_head *bf_head); +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);
@@ -160,7 +160,7 @@ static void ath_tx_flush_tid(struct ath_softc *sc, struct ath_atx_tid *tid)ath_tx_update_baw (sc, tid, bf->bf_seqno);ath_tx_complete_buf (sc, bf, txq, &bf_head, &ts,0 ,0 ); }else { -ath_tx_send_ht_normal (sc, txq, tid, &bf_head); +ath_tx_send_normal (sc, txq, tid, &bf_head); } }
@@ -1322,9 +1322,9 @@ static void ath_tx_send_ampdu(struct ath_softc *sc, struct ath_atx_tid *tid,ath_tx_txqaddbuf (sc, txctl->txq, bf_head); } -static void ath_tx_send_ht_normal (struct ath_softc *sc,struct ath_txq *txq, -struct ath_atx_tid *tid, -struct list_head *bf_head) +static void ath_tx_send_normal (struct ath_softc *sc,struct ath_txq *txq, +struct ath_atx_tid *tid, +struct list_head *bf_head) {struct ath_buf *bf;
@@ -1332,7 +1332,8 @@ static void ath_tx_send_ht_normal(struct ath_softc *sc, struct ath_txq *txq, bf->bf_state.bf_type &= ~BUF_AMPDU ;/* update starting sequence number for subsequent ADDBA request */ -INCR (tid->seq_start,IEEE80211_SEQ_MAX ); +if (tid) +INCR (tid->seq_start,IEEE80211_SEQ_MAX ); bf->bf_nframes =1 ; bf->bf_lastbf = bf;
@@ -1341,20 +1342,6 @@ static void ath_tx_send_ht_normal(struct ath_softc *sc, struct ath_txq *txq,TX_STAT_INC (txq->axq_qnum, queued); } -static void ath_tx_send_normal (struct ath_softc *sc,struct ath_txq *txq, -struct list_head *bf_head) -{ -struct ath_buf *bf; - - bf = list_first_entry(bf_head, struct ath_buf, list); - - bf->bf_lastbf = bf; - bf->bf_nframes =1 ; -ath_buf_set_rate (sc, bf); -ath_tx_txqaddbuf (sc, txq, bf_head); -TX_STAT_INC (txq->axq_qnum, queued); -} -static enum ath9k_pkt_type get_hw_packet_type (struct sk_buff *skb) {struct ieee80211_hdr *hdr;
@@ -1411,7 +1398,7 @@ static void assign_aggr_tid_seqno(struct sk_buff *skb,INCR (tid->seq_next,IEEE80211_SEQ_MAX ); } -static int setup_tx_flags (struct sk_buff *skb,bool use_ldpc) +static int setup_tx_flags (struct sk_buff *skb) {struct ieee80211_tx_info *tx_info =IEEE80211_SKB_CB (skb);int flags =0 ;
@@ -1422,7 +1409,7 @@ static int setup_tx_flags(struct sk_buff *skb, bool use_ldpc)if (tx_info->flags &IEEE80211_TX_CTL_NO_ACK ) flags |=ATH9K_TXDESC_NOACK ; -if (use_ldpc) +if (tx_info->flags &IEEE80211_TX_CTL_LDPC ) flags |=ATH9K_TXDESC_LDPC ;return flags;
@@ -1567,18 +1554,24 @@ static void ath_buf_set_rate(struct ath_softc *sc, struct ath_buf *bf)ath9k_hw_set11n_burstduration (sc->sc_ah, bf->bf_desc,8192 ); } -static int ath_tx_setup_buffer (struct ieee80211_hw *hw,struct ath_buf *bf, -struct sk_buff *skb, -struct ath_tx_control *txctl) +static struct ath_buf *ath_tx_setup_buffer (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 ieee80211_tx_info *tx_info =IEEE80211_SKB_CB (skb);struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)skb->data; +struct ath_buf *bf;int hdrlen;__le16 fc;int padpos, padsize; -bool use_ldpc = false; + + bf =ath_tx_get_buffer (sc); +if (!bf) { +ath_print (common,ATH_DBG_XMIT ,"TX buffers are full\n" ); +return NULL ; + } hdrlen =ieee80211_get_hdrlen_from_skb (skb); fc = hdr->frame_control;
@@ -1594,16 +1587,13 @@ static int ath_tx_setup_buffer(struct ieee80211_hw *hw, struct ath_buf *bf, bf->bf_frmlen -= padsize; } -if (!txctl->paprd &&conf_is_ht (&hw->conf)) { +if (ieee80211_is_data_qos (fc) &&conf_is_ht (&hw->conf)) { bf->bf_state.bf_type |=BUF_HT ; -if (tx_info->flags &IEEE80211_TX_CTL_LDPC ) - use_ldpc = true; +if (sc->sc_flags &SC_OP_TXAGGR ) +assign_aggr_tid_seqno (skb, bf); } - bf->bf_state.bfs_paprd = txctl->paprd; -if (txctl->paprd) - bf->bf_state.bfs_paprd_timestamp = jiffies; - bf->bf_flags =setup_tx_flags (skb, use_ldpc); + 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 ) {
@@ -1613,10 +1603,6 @@ static int ath_tx_setup_buffer(struct ieee80211_hw *hw, struct ath_buf *bf, bf->bf_keyix =ATH9K_TXKEYIX_INVALID ; } -if (ieee80211_is_data_qos (fc) &&bf_isht (bf) && - (sc->sc_flags &SC_OP_TXAGGR )) -assign_aggr_tid_seqno (skb, bf); - bf->bf_mpdu = skb; bf->bf_buf_addr = dma_map_single(sc->dev, skb->data,
@@ -1626,12 +1612,13 @@ static int ath_tx_setup_buffer(struct ieee80211_hw *hw, struct ath_buf *bf, bf->bf_buf_addr =0 ;ath_print (ath9k_hw_common (sc->sc_ah),ATH_DBG_FATAL ,"dma_mapping_error() on TX\n" ); -return -ENOMEM ; +ath_tx_return_buffer (sc, bf); +return NULL ; } bf->bf_tx_aborted = false; -return 0 ; +return bf; }/* FIXME: tx power */
@@ -1679,11 +1666,6 @@ static void ath_tx_start_dma(struct ath_softc *sc, struct ath_buf *bf, an = (struct ath_node *)tx_info->control.sta->drv_priv; tid =ATH_AN_2_TID (an, bf->bf_tidno); -if (!ieee80211_is_data_qos (fc)) { -ath_tx_send_normal (sc, txctl->txq, &bf_head); - goto tx_done; - } -WARN_ON (tid->ac->txq != txctl->txq);if (tx_info->flags &IEEE80211_TX_CTL_AMPDU ) {/*
@@ -1696,15 +1678,18 @@ static void ath_tx_start_dma(struct ath_softc *sc, struct ath_buf *bf,* Send this frame as regular when ADDBA * exchange is neither complete nor pending. */ -ath_tx_send_ht_normal (sc, txctl->txq, - tid, &bf_head); +ath_tx_send_normal (sc, txctl->txq, tid, &bf_head); } }else { bf->bf_state.bfs_ftype = txctl->frame_type; -ath_tx_send_normal (sc, txctl->txq, &bf_head); + bf->bf_state.bfs_paprd = txctl->paprd; + +if (txctl->paprd) + bf->bf_state.bfs_paprd_timestamp = jiffies; + +ath_tx_send_normal (sc, txctl->txq,NULL , &bf_head); } -tx_done:spin_unlock_bh (&txctl->txq->axq_lock); }
@@ -1714,39 +1699,15 @@ int ath_tx_start(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_txq *txq = txctl->txq;struct ath_buf *bf; -int q, r; +int q; - bf =ath_tx_get_buffer (sc); -if (!bf) { -ath_print (common,ATH_DBG_XMIT ,"TX buffers are full\n" ); -return -1 ; - } + bf =ath_tx_setup_buffer (hw, skb); +if (unlikely (!bf)) +return -ENOMEM ; q =skb_get_queue_mapping (skb); - r =ath_tx_setup_buffer (hw, bf, skb, txctl); -if (unlikely (r)) { -ath_print (common,ATH_DBG_FATAL ,"TX mem alloc failure\n" ); - -/* upon ath_tx_processq() this TX queue will be resumed, we -* guarantee this will happen by knowing beforehand that -* we will at least have to run TX completionon one buffer -* on the queue */ -spin_lock_bh (&txq->axq_lock); -if (txq == sc->tx.txq_map[q] && !txq->stopped && - txq->axq_depth >1 ) { -ath_mac80211_stop_queue (sc, q); - txq->stopped =1 ; - } -spin_unlock_bh (&txq->axq_lock); - -ath_tx_return_buffer (sc, bf); - -return r; - } -spin_lock_bh (&txq->axq_lock);if (txq == sc->tx.txq_map[q] && ++txq->pending_frames >ATH_MAX_QDEPTH && !txq->stopped) {
Signature · 1 line
1.7.2.2
PATCH 5/5 ath9k_hw: add a private op for configuring radar pulse detection
Signed-off-by Felix Fietkau <[email protected]>
--- drivers/net/wireless/ath/ath9k/ar5008_phy.c | 32 ++++++++++++++++++++++++ drivers/net/wireless/ath/ath9k/ar9003_phy.c | 32 ++++++++++++++++++++++++ drivers/net/wireless/ath/ath9k/hw.h | 36 +++++++++++++++++++++++++++ 3 files changed, 100 insertions(+), 0 deletions(-)
drivers/net/wireless/ath/ath9k/ar5008_phy.c +32 -0
@@ -1579,6 +1579,37 @@ static void ar5008_hw_set_nf_limits(struct ath_hw *ah) ah->nf_5g.nominal =AR_PHY_CCA_NOM_VAL_5416_5GHZ ; } +static void ar5008_hw_set_radar_params (struct ath_hw *ah, +struct ath_hw_radar_conf *conf) +{ +u32 radar_0 =0 , radar_1 =0 ; + +if (!conf) { +REG_CLR_BIT (ah,AR_PHY_RADAR_0 ,AR_PHY_RADAR_0_ENA ); +return ; + } + + radar_0 |=AR_PHY_RADAR_0_ENA |AR_PHY_RADAR_0_FFT_ENA ; + radar_0 |=SM (conf->fir_power,AR_PHY_RADAR_0_FIRPWR ); + radar_0 |=SM (conf->radar_rssi,AR_PHY_RADAR_0_RRSSI ); + radar_0 |=SM (conf->pulse_height,AR_PHY_RADAR_0_HEIGHT ); + radar_0 |=SM (conf->pulse_rssi,AR_PHY_RADAR_0_PRSSI ); + radar_0 |=SM (conf->pulse_inband,AR_PHY_RADAR_0_INBAND ); + + radar_1 |=AR_PHY_RADAR_1_MAX_RRSSI ; + radar_1 |=AR_PHY_RADAR_1_BLOCK_CHECK ; + radar_1 |=SM (conf->pulse_maxlen,AR_PHY_RADAR_1_MAXLEN ); + radar_1 |=SM (conf->pulse_inband_step,AR_PHY_RADAR_1_RELSTEP_THRESH ); + radar_1 |=SM (conf->radar_inband,AR_PHY_RADAR_1_RELPWR_THRESH ); + +REG_WRITE (ah,AR_PHY_RADAR_0 , radar_0); +REG_WRITE (ah,AR_PHY_RADAR_1 , radar_1); +if (conf->ext_channel) +REG_SET_BIT (ah,AR_PHY_RADAR_EXT ,AR_PHY_RADAR_EXT_ENA ); +else +REG_CLR_BIT (ah,AR_PHY_RADAR_EXT ,AR_PHY_RADAR_EXT_ENA ); +} +void ar5008_hw_attach_phy_ops (struct ath_hw *ah) {struct ath_hw_private_ops *priv_ops =ath9k_hw_private_ops (ah);
@@ -1609,6 +1640,7 @@ void ar5008_hw_attach_phy_ops(struct ath_hw *ah) priv_ops->restore_chainmask = ar5008_restore_chainmask; priv_ops->set_diversity = ar5008_set_diversity; priv_ops->do_getnf = ar5008_hw_do_getnf; + priv_ops->set_radar_params = ar5008_hw_set_radar_params;if (modparam_force_new_ani) { priv_ops->ani_control = ar5008_hw_ani_control_new;
drivers/net/wireless/ath/ath9k/ar9003_phy.c +32 -0
@@ -1113,6 +1113,37 @@ static void ar9003_hw_ani_cache_ini_regs(struct ath_hw *ah) aniState->mrcCCKOff = !ATH9K_ANI_ENABLE_MRC_CCK ; } +static void ar9003_hw_set_radar_params (struct ath_hw *ah, +struct ath_hw_radar_conf *conf) +{ +u32 radar_0 =0 , radar_1 =0 ; + +if (!conf) { +REG_CLR_BIT (ah,AR_PHY_RADAR_0 ,AR_PHY_RADAR_0_ENA ); +return ; + } + + radar_0 |=AR_PHY_RADAR_0_ENA |AR_PHY_RADAR_0_FFT_ENA ; + radar_0 |=SM (conf->fir_power,AR_PHY_RADAR_0_FIRPWR ); + radar_0 |=SM (conf->radar_rssi,AR_PHY_RADAR_0_RRSSI ); + radar_0 |=SM (conf->pulse_height,AR_PHY_RADAR_0_HEIGHT ); + radar_0 |=SM (conf->pulse_rssi,AR_PHY_RADAR_0_PRSSI ); + radar_0 |=SM (conf->pulse_inband,AR_PHY_RADAR_0_INBAND ); + + radar_1 |=AR_PHY_RADAR_1_MAX_RRSSI ; + radar_1 |=AR_PHY_RADAR_1_BLOCK_CHECK ; + radar_1 |=SM (conf->pulse_maxlen,AR_PHY_RADAR_1_MAXLEN ); + radar_1 |=SM (conf->pulse_inband_step,AR_PHY_RADAR_1_RELSTEP_THRESH ); + radar_1 |=SM (conf->radar_inband,AR_PHY_RADAR_1_RELPWR_THRESH ); + +REG_WRITE (ah,AR_PHY_RADAR_0 , radar_0); +REG_WRITE (ah,AR_PHY_RADAR_1 , radar_1); +if (conf->ext_channel) +REG_SET_BIT (ah,AR_PHY_RADAR_EXT ,AR_PHY_RADAR_EXT_ENA ); +else +REG_CLR_BIT (ah,AR_PHY_RADAR_EXT ,AR_PHY_RADAR_EXT_ENA ); +} +void ar9003_hw_attach_phy_ops (struct ath_hw *ah) {struct ath_hw_private_ops *priv_ops =ath9k_hw_private_ops (ah);
@@ -1141,6 +1172,7 @@ void ar9003_hw_attach_phy_ops(struct ath_hw *ah) priv_ops->ani_control = ar9003_hw_ani_control; priv_ops->do_getnf = ar9003_hw_do_getnf; priv_ops->ani_cache_ini_regs = ar9003_hw_ani_cache_ini_regs; + priv_ops->set_radar_params = ar9003_hw_set_radar_params;ar9003_hw_set_nf_limits (ah);memcpy (ah->nf_regs, ar9300_cca_regs,sizeof (ah->nf_regs));
drivers/net/wireless/ath/ath9k/hw.h +36 -0
@@ -485,6 +485,40 @@ struct ath_hw_antcomb_conf { };/** +* struct ath_hw_radar_conf - radar detection initialization parameters +* +* @pulse_inband: threshold for checking the ratio of in-band power +* to total power for short radar pulses (half dB steps) +* @pulse_inband_step: threshold for checking an in-band power to total +* power ratio increase for short radar pulses (half dB steps) +* @pulse_height: threshold for detecting the beginning of a short +* radar pulse (dB step) +* @pulse_rssi: threshold for detecting if a short radar pulse is +* gone (dB step) +* @pulse_maxlen: maximum pulse length (0.8 us steps) +* +* @radar_rssi: RSSI threshold for starting long radar detection (dB steps) +* @radar_inband: threshold for checking the ratio of in-band power +* to total power for long radar pulses (half dB steps) +* @fir_power: threshold for detecting the end of a long radar pulse (dB) +* +* @ext_channel: enable extension channel radar detection +*/ +struct ath_hw_radar_conf { +unsigned int pulse_inband; +unsigned int pulse_inband_step; +unsigned int pulse_height; +unsigned int pulse_rssi; +unsigned int pulse_maxlen; + +unsigned int radar_rssi; +unsigned int radar_inband; +int fir_power; + +bool ext_channel; +}; + +/** * struct ath_hw_private_ops - callbacks used internally by hardware code * * This structure contains private callbacks designed to only be used internally
@@ -549,6 +583,8 @@ struct ath_hw_private_ops {bool (*ani_control)(struct ath_hw *ah,enum ath9k_ani_cmd cmd,int param);void (*do_getnf)(struct ath_hw *ah,int16_t nfarray[NUM_NF_READINGS ]); +void (*set_radar_params)(struct ath_hw *ah, +struct ath_hw_radar_conf *conf);/* ANI */ void (*ani_cache_ini_regs)(struct ath_hw *ah);
Signature · 1 line
1.7.2.2