struct ath_buf_state bf_state;
};
-@@ -658,11 +659,10 @@ enum sc_op_flags {
+@@ -253,6 +254,7 @@ struct ath_atx_tid {
+ int sched;
+ int paused;
+ u8 state;
++ bool stop_cb;
+ };
+
+ struct ath_node {
+@@ -350,7 +352,8 @@ void ath_tx_tasklet(struct ath_softc *sc
+ void ath_tx_edma_tasklet(struct ath_softc *sc);
+ int ath_tx_aggr_start(struct ath_softc *sc, struct ieee80211_sta *sta,
+ u16 tid, u16 *ssn);
+-void ath_tx_aggr_stop(struct ath_softc *sc, struct ieee80211_sta *sta, u16 tid);
++bool ath_tx_aggr_stop(struct ath_softc *sc, struct ieee80211_sta *sta, u16 tid,
++ bool flush);
+ void ath_tx_aggr_resume(struct ath_softc *sc, struct ieee80211_sta *sta, u16 tid);
+
+ void ath_tx_aggr_wakeup(struct ath_softc *sc, struct ath_node *an);
+@@ -658,11 +661,10 @@ enum sc_op_flags {
struct ath_rate_table;
struct ath9k_vif_iter_data {
int nstations; /* number of station vifs */
--- a/drivers/net/wireless/ath/ath9k/hw.c
+++ b/drivers/net/wireless/ath/ath9k/hw.c
-@@ -1698,12 +1698,11 @@ static void ath9k_hw_reset_opmode(struct
+@@ -1366,7 +1366,10 @@ static bool ath9k_hw_set_reset(struct at
+
+ REGWRITE_BUFFER_FLUSH(ah);
+
+- udelay(50);
++ if (AR_SREV_9100(ah))
++ mdelay(10);
++ else
++ udelay(50);
+
+ REG_WRITE(ah, AR_RTC_RC, 0);
+ if (!ath9k_hw_wait(ah, AR_RTC_RC, AR_RTC_RC_M, 0, AH_WAIT_TIMEOUT)) {
+@@ -1377,8 +1380,12 @@ static bool ath9k_hw_set_reset(struct at
+ if (!AR_SREV_9100(ah))
+ REG_WRITE(ah, AR_RC, 0);
+
+- if (AR_SREV_9100(ah))
++ if (AR_SREV_9100(ah) && type != ATH9K_RESET_WARM) {
++ if (ah->external_reset)
++ ah->external_reset();
++
+ udelay(50);
++ }
+
+ return true;
+ }
+@@ -1464,7 +1471,8 @@ static bool ath9k_hw_chip_reset(struct a
+ reset_type = ATH9K_RESET_POWER_ON;
+ else
+ reset_type = ATH9K_RESET_COLD;
+- } else if (ah->chip_fullsleep || REG_READ(ah, AR_Q_TXE) ||
++ } else if (ah->chip_fullsleep ||
++ REG_READ(ah, AR_Q_TXE) ||
+ (REG_READ(ah, AR_CR) & AR_CR_RXE))
+ reset_type = ATH9K_RESET_COLD;
+
+@@ -1698,12 +1706,11 @@ static void ath9k_hw_reset_opmode(struct
ENABLE_REGWRITE_BUFFER(ah);
}
/* Called with sc->mutex held. */
+@@ -1327,6 +1332,7 @@ static int ath9k_sta_add(struct ieee8021
+ struct ath_common *common = ath9k_hw_common(sc->sc_ah);
+ struct ath_node *an = (struct ath_node *) sta->drv_priv;
+ struct ieee80211_key_conf ps_key = { };
++ int key;
+
+ ath_node_attach(sc, sta, vif);
+
+@@ -1334,7 +1340,9 @@ static int ath9k_sta_add(struct ieee8021
+ vif->type != NL80211_IFTYPE_AP_VLAN)
+ return 0;
+
+- an->ps_key = ath_key_config(common, vif, sta, &ps_key);
++ key = ath_key_config(common, vif, sta, &ps_key);
++ if (key > 0)
++ an->ps_key = key;
+
+ return 0;
+ }
+@@ -1351,6 +1359,7 @@ static void ath9k_del_ps_key(struct ath_
+ return;
+
+ ath_key_delete(common, &ps_key);
++ an->ps_key = 0;
+ }
+
+ static int ath9k_sta_remove(struct ieee80211_hw *hw,
+@@ -1678,6 +1687,7 @@ static int ath9k_ampdu_action(struct iee
+ u16 tid, u16 *ssn, u8 buf_size)
+ {
+ struct ath_softc *sc = hw->priv;
++ bool flush = false, cb;
+ int ret = 0;
+
+ local_bh_disable();
+@@ -1694,12 +1704,14 @@ static int ath9k_ampdu_action(struct iee
+ ieee80211_start_tx_ba_cb_irqsafe(vif, sta->addr, tid);
+ ath9k_ps_restore(sc);
+ break;
+- case IEEE80211_AMPDU_TX_STOP_CONT:
+ case IEEE80211_AMPDU_TX_STOP_FLUSH:
+ case IEEE80211_AMPDU_TX_STOP_FLUSH_CONT:
++ flush = true;
++ case IEEE80211_AMPDU_TX_STOP_CONT:
+ ath9k_ps_wakeup(sc);
+- ath_tx_aggr_stop(sc, sta, tid);
+- ieee80211_stop_tx_ba_cb_irqsafe(vif, sta->addr, tid);
++ cb = ath_tx_aggr_stop(sc, sta, tid, flush);
++ if (cb)
++ ieee80211_stop_tx_ba_cb_irqsafe(vif, sta->addr, tid);
+ ath9k_ps_restore(sc);
+ break;
+ case IEEE80211_AMPDU_TX_OPERATIONAL:
--- a/drivers/net/wireless/ath/ath9k/reg.h
+++ b/drivers/net/wireless/ath/ath9k/reg.h
@@ -1493,9 +1493,6 @@ enum {
if (!local->ops->channel_switch) {
/* call "hw_config" only if doing sw channel switch */
-@@ -1054,56 +1013,193 @@ static void ieee80211_chswitch_timer(uns
+@@ -1054,56 +1013,208 @@ static void ieee80211_chswitch_timer(uns
ieee80211_queue_work(&sdata->local->hw, &sdata->u.mgd.chswitch_work);
}
ieee80211_sta_process_chanswitch(struct ieee80211_sub_if_data *sdata,
- const struct ieee80211_channel_sw_ie *sw_elem,
- struct ieee80211_bss *bss, u64 timestamp)
-+ u64 timestamp, struct ieee802_11_elems *elems)
++ u64 timestamp, struct ieee802_11_elems *elems,
++ bool beacon)
{
- struct cfg80211_bss *cbss =
- container_of((void *)bss, struct cfg80211_bss, priv);
+ struct cfg80211_chan_def new_vht_chandef = {};
+ const struct ieee80211_sec_chan_offs_ie *sec_chan_offs;
+ const struct ieee80211_wide_bw_chansw_ie *wide_bw_chansw_ie;
++ const struct ieee80211_ht_operation *ht_oper;
+ int secondary_channel_offset = -1;
ASSERT_MGD_MTX(ifmgd);
- if (!ifmgd->associated)
+ if (!cbss)
++ return;
++
++ if (local->scanning)
return;
- if (sdata->local->scanning)
-+ if (local->scanning)
++ /* disregard subsequent announcements if we are already processing */
++ if (ifmgd->flags & IEEE80211_STA_CSA_RECEIVED)
return;
- /* Disregard subsequent beacons if we are already running a timer
- processing a CSA */
--
-+ /* disregard subsequent announcements if we are already processing */
- if (ifmgd->flags & IEEE80211_STA_CSA_RECEIVED)
- return;
-
-- new_ch = ieee80211_get_channel(sdata->local->hw.wiphy, new_freq);
-- if (!new_ch || new_ch->flags & IEEE80211_CHAN_DISABLED) {
+ sec_chan_offs = elems->sec_chan_offs;
+ wide_bw_chansw_ie = elems->wide_bw_chansw_ie;
++ ht_oper = elems->ht_operation;
+
+ if (ifmgd->flags & (IEEE80211_STA_DISABLE_HT |
+ IEEE80211_STA_DISABLE_40MHZ)) {
+ sec_chan_offs = NULL;
+ wide_bw_chansw_ie = NULL;
++ /* only used for bandwidth here */
++ ht_oper = NULL;
+ }
-+
+
+- if (ifmgd->flags & IEEE80211_STA_CSA_RECEIVED)
+ if (ifmgd->flags & IEEE80211_STA_DISABLE_VHT)
+ wide_bw_chansw_ie = NULL;
+
+ mode = elems->ch_switch_ie->mode;
+ } else {
+ /* nothing here we understand */
-+ return;
+ return;
+ }
+
+ bss = (void *)cbss->priv;
-+
+
+- new_ch = ieee80211_get_channel(sdata->local->hw.wiphy, new_freq);
+- if (!new_ch || new_ch->flags & IEEE80211_CHAN_DISABLED) {
+ new_freq = ieee80211_channel_to_frequency(new_chan_no, new_band);
+ new_chan = ieee80211_get_channel(sdata->local->hw.wiphy, new_freq);
+ if (!new_chan || new_chan->flags & IEEE80211_CHAN_DISABLED) {
+ return;
+ }
+
-+ if (sec_chan_offs) {
++ if (!beacon && sec_chan_offs) {
+ secondary_channel_offset = sec_chan_offs->sec_chan_offs;
++ } else if (beacon && ht_oper) {
++ secondary_channel_offset =
++ ht_oper->ht_param & IEEE80211_HT_PARAM_CHA_SEC_OFFSET;
+ } else if (!(ifmgd->flags & IEEE80211_STA_DISABLE_HT)) {
-+ /* if HT is enabled and the IE not present, it's still HT */
++ /*
++ * If it's not a beacon, HT is enabled and the IE not present,
++ * it's 20 MHz, 802.11-2012 8.5.2.6:
++ * This element [the Secondary Channel Offset Element] is
++ * present when switching to a 40 MHz channel. It may be
++ * present when switching to a 20 MHz channel (in which
++ * case the secondary channel offset is set to SCN).
++ */
+ secondary_channel_offset = IEEE80211_HT_PARAM_CHA_SEC_NONE;
+ }
+
return;
}
chanctx = container_of(rcu_access_pointer(sdata->vif.chanctx_conf),
-@@ -1111,40 +1207,39 @@ ieee80211_sta_process_chanswitch(struct
+@@ -1111,40 +1222,39 @@ ieee80211_sta_process_chanswitch(struct
if (chanctx->refcount > 1) {
sdata_info(sdata,
"channel switch with multiple interfaces on the same channel, disconnecting\n");
}
static u32 ieee80211_handle_pwr_constr(struct ieee80211_sub_if_data *sdata,
-@@ -2120,7 +2215,6 @@ void ieee80211_beacon_loss(struct ieee80
+@@ -2120,7 +2230,6 @@ void ieee80211_beacon_loss(struct ieee80
trace_api_beacon_loss(sdata);
sdata->u.mgd.connection_loss = false;
ieee80211_queue_work(hw, &sdata->u.mgd.beacon_connection_loss_work);
}
-@@ -2170,7 +2264,7 @@ static void ieee80211_auth_challenge(str
+@@ -2170,7 +2279,7 @@ static void ieee80211_auth_challenge(str
u32 tx_flags = 0;
pos = mgmt->u.auth.variable;
if (!elems.challenge)
return;
auth_data->expected_transaction = 4;
-@@ -2435,7 +2529,7 @@ static bool ieee80211_assoc_success(stru
+@@ -2435,7 +2544,7 @@ static bool ieee80211_assoc_success(stru
}
pos = mgmt->u.assoc_resp.variable;
if (!elems.supp_rates) {
sdata_info(sdata, "no SuppRates element in AssocResp\n");
-@@ -2604,7 +2698,7 @@ ieee80211_rx_mgmt_assoc_resp(struct ieee
+@@ -2604,7 +2713,7 @@ ieee80211_rx_mgmt_assoc_resp(struct ieee
capab_info, status_code, (u16)(aid & ~(BIT(15) | BIT(14))));
pos = mgmt->u.assoc_resp.variable;
if (status_code == WLAN_STATUS_ASSOC_REJECTED_TEMPORARILY &&
elems.timeout_int &&
-@@ -2659,6 +2753,8 @@ static void ieee80211_rx_bss_info(struct
+@@ -2659,6 +2768,8 @@ static void ieee80211_rx_bss_info(struct
struct ieee80211_channel *channel;
bool need_ps = false;
if ((sdata->u.mgd.associated &&
ether_addr_equal(mgmt->bssid, sdata->u.mgd.associated->bssid)) ||
(sdata->u.mgd.assoc_data &&
-@@ -2689,7 +2785,8 @@ static void ieee80211_rx_bss_info(struct
+@@ -2689,7 +2800,8 @@ static void ieee80211_rx_bss_info(struct
if (bss)
ieee80211_rx_bss_put(local, bss);
return;
if (need_ps) {
-@@ -2698,10 +2795,8 @@ static void ieee80211_rx_bss_info(struct
+@@ -2698,10 +2810,9 @@ static void ieee80211_rx_bss_info(struct
mutex_unlock(&local->iflist_mtx);
}
- memcmp(mgmt->bssid, sdata->u.mgd.associated->bssid, ETH_ALEN) == 0)
- ieee80211_sta_process_chanswitch(sdata, elems->ch_switch_ie,
- bss, rx_status->mactime);
-+ ieee80211_sta_process_chanswitch(sdata, rx_status->mactime, elems);
++ ieee80211_sta_process_chanswitch(sdata, rx_status->mactime,
++ elems, true);
+
}
-@@ -2726,7 +2821,7 @@ static void ieee80211_rx_mgmt_probe_resp
+@@ -2726,7 +2837,7 @@ static void ieee80211_rx_mgmt_probe_resp
return;
ieee802_11_parse_elems(mgmt->u.probe_resp.variable, len - baselen,
ieee80211_rx_bss_info(sdata, mgmt, len, rx_status, &elems);
-@@ -2809,7 +2904,7 @@ ieee80211_rx_mgmt_beacon(struct ieee8021
+@@ -2809,7 +2920,7 @@ ieee80211_rx_mgmt_beacon(struct ieee8021
if (ifmgd->assoc_data && ifmgd->assoc_data->need_beacon &&
ether_addr_equal(mgmt->bssid, ifmgd->assoc_data->bss->bssid)) {
ieee802_11_parse_elems(mgmt->u.beacon.variable,
ieee80211_rx_bss_info(sdata, mgmt, len, rx_status, &elems);
ifmgd->assoc_data->have_beacon = true;
-@@ -2919,7 +3014,7 @@ ieee80211_rx_mgmt_beacon(struct ieee8021
+@@ -2919,7 +3030,7 @@ ieee80211_rx_mgmt_beacon(struct ieee8021
ncrc = crc32_be(0, (void *)&mgmt->u.beacon.beacon_int, 4);
ncrc = ieee802_11_parse_elems_crc(mgmt->u.beacon.variable,
care_about_ies, ncrc);
if (local->hw.flags & IEEE80211_HW_PS_NULLFUNC_STACK) {
-@@ -3066,6 +3161,8 @@ void ieee80211_sta_rx_queued_mgmt(struct
+@@ -3066,6 +3177,8 @@ void ieee80211_sta_rx_queued_mgmt(struct
enum rx_mgmt_action rma = RX_MGMT_NONE;
u8 deauth_buf[IEEE80211_DEAUTH_FRAME_LEN];
u16 fc;
rx_status = (struct ieee80211_rx_status *) skb->cb;
mgmt = (struct ieee80211_mgmt *) skb->data;
-@@ -3095,14 +3192,48 @@ void ieee80211_sta_rx_queued_mgmt(struct
+@@ -3095,14 +3208,48 @@ void ieee80211_sta_rx_queued_mgmt(struct
rma = ieee80211_rx_mgmt_assoc_resp(sdata, mgmt, skb->len, &bss);
break;
case IEEE80211_STYPE_ACTION:
- rx_status->mactime);
- break;
+ rx_status->mactime,
-+ &elems);
++ &elems, false);
+ } else if (mgmt->u.action.category == WLAN_CATEGORY_PUBLIC) {
+ ies_len = skb->len -
+ offsetof(struct ieee80211_mgmt,
+
+ ieee80211_sta_process_chanswitch(sdata,
+ rx_status->mactime,
-+ &elems);
++ &elems, false);
}
+ break;
}
mutex_unlock(&ifmgd->mtx);
+@@ -4197,7 +4344,7 @@ int ieee80211_mgd_deauth(struct ieee8021
+ struct ieee80211_if_managed *ifmgd = &sdata->u.mgd;
+ u8 frame_buf[IEEE80211_DEAUTH_FRAME_LEN];
+ bool tx = !req->local_state_change;
+- bool sent_frame = false;
++ bool report_frame = false;
+
+ mutex_lock(&ifmgd->mtx);
+
+@@ -4214,7 +4361,7 @@ int ieee80211_mgd_deauth(struct ieee8021
+ ieee80211_destroy_auth_data(sdata, false);
+ mutex_unlock(&ifmgd->mtx);
+
+- sent_frame = tx;
++ report_frame = true;
+ goto out;
+ }
+
+@@ -4222,12 +4369,12 @@ int ieee80211_mgd_deauth(struct ieee8021
+ ether_addr_equal(ifmgd->associated->bssid, req->bssid)) {
+ ieee80211_set_disassoc(sdata, IEEE80211_STYPE_DEAUTH,
+ req->reason_code, tx, frame_buf);
+- sent_frame = tx;
++ report_frame = true;
+ }
+ mutex_unlock(&ifmgd->mtx);
+
+ out:
+- if (sent_frame)
++ if (report_frame)
+ __cfg80211_send_deauth(sdata->dev, frame_buf,
+ IEEE80211_DEAUTH_FRAME_LEN);
+
--- a/net/mac80211/pm.c
+++ b/net/mac80211/pm.c
@@ -38,8 +38,8 @@ int __ieee80211_suspend(struct ieee80211
+ if (rates[i].idx < 0)
+ break;
+
-+ rate_idx_match_mask(&rates[i], sband, mask, chan_width,
++ rate_idx_match_mask(&rates[i], sband, chan_width, mask,
+ mcs_mask);
+ }
+}
break;
case cpu_to_le16(IEEE80211_STYPE_ASSOC_RESP):
case cpu_to_le16(IEEE80211_STYPE_REASSOC_RESP):
-@@ -3031,10 +3060,16 @@ static int prepare_for_handlers(struct i
+@@ -3023,6 +3052,9 @@ static int prepare_for_handlers(struct i
+ * and location updates. Note that mac80211
+ * itself never looks at these frames.
+ */
++ if (!multicast &&
++ !ether_addr_equal(sdata->vif.addr, hdr->addr1))
++ return 0;
+ if (ieee80211_is_public_action(hdr, skb->len))
+ return 1;
+ if (!ieee80211_is_beacon(hdr->frame_control))
+@@ -3031,10 +3063,16 @@ static int prepare_for_handlers(struct i
}
break;
case NL80211_IFTYPE_WDS:
hw->flags |= IEEE80211_HW_AMPDU_AGGREGATION;
--- a/drivers/net/wireless/ath/ath9k/xmit.c
+++ b/drivers/net/wireless/ath/ath9k/xmit.c
-@@ -157,6 +157,13 @@ static void ath_send_bar(struct ath_atx_
+@@ -157,7 +157,27 @@ static void ath_send_bar(struct ath_atx_
seqno << IEEE80211_SEQ_SEQ_SHIFT);
}
+-static void ath_tx_flush_tid(struct ath_softc *sc, struct ath_atx_tid *tid)
+static void ath_set_rates(struct ieee80211_vif *vif, struct ieee80211_sta *sta,
+ struct ath_buf *bf)
+{
+ ARRAY_SIZE(bf->rates));
+}
+
- static void ath_tx_flush_tid(struct ath_softc *sc, struct ath_atx_tid *tid)
++static void ath_tx_clear_tid(struct ath_softc *sc, struct ath_atx_tid *tid)
++{
++ tid->state &= ~AGGR_ADDBA_COMPLETE;
++ tid->state &= ~AGGR_CLEANUP;
++ if (!tid->stop_cb)
++ return;
++
++ ieee80211_start_tx_ba_cb_irqsafe(tid->an->vif, tid->an->sta->addr,
++ tid->tidno);
++ tid->stop_cb = false;
++}
++
++static void ath_tx_flush_tid(struct ath_softc *sc, struct ath_atx_tid *tid,
++ bool flush_packets)
{
struct ath_txq *txq = tid->ac->txq;
-@@ -189,6 +196,7 @@ static void ath_tx_flush_tid(struct ath_
+ struct sk_buff *skb;
+@@ -174,31 +194,29 @@ static void ath_tx_flush_tid(struct ath_
+ while ((skb = __skb_dequeue(&tid->buf_q))) {
+ fi = get_frame_info(skb);
+ bf = fi->bf;
++ if (!bf && !flush_packets)
++ bf = ath_tx_setup_buffer(sc, txq, tid, skb);
+
+ if (!bf) {
+- bf = ath_tx_setup_buffer(sc, txq, tid, skb);
+- if (!bf) {
+- ieee80211_free_txskb(sc->hw, skb);
+- continue;
+- }
++ ieee80211_free_txskb(sc->hw, skb);
++ continue;
+ }
+
+- if (fi->retries) {
++ if (fi->retries || flush_packets) {
+ list_add_tail(&bf->list, &bf_head);
+ ath_tx_update_baw(sc, tid, bf->bf_state.seqno);
ath_tx_complete_buf(sc, bf, txq, &bf_head, &ts, 0);
sendbar = true;
} else {
ath_tx_send_normal(sc, txq, NULL, skb);
}
}
-@@ -407,7 +415,7 @@ static void ath_tx_complete_aggr(struct
+
+- if (tid->baw_head == tid->baw_tail) {
+- tid->state &= ~AGGR_ADDBA_COMPLETE;
+- tid->state &= ~AGGR_CLEANUP;
+- }
++ if (tid->baw_head == tid->baw_tail)
++ ath_tx_clear_tid(sc, tid);
+
+- if (sendbar) {
++ if (sendbar && !flush_packets) {
+ ath_txq_unlock(sc, txq);
+ ath_send_bar(tid, tid->seq_start);
+ ath_txq_lock(sc, txq);
+@@ -269,9 +287,7 @@ static void ath_tid_drain(struct ath_sof
+
+ list_add_tail(&bf->list, &bf_head);
+
+- if (fi->retries)
+- ath_tx_update_baw(sc, tid, bf->bf_state.seqno);
+-
++ ath_tx_update_baw(sc, tid, bf->bf_state.seqno);
+ ath_tx_complete_buf(sc, bf, txq, &bf_head, &ts, 0);
+ }
+
+@@ -407,7 +423,7 @@ static void ath_tx_complete_aggr(struct
tx_info = IEEE80211_SKB_CB(skb);
retries = ts->ts_longretry + 1;
for (i = 0; i < ts->ts_rateindex; i++)
-@@ -736,8 +744,6 @@ static int ath_compute_num_delims(struct
+@@ -594,7 +610,7 @@ static void ath_tx_complete_aggr(struct
+ }
+
+ if (tid->state & AGGR_CLEANUP)
+- ath_tx_flush_tid(sc, tid);
++ ath_tx_flush_tid(sc, tid, false);
+
+ rcu_read_unlock();
+
+@@ -612,6 +628,7 @@ static void ath_tx_process_buffer(struct
+ struct ath_tx_status *ts, struct ath_buf *bf,
+ struct list_head *bf_head)
+ {
++ struct ieee80211_tx_info *info;
+ bool txok, flush;
+
+ txok = !(ts->ts_status & ATH9K_TXERR_MASK);
+@@ -623,8 +640,12 @@ static void ath_tx_process_buffer(struct
+ txq->axq_ampdu_depth--;
+
+ if (!bf_isampdu(bf)) {
+- if (!flush)
++ if (!flush) {
++ info = IEEE80211_SKB_CB(bf->bf_mpdu);
++ memcpy(info->control.rates, bf->rates,
++ sizeof(info->control.rates));
+ ath_tx_rc_status(sc, bf, ts, 1, txok ? 0 : 1, txok);
++ }
+ ath_tx_complete_buf(sc, bf, txq, bf_head, ts, txok);
+ } else
+ ath_tx_complete_aggr(sc, txq, bf, bf_head, ts, txok);
+@@ -668,7 +689,7 @@ static u32 ath_lookup_rate(struct ath_so
+
+ skb = bf->bf_mpdu;
+ tx_info = IEEE80211_SKB_CB(skb);
+- rates = tx_info->control.rates;
++ rates = bf->rates;
+
+ /*
+ * Find the lowest frame length among the rate series that will have a
+@@ -736,8 +757,6 @@ static int ath_compute_num_delims(struct
bool first_subfrm)
{
#define FIRST_DESC_NDELIMS 60
u32 nsymbits, nsymbols;
u16 minlen;
u8 flags, rix;
-@@ -778,8 +784,8 @@ static int ath_compute_num_delims(struct
+@@ -778,8 +797,8 @@ static int ath_compute_num_delims(struct
if (tid->an->mpdudensity == 0)
return ndelim;
width = (flags & IEEE80211_TX_RC_40_MHZ_WIDTH) ? 1 : 0;
half_gi = (flags & IEEE80211_TX_RC_SHORT_GI) ? 1 : 0;
-@@ -858,6 +864,7 @@ static enum ATH_AGGR_STATUS ath_tx_form_
+@@ -858,6 +877,7 @@ static enum ATH_AGGR_STATUS ath_tx_form_
bf_first = bf;
if (!rl) {
aggr_limit = ath_lookup_rate(sc, bf, tid);
rl = 1;
}
-@@ -998,14 +1005,14 @@ static void ath_buf_set_rate(struct ath_
+@@ -998,14 +1018,14 @@ static void ath_buf_set_rate(struct ath_
skb = bf->bf_mpdu;
tx_info = IEEE80211_SKB_CB(skb);
bool is_40, is_sgi, is_sp;
int phy;
-@@ -1743,6 +1750,7 @@ static void ath_tx_send_ampdu(struct ath
+@@ -1249,18 +1269,23 @@ int ath_tx_aggr_start(struct ath_softc *
+ return 0;
+ }
+
+-void ath_tx_aggr_stop(struct ath_softc *sc, struct ieee80211_sta *sta, u16 tid)
++bool ath_tx_aggr_stop(struct ath_softc *sc, struct ieee80211_sta *sta, u16 tid,
++ bool flush)
+ {
+ struct ath_node *an = (struct ath_node *)sta->drv_priv;
+ struct ath_atx_tid *txtid = ATH_AN_2_TID(an, tid);
+ struct ath_txq *txq = txtid->ac->txq;
++ bool ret = !flush;
++
++ if (flush)
++ txtid->stop_cb = false;
+
+ if (txtid->state & AGGR_CLEANUP)
+- return;
++ return false;
+
+ if (!(txtid->state & AGGR_ADDBA_COMPLETE)) {
+ txtid->state &= ~AGGR_ADDBA_PROGRESS;
+- return;
++ return ret;
+ }
+
+ ath_txq_lock(sc, txq);
+@@ -1272,13 +1297,17 @@ void ath_tx_aggr_stop(struct ath_softc *
+ * TID can only be reused after all in-progress subframes have been
+ * completed.
+ */
+- if (txtid->baw_head != txtid->baw_tail)
++ if (txtid->baw_head != txtid->baw_tail) {
+ txtid->state |= AGGR_CLEANUP;
+- else
++ ret = false;
++ txtid->stop_cb = !flush;
++ } else {
+ txtid->state &= ~AGGR_ADDBA_COMPLETE;
++ }
+
+- ath_tx_flush_tid(sc, txtid);
++ ath_tx_flush_tid(sc, txtid, flush);
+ ath_txq_unlock_complete(sc, txq);
++ return ret;
+ }
+
+ void ath_tx_aggr_sleep(struct ieee80211_sta *sta, struct ath_softc *sc,
+@@ -1743,6 +1772,7 @@ static void ath_tx_send_ampdu(struct ath
return;
}
bf->bf_state.bf_type = BUF_AMPDU;
INIT_LIST_HEAD(&bf_head);
list_add(&bf->list, &bf_head);
-@@ -1892,49 +1900,6 @@ static struct ath_buf *ath_tx_setup_buff
+@@ -1892,49 +1922,6 @@ static struct ath_buf *ath_tx_setup_buff
return bf;
}
/* Upon failure caller should free skb */
int ath_tx_start(struct ieee80211_hw *hw, struct sk_buff *skb,
struct ath_tx_control *txctl)
-@@ -1945,8 +1910,11 @@ int ath_tx_start(struct ieee80211_hw *hw
+@@ -1945,8 +1932,11 @@ int ath_tx_start(struct ieee80211_hw *hw
struct ieee80211_vif *vif = info->control.vif;
struct ath_softc *sc = hw->priv;
struct ath_txq *txq = txctl->txq;
int q;
/* NOTE: sta can be NULL according to net/mac80211.h */
-@@ -2002,8 +1970,41 @@ int ath_tx_start(struct ieee80211_hw *hw
+@@ -2002,8 +1992,41 @@ int ath_tx_start(struct ieee80211_hw *hw
txq->stopped = true;
}
+ ath_tx_send_ampdu(sc, tid, skb, txctl);
+ goto out;
+ }
-+
+
+ bf = ath_tx_setup_buffer(sc, txctl->txq, tid, skb);
+ if (!bf) {
+ if (txctl->paprd)
+
+ ath_set_rates(vif, sta, bf);
+ ath_tx_send_normal(sc, txctl->txq, tid, skb);
-
++
+out:
ath_txq_unlock(sc, txq);
return 0;
+@@ -2414,6 +2437,7 @@ void ath_tx_node_init(struct ath_softc *
+ tid->ac = &an->ac[acno];
+ tid->state &= ~AGGR_ADDBA_COMPLETE;
+ tid->state &= ~AGGR_ADDBA_PROGRESS;
++ tid->stop_cb = false;
+ }
+
+ for (acno = 0, ac = &an->ac[acno];
+@@ -2450,8 +2474,7 @@ void ath_tx_node_cleanup(struct ath_soft
+ }
+
+ ath_tid_drain(sc, txq, tid);
+- tid->state &= ~AGGR_ADDBA_COMPLETE;
+- tid->state &= ~AGGR_CLEANUP;
++ ath_tx_clear_tid(sc, tid);
+
+ ath_txq_unlock(sc, txq);
+ }
--- a/drivers/net/wireless/ath/ath9k/recv.c
+++ b/drivers/net/wireless/ath/ath9k/recv.c
@@ -124,7 +124,7 @@ static bool ath_rx_edma_buf_link(struct
skb_put(skb, rs.rs_datalen + ah->caps.rx_status_len);
if (ah->caps.rx_status_len)
skb_pull(skb, ah->caps.rx_status_len);
+--- a/net/wireless/core.c
++++ b/net/wireless/core.c
+@@ -885,7 +885,6 @@ void cfg80211_leave(struct cfg80211_regi
+ #endif
+ __cfg80211_disconnect(rdev, dev,
+ WLAN_REASON_DEAUTH_LEAVING, true);
+- cfg80211_mlme_down(rdev, dev);
+ wdev_unlock(wdev);
+ break;
+ case NL80211_IFTYPE_MESH_POINT:
+--- a/net/wireless/sme.c
++++ b/net/wireless/sme.c
+@@ -961,7 +961,7 @@ int __cfg80211_disconnect(struct cfg8021
+ /* was it connected by userspace SME? */
+ if (!wdev->conn) {
+ cfg80211_mlme_down(rdev, dev);
+- return 0;
++ goto disconnect;
+ }
+
+ if (wdev->sme_state == CFG80211_SME_CONNECTING &&
+@@ -987,6 +987,7 @@ int __cfg80211_disconnect(struct cfg8021
+ return err;
+ }
+
++ disconnect:
+ if (wdev->sme_state == CFG80211_SME_CONNECTED)
+ __cfg80211_disconnected(dev, NULL, 0, 0, false);
+ else if (wdev->sme_state == CFG80211_SME_CONNECTING)