Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net
[cascardo/linux.git] / net / mac80211 / agg-rx.c
index a9aff60..f6749dc 100644 (file)
@@ -261,10 +261,16 @@ void __ieee80211_start_rx_ba_session(struct sta_info *sta,
                .timeout = timeout,
                .ssn = start_seq_num,
        };
-
        int i, ret = -EOPNOTSUPP;
        u16 status = WLAN_STATUS_REQUEST_DECLINED;
 
+       if (tid >= IEEE80211_FIRST_TSPEC_TSID) {
+               ht_dbg(sta->sdata,
+                      "STA %pM requests BA session on unsupported tid %d\n",
+                      sta->sta.addr, tid);
+               goto end_no_lock;
+       }
+
        if (!sta->sta.ht_cap.ht_supported) {
                ht_dbg(sta->sdata,
                       "STA %pM erroneously requests BA session on tid %d w/o QoS\n",
@@ -298,10 +304,13 @@ void __ieee80211_start_rx_ba_session(struct sta_info *sta,
                buf_size = IEEE80211_MAX_AMPDU_BUF;
 
        /* make sure the size doesn't exceed the maximum supported by the hw */
-       if (buf_size > local->hw.max_rx_aggregation_subframes)
-               buf_size = local->hw.max_rx_aggregation_subframes;
+       if (buf_size > sta->sta.max_rx_aggregation_subframes)
+               buf_size = sta->sta.max_rx_aggregation_subframes;
        params.buf_size = buf_size;
 
+       ht_dbg(sta->sdata, "AddBA Req buf_size=%d for %pM\n",
+              buf_size, sta->sta.addr);
+
        /* examine state machine */
        mutex_lock(&sta->ampdu_mlme.mtx);
 
@@ -406,8 +415,10 @@ void __ieee80211_start_rx_ba_session(struct sta_info *sta,
        }
 
 end:
-       if (status == WLAN_STATUS_SUCCESS)
+       if (status == WLAN_STATUS_SUCCESS) {
                __set_bit(tid, sta->ampdu_mlme.agg_session_valid);
+               __clear_bit(tid, sta->ampdu_mlme.unexpected_agg);
+       }
        mutex_unlock(&sta->ampdu_mlme.mtx);
 
 end_no_lock: