mac80211: Move IEEE80211_TX_CTL_PS_RESPONSE
[cascardo/linux.git] / net / mac80211 / sta_info.c
index de494df..db8b07a 100644 (file)
@@ -351,6 +351,9 @@ struct sta_info *sta_info_alloc(struct ieee80211_sub_if_data *sdata,
 
        sta->sta_state = IEEE80211_STA_NONE;
 
+       /* Mark TID as unreserved */
+       sta->reserved_tid = IEEE80211_TID_UNRESERVED;
+
        ktime_get_ts(&uptime);
        sta->last_connected = uptime.tv_sec;
        ewma_init(&sta->avg_signal, 1024, 8);
@@ -501,7 +504,7 @@ static int sta_info_insert_finish(struct sta_info *sta) __acquires(RCU)
        /* make the station visible */
        sta_info_hash_add(local, sta);
 
-       list_add_rcu(&sta->list, &local->sta_list);
+       list_add_tail_rcu(&sta->list, &local->sta_list);
 
        /* notify driver */
        err = sta_info_insert_drv_state(local, sdata, sta);
@@ -847,6 +850,15 @@ static int __must_check __sta_info_destroy_part1(struct sta_info *sta)
        if (WARN_ON(ret))
                return ret;
 
+       /*
+        * for TDLS peers, make sure to return to the base channel before
+        * removal.
+        */
+       if (test_sta_flag(sta, WLAN_STA_TDLS_OFF_CHANNEL)) {
+               drv_tdls_cancel_channel_switch(local, sdata, &sta->sta);
+               clear_sta_flag(sta, WLAN_STA_TDLS_OFF_CHANNEL);
+       }
+
        list_del_rcu(&sta->list);
 
        drv_sta_pre_rcu_remove(local, sta->sdata, sta);
@@ -1231,10 +1243,11 @@ static void ieee80211_send_null_response(struct ieee80211_sub_if_data *sdata,
         * ends the poll/service period.
         */
        info->flags |= IEEE80211_TX_CTL_NO_PS_BUFFER |
-                      IEEE80211_TX_CTL_PS_RESPONSE |
                       IEEE80211_TX_STATUS_EOSP |
                       IEEE80211_TX_CTL_REQ_TX_STATUS;
 
+       info->control.flags |= IEEE80211_TX_CTRL_PS_RESPONSE;
+
        if (call_driver)
                drv_allow_buffered_frames(local, sta, BIT(tid), 1,
                                          reason, false);
@@ -1249,7 +1262,8 @@ static void ieee80211_send_null_response(struct ieee80211_sub_if_data *sdata,
                return;
        }
 
-       ieee80211_xmit(sdata, skb, chanctx_conf->def.chan->band);
+       info->band = chanctx_conf->def.chan->band;
+       ieee80211_xmit(sdata, skb);
        rcu_read_unlock();
 }
 
@@ -1382,8 +1396,8 @@ ieee80211_sta_ps_deliver_response(struct sta_info *sta,
                         * STA may still remain is PS mode after this frame
                         * exchange.
                         */
-                       info->flags |= IEEE80211_TX_CTL_NO_PS_BUFFER |
-                                      IEEE80211_TX_CTL_PS_RESPONSE;
+                       info->flags |= IEEE80211_TX_CTL_NO_PS_BUFFER;
+                       info->control.flags |= IEEE80211_TX_CTRL_PS_RESPONSE;
 
                        /*
                         * Use MoreData flag to indicate whether there are
@@ -1531,7 +1545,7 @@ void ieee80211_sta_ps_deliver_uapsd(struct sta_info *sta)
                break;
        case 0:
                /* XXX: what is a good value? */
-               n_frames = 8;
+               n_frames = 128;
                break;
        }