123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139 |
- From: Lorenzo Bianconi <[email protected]>
- Date: Fri, 2 Nov 2018 21:49:58 +0100
- Subject: [PATCH] ath9k: dynack: make ewma estimation faster
- In order to make propagation time estimation faster,
- use current sample as ewma output value during 'late ack'
- tracking
- Tested-by: Koen Vandeputte <[email protected]>
- Signed-off-by: Lorenzo Bianconi <[email protected]>
- ---
- --- a/drivers/net/wireless/ath/ath9k/ath9k.h
- +++ b/drivers/net/wireless/ath/ath9k/ath9k.h
- @@ -274,7 +274,7 @@ struct ath_node {
- #endif
- u8 key_idx[4];
-
- - u32 ackto;
- + int ackto;
- struct list_head list;
- };
-
- --- a/drivers/net/wireless/ath/ath9k/dynack.c
- +++ b/drivers/net/wireless/ath/ath9k/dynack.c
- @@ -29,9 +29,13 @@
- * ath_dynack_ewma - EWMA (Exponentially Weighted Moving Average) calculation
- *
- */
- -static inline u32 ath_dynack_ewma(u32 old, u32 new)
- +static inline int ath_dynack_ewma(int old, int new)
- {
- - return (new * (EWMA_DIV - EWMA_LEVEL) + old * EWMA_LEVEL) / EWMA_DIV;
- + if (old > 0)
- + return (new * (EWMA_DIV - EWMA_LEVEL) +
- + old * EWMA_LEVEL) / EWMA_DIV;
- + else
- + return new;
- }
-
- /**
- @@ -82,10 +86,10 @@ static inline bool ath_dynack_bssidmask(
- */
- static void ath_dynack_compute_ackto(struct ath_hw *ah)
- {
- - struct ath_node *an;
- - u32 to = 0;
- - struct ath_dynack *da = &ah->dynack;
- struct ath_common *common = ath9k_hw_common(ah);
- + struct ath_dynack *da = &ah->dynack;
- + struct ath_node *an;
- + int to = 0;
-
- list_for_each_entry(an, &da->nodes, list)
- if (an->ackto > to)
- @@ -144,7 +148,8 @@ static void ath_dynack_compute_to(struct
- an->ackto = ath_dynack_ewma(an->ackto,
- ackto);
- ath_dbg(ath9k_hw_common(ah), DYNACK,
- - "%pM to %u\n", dst, an->ackto);
- + "%pM to %d [%u]\n", dst,
- + an->ackto, ackto);
- if (time_is_before_jiffies(da->lto)) {
- ath_dynack_compute_ackto(ah);
- da->lto = jiffies + COMPUTE_TO;
- @@ -166,10 +171,12 @@ static void ath_dynack_compute_to(struct
- * @ah: ath hw
- * @skb: socket buffer
- * @ts: tx status info
- + * @sta: station pointer
- *
- */
- void ath_dynack_sample_tx_ts(struct ath_hw *ah, struct sk_buff *skb,
- - struct ath_tx_status *ts)
- + struct ath_tx_status *ts,
- + struct ieee80211_sta *sta)
- {
- struct ieee80211_hdr *hdr;
- struct ath_dynack *da = &ah->dynack;
- @@ -191,9 +198,16 @@ void ath_dynack_sample_tx_ts(struct ath_
- ieee80211_is_assoc_resp(hdr->frame_control) ||
- ieee80211_is_auth(hdr->frame_control)) {
- ath_dbg(common, DYNACK, "late ack\n");
- +
- ath9k_hw_setslottime(ah, (LATEACK_TO - 3) / 2);
- ath9k_hw_set_ack_timeout(ah, LATEACK_TO);
- ath9k_hw_set_cts_timeout(ah, LATEACK_TO);
- + if (sta) {
- + struct ath_node *an;
- +
- + an = (struct ath_node *)sta->drv_priv;
- + an->ackto = -1;
- + }
- da->lto = jiffies + LATEACK_DELAY;
- }
-
- --- a/drivers/net/wireless/ath/ath9k/dynack.h
- +++ b/drivers/net/wireless/ath/ath9k/dynack.h
- @@ -86,7 +86,8 @@ void ath_dynack_node_deinit(struct ath_h
- void ath_dynack_init(struct ath_hw *ah);
- void ath_dynack_sample_ack_ts(struct ath_hw *ah, struct sk_buff *skb, u32 ts);
- void ath_dynack_sample_tx_ts(struct ath_hw *ah, struct sk_buff *skb,
- - struct ath_tx_status *ts);
- + struct ath_tx_status *ts,
- + struct ieee80211_sta *sta);
- #else
- static inline void ath_dynack_init(struct ath_hw *ah) {}
- static inline void ath_dynack_node_init(struct ath_hw *ah,
- @@ -97,7 +98,8 @@ static inline void ath_dynack_sample_ack
- struct sk_buff *skb, u32 ts) {}
- static inline void ath_dynack_sample_tx_ts(struct ath_hw *ah,
- struct sk_buff *skb,
- - struct ath_tx_status *ts) {}
- + struct ath_tx_status *ts,
- + struct ieee80211_sta *sta) {}
- #endif
-
- #endif /* DYNACK_H */
- --- a/drivers/net/wireless/ath/ath9k/xmit.c
- +++ b/drivers/net/wireless/ath/ath9k/xmit.c
- @@ -629,7 +629,7 @@ static void ath_tx_complete_aggr(struct
- if (bf == bf->bf_lastbf)
- ath_dynack_sample_tx_ts(sc->sc_ah,
- bf->bf_mpdu,
- - ts);
- + ts, sta);
- }
-
- ath_tx_complete_buf(sc, bf, txq, &bf_head, sta, ts,
- @@ -773,7 +773,8 @@ static void ath_tx_process_buffer(struct
- memcpy(info->control.rates, bf->rates,
- sizeof(info->control.rates));
- ath_tx_rc_status(sc, bf, ts, 1, txok ? 0 : 1, txok);
- - ath_dynack_sample_tx_ts(sc->sc_ah, bf->bf_mpdu, ts);
- + ath_dynack_sample_tx_ts(sc->sc_ah, bf->bf_mpdu, ts,
- + sta);
- }
- ath_tx_complete_buf(sc, bf, txq, bf_head, sta, ts, txok);
- } else
|