0dbbc13f9b601f9edebf7125960cf5f4f99421ec
[openwrt-10.03/.git] / package / mac80211 / patches / 521-ath9k_aggr_race_fix.patch
1 --- a/drivers/net/wireless/ath/ath9k/xmit.c
2 +++ b/drivers/net/wireless/ath/ath9k/xmit.c
3 @@ -784,17 +784,23 @@ static void ath_tx_sched_aggr(struct ath
4                  status != ATH_AGGR_BAW_CLOSED);
5  }
6  
7 -void ath_tx_aggr_start(struct ath_softc *sc, struct ieee80211_sta *sta,
8 -                      u16 tid, u16 *ssn)
9 +int ath_tx_aggr_start(struct ath_softc *sc, struct ieee80211_sta *sta,
10 +                     u16 tid, u16 *ssn)
11  {
12         struct ath_atx_tid *txtid;
13         struct ath_node *an;
14  
15         an = (struct ath_node *)sta->drv_priv;
16         txtid = ATH_AN_2_TID(an, tid);
17 +
18 +       if (txtid->state & (AGGR_CLEANUP | AGGR_ADDBA_COMPLETE))
19 +               return -EAGAIN;
20 +
21         txtid->state |= AGGR_ADDBA_PROGRESS;
22         txtid->paused = true;
23         *ssn = txtid->seq_start;
24 +
25 +       return 0;
26  }
27  
28  void ath_tx_aggr_stop(struct ath_softc *sc, struct ieee80211_sta *sta, u16 tid)
29 --- a/drivers/net/wireless/ath/ath9k/ath9k.h
30 +++ b/drivers/net/wireless/ath/ath9k/ath9k.h
31 @@ -346,8 +346,8 @@ void ath_tx_tasklet(struct ath_softc *sc
32  void ath_tx_edma_tasklet(struct ath_softc *sc);
33  void ath_tx_cabq(struct ieee80211_hw *hw, struct sk_buff *skb);
34  bool ath_tx_aggr_check(struct ath_softc *sc, struct ath_node *an, u8 tidno);
35 -void ath_tx_aggr_start(struct ath_softc *sc, struct ieee80211_sta *sta,
36 -                      u16 tid, u16 *ssn);
37 +int ath_tx_aggr_start(struct ath_softc *sc, struct ieee80211_sta *sta,
38 +                     u16 tid, u16 *ssn);
39  void ath_tx_aggr_stop(struct ath_softc *sc, struct ieee80211_sta *sta, u16 tid);
40  void ath_tx_aggr_resume(struct ath_softc *sc, struct ieee80211_sta *sta, u16 tid);
41  void ath9k_enable_ps(struct ath_softc *sc);
42 --- a/drivers/net/wireless/ath/ath9k/main.c
43 +++ b/drivers/net/wireless/ath/ath9k/main.c
44 @@ -1968,8 +1968,9 @@ static int ath9k_ampdu_action(struct iee
45                 break;
46         case IEEE80211_AMPDU_TX_START:
47                 ath9k_ps_wakeup(sc);
48 -               ath_tx_aggr_start(sc, sta, tid, ssn);
49 -               ieee80211_start_tx_ba_cb_irqsafe(vif, sta->addr, tid);
50 +               ret = ath_tx_aggr_start(sc, sta, tid, ssn);
51 +               if (!ret)
52 +                       ieee80211_start_tx_ba_cb_irqsafe(vif, sta->addr, tid);
53                 ath9k_ps_restore(sc);
54                 break;
55         case IEEE80211_AMPDU_TX_STOP: