From: Rafał Miłecki Date: Thu, 1 Mar 2018 13:46:34 +0000 (+0100) Subject: mac80211: reorder patches putting backports first X-Git-Tag: v18.06.0-rc1~749 X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=81542331cb1827650f3abd69375d964d0ce2d050;p=oweals%2Fopenwrt.git mac80211: reorder patches putting backports first Signed-off-by: Rafał Miłecki --- diff --git a/package/kernel/mac80211/patches/300-ath9k_hw-reset-AHB-WMAC-interface-on-AR91xx.patch b/package/kernel/mac80211/patches/300-ath9k_hw-reset-AHB-WMAC-interface-on-AR91xx.patch deleted file mode 100644 index a7bcfa549b..0000000000 --- a/package/kernel/mac80211/patches/300-ath9k_hw-reset-AHB-WMAC-interface-on-AR91xx.patch +++ /dev/null @@ -1,25 +0,0 @@ -From: Felix Fietkau -Date: Sat, 9 Jul 2016 15:25:24 +0200 -Subject: [PATCH] ath9k_hw: reset AHB-WMAC interface on AR91xx - -Should fix a few stability issues - -Signed-off-by: Felix Fietkau ---- - ---- a/drivers/net/wireless/ath/ath9k/hw.c -+++ b/drivers/net/wireless/ath/ath9k/hw.c -@@ -1394,8 +1394,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)) { -+ /* Reset the AHB-WMAC interface */ -+ if (ah->external_reset) -+ ah->external_reset(); - udelay(50); -+ } - - return true; - } diff --git a/package/kernel/mac80211/patches/300-v4.15-ath10k-fix-build-errors-with-CONFIG_PM.patch b/package/kernel/mac80211/patches/300-v4.15-ath10k-fix-build-errors-with-CONFIG_PM.patch new file mode 100644 index 0000000000..2aeb49dc16 --- /dev/null +++ b/package/kernel/mac80211/patches/300-v4.15-ath10k-fix-build-errors-with-CONFIG_PM.patch @@ -0,0 +1,72 @@ +From: Brian Norris +Date: Thu, 19 Oct 2017 11:45:19 -0700 +Subject: [PATCH] ath10k: fix build errors with !CONFIG_PM + +Build errors have been reported with CONFIG_PM=n: + +drivers/net/wireless/ath/ath10k/pci.c:3416:8: error: implicit +declaration of function 'ath10k_pci_suspend' +[-Werror=implicit-function-declaration] + +drivers/net/wireless/ath/ath10k/pci.c:3428:8: error: implicit +declaration of function 'ath10k_pci_resume' +[-Werror=implicit-function-declaration] + +These are caused by the combination of the following two commits: + +6af1de2e4ec4 ("ath10k: mark PM functions as __maybe_unused") +96378bd2c6cd ("ath10k: fix core PCI suspend when WoWLAN is supported but +disabled") + +Both build fine on their own. + +But now that ath10k_pci_pm_{suspend,resume}() is compiled +unconditionally, we should also compile ath10k_pci_{suspend,resume}() +unconditionally. + +And drop the #ifdef around ath10k_pci_hif_{suspend,resume}() too; they +are trivial (empty), so we're not saving much space by compiling them +out. And the alternatives would be to sprinkle more __maybe_unused, or +spread the #ifdef's further. + +Build tested with the following combinations: +CONFIG_PM=y && CONFIG_PM_SLEEP=y +CONFIG_PM=y && CONFIG_PM_SLEEP=n +CONFIG_PM=n + +Fixes: 96378bd2c6cd ("ath10k: fix core PCI suspend when WoWLAN is supported but disabled") +Fixes: 096ad2a15fd8 ("Merge branch 'ath-next'") +Signed-off-by: Brian Norris +Signed-off-by: Kalle Valo +--- + +--- a/drivers/net/wireless/ath/ath10k/pci.c ++++ b/drivers/net/wireless/ath/ath10k/pci.c +@@ -2577,8 +2577,6 @@ void ath10k_pci_hif_power_down(struct at + */ + } + +-#ifdef CONFIG_PM +- + static int ath10k_pci_hif_suspend(struct ath10k *ar) + { + /* Nothing to do; the important stuff is in the driver suspend. */ +@@ -2627,7 +2625,6 @@ static int ath10k_pci_resume(struct ath1 + + return ret; + } +-#endif + + static bool ath10k_pci_validate_cal(void *data, size_t size) + { +@@ -2782,10 +2779,8 @@ static const struct ath10k_hif_ops ath10 + .power_down = ath10k_pci_hif_power_down, + .read32 = ath10k_pci_read32, + .write32 = ath10k_pci_write32, +-#ifdef CONFIG_PM + .suspend = ath10k_pci_hif_suspend, + .resume = ath10k_pci_hif_resume, +-#endif + .fetch_cal_eeprom = ath10k_pci_hif_fetch_cal_eeprom, + }; + diff --git a/package/kernel/mac80211/patches/301-ath9k_hw-issue-external-reset-for-QCA955x.patch b/package/kernel/mac80211/patches/301-ath9k_hw-issue-external-reset-for-QCA955x.patch deleted file mode 100644 index 34d7d3b1cf..0000000000 --- a/package/kernel/mac80211/patches/301-ath9k_hw-issue-external-reset-for-QCA955x.patch +++ /dev/null @@ -1,126 +0,0 @@ -From: Felix Fietkau -Date: Sat, 9 Jul 2016 15:26:44 +0200 -Subject: [PATCH] ath9k_hw: issue external reset for QCA955x - -The RTC interface on the SoC needs to be reset along with the rest of -the WMAC. - -Signed-off-by: Felix Fietkau ---- - ---- a/drivers/net/wireless/ath/ath9k/hw.c -+++ b/drivers/net/wireless/ath/ath9k/hw.c -@@ -1271,39 +1271,56 @@ void ath9k_hw_get_delta_slope_vals(struc - *coef_exponent = coef_exp - 16; - } - --/* AR9330 WAR: -- * call external reset function to reset WMAC if: -- * - doing a cold reset -- * - we have pending frames in the TX queues. -- */ --static bool ath9k_hw_ar9330_reset_war(struct ath_hw *ah, int type) -+static bool ath9k_hw_need_external_reset(struct ath_hw *ah, int type) - { -- int i, npend = 0; -+ int i; - -- for (i = 0; i < AR_NUM_QCU; i++) { -- npend = ath9k_hw_numtxpending(ah, i); -- if (npend) -- break; -+ if (type == ATH9K_RESET_COLD) -+ return true; -+ -+ if (AR_SREV_9550(ah)) -+ return true; -+ -+ /* AR9330 WAR: -+ * call external reset function to reset WMAC if: -+ * - doing a cold reset -+ * - we have pending frames in the TX queues. -+ */ -+ if (AR_SREV_9330(ah)) { -+ for (i = 0; i < AR_NUM_QCU; i++) { -+ if (ath9k_hw_numtxpending(ah, i)) -+ return true; -+ } - } - -- if (ah->external_reset && -- (npend || type == ATH9K_RESET_COLD)) { -- int reset_err = 0; -+ return false; -+} - -- ath_dbg(ath9k_hw_common(ah), RESET, -- "reset MAC via external reset\n"); -+static bool ath9k_hw_external_reset(struct ath_hw *ah, int type) -+{ -+ int err; - -- reset_err = ah->external_reset(); -- if (reset_err) { -- ath_err(ath9k_hw_common(ah), -- "External reset failed, err=%d\n", -- reset_err); -- return false; -- } -+ if (!ah->external_reset || !ath9k_hw_need_external_reset(ah, type)) -+ return true; - -- REG_WRITE(ah, AR_RTC_RESET, 1); -+ ath_dbg(ath9k_hw_common(ah), RESET, -+ "reset MAC via external reset\n"); -+ -+ err = ah->external_reset(); -+ if (err) { -+ ath_err(ath9k_hw_common(ah), -+ "External reset failed, err=%d\n", err); -+ return false; -+ } -+ -+ if (AR_SREV_9550(ah)) { -+ REG_WRITE(ah, AR_RTC_RESET, 0); -+ udelay(10); - } - -+ REG_WRITE(ah, AR_RTC_RESET, 1); -+ udelay(10); -+ - return true; - } - -@@ -1356,24 +1373,24 @@ static bool ath9k_hw_set_reset(struct at - rst_flags |= AR_RTC_RC_MAC_COLD; - } - -- if (AR_SREV_9330(ah)) { -- if (!ath9k_hw_ar9330_reset_war(ah, type)) -- return false; -- } -- - if (ath9k_hw_mci_is_enabled(ah)) - ar9003_mci_check_gpm_offset(ah); - - /* DMA HALT added to resolve ar9300 and ar9580 bus error during -- * RTC_RC reg read -+ * RTC_RC reg read. Also needed for AR9550 external reset - */ -- if (AR_SREV_9300(ah) || AR_SREV_9580(ah)) { -+ if (AR_SREV_9300(ah) || AR_SREV_9580(ah) || AR_SREV_9550(ah)) { - REG_SET_BIT(ah, AR_CFG, AR_CFG_HALT_REQ); - ath9k_hw_wait(ah, AR_CFG, AR_CFG_HALT_ACK, AR_CFG_HALT_ACK, - 20 * AH_WAIT_TIMEOUT); -- REG_CLR_BIT(ah, AR_CFG, AR_CFG_HALT_REQ); - } - -+ if (!AR_SREV_9100(ah)) -+ ath9k_hw_external_reset(ah, type); -+ -+ if (AR_SREV_9300(ah) || AR_SREV_9580(ah)) -+ REG_CLR_BIT(ah, AR_CFG, AR_CFG_HALT_REQ); -+ - REG_WRITE(ah, AR_RTC_RC, rst_flags); - - REGWRITE_BUFFER_FLUSH(ah); diff --git a/package/kernel/mac80211/patches/301-v4.15-mac80211-properly-free-requested-but-not-started-TX-.patch b/package/kernel/mac80211/patches/301-v4.15-mac80211-properly-free-requested-but-not-started-TX-.patch new file mode 100644 index 0000000000..ecc5e49120 --- /dev/null +++ b/package/kernel/mac80211/patches/301-v4.15-mac80211-properly-free-requested-but-not-started-TX-.patch @@ -0,0 +1,37 @@ +From: Johannes Berg +Date: Mon, 20 Nov 2017 17:01:44 +0100 +Subject: [PATCH] mac80211: properly free requested-but-not-started TX agg + sessions + +When deleting a station or otherwise tearing down all aggregation +sessions, make sure to delete requested but not yet started ones, +to avoid the following scenario: + + * session is requested, added to tid_start_tx[] + * ieee80211_ba_session_work() runs, gets past BLOCK_BA check + * ieee80211_sta_tear_down_BA_sessions() runs, locks &sta->ampdu_mlme.mtx, + e.g. while deleting the station - deleting all active sessions + * ieee80211_ba_session_work() continues since tear down flushes it, and + calls ieee80211_tx_ba_session_handle_start() for the new session, arms + the timer for it + * station deletion continues to __cleanup_single_sta() and frees the + session struct, while the timer is armed + +Reported-by: Fengguang Wu +Signed-off-by: Johannes Berg +--- + +--- a/net/mac80211/agg-tx.c ++++ b/net/mac80211/agg-tx.c +@@ -330,6 +330,11 @@ int ___ieee80211_stop_tx_ba_session(stru + + spin_lock_bh(&sta->lock); + ++ /* free struct pending for start, if present */ ++ tid_tx = sta->ampdu_mlme.tid_start_tx[tid]; ++ kfree(tid_tx); ++ sta->ampdu_mlme.tid_start_tx[tid] = NULL; ++ + tid_tx = rcu_dereference_protected_tid_tx(sta, tid); + if (!tid_tx) { + spin_unlock_bh(&sta->lock); diff --git a/package/kernel/mac80211/patches/302-ath9k_hw-set-spectral-scan-enable-bit-on-trigger-for.patch b/package/kernel/mac80211/patches/302-ath9k_hw-set-spectral-scan-enable-bit-on-trigger-for.patch deleted file mode 100644 index dfe9aae268..0000000000 --- a/package/kernel/mac80211/patches/302-ath9k_hw-set-spectral-scan-enable-bit-on-trigger-for.patch +++ /dev/null @@ -1,21 +0,0 @@ -From: Felix Fietkau -Date: Mon, 11 Jul 2016 12:07:40 +0200 -Subject: [PATCH] ath9k_hw: set spectral scan enable bit on trigger for - AR9003+ - -AR9002 code and QCA AR9003+ code do the same. - -Signed-off-by: Felix Fietkau ---- - ---- a/drivers/net/wireless/ath/ath9k/ar9003_phy.c -+++ b/drivers/net/wireless/ath/ath9k/ar9003_phy.c -@@ -1800,6 +1800,8 @@ static void ar9003_hw_spectral_scan_conf - - static void ar9003_hw_spectral_scan_trigger(struct ath_hw *ah) - { -+ REG_SET_BIT(ah, AR_PHY_SPECTRAL_SCAN, -+ AR_PHY_SPECTRAL_SCAN_ENABLE); - /* Activate spectral scan */ - REG_SET_BIT(ah, AR_PHY_SPECTRAL_SCAN, - AR_PHY_SPECTRAL_SCAN_ACTIVE); diff --git a/package/kernel/mac80211/patches/302-v4.15-mac80211-mesh-drop-frames-appearing-to-be-from-us.patch b/package/kernel/mac80211/patches/302-v4.15-mac80211-mesh-drop-frames-appearing-to-be-from-us.patch new file mode 100644 index 0000000000..839e927880 --- /dev/null +++ b/package/kernel/mac80211/patches/302-v4.15-mac80211-mesh-drop-frames-appearing-to-be-from-us.patch @@ -0,0 +1,25 @@ +From: Johannes Berg +Date: Thu, 4 Jan 2018 15:51:53 +0100 +Subject: [PATCH] mac80211: mesh: drop frames appearing to be from us + +If there are multiple mesh stations with the same MAC address, +they will both get confused and start throwing warnings. + +Obviously in this case nothing can actually work anyway, so just +drop frames that look like they're from ourselves early on. + +Reported-by: Gui Iribarren +Signed-off-by: Johannes Berg +--- + +--- a/net/mac80211/rx.c ++++ b/net/mac80211/rx.c +@@ -3632,6 +3632,8 @@ static bool ieee80211_accept_frame(struc + } + return true; + case NL80211_IFTYPE_MESH_POINT: ++ if (ether_addr_equal(sdata->vif.addr, hdr->addr2)) ++ return false; + if (multicast) + return true; + return ether_addr_equal(sdata->vif.addr, hdr->addr1); diff --git a/package/kernel/mac80211/patches/303-ath9k-don-t-run-periodic-and-nf-calibation-at-the-sa.patch b/package/kernel/mac80211/patches/303-ath9k-don-t-run-periodic-and-nf-calibation-at-the-sa.patch deleted file mode 100644 index 22f5154146..0000000000 --- a/package/kernel/mac80211/patches/303-ath9k-don-t-run-periodic-and-nf-calibation-at-the-sa.patch +++ /dev/null @@ -1,27 +0,0 @@ -From: Felix Fietkau -Date: Tue, 27 Dec 2016 23:16:23 +0100 -Subject: [PATCH] ath9k: don't run periodic and nf calibation at the same - time - -The checks already prevents periodic cal from being started while noise -floor calibration runs. It is missing checks for the other way around. - -Signed-off-by: Felix Fietkau ---- - ---- a/drivers/net/wireless/ath/ath9k/ar9002_calib.c -+++ b/drivers/net/wireless/ath/ath9k/ar9002_calib.c -@@ -676,10 +676,10 @@ static int ar9002_hw_calibrate(struct at - return 0; - - ah->cal_list_curr = currCal = currCal->calNext; -- if (currCal->calState == CAL_WAITING) { -+ if (currCal->calState == CAL_WAITING) - ath9k_hw_reset_calibration(ah, currCal); -- return 0; -- } -+ -+ return 0; - } - - /* Do NF cal only at longer intervals */ diff --git a/package/kernel/mac80211/patches/304-ath9k-force-rx_clear-when-disabling-rx.patch b/package/kernel/mac80211/patches/304-ath9k-force-rx_clear-when-disabling-rx.patch deleted file mode 100644 index 8aaccf49b4..0000000000 --- a/package/kernel/mac80211/patches/304-ath9k-force-rx_clear-when-disabling-rx.patch +++ /dev/null @@ -1,35 +0,0 @@ -From: Felix Fietkau -Date: Sun, 7 Jun 2015 13:53:35 +0200 -Subject: [PATCH] ath9k: force rx_clear when disabling rx - -This makes stopping Rx more reliable and should reduce the frequency of -Rx related DMA stop warnings. Don't use rx_clear in TX99 mode. - -Cc: stable@vger.kernel.org -Signed-off-by: Felix Fietkau -Signed-off-by: Helmut Schaa ---- - ---- a/drivers/net/wireless/ath/ath9k/mac.c -+++ b/drivers/net/wireless/ath/ath9k/mac.c -@@ -678,13 +678,18 @@ void ath9k_hw_startpcureceive(struct ath - - ath9k_ani_reset(ah, is_scanning); - -- REG_CLR_BIT(ah, AR_DIAG_SW, (AR_DIAG_RX_DIS | AR_DIAG_RX_ABORT)); -+ REG_CLR_BIT(ah, AR_DIAG_SW, -+ AR_DIAG_RX_DIS | AR_DIAG_RX_ABORT | AR_DIAG_FORCE_RX_CLEAR); - } - EXPORT_SYMBOL(ath9k_hw_startpcureceive); - - void ath9k_hw_abortpcurecv(struct ath_hw *ah) - { -- REG_SET_BIT(ah, AR_DIAG_SW, AR_DIAG_RX_ABORT | AR_DIAG_RX_DIS); -+ u32 reg = AR_DIAG_RX_DIS | AR_DIAG_RX_ABORT; -+ -+ if (!IS_ENABLED(CPTCFG_ATH9K_TX99)) -+ reg |= AR_DIAG_FORCE_RX_CLEAR; -+ REG_SET_BIT(ah, AR_DIAG_SW, reg); - - ath9k_hw_disable_mib_counters(ah); - } diff --git a/package/kernel/mac80211/patches/305-ath9k-limit-retries-for-powersave-response-frames.patch b/package/kernel/mac80211/patches/305-ath9k-limit-retries-for-powersave-response-frames.patch deleted file mode 100644 index 31825b819c..0000000000 --- a/package/kernel/mac80211/patches/305-ath9k-limit-retries-for-powersave-response-frames.patch +++ /dev/null @@ -1,96 +0,0 @@ -From: Felix Fietkau -Date: Thu, 2 Jul 2015 15:20:56 +0200 -Subject: [PATCH] ath9k: limit retries for powersave response frames - -In some cases, the channel might be busy enough that an ath9k AP's -response to PS-Poll frames might be too slow and the station has already -gone to sleep. To avoid wasting too much airtime on this, limit the -number of retries on such frames and ensure that no sample rate gets -used. - -Signed-off-by: Felix Fietkau ---- - ---- a/drivers/net/wireless/ath/ath9k/xmit.c -+++ b/drivers/net/wireless/ath/ath9k/xmit.c -@@ -188,10 +188,25 @@ static void ath_send_bar(struct ath_atx_ - } - - static void ath_set_rates(struct ieee80211_vif *vif, struct ieee80211_sta *sta, -- struct ath_buf *bf) -+ struct ath_buf *bf, bool ps) - { -+ struct ieee80211_tx_info *info = IEEE80211_SKB_CB(bf->bf_mpdu); -+ -+ if (ps) { -+ /* Clear the first rate to avoid using a sample rate for PS frames */ -+ info->control.rates[0].idx = -1; -+ info->control.rates[0].count = 0; -+ } -+ - ieee80211_get_tx_rates(vif, sta, bf->bf_mpdu, bf->rates, - ARRAY_SIZE(bf->rates)); -+ if (!ps) -+ return; -+ -+ if (bf->rates[0].count > 2) -+ bf->rates[0].count = 2; -+ -+ bf->rates[1].idx = -1; - } - - static void ath_txq_skb_done(struct ath_softc *sc, struct ath_txq *txq, -@@ -1502,7 +1517,7 @@ ath_tx_form_burst(struct ath_softc *sc, - break; - } - -- ath_set_rates(tid->an->vif, tid->an->sta, bf); -+ ath_set_rates(tid->an->vif, tid->an->sta, bf, false); - } while (1); - } - -@@ -1532,7 +1547,7 @@ static bool ath_tx_sched_aggr(struct ath - return false; - } - -- ath_set_rates(tid->an->vif, tid->an->sta, bf); -+ ath_set_rates(tid->an->vif, tid->an->sta, bf, false); - if (aggr) - aggr_len = ath_tx_form_aggr(sc, txq, tid, &bf_q, bf); - else -@@ -1690,7 +1705,7 @@ void ath9k_release_buffered_frames(struc - break; - - list_add_tail(&bf->list, &bf_q); -- ath_set_rates(tid->an->vif, tid->an->sta, bf); -+ ath_set_rates(tid->an->vif, tid->an->sta, bf, true); - if (bf_isampdu(bf)) { - ath_tx_addto_baw(sc, tid, bf); - bf->bf_state.bf_type &= ~BUF_AGGR; -@@ -2390,7 +2405,7 @@ int ath_tx_start(struct ieee80211_hw *hw - if (txctl->paprd) - bf->bf_state.bfs_paprd_timestamp = jiffies; - -- ath_set_rates(vif, sta, bf); -+ ath_set_rates(vif, sta, bf, ps_resp); - ath_tx_send_normal(sc, txq, tid, skb); - - out: -@@ -2429,7 +2444,7 @@ void ath_tx_cabq(struct ieee80211_hw *hw - break; - - bf->bf_lastbf = bf; -- ath_set_rates(vif, NULL, bf); -+ ath_set_rates(vif, NULL, bf, false); - ath_buf_set_rate(sc, bf, &info, fi->framelen, false); - duration += info.rates[0].PktDuration; - if (bf_tail) -@@ -2946,7 +2961,7 @@ int ath9k_tx99_send(struct ath_softc *sc - return -EINVAL; - } - -- ath_set_rates(sc->tx99_vif, NULL, bf); -+ ath_set_rates(sc->tx99_vif, NULL, bf, false); - - ath9k_hw_set_desc_link(sc->sc_ah, bf->bf_desc, bf->bf_daddr); - ath9k_hw_tx99_start(sc->sc_ah, txctl->txq->axq_qnum); diff --git a/package/kernel/mac80211/patches/306-Revert-ath9k-interpret-requested-txpower-in-EIRP-dom.patch b/package/kernel/mac80211/patches/306-Revert-ath9k-interpret-requested-txpower-in-EIRP-dom.patch deleted file mode 100644 index 35d07430eb..0000000000 --- a/package/kernel/mac80211/patches/306-Revert-ath9k-interpret-requested-txpower-in-EIRP-dom.patch +++ /dev/null @@ -1,37 +0,0 @@ -From: Felix Fietkau -Date: Sat, 14 May 2016 14:51:02 +0200 -Subject: [PATCH] Revert "ath9k: interpret requested txpower in EIRP - domain" - -This reverts commit 71f5137bf010c6faffab50c0ec15374c59c4a411. ---- - ---- a/drivers/net/wireless/ath/ath9k/hw.c -+++ b/drivers/net/wireless/ath/ath9k/hw.c -@@ -2935,7 +2935,8 @@ void ath9k_hw_apply_txpower(struct ath_h - { - struct ath_regulatory *reg = ath9k_hw_regulatory(ah); - struct ieee80211_channel *channel; -- int chan_pwr, new_pwr; -+ int chan_pwr, new_pwr, max_gain; -+ int ant_gain, ant_reduction = 0; - - if (!chan) - return; -@@ -2943,10 +2944,15 @@ void ath9k_hw_apply_txpower(struct ath_h - channel = chan->chan; - chan_pwr = min_t(int, channel->max_power * 2, MAX_RATE_POWER); - new_pwr = min_t(int, chan_pwr, reg->power_limit); -+ max_gain = chan_pwr - new_pwr + channel->max_antenna_gain * 2; -+ -+ ant_gain = get_antenna_gain(ah, chan); -+ if (ant_gain > max_gain) -+ ant_reduction = ant_gain - max_gain; - - ah->eep_ops->set_txpower(ah, chan, - ath9k_regd_get_ctl(reg, chan), -- get_antenna_gain(ah, chan), new_pwr, test); -+ ant_reduction, new_pwr, test); - } - - void ath9k_hw_set_txpowerlimit(struct ath_hw *ah, u32 limit, bool test) diff --git a/package/kernel/mac80211/patches/307-mac80211-add-hdrlen-to-ieee80211_tx_data.patch b/package/kernel/mac80211/patches/307-mac80211-add-hdrlen-to-ieee80211_tx_data.patch deleted file mode 100644 index 83c613434d..0000000000 --- a/package/kernel/mac80211/patches/307-mac80211-add-hdrlen-to-ieee80211_tx_data.patch +++ /dev/null @@ -1,219 +0,0 @@ -From: Janusz Dziedzic -Date: Fri, 19 Feb 2016 11:01:49 +0100 -Subject: [PATCH] mac80211: add hdrlen to ieee80211_tx_data - -Add hdrlen to ieee80211_tx_data and use this -when wep/ccmd/tkip. This is preparation for -aligned4 code. - -Signed-off-by: Janusz Dziedzic ---- - ---- a/net/mac80211/ieee80211_i.h -+++ b/net/mac80211/ieee80211_i.h -@@ -177,6 +177,7 @@ struct ieee80211_tx_data { - struct ieee80211_tx_rate rate; - - unsigned int flags; -+ unsigned int hdrlen; - }; - - ---- a/net/mac80211/tx.c -+++ b/net/mac80211/tx.c -@@ -921,7 +921,7 @@ ieee80211_tx_h_fragment(struct ieee80211 - struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb); - struct ieee80211_hdr *hdr = (void *)skb->data; - int frag_threshold = tx->local->hw.wiphy->frag_threshold; -- int hdrlen; -+ int hdrlen = tx->hdrlen; - int fragnum; - - /* no matter what happens, tx->skb moves to tx->skbs */ -@@ -942,8 +942,6 @@ ieee80211_tx_h_fragment(struct ieee80211 - if (WARN_ON(info->flags & IEEE80211_TX_CTL_AMPDU)) - return TX_DROP; - -- hdrlen = ieee80211_hdrlen(hdr->frame_control); -- - /* internal error, why isn't DONTFRAG set? */ - if (WARN_ON(skb->len + FCS_LEN <= frag_threshold)) - return TX_DROP; -@@ -1175,6 +1173,8 @@ ieee80211_tx_prepare(struct ieee80211_su - - hdr = (struct ieee80211_hdr *) skb->data; - -+ tx->hdrlen = ieee80211_hdrlen(hdr->frame_control); -+ - if (likely(sta)) { - if (!IS_ERR(sta)) - tx->sta = sta; -@@ -3468,6 +3468,7 @@ begin: - tx.local = local; - tx.skb = skb; - tx.sdata = vif_to_sdata(info->control.vif); -+ tx.hdrlen = ieee80211_padded_hdrlen(hw, hdr->frame_control); - - if (txq->sta) - tx.sta = container_of(txq->sta, struct sta_info, sta); -@@ -3796,6 +3797,7 @@ ieee80211_build_data_template(struct iee - hdr = (void *)skb->data; - tx.sta = sta_info_get(sdata, hdr->addr1); - tx.skb = skb; -+ tx.hdrlen = ieee80211_padded_hdrlen(&tx.local->hw, hdr->frame_control); - - if (ieee80211_tx_h_select_key(&tx) != TX_CONTINUE) { - rcu_read_unlock(); ---- a/net/mac80211/util.c -+++ b/net/mac80211/util.c -@@ -1232,6 +1232,7 @@ void ieee80211_send_auth(struct ieee8021 - struct ieee80211_local *local = sdata->local; - struct sk_buff *skb; - struct ieee80211_mgmt *mgmt; -+ unsigned int hdrlen; - int err; - - /* 24 + 6 = header + auth_algo + auth_transaction + status_code */ -@@ -1255,8 +1256,10 @@ void ieee80211_send_auth(struct ieee8021 - skb_put_data(skb, extra, extra_len); - - if (auth_alg == WLAN_AUTH_SHARED_KEY && transaction == 3) { -+ hdrlen = ieee80211_hdrlen(mgmt->frame_control); - mgmt->frame_control |= cpu_to_le16(IEEE80211_FCTL_PROTECTED); -- err = ieee80211_wep_encrypt(local, skb, key, key_len, key_idx); -+ err = ieee80211_wep_encrypt(local, skb, hdrlen, key, -+ key_len, key_idx); - WARN_ON(err); - } - ---- a/net/mac80211/wep.c -+++ b/net/mac80211/wep.c -@@ -89,11 +89,11 @@ static void ieee80211_wep_get_iv(struct - - static u8 *ieee80211_wep_add_iv(struct ieee80211_local *local, - struct sk_buff *skb, -+ unsigned int hdrlen, - int keylen, int keyidx) - { - struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)skb->data; - struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb); -- unsigned int hdrlen; - u8 *newhdr; - - hdr->frame_control |= cpu_to_le16(IEEE80211_FCTL_PROTECTED); -@@ -101,7 +101,6 @@ static u8 *ieee80211_wep_add_iv(struct i - if (WARN_ON(skb_headroom(skb) < IEEE80211_WEP_IV_LEN)) - return NULL; - -- hdrlen = ieee80211_hdrlen(hdr->frame_control); - newhdr = skb_push(skb, IEEE80211_WEP_IV_LEN); - memmove(newhdr, newhdr + IEEE80211_WEP_IV_LEN, hdrlen); - -@@ -160,6 +159,7 @@ int ieee80211_wep_encrypt_data(struct cr - */ - int ieee80211_wep_encrypt(struct ieee80211_local *local, - struct sk_buff *skb, -+ unsigned int hdrlen, - const u8 *key, int keylen, int keyidx) - { - u8 *iv; -@@ -169,7 +169,7 @@ int ieee80211_wep_encrypt(struct ieee802 - if (WARN_ON(skb_tailroom(skb) < IEEE80211_WEP_ICV_LEN)) - return -1; - -- iv = ieee80211_wep_add_iv(local, skb, keylen, keyidx); -+ iv = ieee80211_wep_add_iv(local, skb, hdrlen, keylen, keyidx); - if (!iv) - return -1; - -@@ -307,13 +307,14 @@ static int wep_encrypt_skb(struct ieee80 - struct ieee80211_key_conf *hw_key = info->control.hw_key; - - if (!hw_key) { -- if (ieee80211_wep_encrypt(tx->local, skb, tx->key->conf.key, -+ if (ieee80211_wep_encrypt(tx->local, skb, tx->hdrlen, -+ tx->key->conf.key, - tx->key->conf.keylen, - tx->key->conf.keyidx)) - return -1; - } else if ((hw_key->flags & IEEE80211_KEY_FLAG_GENERATE_IV) || - (hw_key->flags & IEEE80211_KEY_FLAG_PUT_IV_SPACE)) { -- if (!ieee80211_wep_add_iv(tx->local, skb, -+ if (!ieee80211_wep_add_iv(tx->local, skb, tx->hdrlen, - tx->key->conf.keylen, - tx->key->conf.keyidx)) - return -1; ---- a/net/mac80211/wep.h -+++ b/net/mac80211/wep.h -@@ -22,6 +22,7 @@ int ieee80211_wep_encrypt_data(struct cr - size_t klen, u8 *data, size_t data_len); - int ieee80211_wep_encrypt(struct ieee80211_local *local, - struct sk_buff *skb, -+ unsigned int hdrlen, - const u8 *key, int keylen, int keyidx); - int ieee80211_wep_decrypt_data(struct crypto_cipher *tfm, u8 *rc4key, - size_t klen, u8 *data, size_t data_len); ---- a/net/mac80211/wpa.c -+++ b/net/mac80211/wpa.c -@@ -44,7 +44,7 @@ ieee80211_tx_h_michael_mic_add(struct ie - skb->len < 24 || !ieee80211_is_data_present(hdr->frame_control)) - return TX_CONTINUE; - -- hdrlen = ieee80211_hdrlen(hdr->frame_control); -+ hdrlen = tx->hdrlen; - if (skb->len < hdrlen) - return TX_DROP; - -@@ -187,7 +187,6 @@ mic_fail_no_key: - - static int tkip_encrypt_skb(struct ieee80211_tx_data *tx, struct sk_buff *skb) - { -- struct ieee80211_hdr *hdr = (struct ieee80211_hdr *) skb->data; - struct ieee80211_key *key = tx->key; - struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb); - unsigned int hdrlen; -@@ -202,7 +201,7 @@ static int tkip_encrypt_skb(struct ieee8 - return 0; - } - -- hdrlen = ieee80211_hdrlen(hdr->frame_control); -+ hdrlen = tx->hdrlen; - len = skb->len - hdrlen; - - if (info->control.hw_key) -@@ -420,7 +419,7 @@ static int ccmp_encrypt_skb(struct ieee8 - return 0; - } - -- hdrlen = ieee80211_hdrlen(hdr->frame_control); -+ hdrlen = tx->hdrlen; - len = skb->len - hdrlen; - - if (info->control.hw_key) -@@ -653,7 +652,7 @@ static int gcmp_encrypt_skb(struct ieee8 - return 0; - } - -- hdrlen = ieee80211_hdrlen(hdr->frame_control); -+ hdrlen = tx->hdrlen; - len = skb->len - hdrlen; - - if (info->control.hw_key) -@@ -793,7 +792,6 @@ static ieee80211_tx_result - ieee80211_crypto_cs_encrypt(struct ieee80211_tx_data *tx, - struct sk_buff *skb) - { -- struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)skb->data; - struct ieee80211_key *key = tx->key; - struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb); - int hdrlen; -@@ -809,8 +807,7 @@ ieee80211_crypto_cs_encrypt(struct ieee8 - pskb_expand_head(skb, iv_len, 0, GFP_ATOMIC))) - return TX_DROP; - -- hdrlen = ieee80211_hdrlen(hdr->frame_control); -- -+ hdrlen = tx->hdrlen; - pos = skb_push(skb, iv_len); - memmove(pos, pos + iv_len, hdrlen); - diff --git a/package/kernel/mac80211/patches/308-mac80211-add-NEED_ALIGNED4_SKBS-hw-flag.patch b/package/kernel/mac80211/patches/308-mac80211-add-NEED_ALIGNED4_SKBS-hw-flag.patch deleted file mode 100644 index a9f01b368d..0000000000 --- a/package/kernel/mac80211/patches/308-mac80211-add-NEED_ALIGNED4_SKBS-hw-flag.patch +++ /dev/null @@ -1,233 +0,0 @@ -From: Janusz Dziedzic -Date: Fri, 19 Feb 2016 11:01:50 +0100 -Subject: [PATCH] mac80211: add NEED_ALIGNED4_SKBS hw flag - -HW/driver should set NEED_ALIGNED4_SKBS flag in case -require aligned skbs to four-byte boundaries. -This affect only TX direction. - -Padding is added after ieee80211_hdr, before IV/LLC. - -Before we have to do memmove(hdrlen) twice in the -dirver. Once before we pass this to HW and next -in tx completion (to be sure monitor will report -this tx frame correctly). - -With this patch we can skip this memmove() and save CPU. - -Currently this was tested with ath9k, both hw/sw crypt for -wep/tkip/ccmp. - -Signed-off-by: Janusz Dziedzic ---- - ---- a/include/net/mac80211.h -+++ b/include/net/mac80211.h -@@ -2059,6 +2059,9 @@ struct ieee80211_txq { - * @IEEE80211_HW_SUPPORTS_TDLS_BUFFER_STA: Hardware supports buffer STA on - * TDLS links. - * -+ * @IEEE80211_HW_NEEDS_ALIGNED4_SKBS: Driver need aligned skbs to four-byte. -+ * Padding will be added after ieee80211_hdr, before IV/LLC. -+ * - * @NUM_IEEE80211_HW_FLAGS: number of hardware flags, used for sizing arrays - */ - enum ieee80211_hw_flags { -@@ -2102,6 +2105,7 @@ enum ieee80211_hw_flags { - IEEE80211_HW_REPORTS_LOW_ACK, - IEEE80211_HW_SUPPORTS_TX_FRAG, - IEEE80211_HW_SUPPORTS_TDLS_BUFFER_STA, -+ IEEE80211_HW_NEEDS_ALIGNED4_SKBS, - - /* keep last, obviously */ - NUM_IEEE80211_HW_FLAGS ---- a/net/mac80211/debugfs.c -+++ b/net/mac80211/debugfs.c -@@ -212,6 +212,7 @@ static const char *hw_flag_names[] = { - FLAG(REPORTS_LOW_ACK), - FLAG(SUPPORTS_TX_FRAG), - FLAG(SUPPORTS_TDLS_BUFFER_STA), -+ FLAG(NEEDS_ALIGNED4_SKBS), - #undef FLAG - }; - ---- a/net/mac80211/ieee80211_i.h -+++ b/net/mac80211/ieee80211_i.h -@@ -1548,6 +1548,29 @@ ieee80211_vif_get_num_mcast_if(struct ie - return -1; - } - -+static inline unsigned int -+ieee80211_hdr_padsize(struct ieee80211_hw *hw, unsigned int hdrlen) -+{ -+ /* -+ * While hdrlen is already aligned to two-byte boundaries, -+ * simple check with & 2 will return correct padsize. -+ */ -+ if (ieee80211_hw_check(hw, NEEDS_ALIGNED4_SKBS)) -+ return hdrlen & 2; -+ return 0; -+} -+ -+static inline unsigned int -+ieee80211_padded_hdrlen(struct ieee80211_hw *hw, __le16 fc) -+{ -+ unsigned int hdrlen; -+ -+ hdrlen = ieee80211_hdrlen(fc); -+ hdrlen += ieee80211_hdr_padsize(hw, hdrlen); -+ -+ return hdrlen; -+} -+ - u64 ieee80211_calculate_rx_timestamp(struct ieee80211_local *local, - struct ieee80211_rx_status *status, - unsigned int mpdu_len, ---- a/net/mac80211/sta_info.h -+++ b/net/mac80211/sta_info.h -@@ -300,7 +300,7 @@ struct ieee80211_fast_tx { - u8 hdr_len; - u8 sa_offs, da_offs, pn_offs; - u8 band; -- u8 hdr[30 + 2 + IEEE80211_FAST_XMIT_MAX_IV + -+ u8 hdr[30 + 2 + 2 + IEEE80211_FAST_XMIT_MAX_IV + - sizeof(rfc1042_header)] __aligned(2); - - struct rcu_head rcu_head; ---- a/net/mac80211/status.c -+++ b/net/mac80211/status.c -@@ -642,9 +642,22 @@ void ieee80211_tx_monitor(struct ieee802 - struct sk_buff *skb2; - struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb); - struct ieee80211_sub_if_data *sdata; -+ struct ieee80211_hdr *hdr = (void *)skb->data; - struct net_device *prev_dev = NULL; -+ unsigned int hdrlen, padsize; - int rtap_len; - -+ /* Remove padding if was added */ -+ if (ieee80211_hw_check(&local->hw, NEEDS_ALIGNED4_SKBS)) { -+ hdrlen = ieee80211_hdrlen(hdr->frame_control); -+ padsize = ieee80211_hdr_padsize(&local->hw, hdrlen); -+ -+ if (padsize && skb->len > hdrlen + padsize) { -+ memmove(skb->data + padsize, skb->data, hdrlen); -+ skb_pull(skb, padsize); -+ } -+ } -+ - /* send frame to monitor interfaces now */ - rtap_len = ieee80211_tx_radiotap_len(info); - if (WARN_ON_ONCE(skb_headroom(skb) < rtap_len)) { ---- a/net/mac80211/tkip.c -+++ b/net/mac80211/tkip.c -@@ -201,10 +201,12 @@ void ieee80211_get_tkip_p2k(struct ieee8 - { - struct ieee80211_key *key = (struct ieee80211_key *) - container_of(keyconf, struct ieee80211_key, conf); -+ struct ieee80211_hw *hw = &key->local->hw; - const u8 *tk = &key->conf.key[NL80211_TKIP_DATA_OFFSET_ENCR_KEY]; - struct tkip_ctx *ctx = &key->u.tkip.tx; - struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)skb->data; -- const u8 *data = (u8 *)hdr + ieee80211_hdrlen(hdr->frame_control); -+ const u8 *data = (u8 *)hdr + ieee80211_padded_hdrlen(hw, -+ hdr->frame_control); - u32 iv32 = get_unaligned_le32(&data[4]); - u16 iv16 = data[2] | (data[0] << 8); - ---- a/net/mac80211/tx.c -+++ b/net/mac80211/tx.c -@@ -1172,8 +1172,7 @@ ieee80211_tx_prepare(struct ieee80211_su - info->flags &= ~IEEE80211_TX_INTFL_NEED_TXPROCESSING; - - hdr = (struct ieee80211_hdr *) skb->data; -- -- tx->hdrlen = ieee80211_hdrlen(hdr->frame_control); -+ tx->hdrlen = ieee80211_padded_hdrlen(&local->hw, hdr->frame_control); - - if (likely(sta)) { - if (!IS_ERR(sta)) -@@ -2184,7 +2183,7 @@ netdev_tx_t ieee80211_monitor_start_xmit - goto fail; - - hdr = (struct ieee80211_hdr *)(skb->data + len_rthdr); -- hdrlen = ieee80211_hdrlen(hdr->frame_control); -+ hdrlen = ieee80211_padded_hdrlen(&local->hw, hdr->frame_control); - - if (skb->len < len_rthdr + hdrlen) - goto fail; -@@ -2402,7 +2401,7 @@ static struct sk_buff *ieee80211_build_h - struct ieee80211_chanctx_conf *chanctx_conf; - struct ieee80211_sub_if_data *ap_sdata; - enum nl80211_band band; -- int ret; -+ int padsize, ret; - - if (IS_ERR(sta)) - sta = NULL; -@@ -2622,6 +2621,9 @@ static struct sk_buff *ieee80211_build_h - hdrlen += 2; - } - -+ /* Check aligned4 skb required */ -+ padsize = ieee80211_hdr_padsize(&sdata->local->hw, hdrlen); -+ - /* - * Drop unicast frames to unauthorised stations unless they are - * EAPOL frames from the local station. -@@ -2702,6 +2704,7 @@ static struct sk_buff *ieee80211_build_h - - skb_pull(skb, skip_header_bytes); - head_need = hdrlen + encaps_len + meshhdrlen - skb_headroom(skb); -+ head_need += padsize; - - /* - * So we need to modify the skb header and hence need a copy of -@@ -2734,6 +2737,9 @@ static struct sk_buff *ieee80211_build_h - memcpy(skb_push(skb, meshhdrlen), &mesh_hdr, meshhdrlen); - #endif - -+ if (padsize) -+ memset(skb_push(skb, padsize), 0, padsize); -+ - if (ieee80211_is_data_qos(fc)) { - __le16 *qos_control; - -@@ -2909,6 +2915,9 @@ void ieee80211_check_fast_xmit(struct st - fc |= cpu_to_le16(IEEE80211_STYPE_QOS_DATA); - } - -+ /* Check aligned4 skb required */ -+ build.hdr_len += ieee80211_hdr_padsize(&local->hw, build.hdr_len); -+ - /* We store the key here so there's no point in using rcu_dereference() - * but that's fine because the code that changes the pointers will call - * this function after doing so. For a single CPU that would be enough, -@@ -3495,7 +3504,7 @@ begin: - - if (tx.key && - (tx.key->conf.flags & IEEE80211_KEY_FLAG_GENERATE_IV)) -- pn_offs = ieee80211_hdrlen(hdr->frame_control); -+ pn_offs = tx.hdrlen; - - ieee80211_xmit_fast_finish(sta->sdata, sta, pn_offs, - tx.key, skb); ---- a/net/mac80211/util.c -+++ b/net/mac80211/util.c -@@ -1230,6 +1230,7 @@ void ieee80211_send_auth(struct ieee8021 - u32 tx_flags) - { - struct ieee80211_local *local = sdata->local; -+ struct ieee80211_hw *hw = &local->hw; - struct sk_buff *skb; - struct ieee80211_mgmt *mgmt; - unsigned int hdrlen; -@@ -1256,7 +1257,7 @@ void ieee80211_send_auth(struct ieee8021 - skb_put_data(skb, extra, extra_len); - - if (auth_alg == WLAN_AUTH_SHARED_KEY && transaction == 3) { -- hdrlen = ieee80211_hdrlen(mgmt->frame_control); -+ hdrlen = ieee80211_padded_hdrlen(hw, mgmt->frame_control); - mgmt->frame_control |= cpu_to_le16(IEEE80211_FCTL_PROTECTED); - err = ieee80211_wep_encrypt(local, skb, hdrlen, key, - key_len, key_idx); diff --git a/package/kernel/mac80211/patches/308-v4.16-0001-ath9k-move-spectral-scan-support-under-a-separate-co.patch b/package/kernel/mac80211/patches/308-v4.16-0001-ath9k-move-spectral-scan-support-under-a-separate-co.patch new file mode 100644 index 0000000000..703051fe19 --- /dev/null +++ b/package/kernel/mac80211/patches/308-v4.16-0001-ath9k-move-spectral-scan-support-under-a-separate-co.patch @@ -0,0 +1,103 @@ +From 9df7ddc3ed25b7d3473f117a0680b9418adb5753 Mon Sep 17 00:00:00 2001 +Message-Id: <9df7ddc3ed25b7d3473f117a0680b9418adb5753.1515610034.git.mschiffer@universe-factory.net> +From: Matthias Schiffer +Date: Mon, 27 Nov 2017 18:56:22 +0100 +Subject: [PATCH 1/2] ath9k: move spectral scan support under a separate config + symbol + +At the moment, spectral scan support, and with it RELAY, is always enabled +with ATH9K[_HTC]_DEBUGFS. Spectral scan support is currently the only user +of RELAY in ath9k, and it unconditionally reserves a relay channel. + +Having debugfs support in ath9k is often useful even on very small embedded +routers, where we'd rather like to avoid the code size and RAM usage of the +relay support. + +Signed-off-by: Matthias Schiffer +Signed-off-by: Kalle Valo +--- + drivers/net/wireless/ath/ath9k/Kconfig | 14 ++++++++++---- + drivers/net/wireless/ath/ath9k/Makefile | 4 ++-- + drivers/net/wireless/ath/ath9k/common-spectral.h | 4 ++-- + 3 files changed, 14 insertions(+), 8 deletions(-) + +--- a/drivers/net/wireless/ath/ath9k/Kconfig ++++ b/drivers/net/wireless/ath/ath9k/Kconfig +@@ -64,13 +64,12 @@ config ATH9K_DEBUGFS + depends on ATH9K && DEBUG_FS + select MAC80211_DEBUGFS + select ATH9K_COMMON_DEBUG +- depends on RELAY + ---help--- + Say Y, if you need access to ath9k's statistics for + interrupts, rate control, etc. + +- Also required for changing debug message flags at run time. +- As well as access to the FFT/spectral data and TX99. ++ Also required for changing debug message flags at run time and for ++ TX99. + + config ATH9K_STATION_STATISTICS + bool "Detailed station statistics" +@@ -181,7 +180,6 @@ config ATH9K_HTC_DEBUGFS + bool "Atheros ath9k_htc debugging" + depends on ATH9K_HTC && DEBUG_FS + select ATH9K_COMMON_DEBUG +- depends on RELAY + ---help--- + Say Y, if you need access to ath9k_htc's statistics. + As well as access to the FFT/spectral data. +@@ -197,3 +195,11 @@ config ATH9K_HWRNG + + Say Y, feeds the entropy directly from the WiFi driver to the input + pool. ++ ++config ATH9K_COMMON_SPECTRAL ++ bool "Atheros ath9k/ath9k_htc spectral scan support" ++ depends on ATH9K_DEBUGFS || ATH9K_HTC_DEBUGFS ++ depends on RELAY ++ default n ++ ---help--- ++ Say Y to enable access to the FFT/spectral data via debugfs. +--- a/drivers/net/wireless/ath/ath9k/Makefile ++++ b/drivers/net/wireless/ath/ath9k/Makefile +@@ -61,8 +61,8 @@ ath9k_common-y:= common.o \ + common-init.o \ + common-beacon.o \ + +-ath9k_common-$(CPTCFG_ATH9K_COMMON_DEBUG) += common-debug.o \ +- common-spectral.o ++ath9k_common-$(CPTCFG_ATH9K_COMMON_DEBUG) += common-debug.o ++ath9k_common-$(CPTCFG_ATH9K_COMMON_SPECTRAL) += common-spectral.o + + ath9k_htc-y += htc_hst.o \ + hif_usb.o \ +--- a/drivers/net/wireless/ath/ath9k/common-spectral.h ++++ b/drivers/net/wireless/ath/ath9k/common-spectral.h +@@ -151,7 +151,7 @@ static inline u8 spectral_bitmap_weight( + return bins[0] & 0x3f; + } + +-#ifdef CPTCFG_ATH9K_COMMON_DEBUG ++#ifdef CPTCFG_ATH9K_COMMON_SPECTRAL + void ath9k_cmn_spectral_init_debug(struct ath_spec_scan_priv *spec_priv, struct dentry *debugfs_phy); + void ath9k_cmn_spectral_deinit_debug(struct ath_spec_scan_priv *spec_priv); + +@@ -183,6 +183,6 @@ static inline int ath_cmn_process_fft(st + { + return 0; + } +-#endif /* CPTCFG_ATH9K_COMMON_DEBUG */ ++#endif /* CPTCFG_ATH9K_COMMON_SPECTRAL */ + + #endif /* SPECTRAL_H */ +--- a/local-symbols ++++ b/local-symbols +@@ -116,6 +116,7 @@ ATH9K_PCOEM= + ATH9K_HTC= + ATH9K_HTC_DEBUGFS= + ATH9K_HWRNG= ++ATH9K_COMMON_SPECTRAL= + CARL9170= + CARL9170_LEDS= + CARL9170_DEBUGFS= diff --git a/package/kernel/mac80211/patches/309-mac80211-minstrel-Enable-STBC-and-LDPC-for-VHT-Rates.patch b/package/kernel/mac80211/patches/309-mac80211-minstrel-Enable-STBC-and-LDPC-for-VHT-Rates.patch deleted file mode 100644 index 609b15b832..0000000000 --- a/package/kernel/mac80211/patches/309-mac80211-minstrel-Enable-STBC-and-LDPC-for-VHT-Rates.patch +++ /dev/null @@ -1,82 +0,0 @@ -From: Chaitanya T K -Date: Mon, 27 Jun 2016 15:23:26 +0530 -Subject: [PATCH] mac80211: minstrel: Enable STBC and LDPC for VHT Rates - -If peer support reception of STBC and LDPC, enable them for better -performance. - -Signed-off-by: Chaitanya TK ---- - ---- a/include/linux/ieee80211.h -+++ b/include/linux/ieee80211.h -@@ -1556,6 +1556,7 @@ struct ieee80211_vht_operation { - #define IEEE80211_VHT_CAP_RXSTBC_3 0x00000300 - #define IEEE80211_VHT_CAP_RXSTBC_4 0x00000400 - #define IEEE80211_VHT_CAP_RXSTBC_MASK 0x00000700 -+#define IEEE80211_VHT_CAP_RXSTBC_SHIFT 8 - #define IEEE80211_VHT_CAP_SU_BEAMFORMER_CAPABLE 0x00000800 - #define IEEE80211_VHT_CAP_SU_BEAMFORMEE_CAPABLE 0x00001000 - #define IEEE80211_VHT_CAP_BEAMFORMEE_STS_SHIFT 13 ---- a/net/mac80211/rc80211_minstrel_ht.c -+++ b/net/mac80211/rc80211_minstrel_ht.c -@@ -1130,7 +1130,7 @@ minstrel_ht_update_caps(void *priv, stru - struct minstrel_ht_sta_priv *msp = priv_sta; - struct minstrel_ht_sta *mi = &msp->ht; - struct ieee80211_mcs_info *mcs = &sta->ht_cap.mcs; -- u16 sta_cap = sta->ht_cap.cap; -+ u16 ht_cap = sta->ht_cap.cap; - struct ieee80211_sta_vht_cap *vht_cap = &sta->vht_cap; - struct sta_info *sinfo = container_of(sta, struct sta_info, sta); - int use_vht; -@@ -1138,6 +1138,7 @@ minstrel_ht_update_caps(void *priv, stru - int ack_dur; - int stbc; - int i; -+ bool ldpc = false; - - /* fall back to the old minstrel for legacy stations */ - if (!sta->ht_cap.ht_supported) -@@ -1175,16 +1176,24 @@ minstrel_ht_update_caps(void *priv, stru - } - mi->sample_tries = 4; - -- /* TODO tx_flags for vht - ATM the RC API is not fine-grained enough */ - if (!use_vht) { -- stbc = (sta_cap & IEEE80211_HT_CAP_RX_STBC) >> -+ stbc = (ht_cap & IEEE80211_HT_CAP_RX_STBC) >> - IEEE80211_HT_CAP_RX_STBC_SHIFT; -- mi->tx_flags |= stbc << IEEE80211_TX_CTL_STBC_SHIFT; - -- if (sta_cap & IEEE80211_HT_CAP_LDPC_CODING) -- mi->tx_flags |= IEEE80211_TX_CTL_LDPC; -+ if (ht_cap & IEEE80211_HT_CAP_LDPC_CODING) -+ ldpc = true; -+ } else { -+ stbc = (vht_cap->cap & IEEE80211_VHT_CAP_RXSTBC_MASK) >> -+ IEEE80211_VHT_CAP_RXSTBC_SHIFT; -+ -+ if (vht_cap->cap & IEEE80211_VHT_CAP_RXLDPC) -+ ldpc = true; - } - -+ mi->tx_flags |= stbc << IEEE80211_TX_CTL_STBC_SHIFT; -+ if (ldpc) -+ mi->tx_flags |= IEEE80211_TX_CTL_LDPC; -+ - for (i = 0; i < ARRAY_SIZE(mi->groups); i++) { - u32 gflags = minstrel_mcs_groups[i].flags; - int bw, nss; -@@ -1197,10 +1206,10 @@ minstrel_ht_update_caps(void *priv, stru - - if (gflags & IEEE80211_TX_RC_SHORT_GI) { - if (gflags & IEEE80211_TX_RC_40_MHZ_WIDTH) { -- if (!(sta_cap & IEEE80211_HT_CAP_SGI_40)) -+ if (!(ht_cap & IEEE80211_HT_CAP_SGI_40)) - continue; - } else { -- if (!(sta_cap & IEEE80211_HT_CAP_SGI_20)) -+ if (!(ht_cap & IEEE80211_HT_CAP_SGI_20)) - continue; - } - } diff --git a/package/kernel/mac80211/patches/309-v4.16-0002-ath10k-move-spectral-scan-support-under-a-separate-c.patch b/package/kernel/mac80211/patches/309-v4.16-0002-ath10k-move-spectral-scan-support-under-a-separate-c.patch new file mode 100644 index 0000000000..604a6f1585 --- /dev/null +++ b/package/kernel/mac80211/patches/309-v4.16-0002-ath10k-move-spectral-scan-support-under-a-separate-c.patch @@ -0,0 +1,91 @@ +From 42e01cb9cb109fb0bb4743f6c54d6aa67ac39b61 Mon Sep 17 00:00:00 2001 +Message-Id: <42e01cb9cb109fb0bb4743f6c54d6aa67ac39b61.1515610034.git.mschiffer@universe-factory.net> +In-Reply-To: <9df7ddc3ed25b7d3473f117a0680b9418adb5753.1515610034.git.mschiffer@universe-factory.net> +References: <9df7ddc3ed25b7d3473f117a0680b9418adb5753.1515610034.git.mschiffer@universe-factory.net> +From: Matthias Schiffer +Date: Mon, 27 Nov 2017 18:56:23 +0100 +Subject: [PATCH 2/2] ath10k: move spectral scan support under a separate + config symbol + +At the moment, spectral scan support, and with it RELAY, is always enabled +with ATH10K_DEBUGFS. Spectral scan support is currently the only user of +RELAY in ath10k, and it unconditionally reserves a relay channel. + +Having debugfs support in ath10k is often useful even on very small +embedded routers, where we'd rather like to avoid the code size and RAM +usage of the relay support. While ath10k-based devices usually have more +resources than ath9k-based ones, it makes sense to keep the configuration +symmetric to ath9k, so the same base kernel without RELAY can be used for +both ath9k and ath10k hardware. + +Signed-off-by: Matthias Schiffer +Signed-off-by: Kalle Valo +--- + drivers/net/wireless/ath/ath10k/Kconfig | 9 ++++++++- + drivers/net/wireless/ath/ath10k/Makefile | 2 +- + drivers/net/wireless/ath/ath10k/spectral.h | 4 ++-- + 3 files changed, 11 insertions(+), 4 deletions(-) + +--- a/drivers/net/wireless/ath/ath10k/Kconfig ++++ b/drivers/net/wireless/ath/ath10k/Kconfig +@@ -51,12 +51,19 @@ config ATH10K_DEBUG + config ATH10K_DEBUGFS + bool "Atheros ath10k debugfs support" + depends on ATH10K && DEBUG_FS +- depends on RELAY + ---help--- + Enabled debugfs support + + If unsure, say Y to make it easier to debug problems. + ++config ATH10K_SPECTRAL ++ bool "Atheros ath10k spectral scan support" ++ depends on ATH10K_DEBUGFS ++ depends on RELAY ++ default n ++ ---help--- ++ Say Y to enable access to the FFT/spectral data via debugfs. ++ + config ATH10K_TRACING + depends on !KERNEL_3_4 + bool "Atheros ath10k tracing support" +--- a/drivers/net/wireless/ath/ath10k/Makefile ++++ b/drivers/net/wireless/ath/ath10k/Makefile +@@ -14,7 +14,7 @@ ath10k_core-y += mac.o \ + p2p.o \ + swap.o + +-ath10k_core-$(CPTCFG_ATH10K_DEBUGFS) += spectral.o ++ath10k_core-$(CPTCFG_ATH10K_SPECTRAL) += spectral.o + ath10k_core-$(CPTCFG_NL80211_TESTMODE) += testmode.o + ath10k_core-$(CPTCFG_ATH10K_TRACING) += trace.o + ath10k_core-$(CPTCFG_ATH10K_THERMAL) += thermal.o +--- a/drivers/net/wireless/ath/ath10k/spectral.h ++++ b/drivers/net/wireless/ath/ath10k/spectral.h +@@ -44,7 +44,7 @@ enum ath10k_spectral_mode { + SPECTRAL_MANUAL, + }; + +-#ifdef CPTCFG_ATH10K_DEBUGFS ++#ifdef CPTCFG_ATH10K_SPECTRAL + + int ath10k_spectral_process_fft(struct ath10k *ar, + struct wmi_phyerr_ev_arg *phyerr, +@@ -85,6 +85,6 @@ static inline void ath10k_spectral_destr + { + } + +-#endif /* CPTCFG_ATH10K_DEBUGFS */ ++#endif /* CPTCFG_ATH10K_SPECTRAL */ + + #endif /* SPECTRAL_H */ +--- a/local-symbols ++++ b/local-symbols +@@ -140,6 +140,7 @@ ATH10K_SDIO= + ATH10K_USB= + ATH10K_DEBUG= + ATH10K_DEBUGFS= ++ATH10K_SPECTRAL= + ATH10K_TRACING= + ATH10K_DFS_CERTIFIED= + WCN36XX= diff --git a/package/kernel/mac80211/patches/310-ath9k-fix-moredata-bit-in-PS-buffered-frame-release.patch b/package/kernel/mac80211/patches/310-ath9k-fix-moredata-bit-in-PS-buffered-frame-release.patch deleted file mode 100644 index c9c74bb836..0000000000 --- a/package/kernel/mac80211/patches/310-ath9k-fix-moredata-bit-in-PS-buffered-frame-release.patch +++ /dev/null @@ -1,50 +0,0 @@ -From: Felix Fietkau -Date: Sun, 28 Aug 2016 13:13:01 +0200 -Subject: [PATCH] ath9k: fix moredata bit in PS buffered frame release - -Signed-off-by: Felix Fietkau ---- - ---- a/drivers/net/wireless/ath/ath9k/xmit.c -+++ b/drivers/net/wireless/ath/ath9k/xmit.c -@@ -1674,6 +1674,22 @@ void ath_tx_aggr_wakeup(struct ath_softc - } - } - -+ -+static void -+ath9k_set_moredata(struct ath_softc *sc, struct ath_buf *bf, bool val) -+{ -+ struct ieee80211_hdr *hdr; -+ u16 mask = cpu_to_le16(IEEE80211_FCTL_MOREDATA); -+ u16 mask_val = mask * val; -+ -+ hdr = (struct ieee80211_hdr *) bf->bf_mpdu->data; -+ if ((hdr->frame_control & mask) != mask_val) { -+ hdr->frame_control = (hdr->frame_control & ~mask) | mask_val; -+ dma_sync_single_for_device(sc->dev, bf->bf_buf_addr, -+ sizeof(*hdr), DMA_TO_DEVICE); -+ } -+} -+ - void ath9k_release_buffered_frames(struct ieee80211_hw *hw, - struct ieee80211_sta *sta, - u16 tids, int nframes, -@@ -1704,6 +1720,7 @@ void ath9k_release_buffered_frames(struc - if (!bf) - break; - -+ ath9k_set_moredata(sc, bf, true); - list_add_tail(&bf->list, &bf_q); - ath_set_rates(tid->an->vif, tid->an->sta, bf, true); - if (bf_isampdu(bf)) { -@@ -1727,6 +1744,9 @@ void ath9k_release_buffered_frames(struc - if (list_empty(&bf_q)) - return; - -+ if (!more_data) -+ ath9k_set_moredata(sc, bf_tail, false); -+ - info = IEEE80211_SKB_CB(bf_tail->bf_mpdu); - info->flags |= IEEE80211_TX_STATUS_EOSP; - diff --git a/package/kernel/mac80211/patches/310-v4.16-ath9k-discard-undersized-packets.patch b/package/kernel/mac80211/patches/310-v4.16-ath9k-discard-undersized-packets.patch new file mode 100644 index 0000000000..b2b2fcf4aa --- /dev/null +++ b/package/kernel/mac80211/patches/310-v4.16-ath9k-discard-undersized-packets.patch @@ -0,0 +1,25 @@ +From: Felix Fietkau +Date: Wed, 17 Jan 2018 11:11:17 +0100 +Subject: [PATCH] ath9k: discard undersized packets + +Sometimes the hardware will push small packets that trigger a WARN_ON +in mac80211. Discard them early to avoid this issue. + +Reported-by: Stijn Tintel +Signed-off-by: Felix Fietkau +--- + +--- a/drivers/net/wireless/ath/ath9k/recv.c ++++ b/drivers/net/wireless/ath/ath9k/recv.c +@@ -826,9 +826,9 @@ static int ath9k_rx_skb_preprocess(struc + sc->rx.discard_next = false; + + /* +- * Discard zero-length packets. ++ * Discard zero-length packets and packets smaller than an ACK + */ +- if (!rx_stats->rs_datalen) { ++ if (rx_stats->rs_datalen < 10) { + RX_STAT_INC(rx_len_err); + goto corrupt; + } diff --git a/package/kernel/mac80211/patches/311-ath9k-clear-potentially-stale-EOSP-status-bit-in-int.patch b/package/kernel/mac80211/patches/311-ath9k-clear-potentially-stale-EOSP-status-bit-in-int.patch deleted file mode 100644 index 1893187e8a..0000000000 --- a/package/kernel/mac80211/patches/311-ath9k-clear-potentially-stale-EOSP-status-bit-in-int.patch +++ /dev/null @@ -1,22 +0,0 @@ -From: Felix Fietkau -Date: Sun, 28 Aug 2016 13:13:42 +0200 -Subject: [PATCH] ath9k: clear potentially stale EOSP status bit in - intermediate queues - -Prevents spurious ieee80211_sta_eosp calls. - -Signed-off-by: Felix Fietkau ---- - ---- a/drivers/net/wireless/ath/ath9k/xmit.c -+++ b/drivers/net/wireless/ath/ath9k/xmit.c -@@ -984,7 +984,8 @@ ath_tx_get_tid_subframe(struct ath_softc - bf->bf_lastbf = bf; - - tx_info = IEEE80211_SKB_CB(skb); -- tx_info->flags &= ~IEEE80211_TX_CTL_CLEAR_PS_FILT; -+ tx_info->flags &= ~(IEEE80211_TX_CTL_CLEAR_PS_FILT | -+ IEEE80211_TX_STATUS_EOSP); - - /* - * No aggregation session is running, but there may be frames diff --git a/package/kernel/mac80211/patches/312-ath9k-report-tx-status-on-EOSP.patch b/package/kernel/mac80211/patches/312-ath9k-report-tx-status-on-EOSP.patch deleted file mode 100644 index 80a3074a4d..0000000000 --- a/package/kernel/mac80211/patches/312-ath9k-report-tx-status-on-EOSP.patch +++ /dev/null @@ -1,19 +0,0 @@ -From: Felix Fietkau -Date: Sun, 28 Aug 2016 13:23:27 +0200 -Subject: [PATCH] ath9k: report tx status on EOSP - -Signed-off-by: Felix Fietkau ---- - ---- a/drivers/net/wireless/ath/ath9k/xmit.c -+++ b/drivers/net/wireless/ath/ath9k/xmit.c -@@ -86,7 +86,8 @@ static void ath_tx_status(struct ieee802 - struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb); - struct ieee80211_sta *sta = info->status.status_driver_data[0]; - -- if (info->flags & IEEE80211_TX_CTL_REQ_TX_STATUS) { -+ if (info->flags & (IEEE80211_TX_CTL_REQ_TX_STATUS | -+ IEEE80211_TX_STATUS_EOSP)) { - ieee80211_tx_status(hw, skb); - return; - } diff --git a/package/kernel/mac80211/patches/313-ath9k-fix-block-ack-window-tracking-issues.patch b/package/kernel/mac80211/patches/313-ath9k-fix-block-ack-window-tracking-issues.patch deleted file mode 100644 index 59de1dfe1a..0000000000 --- a/package/kernel/mac80211/patches/313-ath9k-fix-block-ack-window-tracking-issues.patch +++ /dev/null @@ -1,114 +0,0 @@ -From: Felix Fietkau -Date: Tue, 30 Aug 2016 12:44:08 +0200 -Subject: [PATCH] ath9k: fix block-ack window tracking issues - -Ensure that a buffer gets tracked as part of the block-ack window as -soon as it's dequeued from the tid for the first time. Ensure that -double calls to ath_tx_addto_baw (e.g. on retransmission) don't cause -any issues. - -Signed-off-by: Felix Fietkau ---- - ---- a/drivers/net/wireless/ath/ath9k/xmit.c -+++ b/drivers/net/wireless/ath/ath9k/xmit.c -@@ -62,7 +62,7 @@ static void ath_tx_rc_status(struct ath_ - struct ath_tx_status *ts, int nframes, int nbad, - int txok); - static void ath_tx_update_baw(struct ath_softc *sc, struct ath_atx_tid *tid, -- int seqno); -+ struct ath_buf *bf); - static struct ath_buf *ath_tx_setup_buffer(struct ath_softc *sc, - struct ath_txq *txq, - struct ath_atx_tid *tid, -@@ -311,7 +311,7 @@ static void ath_tx_flush_tid(struct ath_ - } - - if (fi->baw_tracked) { -- ath_tx_update_baw(sc, tid, bf->bf_state.seqno); -+ ath_tx_update_baw(sc, tid, bf); - sendbar = true; - } - -@@ -327,10 +327,15 @@ static void ath_tx_flush_tid(struct ath_ - } - - static void ath_tx_update_baw(struct ath_softc *sc, struct ath_atx_tid *tid, -- int seqno) -+ struct ath_buf *bf) - { -+ struct ath_frame_info *fi = get_frame_info(bf->bf_mpdu); -+ u16 seqno = bf->bf_state.seqno; - int index, cindex; - -+ if (!fi->baw_tracked) -+ return; -+ - index = ATH_BA_INDEX(tid->seq_start, seqno); - cindex = (tid->baw_head + index) & (ATH_TID_MAX_BUFS - 1); - -@@ -351,6 +356,9 @@ static void ath_tx_addto_baw(struct ath_ - u16 seqno = bf->bf_state.seqno; - int index, cindex; - -+ if (fi->baw_tracked) -+ return; -+ - index = ATH_BA_INDEX(tid->seq_start, seqno); - cindex = (tid->baw_head + index) & (ATH_TID_MAX_BUFS - 1); - __set_bit(cindex, tid->tx_buf); -@@ -627,7 +635,7 @@ static void ath_tx_complete_aggr(struct - * complete the acked-ones/xretried ones; update - * block-ack window - */ -- ath_tx_update_baw(sc, tid, seqno); -+ ath_tx_update_baw(sc, tid, bf); - - if (rc_update && (acked_cnt == 1 || txfail_cnt == 1)) { - memcpy(tx_info->control.rates, rates, sizeof(rates)); -@@ -657,7 +665,7 @@ static void ath_tx_complete_aggr(struct - * run out of tx buf. - */ - if (!tbf) { -- ath_tx_update_baw(sc, tid, seqno); -+ ath_tx_update_baw(sc, tid, bf); - - ath_tx_complete_buf(sc, bf, txq, - &bf_head, NULL, ts, -@@ -1026,11 +1034,14 @@ ath_tx_get_tid_subframe(struct ath_softc - - INIT_LIST_HEAD(&bf_head); - list_add(&bf->list, &bf_head); -- ath_tx_update_baw(sc, tid, seqno); -+ ath_tx_update_baw(sc, tid, bf); - ath_tx_complete_buf(sc, bf, txq, &bf_head, NULL, &ts, 0); - continue; - } - -+ if (bf_isampdu(bf)) -+ ath_tx_addto_baw(sc, tid, bf); -+ - return bf; - } - -@@ -1088,8 +1099,6 @@ ath_tx_form_aggr(struct ath_softc *sc, s - bf->bf_next = NULL; - - /* link buffers of this frame to the aggregate */ -- if (!fi->baw_tracked) -- ath_tx_addto_baw(sc, tid, bf); - bf->bf_state.ndelim = ndelim; - - list_add_tail(&bf->list, bf_q); -@@ -1725,10 +1734,8 @@ void ath9k_release_buffered_frames(struc - ath9k_set_moredata(sc, bf, true); - list_add_tail(&bf->list, &bf_q); - ath_set_rates(tid->an->vif, tid->an->sta, bf, true); -- if (bf_isampdu(bf)) { -- ath_tx_addto_baw(sc, tid, bf); -+ if (bf_isampdu(bf)) - bf->bf_state.bf_type &= ~BUF_AGGR; -- } - if (bf_tail) - bf_tail->bf_next = bf; - diff --git a/package/kernel/mac80211/patches/314-ath9k_hw-fix-channel-maximum-power-level-test.patch b/package/kernel/mac80211/patches/314-ath9k_hw-fix-channel-maximum-power-level-test.patch deleted file mode 100644 index 67cbe92e59..0000000000 --- a/package/kernel/mac80211/patches/314-ath9k_hw-fix-channel-maximum-power-level-test.patch +++ /dev/null @@ -1,47 +0,0 @@ -From: Felix Fietkau -Date: Wed, 22 Mar 2017 20:37:04 +0100 -Subject: [PATCH] ath9k_hw: fix channel maximum power level test - -The tx power applied by set_txpower is limited by the CTL (conformance -test limit) entries in the EEPROM. These can change based on the user -configured regulatory domain. -Depending on the EEPROM data this can cause the tx power to become too -limited, if the original regdomain CTLs impose lowr limits than the CTLs -of the user configured regdomain. - -To fix this issue, set the initial channel limits without any CTL -restrictions and only apply the CTL at run time when setting the channel -and the real tx power. - -Cc: stable@vger.kernel.org -Signed-off-by: Felix Fietkau ---- - ---- a/drivers/net/wireless/ath/ath9k/hw.c -+++ b/drivers/net/wireless/ath/ath9k/hw.c -@@ -2937,10 +2937,14 @@ void ath9k_hw_apply_txpower(struct ath_h - struct ieee80211_channel *channel; - int chan_pwr, new_pwr, max_gain; - int ant_gain, ant_reduction = 0; -+ u16 ctl = NO_CTL; - - if (!chan) - return; - -+ if (!test) -+ ctl = ath9k_regd_get_ctl(reg, chan); -+ - channel = chan->chan; - chan_pwr = min_t(int, channel->max_power * 2, MAX_RATE_POWER); - new_pwr = min_t(int, chan_pwr, reg->power_limit); -@@ -2950,9 +2954,7 @@ void ath9k_hw_apply_txpower(struct ath_h - if (ant_gain > max_gain) - ant_reduction = ant_gain - max_gain; - -- ah->eep_ops->set_txpower(ah, chan, -- ath9k_regd_get_ctl(reg, chan), -- ant_reduction, new_pwr, test); -+ ah->eep_ops->set_txpower(ah, chan, ctl, ant_reduction, new_pwr, test); - } - - void ath9k_hw_set_txpowerlimit(struct ath_hw *ah, u32 limit, bool test) diff --git a/package/kernel/mac80211/patches/315-ath9k-adjust-tx-power-reduction-for-US-regulatory-do.patch b/package/kernel/mac80211/patches/315-ath9k-adjust-tx-power-reduction-for-US-regulatory-do.patch deleted file mode 100644 index 78083517bc..0000000000 --- a/package/kernel/mac80211/patches/315-ath9k-adjust-tx-power-reduction-for-US-regulatory-do.patch +++ /dev/null @@ -1,24 +0,0 @@ -From: Felix Fietkau -Date: Wed, 19 Jul 2017 08:49:31 +0200 -Subject: [PATCH] ath9k: adjust tx power reduction for US regulatory - domain - -FCC regulatory rules allow for up to 3 dBi antenna gain. Account for -this in the EEPROM based tx power reduction code. - -Signed-off-by: Felix Fietkau ---- - ---- a/drivers/net/wireless/ath/ath9k/hw.c -+++ b/drivers/net/wireless/ath/ath9k/hw.c -@@ -2954,6 +2954,10 @@ void ath9k_hw_apply_txpower(struct ath_h - if (ant_gain > max_gain) - ant_reduction = ant_gain - max_gain; - -+ /* FCC allows maximum antenna gain of 3 dBi */ -+ if (reg->region == NL80211_DFS_FCC) -+ ant_reduction = max_t(int, ant_reduction - 6, 0); -+ - ah->eep_ops->set_txpower(ah, chan, ctl, ant_reduction, new_pwr, test); - } - diff --git a/package/kernel/mac80211/patches/316-ath9k-fix-more-data-flag-for-buffered-multicast-pack.patch b/package/kernel/mac80211/patches/316-ath9k-fix-more-data-flag-for-buffered-multicast-pack.patch deleted file mode 100644 index 096eb56a2d..0000000000 --- a/package/kernel/mac80211/patches/316-ath9k-fix-more-data-flag-for-buffered-multicast-pack.patch +++ /dev/null @@ -1,41 +0,0 @@ -From: Felix Fietkau -Date: Sun, 23 Jul 2017 14:58:22 +0200 -Subject: [PATCH] ath9k: fix more-data flag for buffered multicast - packets - -The flag needs to be cleared for the last packet in the list, not the -first one. Fixes some issues with multicast packet loss for powersave -clients connected to an ath9k AP. - -Signed-off-by: Felix Fietkau ---- - ---- a/drivers/net/wireless/ath/ath9k/xmit.c -+++ b/drivers/net/wireless/ath/ath9k/xmit.c -@@ -2451,7 +2451,6 @@ void ath_tx_cabq(struct ieee80211_hw *hw - .txq = sc->beacon.cabq - }; - struct ath_tx_info info = {}; -- struct ieee80211_hdr *hdr; - struct ath_buf *bf_tail = NULL; - struct ath_buf *bf; - LIST_HEAD(bf_q); -@@ -2495,15 +2494,10 @@ void ath_tx_cabq(struct ieee80211_hw *hw - if (list_empty(&bf_q)) - return; - -- bf = list_first_entry(&bf_q, struct ath_buf, list); -- hdr = (struct ieee80211_hdr *) bf->bf_mpdu->data; -- -- if (hdr->frame_control & cpu_to_le16(IEEE80211_FCTL_MOREDATA)) { -- hdr->frame_control &= ~cpu_to_le16(IEEE80211_FCTL_MOREDATA); -- dma_sync_single_for_device(sc->dev, bf->bf_buf_addr, -- sizeof(*hdr), DMA_TO_DEVICE); -- } -+ bf = list_last_entry(&bf_q, struct ath_buf, list); -+ ath9k_set_moredata(sc, bf, false); - -+ bf = list_first_entry(&bf_q, struct ath_buf, list); - ath_txq_lock(sc, txctl.txq); - ath_tx_fill_desc(sc, bf, txctl.txq, 0); - ath_tx_txqaddbuf(sc, txctl.txq, &bf_q, false); diff --git a/package/kernel/mac80211/patches/317-Revert-ath10k-disable-wake_tx_queue-for-older-device.patch b/package/kernel/mac80211/patches/317-Revert-ath10k-disable-wake_tx_queue-for-older-device.patch deleted file mode 100644 index 56d86c1525..0000000000 --- a/package/kernel/mac80211/patches/317-Revert-ath10k-disable-wake_tx_queue-for-older-device.patch +++ /dev/null @@ -1,27 +0,0 @@ -From: dave taht -Date: Wed, 5 Oct 2016 20:09:15 -0700 -Subject: [PATCH] Revert "ath10k: disable wake_tx_queue for older - devices" - -This reverts commit 4ca1807815aa6801aaced7fdefa9edacc2521767 -in the hope that we've fixed all the performance problems now. ---- - ---- a/drivers/net/wireless/ath/ath10k/mac.c -+++ b/drivers/net/wireless/ath/ath10k/mac.c -@@ -8319,15 +8319,6 @@ int ath10k_mac_register(struct ath10k *a - ath10k_warn(ar, "failed to initialise DFS pattern detector\n"); - } - -- /* Current wake_tx_queue implementation imposes a significant -- * performance penalty in some setups. The tx scheduling code needs -- * more work anyway so disable the wake_tx_queue unless firmware -- * supports the pull-push mechanism. -- */ -- if (!test_bit(ATH10K_FW_FEATURE_PEER_FLOW_CONTROL, -- ar->running_fw->fw_file.fw_features)) -- ar->ops->wake_tx_queue = NULL; -- - ret = ath10k_mac_init_rd(ar); - if (ret) { - ath10k_err(ar, "failed to derive regdom: %d\n", ret); diff --git a/package/kernel/mac80211/patches/318-v4.15-ath10k-fix-build-errors-with-CONFIG_PM.patch b/package/kernel/mac80211/patches/318-v4.15-ath10k-fix-build-errors-with-CONFIG_PM.patch deleted file mode 100644 index 2aeb49dc16..0000000000 --- a/package/kernel/mac80211/patches/318-v4.15-ath10k-fix-build-errors-with-CONFIG_PM.patch +++ /dev/null @@ -1,72 +0,0 @@ -From: Brian Norris -Date: Thu, 19 Oct 2017 11:45:19 -0700 -Subject: [PATCH] ath10k: fix build errors with !CONFIG_PM - -Build errors have been reported with CONFIG_PM=n: - -drivers/net/wireless/ath/ath10k/pci.c:3416:8: error: implicit -declaration of function 'ath10k_pci_suspend' -[-Werror=implicit-function-declaration] - -drivers/net/wireless/ath/ath10k/pci.c:3428:8: error: implicit -declaration of function 'ath10k_pci_resume' -[-Werror=implicit-function-declaration] - -These are caused by the combination of the following two commits: - -6af1de2e4ec4 ("ath10k: mark PM functions as __maybe_unused") -96378bd2c6cd ("ath10k: fix core PCI suspend when WoWLAN is supported but -disabled") - -Both build fine on their own. - -But now that ath10k_pci_pm_{suspend,resume}() is compiled -unconditionally, we should also compile ath10k_pci_{suspend,resume}() -unconditionally. - -And drop the #ifdef around ath10k_pci_hif_{suspend,resume}() too; they -are trivial (empty), so we're not saving much space by compiling them -out. And the alternatives would be to sprinkle more __maybe_unused, or -spread the #ifdef's further. - -Build tested with the following combinations: -CONFIG_PM=y && CONFIG_PM_SLEEP=y -CONFIG_PM=y && CONFIG_PM_SLEEP=n -CONFIG_PM=n - -Fixes: 96378bd2c6cd ("ath10k: fix core PCI suspend when WoWLAN is supported but disabled") -Fixes: 096ad2a15fd8 ("Merge branch 'ath-next'") -Signed-off-by: Brian Norris -Signed-off-by: Kalle Valo ---- - ---- a/drivers/net/wireless/ath/ath10k/pci.c -+++ b/drivers/net/wireless/ath/ath10k/pci.c -@@ -2577,8 +2577,6 @@ void ath10k_pci_hif_power_down(struct at - */ - } - --#ifdef CONFIG_PM -- - static int ath10k_pci_hif_suspend(struct ath10k *ar) - { - /* Nothing to do; the important stuff is in the driver suspend. */ -@@ -2627,7 +2625,6 @@ static int ath10k_pci_resume(struct ath1 - - return ret; - } --#endif - - static bool ath10k_pci_validate_cal(void *data, size_t size) - { -@@ -2782,10 +2779,8 @@ static const struct ath10k_hif_ops ath10 - .power_down = ath10k_pci_hif_power_down, - .read32 = ath10k_pci_read32, - .write32 = ath10k_pci_write32, --#ifdef CONFIG_PM - .suspend = ath10k_pci_hif_suspend, - .resume = ath10k_pci_hif_resume, --#endif - .fetch_cal_eeprom = ath10k_pci_hif_fetch_cal_eeprom, - }; - diff --git a/package/kernel/mac80211/patches/318-v4.17-mac80211-round-IEEE80211_TX_STATUS_HEADROOM-up-to-mu.patch b/package/kernel/mac80211/patches/318-v4.17-mac80211-round-IEEE80211_TX_STATUS_HEADROOM-up-to-mu.patch new file mode 100644 index 0000000000..e955cb3a25 --- /dev/null +++ b/package/kernel/mac80211/patches/318-v4.17-mac80211-round-IEEE80211_TX_STATUS_HEADROOM-up-to-mu.patch @@ -0,0 +1,26 @@ +From: Felix Fietkau +Date: Fri, 9 Feb 2018 19:46:54 +0100 +Subject: [PATCH] mac80211: round IEEE80211_TX_STATUS_HEADROOM up to multiple + of 4 + +This ensures that mac80211 allocated management frames are properly +aligned, which makes copying them more efficient. +For instance, mt76 uses iowrite32_copy to copy beacon frames to beacon +template memory on the chip. +Misaligned 32-bit accesses cause CPU exceptions on MIPS and should be +avoided. + +Signed-off-by: Felix Fietkau +--- + +--- a/include/net/mac80211.h ++++ b/include/net/mac80211.h +@@ -4145,7 +4145,7 @@ void ieee80211_sta_uapsd_trigger(struct + * The TX headroom reserved by mac80211 for its own tx_status functions. + * This is enough for the radiotap header. + */ +-#define IEEE80211_TX_STATUS_HEADROOM 14 ++#define IEEE80211_TX_STATUS_HEADROOM ALIGN(14, 4) + + /** + * ieee80211_sta_set_buffered - inform mac80211 about driver-buffered frames diff --git a/package/kernel/mac80211/patches/319-ath10k-fix-recent-bandwidth-conversion-bug.patch b/package/kernel/mac80211/patches/319-ath10k-fix-recent-bandwidth-conversion-bug.patch deleted file mode 100644 index 5d5329f27e..0000000000 --- a/package/kernel/mac80211/patches/319-ath10k-fix-recent-bandwidth-conversion-bug.patch +++ /dev/null @@ -1,61 +0,0 @@ -From: Christian Lamparter -Date: Wed, 1 Nov 2017 21:01:57 +0100 -Subject: [PATCH] ath10k: fix recent bandwidth conversion bug - -The commit "cfg80211: make RATE_INFO_BW_20 the default" changed -the index of RATE_INFO_BW_20, but the updates to ath10k missed -the special bandwidth calculation case in -ath10k_update_per_peer_tx_stats(). - -Fixes: 842be75c77cb ("cfg80211: make RATE_INFO_BW_20 the default") -Signed-off-by: Christian Lamparter -Patchwork-Id: 10037035 -Signed-off-by: Kalle Valo ---- - ---- a/drivers/net/wireless/ath/ath10k/htt_rx.c -+++ b/drivers/net/wireless/ath/ath10k/htt_rx.c -@@ -592,6 +592,9 @@ struct amsdu_subframe_hdr { - - #define GROUP_ID_IS_SU_MIMO(x) ((x) == 0 || (x) == 63) - -+static const u8 ath10k_bw_to_mac80211[] = { RATE_INFO_BW_20, RATE_INFO_BW_40, -+ RATE_INFO_BW_80, RATE_INFO_BW_160 }; -+ - static void ath10k_htt_rx_h_rates(struct ath10k *ar, - struct ieee80211_rx_status *status, - struct htt_rx_desc *rxd) -@@ -694,23 +697,7 @@ static void ath10k_htt_rx_h_rates(struct - if (sgi) - status->enc_flags |= RX_ENC_FLAG_SHORT_GI; - -- switch (bw) { -- /* 20MHZ */ -- case 0: -- break; -- /* 40MHZ */ -- case 1: -- status->bw = RATE_INFO_BW_40; -- break; -- /* 80MHZ */ -- case 2: -- status->bw = RATE_INFO_BW_80; -- break; -- case 3: -- status->bw = RATE_INFO_BW_160; -- break; -- } -- -+ status->bw = ath10k_bw_to_mac80211[bw]; - status->encoding = RX_ENC_VHT; - break; - default: -@@ -2297,7 +2284,7 @@ ath10k_update_per_peer_tx_stats(struct a - arsta->txrate.flags |= RATE_INFO_FLAGS_SHORT_GI; - - arsta->txrate.nss = txrate.nss; -- arsta->txrate.bw = txrate.bw + RATE_INFO_BW_20; -+ arsta->txrate.bw = ath10k_bw_to_mac80211[txrate.bw]; - } - - static void ath10k_htt_fetch_peer_stats(struct ath10k *ar, diff --git a/package/kernel/mac80211/patches/319-v4.17-0001-mac80211-drop-frames-with-unexpected-DS-bits-from-fa.patch b/package/kernel/mac80211/patches/319-v4.17-0001-mac80211-drop-frames-with-unexpected-DS-bits-from-fa.patch new file mode 100644 index 0000000000..a7562996b1 --- /dev/null +++ b/package/kernel/mac80211/patches/319-v4.17-0001-mac80211-drop-frames-with-unexpected-DS-bits-from-fa.patch @@ -0,0 +1,21 @@ +From: Felix Fietkau +Date: Fri, 23 Feb 2018 09:59:35 +0100 +Subject: [PATCH] mac80211: drop frames with unexpected DS bits from + fast-rx to slow path + +Fixes rx for 4-addr packets in AP mode + +Signed-off-by: Felix Fietkau +--- + +--- a/net/mac80211/rx.c ++++ b/net/mac80211/rx.c +@@ -3928,7 +3928,7 @@ static bool ieee80211_invoke_fast_rx(str + if ((hdr->frame_control & cpu_to_le16(IEEE80211_FCTL_FROMDS | + IEEE80211_FCTL_TODS)) != + fast_rx->expected_ds_bits) +- goto drop; ++ return false; + + /* assign the key to drop unencrypted frames (later) + * and strip the IV/MIC if necessary diff --git a/package/kernel/mac80211/patches/319-v4.17-0002-mac80211-support-AP-4-addr-mode-fast-rx.patch b/package/kernel/mac80211/patches/319-v4.17-0002-mac80211-support-AP-4-addr-mode-fast-rx.patch new file mode 100644 index 0000000000..3f3eb0a5e1 --- /dev/null +++ b/package/kernel/mac80211/patches/319-v4.17-0002-mac80211-support-AP-4-addr-mode-fast-rx.patch @@ -0,0 +1,25 @@ +From: Felix Fietkau +Date: Fri, 23 Feb 2018 10:00:22 +0100 +Subject: [PATCH] mac80211: support AP 4-addr mode fast-rx + +Signed-off-by: Felix Fietkau +--- + +--- a/net/mac80211/rx.c ++++ b/net/mac80211/rx.c +@@ -3774,6 +3774,15 @@ void ieee80211_check_fast_rx(struct sta_ + !(sdata->flags & IEEE80211_SDATA_DONT_BRIDGE_PACKETS) && + (sdata->vif.type != NL80211_IFTYPE_AP_VLAN || + !sdata->u.vlan.sta); ++ ++ if (sdata->vif.type == NL80211_IFTYPE_AP_VLAN && ++ sdata->u.vlan.sta) { ++ fastrx.expected_ds_bits |= ++ cpu_to_le16(IEEE80211_FCTL_FROMDS); ++ fastrx.sa_offs = offsetof(struct ieee80211_hdr, addr4); ++ fastrx.internal_forward = 0; ++ } ++ + break; + default: + goto clear; diff --git a/package/kernel/mac80211/patches/319-v4.17-0003-mac80211-support-fast-rx-with-incompatible-PS-capabi.patch b/package/kernel/mac80211/patches/319-v4.17-0003-mac80211-support-fast-rx-with-incompatible-PS-capabi.patch new file mode 100644 index 0000000000..8c4c724ef7 --- /dev/null +++ b/package/kernel/mac80211/patches/319-v4.17-0003-mac80211-support-fast-rx-with-incompatible-PS-capabi.patch @@ -0,0 +1,53 @@ +From: Felix Fietkau +Date: Fri, 23 Feb 2018 10:01:53 +0100 +Subject: [PATCH] mac80211: support fast-rx with incompatible PS + capabilities when PS is disabled + +When powersave is disabled for the interface, we can do fast-rx anyway. + +Signed-off-by: Felix Fietkau +--- + +--- a/net/mac80211/cfg.c ++++ b/net/mac80211/cfg.c +@@ -2658,6 +2658,7 @@ static int ieee80211_set_power_mgmt(stru + + ieee80211_recalc_ps(local); + ieee80211_recalc_ps_vif(sdata); ++ ieee80211_check_fast_rx_iface(sdata); + + return 0; + } +--- a/net/mac80211/rx.c ++++ b/net/mac80211/rx.c +@@ -3741,12 +3741,7 @@ void ieee80211_check_fast_rx(struct sta_ + /* 4-addr is harder to deal with, later maybe */ + if (sdata->u.mgd.use_4addr) + goto clear; +- /* software powersave is a huge mess, avoid all of it */ +- if (ieee80211_hw_check(&local->hw, PS_NULLFUNC_STACK)) +- goto clear; +- if (ieee80211_hw_check(&local->hw, SUPPORTS_PS) && +- !ieee80211_hw_check(&local->hw, SUPPORTS_DYNAMIC_PS)) +- goto clear; ++ + if (sta->sta.tdls) { + fastrx.da_offs = offsetof(struct ieee80211_hdr, addr1); + fastrx.sa_offs = offsetof(struct ieee80211_hdr, addr2); +@@ -3758,6 +3753,16 @@ void ieee80211_check_fast_rx(struct sta_ + fastrx.expected_ds_bits = + cpu_to_le16(IEEE80211_FCTL_FROMDS); + } ++ ++ if (!sdata->u.mgd.powersave) ++ break; ++ ++ /* software powersave is a huge mess, avoid all of it */ ++ if (ieee80211_hw_check(&local->hw, PS_NULLFUNC_STACK)) ++ goto clear; ++ if (ieee80211_hw_check(&local->hw, SUPPORTS_PS) && ++ !ieee80211_hw_check(&local->hw, SUPPORTS_DYNAMIC_PS)) ++ goto clear; + break; + case NL80211_IFTYPE_AP_VLAN: + case NL80211_IFTYPE_AP: diff --git a/package/kernel/mac80211/patches/319-v4.17-0004-mac80211-support-station-4-addr-mode-fast-rx.patch b/package/kernel/mac80211/patches/319-v4.17-0004-mac80211-support-station-4-addr-mode-fast-rx.patch new file mode 100644 index 0000000000..97a5d8beba --- /dev/null +++ b/package/kernel/mac80211/patches/319-v4.17-0004-mac80211-support-station-4-addr-mode-fast-rx.patch @@ -0,0 +1,34 @@ +From: Felix Fietkau +Date: Fri, 23 Feb 2018 10:05:08 +0100 +Subject: [PATCH] mac80211: support station 4-addr mode fast-rx + +Signed-off-by: Felix Fietkau +--- + +--- a/net/mac80211/rx.c ++++ b/net/mac80211/rx.c +@@ -3738,10 +3738,6 @@ void ieee80211_check_fast_rx(struct sta_ + + switch (sdata->vif.type) { + case NL80211_IFTYPE_STATION: +- /* 4-addr is harder to deal with, later maybe */ +- if (sdata->u.mgd.use_4addr) +- goto clear; +- + if (sta->sta.tdls) { + fastrx.da_offs = offsetof(struct ieee80211_hdr, addr1); + fastrx.sa_offs = offsetof(struct ieee80211_hdr, addr2); +@@ -3754,6 +3750,13 @@ void ieee80211_check_fast_rx(struct sta_ + cpu_to_le16(IEEE80211_FCTL_FROMDS); + } + ++ if (sdata->u.mgd.use_4addr && !sta->sta.tdls) { ++ fastrx.expected_ds_bits |= ++ cpu_to_le16(IEEE80211_FCTL_TODS); ++ fastrx.da_offs = offsetof(struct ieee80211_hdr, addr3); ++ fastrx.sa_offs = offsetof(struct ieee80211_hdr, addr4); ++ } ++ + if (!sdata->u.mgd.powersave) + break; + diff --git a/package/kernel/mac80211/patches/320-v4.15-mac80211-properly-free-requested-but-not-started-TX-.patch b/package/kernel/mac80211/patches/320-v4.15-mac80211-properly-free-requested-but-not-started-TX-.patch deleted file mode 100644 index ecc5e49120..0000000000 --- a/package/kernel/mac80211/patches/320-v4.15-mac80211-properly-free-requested-but-not-started-TX-.patch +++ /dev/null @@ -1,37 +0,0 @@ -From: Johannes Berg -Date: Mon, 20 Nov 2017 17:01:44 +0100 -Subject: [PATCH] mac80211: properly free requested-but-not-started TX agg - sessions - -When deleting a station or otherwise tearing down all aggregation -sessions, make sure to delete requested but not yet started ones, -to avoid the following scenario: - - * session is requested, added to tid_start_tx[] - * ieee80211_ba_session_work() runs, gets past BLOCK_BA check - * ieee80211_sta_tear_down_BA_sessions() runs, locks &sta->ampdu_mlme.mtx, - e.g. while deleting the station - deleting all active sessions - * ieee80211_ba_session_work() continues since tear down flushes it, and - calls ieee80211_tx_ba_session_handle_start() for the new session, arms - the timer for it - * station deletion continues to __cleanup_single_sta() and frees the - session struct, while the timer is armed - -Reported-by: Fengguang Wu -Signed-off-by: Johannes Berg ---- - ---- a/net/mac80211/agg-tx.c -+++ b/net/mac80211/agg-tx.c -@@ -330,6 +330,11 @@ int ___ieee80211_stop_tx_ba_session(stru - - spin_lock_bh(&sta->lock); - -+ /* free struct pending for start, if present */ -+ tid_tx = sta->ampdu_mlme.tid_start_tx[tid]; -+ kfree(tid_tx); -+ sta->ampdu_mlme.tid_start_tx[tid] = NULL; -+ - tid_tx = rcu_dereference_protected_tid_tx(sta, tid); - if (!tid_tx) { - spin_unlock_bh(&sta->lock); diff --git a/package/kernel/mac80211/patches/320-v4.17-mac80211-support-A-MSDU-in-fast-rx.patch b/package/kernel/mac80211/patches/320-v4.17-mac80211-support-A-MSDU-in-fast-rx.patch new file mode 100644 index 0000000000..3c6d342ff1 --- /dev/null +++ b/package/kernel/mac80211/patches/320-v4.17-mac80211-support-A-MSDU-in-fast-rx.patch @@ -0,0 +1,256 @@ +From: Felix Fietkau +Date: Mon, 26 Feb 2018 22:09:29 +0100 +Subject: [PATCH] mac80211: support A-MSDU in fast-rx + +Only works if the IV was stripped from packets. Create a smaller +variant of ieee80211_rx_h_amsdu, which bypasses checks already done +within the fast-rx context. + +Signed-off-by: Felix Fietkau +--- + +--- a/net/mac80211/rx.c ++++ b/net/mac80211/rx.c +@@ -2358,39 +2358,17 @@ ieee80211_deliver_skb(struct ieee80211_r + } + + static ieee80211_rx_result debug_noinline +-ieee80211_rx_h_amsdu(struct ieee80211_rx_data *rx) ++__ieee80211_rx_h_amsdu(struct ieee80211_rx_data *rx, u8 data_offset) + { + struct net_device *dev = rx->sdata->dev; + struct sk_buff *skb = rx->skb; + struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)skb->data; + __le16 fc = hdr->frame_control; + struct sk_buff_head frame_list; +- struct ieee80211_rx_status *status = IEEE80211_SKB_RXCB(rx->skb); + struct ethhdr ethhdr; + const u8 *check_da = ethhdr.h_dest, *check_sa = ethhdr.h_source; + +- if (unlikely(!ieee80211_is_data(fc))) +- return RX_CONTINUE; +- +- if (unlikely(!ieee80211_is_data_present(fc))) +- return RX_DROP_MONITOR; +- +- if (!(status->rx_flags & IEEE80211_RX_AMSDU)) +- return RX_CONTINUE; +- + if (unlikely(ieee80211_has_a4(hdr->frame_control))) { +- switch (rx->sdata->vif.type) { +- case NL80211_IFTYPE_AP_VLAN: +- if (!rx->sdata->u.vlan.sta) +- return RX_DROP_UNUSABLE; +- break; +- case NL80211_IFTYPE_STATION: +- if (!rx->sdata->u.mgd.use_4addr) +- return RX_DROP_UNUSABLE; +- break; +- default: +- return RX_DROP_UNUSABLE; +- } + check_da = NULL; + check_sa = NULL; + } else switch (rx->sdata->vif.type) { +@@ -2410,15 +2388,13 @@ ieee80211_rx_h_amsdu(struct ieee80211_rx + break; + } + +- if (is_multicast_ether_addr(hdr->addr1)) +- return RX_DROP_UNUSABLE; +- + skb->dev = dev; + __skb_queue_head_init(&frame_list); + + if (ieee80211_data_to_8023_exthdr(skb, ðhdr, + rx->sdata->vif.addr, +- rx->sdata->vif.type)) ++ rx->sdata->vif.type, ++ data_offset)) + return RX_DROP_UNUSABLE; + + ieee80211_amsdu_to_8023s(skb, &frame_list, dev->dev_addr, +@@ -2440,6 +2416,44 @@ ieee80211_rx_h_amsdu(struct ieee80211_rx + return RX_QUEUED; + } + ++static ieee80211_rx_result debug_noinline ++ieee80211_rx_h_amsdu(struct ieee80211_rx_data *rx) ++{ ++ struct sk_buff *skb = rx->skb; ++ struct ieee80211_rx_status *status = IEEE80211_SKB_RXCB(skb); ++ struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)skb->data; ++ __le16 fc = hdr->frame_control; ++ ++ if (!(status->rx_flags & IEEE80211_RX_AMSDU)) ++ return RX_CONTINUE; ++ ++ if (unlikely(!ieee80211_is_data(fc))) ++ return RX_CONTINUE; ++ ++ if (unlikely(!ieee80211_is_data_present(fc))) ++ return RX_DROP_MONITOR; ++ ++ if (unlikely(ieee80211_has_a4(hdr->frame_control))) { ++ switch (rx->sdata->vif.type) { ++ case NL80211_IFTYPE_AP_VLAN: ++ if (!rx->sdata->u.vlan.sta) ++ return RX_DROP_UNUSABLE; ++ break; ++ case NL80211_IFTYPE_STATION: ++ if (!rx->sdata->u.mgd.use_4addr) ++ return RX_DROP_UNUSABLE; ++ break; ++ default: ++ return RX_DROP_UNUSABLE; ++ } ++ } ++ ++ if (is_multicast_ether_addr(hdr->addr1)) ++ return RX_DROP_UNUSABLE; ++ ++ return __ieee80211_rx_h_amsdu(rx, 0); ++} ++ + #ifdef CPTCFG_MAC80211_MESH + static ieee80211_rx_result + ieee80211_rx_h_mesh_fwding(struct ieee80211_rx_data *rx) +@@ -3889,7 +3903,8 @@ static bool ieee80211_invoke_fast_rx(str + struct ieee80211_rx_status *status = IEEE80211_SKB_RXCB(skb); + struct sta_info *sta = rx->sta; + int orig_len = skb->len; +- int snap_offs = ieee80211_hdrlen(hdr->frame_control); ++ int hdrlen = ieee80211_hdrlen(hdr->frame_control); ++ int snap_offs = hdrlen; + struct { + u8 snap[sizeof(rfc1042_header)]; + __be16 proto; +@@ -3920,10 +3935,6 @@ static bool ieee80211_invoke_fast_rx(str + (status->flag & FAST_RX_CRYPT_FLAGS) != FAST_RX_CRYPT_FLAGS) + return false; + +- /* we don't deal with A-MSDU deaggregation here */ +- if (status->rx_flags & IEEE80211_RX_AMSDU) +- return false; +- + if (unlikely(!ieee80211_is_data_present(hdr->frame_control))) + return false; + +@@ -3955,21 +3966,24 @@ static bool ieee80211_invoke_fast_rx(str + snap_offs += IEEE80211_CCMP_HDR_LEN; + } + +- if (!pskb_may_pull(skb, snap_offs + sizeof(*payload))) +- goto drop; +- payload = (void *)(skb->data + snap_offs); ++ if (!(status->rx_flags & IEEE80211_RX_AMSDU)) { ++ if (!pskb_may_pull(skb, snap_offs + sizeof(*payload))) ++ goto drop; + +- if (!ether_addr_equal(payload->snap, fast_rx->rfc1042_hdr)) +- return false; ++ payload = (void *)(skb->data + snap_offs); + +- /* Don't handle these here since they require special code. +- * Accept AARP and IPX even though they should come with a +- * bridge-tunnel header - but if we get them this way then +- * there's little point in discarding them. +- */ +- if (unlikely(payload->proto == cpu_to_be16(ETH_P_TDLS) || +- payload->proto == fast_rx->control_port_protocol)) +- return false; ++ if (!ether_addr_equal(payload->snap, fast_rx->rfc1042_hdr)) ++ return false; ++ ++ /* Don't handle these here since they require special code. ++ * Accept AARP and IPX even though they should come with a ++ * bridge-tunnel header - but if we get them this way then ++ * there's little point in discarding them. ++ */ ++ if (unlikely(payload->proto == cpu_to_be16(ETH_P_TDLS) || ++ payload->proto == fast_rx->control_port_protocol)) ++ return false; ++ } + + /* after this point, don't punt to the slowpath! */ + +@@ -3983,12 +3997,6 @@ static bool ieee80211_invoke_fast_rx(str + } + + /* statistics part of ieee80211_rx_h_sta_process() */ +- stats->last_rx = jiffies; +- stats->last_rate = sta_stats_encode_rate(status); +- +- stats->fragments++; +- stats->packets++; +- + if (!(status->flag & RX_FLAG_NO_SIGNAL_VAL)) { + stats->last_signal = status->signal; + if (!fast_rx->uses_rss) +@@ -4017,6 +4025,20 @@ static bool ieee80211_invoke_fast_rx(str + if (rx->key && !ieee80211_has_protected(hdr->frame_control)) + goto drop; + ++ if (status->rx_flags & IEEE80211_RX_AMSDU) { ++ if (__ieee80211_rx_h_amsdu(rx, snap_offs - hdrlen) != ++ RX_QUEUED) ++ goto drop; ++ ++ return true; ++ } ++ ++ stats->last_rx = jiffies; ++ stats->last_rate = sta_stats_encode_rate(status); ++ ++ stats->fragments++; ++ stats->packets++; ++ + /* do the header conversion - first grab the addresses */ + ether_addr_copy(addrs.da, skb->data + fast_rx->da_offs); + ether_addr_copy(addrs.sa, skb->data + fast_rx->sa_offs); +--- a/include/net/cfg80211.h ++++ b/include/net/cfg80211.h +@@ -4331,10 +4331,12 @@ unsigned int ieee80211_get_mesh_hdrlen(s + * of it being pushed into the SKB + * @addr: the device MAC address + * @iftype: the virtual interface type ++ * @data_offset: offset of payload after the 802.11 header + * Return: 0 on success. Non-zero on error. + */ + int ieee80211_data_to_8023_exthdr(struct sk_buff *skb, struct ethhdr *ehdr, +- const u8 *addr, enum nl80211_iftype iftype); ++ const u8 *addr, enum nl80211_iftype iftype, ++ u8 data_offset); + + /** + * ieee80211_data_to_8023 - convert an 802.11 data frame to 802.3 +@@ -4346,7 +4348,7 @@ int ieee80211_data_to_8023_exthdr(struct + static inline int ieee80211_data_to_8023(struct sk_buff *skb, const u8 *addr, + enum nl80211_iftype iftype) + { +- return ieee80211_data_to_8023_exthdr(skb, NULL, addr, iftype); ++ return ieee80211_data_to_8023_exthdr(skb, NULL, addr, iftype, 0); + } + + /** +--- a/net/wireless/util.c ++++ b/net/wireless/util.c +@@ -419,7 +419,8 @@ unsigned int ieee80211_get_mesh_hdrlen(s + EXPORT_SYMBOL(ieee80211_get_mesh_hdrlen); + + int ieee80211_data_to_8023_exthdr(struct sk_buff *skb, struct ethhdr *ehdr, +- const u8 *addr, enum nl80211_iftype iftype) ++ const u8 *addr, enum nl80211_iftype iftype, ++ u8 data_offset) + { + struct ieee80211_hdr *hdr = (struct ieee80211_hdr *) skb->data; + struct { +@@ -433,7 +434,7 @@ int ieee80211_data_to_8023_exthdr(struct + if (unlikely(!ieee80211_is_data_present(hdr->frame_control))) + return -1; + +- hdrlen = ieee80211_hdrlen(hdr->frame_control); ++ hdrlen = ieee80211_hdrlen(hdr->frame_control) + data_offset; + if (skb->len < hdrlen + 8) + return -1; + diff --git a/package/kernel/mac80211/patches/321-v4.16-0001-ath9k-move-spectral-scan-support-under-a-separate-co.patch b/package/kernel/mac80211/patches/321-v4.16-0001-ath9k-move-spectral-scan-support-under-a-separate-co.patch deleted file mode 100644 index 703051fe19..0000000000 --- a/package/kernel/mac80211/patches/321-v4.16-0001-ath9k-move-spectral-scan-support-under-a-separate-co.patch +++ /dev/null @@ -1,103 +0,0 @@ -From 9df7ddc3ed25b7d3473f117a0680b9418adb5753 Mon Sep 17 00:00:00 2001 -Message-Id: <9df7ddc3ed25b7d3473f117a0680b9418adb5753.1515610034.git.mschiffer@universe-factory.net> -From: Matthias Schiffer -Date: Mon, 27 Nov 2017 18:56:22 +0100 -Subject: [PATCH 1/2] ath9k: move spectral scan support under a separate config - symbol - -At the moment, spectral scan support, and with it RELAY, is always enabled -with ATH9K[_HTC]_DEBUGFS. Spectral scan support is currently the only user -of RELAY in ath9k, and it unconditionally reserves a relay channel. - -Having debugfs support in ath9k is often useful even on very small embedded -routers, where we'd rather like to avoid the code size and RAM usage of the -relay support. - -Signed-off-by: Matthias Schiffer -Signed-off-by: Kalle Valo ---- - drivers/net/wireless/ath/ath9k/Kconfig | 14 ++++++++++---- - drivers/net/wireless/ath/ath9k/Makefile | 4 ++-- - drivers/net/wireless/ath/ath9k/common-spectral.h | 4 ++-- - 3 files changed, 14 insertions(+), 8 deletions(-) - ---- a/drivers/net/wireless/ath/ath9k/Kconfig -+++ b/drivers/net/wireless/ath/ath9k/Kconfig -@@ -64,13 +64,12 @@ config ATH9K_DEBUGFS - depends on ATH9K && DEBUG_FS - select MAC80211_DEBUGFS - select ATH9K_COMMON_DEBUG -- depends on RELAY - ---help--- - Say Y, if you need access to ath9k's statistics for - interrupts, rate control, etc. - -- Also required for changing debug message flags at run time. -- As well as access to the FFT/spectral data and TX99. -+ Also required for changing debug message flags at run time and for -+ TX99. - - config ATH9K_STATION_STATISTICS - bool "Detailed station statistics" -@@ -181,7 +180,6 @@ config ATH9K_HTC_DEBUGFS - bool "Atheros ath9k_htc debugging" - depends on ATH9K_HTC && DEBUG_FS - select ATH9K_COMMON_DEBUG -- depends on RELAY - ---help--- - Say Y, if you need access to ath9k_htc's statistics. - As well as access to the FFT/spectral data. -@@ -197,3 +195,11 @@ config ATH9K_HWRNG - - Say Y, feeds the entropy directly from the WiFi driver to the input - pool. -+ -+config ATH9K_COMMON_SPECTRAL -+ bool "Atheros ath9k/ath9k_htc spectral scan support" -+ depends on ATH9K_DEBUGFS || ATH9K_HTC_DEBUGFS -+ depends on RELAY -+ default n -+ ---help--- -+ Say Y to enable access to the FFT/spectral data via debugfs. ---- a/drivers/net/wireless/ath/ath9k/Makefile -+++ b/drivers/net/wireless/ath/ath9k/Makefile -@@ -61,8 +61,8 @@ ath9k_common-y:= common.o \ - common-init.o \ - common-beacon.o \ - --ath9k_common-$(CPTCFG_ATH9K_COMMON_DEBUG) += common-debug.o \ -- common-spectral.o -+ath9k_common-$(CPTCFG_ATH9K_COMMON_DEBUG) += common-debug.o -+ath9k_common-$(CPTCFG_ATH9K_COMMON_SPECTRAL) += common-spectral.o - - ath9k_htc-y += htc_hst.o \ - hif_usb.o \ ---- a/drivers/net/wireless/ath/ath9k/common-spectral.h -+++ b/drivers/net/wireless/ath/ath9k/common-spectral.h -@@ -151,7 +151,7 @@ static inline u8 spectral_bitmap_weight( - return bins[0] & 0x3f; - } - --#ifdef CPTCFG_ATH9K_COMMON_DEBUG -+#ifdef CPTCFG_ATH9K_COMMON_SPECTRAL - void ath9k_cmn_spectral_init_debug(struct ath_spec_scan_priv *spec_priv, struct dentry *debugfs_phy); - void ath9k_cmn_spectral_deinit_debug(struct ath_spec_scan_priv *spec_priv); - -@@ -183,6 +183,6 @@ static inline int ath_cmn_process_fft(st - { - return 0; - } --#endif /* CPTCFG_ATH9K_COMMON_DEBUG */ -+#endif /* CPTCFG_ATH9K_COMMON_SPECTRAL */ - - #endif /* SPECTRAL_H */ ---- a/local-symbols -+++ b/local-symbols -@@ -116,6 +116,7 @@ ATH9K_PCOEM= - ATH9K_HTC= - ATH9K_HTC_DEBUGFS= - ATH9K_HWRNG= -+ATH9K_COMMON_SPECTRAL= - CARL9170= - CARL9170_LEDS= - CARL9170_DEBUGFS= diff --git a/package/kernel/mac80211/patches/321-v4.16-0002-ath10k-move-spectral-scan-support-under-a-separate-c.patch b/package/kernel/mac80211/patches/321-v4.16-0002-ath10k-move-spectral-scan-support-under-a-separate-c.patch deleted file mode 100644 index 604a6f1585..0000000000 --- a/package/kernel/mac80211/patches/321-v4.16-0002-ath10k-move-spectral-scan-support-under-a-separate-c.patch +++ /dev/null @@ -1,91 +0,0 @@ -From 42e01cb9cb109fb0bb4743f6c54d6aa67ac39b61 Mon Sep 17 00:00:00 2001 -Message-Id: <42e01cb9cb109fb0bb4743f6c54d6aa67ac39b61.1515610034.git.mschiffer@universe-factory.net> -In-Reply-To: <9df7ddc3ed25b7d3473f117a0680b9418adb5753.1515610034.git.mschiffer@universe-factory.net> -References: <9df7ddc3ed25b7d3473f117a0680b9418adb5753.1515610034.git.mschiffer@universe-factory.net> -From: Matthias Schiffer -Date: Mon, 27 Nov 2017 18:56:23 +0100 -Subject: [PATCH 2/2] ath10k: move spectral scan support under a separate - config symbol - -At the moment, spectral scan support, and with it RELAY, is always enabled -with ATH10K_DEBUGFS. Spectral scan support is currently the only user of -RELAY in ath10k, and it unconditionally reserves a relay channel. - -Having debugfs support in ath10k is often useful even on very small -embedded routers, where we'd rather like to avoid the code size and RAM -usage of the relay support. While ath10k-based devices usually have more -resources than ath9k-based ones, it makes sense to keep the configuration -symmetric to ath9k, so the same base kernel without RELAY can be used for -both ath9k and ath10k hardware. - -Signed-off-by: Matthias Schiffer -Signed-off-by: Kalle Valo ---- - drivers/net/wireless/ath/ath10k/Kconfig | 9 ++++++++- - drivers/net/wireless/ath/ath10k/Makefile | 2 +- - drivers/net/wireless/ath/ath10k/spectral.h | 4 ++-- - 3 files changed, 11 insertions(+), 4 deletions(-) - ---- a/drivers/net/wireless/ath/ath10k/Kconfig -+++ b/drivers/net/wireless/ath/ath10k/Kconfig -@@ -51,12 +51,19 @@ config ATH10K_DEBUG - config ATH10K_DEBUGFS - bool "Atheros ath10k debugfs support" - depends on ATH10K && DEBUG_FS -- depends on RELAY - ---help--- - Enabled debugfs support - - If unsure, say Y to make it easier to debug problems. - -+config ATH10K_SPECTRAL -+ bool "Atheros ath10k spectral scan support" -+ depends on ATH10K_DEBUGFS -+ depends on RELAY -+ default n -+ ---help--- -+ Say Y to enable access to the FFT/spectral data via debugfs. -+ - config ATH10K_TRACING - depends on !KERNEL_3_4 - bool "Atheros ath10k tracing support" ---- a/drivers/net/wireless/ath/ath10k/Makefile -+++ b/drivers/net/wireless/ath/ath10k/Makefile -@@ -14,7 +14,7 @@ ath10k_core-y += mac.o \ - p2p.o \ - swap.o - --ath10k_core-$(CPTCFG_ATH10K_DEBUGFS) += spectral.o -+ath10k_core-$(CPTCFG_ATH10K_SPECTRAL) += spectral.o - ath10k_core-$(CPTCFG_NL80211_TESTMODE) += testmode.o - ath10k_core-$(CPTCFG_ATH10K_TRACING) += trace.o - ath10k_core-$(CPTCFG_ATH10K_THERMAL) += thermal.o ---- a/drivers/net/wireless/ath/ath10k/spectral.h -+++ b/drivers/net/wireless/ath/ath10k/spectral.h -@@ -44,7 +44,7 @@ enum ath10k_spectral_mode { - SPECTRAL_MANUAL, - }; - --#ifdef CPTCFG_ATH10K_DEBUGFS -+#ifdef CPTCFG_ATH10K_SPECTRAL - - int ath10k_spectral_process_fft(struct ath10k *ar, - struct wmi_phyerr_ev_arg *phyerr, -@@ -85,6 +85,6 @@ static inline void ath10k_spectral_destr - { - } - --#endif /* CPTCFG_ATH10K_DEBUGFS */ -+#endif /* CPTCFG_ATH10K_SPECTRAL */ - - #endif /* SPECTRAL_H */ ---- a/local-symbols -+++ b/local-symbols -@@ -140,6 +140,7 @@ ATH10K_SDIO= - ATH10K_USB= - ATH10K_DEBUG= - ATH10K_DEBUGFS= -+ATH10K_SPECTRAL= - ATH10K_TRACING= - ATH10K_DFS_CERTIFIED= - WCN36XX= diff --git a/package/kernel/mac80211/patches/322-v4.16-ath9k-discard-undersized-packets.patch b/package/kernel/mac80211/patches/322-v4.16-ath9k-discard-undersized-packets.patch deleted file mode 100644 index b2b2fcf4aa..0000000000 --- a/package/kernel/mac80211/patches/322-v4.16-ath9k-discard-undersized-packets.patch +++ /dev/null @@ -1,25 +0,0 @@ -From: Felix Fietkau -Date: Wed, 17 Jan 2018 11:11:17 +0100 -Subject: [PATCH] ath9k: discard undersized packets - -Sometimes the hardware will push small packets that trigger a WARN_ON -in mac80211. Discard them early to avoid this issue. - -Reported-by: Stijn Tintel -Signed-off-by: Felix Fietkau ---- - ---- a/drivers/net/wireless/ath/ath9k/recv.c -+++ b/drivers/net/wireless/ath/ath9k/recv.c -@@ -826,9 +826,9 @@ static int ath9k_rx_skb_preprocess(struc - sc->rx.discard_next = false; - - /* -- * Discard zero-length packets. -+ * Discard zero-length packets and packets smaller than an ACK - */ -- if (!rx_stats->rs_datalen) { -+ if (rx_stats->rs_datalen < 10) { - RX_STAT_INC(rx_len_err); - goto corrupt; - } diff --git a/package/kernel/mac80211/patches/323-v4.15-mac80211-mesh-drop-frames-appearing-to-be-from-us.patch b/package/kernel/mac80211/patches/323-v4.15-mac80211-mesh-drop-frames-appearing-to-be-from-us.patch deleted file mode 100644 index 839e927880..0000000000 --- a/package/kernel/mac80211/patches/323-v4.15-mac80211-mesh-drop-frames-appearing-to-be-from-us.patch +++ /dev/null @@ -1,25 +0,0 @@ -From: Johannes Berg -Date: Thu, 4 Jan 2018 15:51:53 +0100 -Subject: [PATCH] mac80211: mesh: drop frames appearing to be from us - -If there are multiple mesh stations with the same MAC address, -they will both get confused and start throwing warnings. - -Obviously in this case nothing can actually work anyway, so just -drop frames that look like they're from ourselves early on. - -Reported-by: Gui Iribarren -Signed-off-by: Johannes Berg ---- - ---- a/net/mac80211/rx.c -+++ b/net/mac80211/rx.c -@@ -3632,6 +3632,8 @@ static bool ieee80211_accept_frame(struc - } - return true; - case NL80211_IFTYPE_MESH_POINT: -+ if (ether_addr_equal(sdata->vif.addr, hdr->addr2)) -+ return false; - if (multicast) - return true; - return ether_addr_equal(sdata->vif.addr, hdr->addr1); diff --git a/package/kernel/mac80211/patches/324-cfg80211-use-only-1Mbps-for-basic-rates-in-mesh.patch b/package/kernel/mac80211/patches/324-cfg80211-use-only-1Mbps-for-basic-rates-in-mesh.patch deleted file mode 100644 index bc4174e4c2..0000000000 --- a/package/kernel/mac80211/patches/324-cfg80211-use-only-1Mbps-for-basic-rates-in-mesh.patch +++ /dev/null @@ -1,55 +0,0 @@ -From: Johannes Berg -Date: Tue, 30 Jan 2018 13:17:38 +0100 -Subject: [PATCH] cfg80211: use only 1Mbps for basic rates in mesh - -Mesh used to use the mandatory rates as basic rates, but we got -the calculation of mandatory rates wrong until some time ago. -Fix this this broke interoperability with older versions since -now more basic rates are required, and thus the MBSS isn't the -same and the network stops working. - -Fix this by simply using only 1Mbps as the basic rate in 2.4GHz. -Since the changed mandatory rates only affected 2.4GHz, this is -all we need to make it work again. - -Reported-and-tested-by: Matthias Schiffer -Fixes: 1bd773c077de ("wireless: set correct mandatory rate flags") -Signed-off-by: Johannes Berg ---- - net/wireless/mesh.c | 25 ++++++++++++++++++++++--- - 1 file changed, 22 insertions(+), 3 deletions(-) - ---- a/net/wireless/mesh.c -+++ b/net/wireless/mesh.c -@@ -169,9 +169,28 @@ int __cfg80211_join_mesh(struct cfg80211 - enum nl80211_bss_scan_width scan_width; - struct ieee80211_supported_band *sband = - rdev->wiphy.bands[setup->chandef.chan->band]; -- scan_width = cfg80211_chandef_to_scan_width(&setup->chandef); -- setup->basic_rates = ieee80211_mandatory_rates(sband, -- scan_width); -+ -+ if (setup->chandef.chan->band == NL80211_BAND_2GHZ) { -+ int i; -+ -+ /* -+ * Older versions selected the mandatory rates for -+ * 2.4 GHz as well, but were broken in that only -+ * 1 Mbps was regarded as a mandatory rate. Keep -+ * using just 1 Mbps as the default basic rate for -+ * mesh to be interoperable with older versions. -+ */ -+ for (i = 0; i < sband->n_bitrates; i++) { -+ if (sband->bitrates[i].bitrate == 10) { -+ setup->basic_rates = BIT(i); -+ break; -+ } -+ } -+ } else { -+ scan_width = cfg80211_chandef_to_scan_width(&setup->chandef); -+ setup->basic_rates = ieee80211_mandatory_rates(sband, -+ scan_width); -+ } - } - - err = cfg80211_chandef_dfs_required(&rdev->wiphy, diff --git a/package/kernel/mac80211/patches/325-v4.17-mac80211-round-IEEE80211_TX_STATUS_HEADROOM-up-to-mu.patch b/package/kernel/mac80211/patches/325-v4.17-mac80211-round-IEEE80211_TX_STATUS_HEADROOM-up-to-mu.patch deleted file mode 100644 index 56c0acc099..0000000000 --- a/package/kernel/mac80211/patches/325-v4.17-mac80211-round-IEEE80211_TX_STATUS_HEADROOM-up-to-mu.patch +++ /dev/null @@ -1,26 +0,0 @@ -From: Felix Fietkau -Date: Fri, 9 Feb 2018 19:46:54 +0100 -Subject: [PATCH] mac80211: round IEEE80211_TX_STATUS_HEADROOM up to multiple - of 4 - -This ensures that mac80211 allocated management frames are properly -aligned, which makes copying them more efficient. -For instance, mt76 uses iowrite32_copy to copy beacon frames to beacon -template memory on the chip. -Misaligned 32-bit accesses cause CPU exceptions on MIPS and should be -avoided. - -Signed-off-by: Felix Fietkau ---- - ---- a/include/net/mac80211.h -+++ b/include/net/mac80211.h -@@ -4149,7 +4149,7 @@ void ieee80211_sta_uapsd_trigger(struct - * The TX headroom reserved by mac80211 for its own tx_status functions. - * This is enough for the radiotap header. - */ --#define IEEE80211_TX_STATUS_HEADROOM 14 -+#define IEEE80211_TX_STATUS_HEADROOM ALIGN(14, 4) - - /** - * ieee80211_sta_set_buffered - inform mac80211 about driver-buffered frames diff --git a/package/kernel/mac80211/patches/326-mac80211-minstrel-remove-unnecessary-debugfs-cleanup.patch b/package/kernel/mac80211/patches/326-mac80211-minstrel-remove-unnecessary-debugfs-cleanup.patch deleted file mode 100644 index 14cf6641d8..0000000000 --- a/package/kernel/mac80211/patches/326-mac80211-minstrel-remove-unnecessary-debugfs-cleanup.patch +++ /dev/null @@ -1,150 +0,0 @@ -From: Felix Fietkau -Date: Sat, 10 Feb 2018 12:41:51 +0100 -Subject: [PATCH] mac80211: minstrel: remove unnecessary debugfs cleanup - code - -debugfs entries are cleaned up by debugfs_remove_recursive already. - -Signed-off-by: Felix Fietkau ---- - ---- a/net/mac80211/rc80211_minstrel.c -+++ b/net/mac80211/rc80211_minstrel.c -@@ -689,8 +689,8 @@ minstrel_alloc(struct ieee80211_hw *hw, - - #ifdef CPTCFG_MAC80211_DEBUGFS - mp->fixed_rate_idx = (u32) -1; -- mp->dbg_fixed_rate = debugfs_create_u32("fixed_rate_idx", -- S_IRUGO | S_IWUGO, debugfsdir, &mp->fixed_rate_idx); -+ debugfs_create_u32("fixed_rate_idx", S_IRUGO | S_IWUGO, debugfsdir, -+ &mp->fixed_rate_idx); - #endif - - minstrel_init_cck_rates(mp); -@@ -701,9 +701,6 @@ minstrel_alloc(struct ieee80211_hw *hw, - static void - minstrel_free(void *priv) - { --#ifdef CPTCFG_MAC80211_DEBUGFS -- debugfs_remove(((struct minstrel_priv *)priv)->dbg_fixed_rate); --#endif - kfree(priv); - } - -@@ -735,7 +732,6 @@ const struct rate_control_ops mac80211_m - .free_sta = minstrel_free_sta, - #ifdef CPTCFG_MAC80211_DEBUGFS - .add_sta_debugfs = minstrel_add_sta_debugfs, -- .remove_sta_debugfs = minstrel_remove_sta_debugfs, - #endif - .get_expected_throughput = minstrel_get_expected_throughput, - }; ---- a/net/mac80211/rc80211_minstrel.h -+++ b/net/mac80211/rc80211_minstrel.h -@@ -109,11 +109,6 @@ struct minstrel_sta_info { - - /* sampling table */ - u8 *sample_table; -- --#ifdef CPTCFG_MAC80211_DEBUGFS -- struct dentry *dbg_stats; -- struct dentry *dbg_stats_csv; --#endif - }; - - struct minstrel_priv { -@@ -137,7 +132,6 @@ struct minstrel_priv { - * - setting will be applied on next update - */ - u32 fixed_rate_idx; -- struct dentry *dbg_fixed_rate; - #endif - }; - -@@ -156,7 +150,6 @@ minstrel_get_ewmsd10(struct minstrel_rat - - extern const struct rate_control_ops mac80211_minstrel; - void minstrel_add_sta_debugfs(void *priv, void *priv_sta, struct dentry *dir); --void minstrel_remove_sta_debugfs(void *priv, void *priv_sta); - - /* Recalculate success probabilities and counters for a given rate using EWMA */ - void minstrel_calc_rate_stats(struct minstrel_rate_stats *mrs); ---- a/net/mac80211/rc80211_minstrel_debugfs.c -+++ b/net/mac80211/rc80211_minstrel_debugfs.c -@@ -214,19 +214,7 @@ minstrel_add_sta_debugfs(void *priv, voi - { - struct minstrel_sta_info *mi = priv_sta; - -- mi->dbg_stats = debugfs_create_file("rc_stats", S_IRUGO, dir, mi, -- &minstrel_stat_fops); -- -- mi->dbg_stats_csv = debugfs_create_file("rc_stats_csv", S_IRUGO, dir, -- mi, &minstrel_stat_csv_fops); --} -- --void --minstrel_remove_sta_debugfs(void *priv, void *priv_sta) --{ -- struct minstrel_sta_info *mi = priv_sta; -- -- debugfs_remove(mi->dbg_stats); -- -- debugfs_remove(mi->dbg_stats_csv); -+ debugfs_create_file("rc_stats", S_IRUGO, dir, mi, &minstrel_stat_fops); -+ debugfs_create_file("rc_stats_csv", S_IRUGO, dir, mi, -+ &minstrel_stat_csv_fops); - } ---- a/net/mac80211/rc80211_minstrel_ht.c -+++ b/net/mac80211/rc80211_minstrel_ht.c -@@ -1393,7 +1393,6 @@ static const struct rate_control_ops mac - .free = minstrel_ht_free, - #ifdef CPTCFG_MAC80211_DEBUGFS - .add_sta_debugfs = minstrel_ht_add_sta_debugfs, -- .remove_sta_debugfs = minstrel_ht_remove_sta_debugfs, - #endif - .get_expected_throughput = minstrel_ht_get_expected_throughput, - }; ---- a/net/mac80211/rc80211_minstrel_ht.h -+++ b/net/mac80211/rc80211_minstrel_ht.h -@@ -110,17 +110,12 @@ struct minstrel_ht_sta_priv { - struct minstrel_ht_sta ht; - struct minstrel_sta_info legacy; - }; --#ifdef CPTCFG_MAC80211_DEBUGFS -- struct dentry *dbg_stats; -- struct dentry *dbg_stats_csv; --#endif - void *ratelist; - void *sample_table; - bool is_ht; - }; - - void minstrel_ht_add_sta_debugfs(void *priv, void *priv_sta, struct dentry *dir); --void minstrel_ht_remove_sta_debugfs(void *priv, void *priv_sta); - int minstrel_ht_get_tp_avg(struct minstrel_ht_sta *mi, int group, int rate, - int prob_ewma); - ---- a/net/mac80211/rc80211_minstrel_ht_debugfs.c -+++ b/net/mac80211/rc80211_minstrel_ht_debugfs.c -@@ -303,17 +303,8 @@ minstrel_ht_add_sta_debugfs(void *priv, - { - struct minstrel_ht_sta_priv *msp = priv_sta; - -- msp->dbg_stats = debugfs_create_file("rc_stats", S_IRUGO, dir, msp, -- &minstrel_ht_stat_fops); -- msp->dbg_stats_csv = debugfs_create_file("rc_stats_csv", S_IRUGO, -- dir, msp, &minstrel_ht_stat_csv_fops); --} -- --void --minstrel_ht_remove_sta_debugfs(void *priv, void *priv_sta) --{ -- struct minstrel_ht_sta_priv *msp = priv_sta; -- -- debugfs_remove(msp->dbg_stats); -- debugfs_remove(msp->dbg_stats_csv); -+ debugfs_create_file("rc_stats", S_IRUGO, dir, msp, -+ &minstrel_ht_stat_fops); -+ debugfs_create_file("rc_stats_csv", S_IRUGO, dir, msp, -+ &minstrel_ht_stat_csv_fops); - } diff --git a/package/kernel/mac80211/patches/327-mac80211-minstrel-merge-with-minstrel_ht-always-enab.patch b/package/kernel/mac80211/patches/327-mac80211-minstrel-merge-with-minstrel_ht-always-enab.patch deleted file mode 100644 index a2bdfd81a0..0000000000 --- a/package/kernel/mac80211/patches/327-mac80211-minstrel-merge-with-minstrel_ht-always-enab.patch +++ /dev/null @@ -1,576 +0,0 @@ -From: Felix Fietkau -Date: Sat, 10 Feb 2018 12:43:30 +0100 -Subject: [PATCH] mac80211: minstrel: merge with minstrel_ht, always enable - VHT support - -Legacy-only devices are not very common and the overhead of the extra -code for HT and VHT rates is not big enough to justify all those extra -lines of code to make it optional. - -Signed-off-by: Felix Fietkau ---- - ---- a/net/mac80211/Kconfig -+++ b/net/mac80211/Kconfig -@@ -25,20 +25,6 @@ config MAC80211_RC_MINSTREL - ---help--- - This option enables the 'minstrel' TX rate control algorithm - --config MAC80211_RC_MINSTREL_HT -- bool "Minstrel 802.11n support" if EXPERT -- depends on MAC80211_RC_MINSTREL -- default y -- ---help--- -- This option enables the 'minstrel_ht' TX rate control algorithm -- --config MAC80211_RC_MINSTREL_VHT -- bool "Minstrel 802.11ac support" if EXPERT -- depends on MAC80211_RC_MINSTREL_HT -- default n -- ---help--- -- This option enables VHT in the 'minstrel_ht' TX rate control algorithm -- - choice - prompt "Default rate control algorithm" - depends on MAC80211_HAS_RC -@@ -60,8 +46,7 @@ endchoice - - config MAC80211_RC_DEFAULT - string -- default "minstrel_ht" if MAC80211_RC_DEFAULT_MINSTREL && MAC80211_RC_MINSTREL_HT -- default "minstrel" if MAC80211_RC_DEFAULT_MINSTREL -+ default "minstrel_ht" if MAC80211_RC_DEFAULT_MINSTREL - default "" - - endif ---- a/net/mac80211/Makefile -+++ b/net/mac80211/Makefile -@@ -50,13 +50,14 @@ mac80211-$(CONFIG_PM) += pm.o - - CFLAGS_trace.o := -I$(src) - --rc80211_minstrel-y := rc80211_minstrel.o --rc80211_minstrel-$(CPTCFG_MAC80211_DEBUGFS) += rc80211_minstrel_debugfs.o -+rc80211_minstrel-y := \ -+ rc80211_minstrel.o \ -+ rc80211_minstrel_ht.o - --rc80211_minstrel_ht-y := rc80211_minstrel_ht.o --rc80211_minstrel_ht-$(CPTCFG_MAC80211_DEBUGFS) += rc80211_minstrel_ht_debugfs.o -+rc80211_minstrel-$(CPTCFG_MAC80211_DEBUGFS) += \ -+ rc80211_minstrel_debugfs.o \ -+ rc80211_minstrel_ht_debugfs.o - - mac80211-$(CPTCFG_MAC80211_RC_MINSTREL) += $(rc80211_minstrel-y) --mac80211-$(CPTCFG_MAC80211_RC_MINSTREL_HT) += $(rc80211_minstrel_ht-y) - - ccflags-y += -DDEBUG ---- a/net/mac80211/main.c -+++ b/net/mac80211/main.c -@@ -1252,18 +1252,12 @@ static int __init ieee80211_init(void) - if (ret) - return ret; - -- ret = rc80211_minstrel_ht_init(); -- if (ret) -- goto err_minstrel; -- - ret = ieee80211_iface_init(); - if (ret) - goto err_netdev; - - return 0; - err_netdev: -- rc80211_minstrel_ht_exit(); -- err_minstrel: - rc80211_minstrel_exit(); - - return ret; -@@ -1271,7 +1265,6 @@ static int __init ieee80211_init(void) - - static void __exit ieee80211_exit(void) - { -- rc80211_minstrel_ht_exit(); - rc80211_minstrel_exit(); - - ieee80211s_stop(); ---- a/net/mac80211/rate.h -+++ b/net/mac80211/rate.h -@@ -95,18 +95,5 @@ static inline void rc80211_minstrel_exit - } - #endif - --#ifdef CPTCFG_MAC80211_RC_MINSTREL_HT --int rc80211_minstrel_ht_init(void); --void rc80211_minstrel_ht_exit(void); --#else --static inline int rc80211_minstrel_ht_init(void) --{ -- return 0; --} --static inline void rc80211_minstrel_ht_exit(void) --{ --} --#endif -- - - #endif /* IEEE80211_RATE_H */ ---- a/net/mac80211/rc80211_minstrel.c -+++ b/net/mac80211/rc80211_minstrel.c -@@ -572,138 +572,6 @@ minstrel_rate_init(void *priv, struct ie - minstrel_update_rates(mp, mi); - } - --static void * --minstrel_alloc_sta(void *priv, struct ieee80211_sta *sta, gfp_t gfp) --{ -- struct ieee80211_supported_band *sband; -- struct minstrel_sta_info *mi; -- struct minstrel_priv *mp = priv; -- struct ieee80211_hw *hw = mp->hw; -- int max_rates = 0; -- int i; -- -- mi = kzalloc(sizeof(struct minstrel_sta_info), gfp); -- if (!mi) -- return NULL; -- -- for (i = 0; i < NUM_NL80211_BANDS; i++) { -- sband = hw->wiphy->bands[i]; -- if (sband && sband->n_bitrates > max_rates) -- max_rates = sband->n_bitrates; -- } -- -- mi->r = kzalloc(sizeof(struct minstrel_rate) * max_rates, gfp); -- if (!mi->r) -- goto error; -- -- mi->sample_table = kmalloc(SAMPLE_COLUMNS * max_rates, gfp); -- if (!mi->sample_table) -- goto error1; -- -- mi->last_stats_update = jiffies; -- return mi; -- --error1: -- kfree(mi->r); --error: -- kfree(mi); -- return NULL; --} -- --static void --minstrel_free_sta(void *priv, struct ieee80211_sta *sta, void *priv_sta) --{ -- struct minstrel_sta_info *mi = priv_sta; -- -- kfree(mi->sample_table); -- kfree(mi->r); -- kfree(mi); --} -- --static void --minstrel_init_cck_rates(struct minstrel_priv *mp) --{ -- static const int bitrates[4] = { 10, 20, 55, 110 }; -- struct ieee80211_supported_band *sband; -- u32 rate_flags = ieee80211_chandef_rate_flags(&mp->hw->conf.chandef); -- int i, j; -- -- sband = mp->hw->wiphy->bands[NL80211_BAND_2GHZ]; -- if (!sband) -- return; -- -- for (i = 0, j = 0; i < sband->n_bitrates; i++) { -- struct ieee80211_rate *rate = &sband->bitrates[i]; -- -- if (rate->flags & IEEE80211_RATE_ERP_G) -- continue; -- -- if ((rate_flags & sband->bitrates[i].flags) != rate_flags) -- continue; -- -- for (j = 0; j < ARRAY_SIZE(bitrates); j++) { -- if (rate->bitrate != bitrates[j]) -- continue; -- -- mp->cck_rates[j] = i; -- break; -- } -- } --} -- --static void * --minstrel_alloc(struct ieee80211_hw *hw, struct dentry *debugfsdir) --{ -- struct minstrel_priv *mp; -- -- mp = kzalloc(sizeof(struct minstrel_priv), GFP_ATOMIC); -- if (!mp) -- return NULL; -- -- /* contention window settings -- * Just an approximation. Using the per-queue values would complicate -- * the calculations and is probably unnecessary */ -- mp->cw_min = 15; -- mp->cw_max = 1023; -- -- /* number of packets (in %) to use for sampling other rates -- * sample less often for non-mrr packets, because the overhead -- * is much higher than with mrr */ -- mp->lookaround_rate = 5; -- mp->lookaround_rate_mrr = 10; -- -- /* maximum time that the hw is allowed to stay in one MRR segment */ -- mp->segment_size = 6000; -- -- if (hw->max_rate_tries > 0) -- mp->max_retry = hw->max_rate_tries; -- else -- /* safe default, does not necessarily have to match hw properties */ -- mp->max_retry = 7; -- -- if (hw->max_rates >= 4) -- mp->has_mrr = true; -- -- mp->hw = hw; -- mp->update_interval = 100; -- --#ifdef CPTCFG_MAC80211_DEBUGFS -- mp->fixed_rate_idx = (u32) -1; -- debugfs_create_u32("fixed_rate_idx", S_IRUGO | S_IWUGO, debugfsdir, -- &mp->fixed_rate_idx); --#endif -- -- minstrel_init_cck_rates(mp); -- -- return mp; --} -- --static void --minstrel_free(void *priv) --{ -- kfree(priv); --} -- - static u32 minstrel_get_expected_throughput(void *priv_sta) - { - struct minstrel_sta_info *mi = priv_sta; -@@ -722,29 +590,8 @@ static u32 minstrel_get_expected_through - } - - const struct rate_control_ops mac80211_minstrel = { -- .name = "minstrel", - .tx_status_ext = minstrel_tx_status, - .get_rate = minstrel_get_rate, - .rate_init = minstrel_rate_init, -- .alloc = minstrel_alloc, -- .free = minstrel_free, -- .alloc_sta = minstrel_alloc_sta, -- .free_sta = minstrel_free_sta, --#ifdef CPTCFG_MAC80211_DEBUGFS -- .add_sta_debugfs = minstrel_add_sta_debugfs, --#endif - .get_expected_throughput = minstrel_get_expected_throughput, - }; -- --int __init --rc80211_minstrel_init(void) --{ -- return ieee80211_rate_control_register(&mac80211_minstrel); --} -- --void --rc80211_minstrel_exit(void) --{ -- ieee80211_rate_control_unregister(&mac80211_minstrel); --} -- ---- a/net/mac80211/rc80211_minstrel.h -+++ b/net/mac80211/rc80211_minstrel.h -@@ -158,7 +158,5 @@ int minstrel_get_tp_avg(struct minstrel_ - /* debugfs */ - int minstrel_stats_open(struct inode *inode, struct file *file); - int minstrel_stats_csv_open(struct inode *inode, struct file *file); --ssize_t minstrel_stats_read(struct file *file, char __user *buf, size_t len, loff_t *ppos); --int minstrel_stats_release(struct inode *inode, struct file *file); - - #endif ---- a/net/mac80211/rc80211_minstrel_debugfs.c -+++ b/net/mac80211/rc80211_minstrel_debugfs.c -@@ -54,22 +54,6 @@ - #include - #include "rc80211_minstrel.h" - --ssize_t --minstrel_stats_read(struct file *file, char __user *buf, size_t len, loff_t *ppos) --{ -- struct minstrel_debugfs_info *ms; -- -- ms = file->private_data; -- return simple_read_from_buffer(buf, len, ppos, ms->buf, ms->len); --} -- --int --minstrel_stats_release(struct inode *inode, struct file *file) --{ -- kfree(file->private_data); -- return 0; --} -- - int - minstrel_stats_open(struct inode *inode, struct file *file) - { -@@ -135,14 +119,6 @@ minstrel_stats_open(struct inode *inode, - return 0; - } - --static const struct file_operations minstrel_stat_fops = { -- .owner = THIS_MODULE, -- .open = minstrel_stats_open, -- .read = minstrel_stats_read, -- .release = minstrel_stats_release, -- .llseek = default_llseek, --}; -- - int - minstrel_stats_csv_open(struct inode *inode, struct file *file) - { -@@ -200,21 +176,3 @@ minstrel_stats_csv_open(struct inode *in - - return 0; - } -- --static const struct file_operations minstrel_stat_csv_fops = { -- .owner = THIS_MODULE, -- .open = minstrel_stats_csv_open, -- .read = minstrel_stats_read, -- .release = minstrel_stats_release, -- .llseek = default_llseek, --}; -- --void --minstrel_add_sta_debugfs(void *priv, void *priv_sta, struct dentry *dir) --{ -- struct minstrel_sta_info *mi = priv_sta; -- -- debugfs_create_file("rc_stats", S_IRUGO, dir, mi, &minstrel_stat_fops); -- debugfs_create_file("rc_stats_csv", S_IRUGO, dir, mi, -- &minstrel_stat_csv_fops); --} ---- a/net/mac80211/rc80211_minstrel_ht.c -+++ b/net/mac80211/rc80211_minstrel_ht.c -@@ -137,12 +137,10 @@ - } \ - } - --#ifdef CPTCFG_MAC80211_RC_MINSTREL_VHT - static bool minstrel_vht_only = true; - module_param(minstrel_vht_only, bool, 0644); - MODULE_PARM_DESC(minstrel_vht_only, - "Use only VHT rates when VHT is supported by sta."); --#endif - - /* - * To enable sufficiently targeted rate sampling, MCS rates are divided into -@@ -171,7 +169,6 @@ const struct mcs_group minstrel_mcs_grou - - CCK_GROUP, - --#ifdef CPTCFG_MAC80211_RC_MINSTREL_VHT - VHT_GROUP(1, 0, BW_20), - VHT_GROUP(2, 0, BW_20), - VHT_GROUP(3, 0, BW_20), -@@ -195,7 +192,6 @@ const struct mcs_group minstrel_mcs_grou - VHT_GROUP(1, 1, BW_80), - VHT_GROUP(2, 1, BW_80), - VHT_GROUP(3, 1, BW_80), --#endif - }; - - static u8 sample_table[SAMPLE_COLUMNS][MCS_GROUP_RATES] __read_mostly; -@@ -1146,12 +1142,10 @@ minstrel_ht_update_caps(void *priv, stru - - BUILD_BUG_ON(ARRAY_SIZE(minstrel_mcs_groups) != MINSTREL_GROUPS_NB); - --#ifdef CPTCFG_MAC80211_RC_MINSTREL_VHT - if (vht_cap->vht_supported) - use_vht = vht_cap->vht_mcs.tx_mcs_map != cpu_to_le16(~0); - else --#endif -- use_vht = 0; -+ use_vht = 0; - - msp->is_ht = true; - memset(mi, 0, sizeof(*mi)); -@@ -1226,10 +1220,9 @@ minstrel_ht_update_caps(void *priv, stru - - /* HT rate */ - if (gflags & IEEE80211_TX_RC_MCS) { --#ifdef CPTCFG_MAC80211_RC_MINSTREL_VHT - if (use_vht && minstrel_vht_only) - continue; --#endif -+ - mi->supported[i] = mcs->rx_mask[nss - 1]; - if (mi->supported[i]) - n_supported++; -@@ -1349,16 +1342,88 @@ minstrel_ht_free_sta(void *priv, struct - kfree(msp); - } - -+static void -+minstrel_ht_init_cck_rates(struct minstrel_priv *mp) -+{ -+ static const int bitrates[4] = { 10, 20, 55, 110 }; -+ struct ieee80211_supported_band *sband; -+ u32 rate_flags = ieee80211_chandef_rate_flags(&mp->hw->conf.chandef); -+ int i, j; -+ -+ sband = mp->hw->wiphy->bands[NL80211_BAND_2GHZ]; -+ if (!sband) -+ return; -+ -+ for (i = 0, j = 0; i < sband->n_bitrates; i++) { -+ struct ieee80211_rate *rate = &sband->bitrates[i]; -+ -+ if (rate->flags & IEEE80211_RATE_ERP_G) -+ continue; -+ -+ if ((rate_flags & sband->bitrates[i].flags) != rate_flags) -+ continue; -+ -+ for (j = 0; j < ARRAY_SIZE(bitrates); j++) { -+ if (rate->bitrate != bitrates[j]) -+ continue; -+ -+ mp->cck_rates[j] = i; -+ break; -+ } -+ } -+} -+ - static void * - minstrel_ht_alloc(struct ieee80211_hw *hw, struct dentry *debugfsdir) - { -- return mac80211_minstrel.alloc(hw, debugfsdir); -+ struct minstrel_priv *mp; -+ -+ mp = kzalloc(sizeof(struct minstrel_priv), GFP_ATOMIC); -+ if (!mp) -+ return NULL; -+ -+ /* contention window settings -+ * Just an approximation. Using the per-queue values would complicate -+ * the calculations and is probably unnecessary */ -+ mp->cw_min = 15; -+ mp->cw_max = 1023; -+ -+ /* number of packets (in %) to use for sampling other rates -+ * sample less often for non-mrr packets, because the overhead -+ * is much higher than with mrr */ -+ mp->lookaround_rate = 5; -+ mp->lookaround_rate_mrr = 10; -+ -+ /* maximum time that the hw is allowed to stay in one MRR segment */ -+ mp->segment_size = 6000; -+ -+ if (hw->max_rate_tries > 0) -+ mp->max_retry = hw->max_rate_tries; -+ else -+ /* safe default, does not necessarily have to match hw properties */ -+ mp->max_retry = 7; -+ -+ if (hw->max_rates >= 4) -+ mp->has_mrr = true; -+ -+ mp->hw = hw; -+ mp->update_interval = 100; -+ -+#ifdef CPTCFG_MAC80211_DEBUGFS -+ mp->fixed_rate_idx = (u32) -1; -+ debugfs_create_u32("fixed_rate_idx", S_IRUGO | S_IWUGO, debugfsdir, -+ &mp->fixed_rate_idx); -+#endif -+ -+ minstrel_ht_init_cck_rates(mp); -+ -+ return mp; - } - - static void - minstrel_ht_free(void *priv) - { -- mac80211_minstrel.free(priv); -+ kfree(priv); - } - - static u32 minstrel_ht_get_expected_throughput(void *priv_sta) -@@ -1417,14 +1482,14 @@ static void __init init_sample_table(voi - } - - int __init --rc80211_minstrel_ht_init(void) -+rc80211_minstrel_init(void) - { - init_sample_table(); - return ieee80211_rate_control_register(&mac80211_minstrel_ht); - } - - void --rc80211_minstrel_ht_exit(void) -+rc80211_minstrel_exit(void) - { - ieee80211_rate_control_unregister(&mac80211_minstrel_ht); - } ---- a/net/mac80211/rc80211_minstrel_ht.h -+++ b/net/mac80211/rc80211_minstrel_ht.h -@@ -15,11 +15,7 @@ - */ - #define MINSTREL_MAX_STREAMS 3 - #define MINSTREL_HT_STREAM_GROUPS 4 /* BW(=2) * SGI(=2) */ --#ifdef CPTCFG_MAC80211_RC_MINSTREL_VHT - #define MINSTREL_VHT_STREAM_GROUPS 6 /* BW(=3) * SGI(=2) */ --#else --#define MINSTREL_VHT_STREAM_GROUPS 0 --#endif - - #define MINSTREL_HT_GROUPS_NB (MINSTREL_MAX_STREAMS * \ - MINSTREL_HT_STREAM_GROUPS) -@@ -34,11 +30,7 @@ - #define MINSTREL_CCK_GROUP (MINSTREL_HT_GROUP_0 + MINSTREL_HT_GROUPS_NB) - #define MINSTREL_VHT_GROUP_0 (MINSTREL_CCK_GROUP + 1) - --#ifdef CPTCFG_MAC80211_RC_MINSTREL_VHT - #define MCS_GROUP_RATES 10 --#else --#define MCS_GROUP_RATES 8 --#endif - - struct mcs_group { - u32 flags; ---- a/net/mac80211/rc80211_minstrel_ht_debugfs.c -+++ b/net/mac80211/rc80211_minstrel_ht_debugfs.c -@@ -15,6 +15,22 @@ - #include "rc80211_minstrel.h" - #include "rc80211_minstrel_ht.h" - -+static ssize_t -+minstrel_stats_read(struct file *file, char __user *buf, size_t len, loff_t *ppos) -+{ -+ struct minstrel_debugfs_info *ms; -+ -+ ms = file->private_data; -+ return simple_read_from_buffer(buf, len, ppos, ms->buf, ms->len); -+} -+ -+static int -+minstrel_stats_release(struct inode *inode, struct file *file) -+{ -+ kfree(file->private_data); -+ return 0; -+} -+ - static char * - minstrel_ht_stats_dump(struct minstrel_ht_sta *mi, int i, char *p) - { diff --git a/package/kernel/mac80211/patches/328-mac80211-minstrel-reduce-minstrel_mcs_groups-size.patch b/package/kernel/mac80211/patches/328-mac80211-minstrel-reduce-minstrel_mcs_groups-size.patch deleted file mode 100644 index fa51f1be7e..0000000000 --- a/package/kernel/mac80211/patches/328-mac80211-minstrel-reduce-minstrel_mcs_groups-size.patch +++ /dev/null @@ -1,358 +0,0 @@ -From: Felix Fietkau -Date: Sat, 10 Feb 2018 12:45:47 +0100 -Subject: [PATCH] mac80211: minstrel: reduce minstrel_mcs_groups size - -By storing a shift value for all duration values of a group, we can -reduce precision by a neglegible amount to make it fit into a u16 value. -This improves cache footprint and reduces size: - -Before: - text data bss dec hex filename - 10024 116 0 10140 279c rc80211_minstrel_ht.o - -After: - text data bss dec hex filename - 9368 116 0 9484 250c rc80211_minstrel_ht.o - -Signed-off-by: Felix Fietkau ---- - ---- a/net/mac80211/rc80211_minstrel_ht.c -+++ b/net/mac80211/rc80211_minstrel_ht.c -@@ -52,22 +52,23 @@ - _streams - 1 - - /* MCS rate information for an MCS group */ --#define MCS_GROUP(_streams, _sgi, _ht40) \ -+#define MCS_GROUP(_streams, _sgi, _ht40, _s) \ - [GROUP_IDX(_streams, _sgi, _ht40)] = { \ - .streams = _streams, \ -+ .shift = _s, \ - .flags = \ - IEEE80211_TX_RC_MCS | \ - (_sgi ? IEEE80211_TX_RC_SHORT_GI : 0) | \ - (_ht40 ? IEEE80211_TX_RC_40_MHZ_WIDTH : 0), \ - .duration = { \ -- MCS_DURATION(_streams, _sgi, _ht40 ? 54 : 26), \ -- MCS_DURATION(_streams, _sgi, _ht40 ? 108 : 52), \ -- MCS_DURATION(_streams, _sgi, _ht40 ? 162 : 78), \ -- MCS_DURATION(_streams, _sgi, _ht40 ? 216 : 104), \ -- MCS_DURATION(_streams, _sgi, _ht40 ? 324 : 156), \ -- MCS_DURATION(_streams, _sgi, _ht40 ? 432 : 208), \ -- MCS_DURATION(_streams, _sgi, _ht40 ? 486 : 234), \ -- MCS_DURATION(_streams, _sgi, _ht40 ? 540 : 260) \ -+ MCS_DURATION(_streams, _sgi, _ht40 ? 54 : 26) >> _s, \ -+ MCS_DURATION(_streams, _sgi, _ht40 ? 108 : 52) >> _s, \ -+ MCS_DURATION(_streams, _sgi, _ht40 ? 162 : 78) >> _s, \ -+ MCS_DURATION(_streams, _sgi, _ht40 ? 216 : 104) >> _s, \ -+ MCS_DURATION(_streams, _sgi, _ht40 ? 324 : 156) >> _s, \ -+ MCS_DURATION(_streams, _sgi, _ht40 ? 432 : 208) >> _s, \ -+ MCS_DURATION(_streams, _sgi, _ht40 ? 486 : 234) >> _s, \ -+ MCS_DURATION(_streams, _sgi, _ht40 ? 540 : 260) >> _s \ - } \ - } - -@@ -80,9 +81,10 @@ - #define BW2VBPS(_bw, r3, r2, r1) \ - (_bw == BW_80 ? r3 : _bw == BW_40 ? r2 : r1) - --#define VHT_GROUP(_streams, _sgi, _bw) \ -+#define VHT_GROUP(_streams, _sgi, _bw, _s) \ - [VHT_GROUP_IDX(_streams, _sgi, _bw)] = { \ - .streams = _streams, \ -+ .shift = _s, \ - .flags = \ - IEEE80211_TX_RC_VHT_MCS | \ - (_sgi ? IEEE80211_TX_RC_SHORT_GI : 0) | \ -@@ -90,25 +92,25 @@ - _bw == BW_40 ? IEEE80211_TX_RC_40_MHZ_WIDTH : 0), \ - .duration = { \ - MCS_DURATION(_streams, _sgi, \ -- BW2VBPS(_bw, 117, 54, 26)), \ -+ BW2VBPS(_bw, 117, 54, 26)) >> _s, \ - MCS_DURATION(_streams, _sgi, \ -- BW2VBPS(_bw, 234, 108, 52)), \ -+ BW2VBPS(_bw, 234, 108, 52)) >> _s, \ - MCS_DURATION(_streams, _sgi, \ -- BW2VBPS(_bw, 351, 162, 78)), \ -+ BW2VBPS(_bw, 351, 162, 78)) >> _s, \ - MCS_DURATION(_streams, _sgi, \ -- BW2VBPS(_bw, 468, 216, 104)), \ -+ BW2VBPS(_bw, 468, 216, 104)) >> _s, \ - MCS_DURATION(_streams, _sgi, \ -- BW2VBPS(_bw, 702, 324, 156)), \ -+ BW2VBPS(_bw, 702, 324, 156)) >> _s, \ - MCS_DURATION(_streams, _sgi, \ -- BW2VBPS(_bw, 936, 432, 208)), \ -+ BW2VBPS(_bw, 936, 432, 208)) >> _s, \ - MCS_DURATION(_streams, _sgi, \ -- BW2VBPS(_bw, 1053, 486, 234)), \ -+ BW2VBPS(_bw, 1053, 486, 234)) >> _s, \ - MCS_DURATION(_streams, _sgi, \ -- BW2VBPS(_bw, 1170, 540, 260)), \ -+ BW2VBPS(_bw, 1170, 540, 260)) >> _s, \ - MCS_DURATION(_streams, _sgi, \ -- BW2VBPS(_bw, 1404, 648, 312)), \ -+ BW2VBPS(_bw, 1404, 648, 312)) >> _s, \ - MCS_DURATION(_streams, _sgi, \ -- BW2VBPS(_bw, 1560, 720, 346)) \ -+ BW2VBPS(_bw, 1560, 720, 346)) >> _s \ - } \ - } - -@@ -121,19 +123,20 @@ - (CCK_DURATION((_bitrate > 10 ? 20 : 10), false, 60) + \ - CCK_DURATION(_bitrate, _short, AVG_PKT_SIZE)) - --#define CCK_DURATION_LIST(_short) \ -- CCK_ACK_DURATION(10, _short), \ -- CCK_ACK_DURATION(20, _short), \ -- CCK_ACK_DURATION(55, _short), \ -- CCK_ACK_DURATION(110, _short) -+#define CCK_DURATION_LIST(_short, _s) \ -+ CCK_ACK_DURATION(10, _short) >> _s, \ -+ CCK_ACK_DURATION(20, _short) >> _s, \ -+ CCK_ACK_DURATION(55, _short) >> _s, \ -+ CCK_ACK_DURATION(110, _short) >> _s - --#define CCK_GROUP \ -+#define CCK_GROUP(_s) \ - [MINSTREL_CCK_GROUP] = { \ - .streams = 0, \ - .flags = 0, \ -+ .shift = _s, \ - .duration = { \ -- CCK_DURATION_LIST(false), \ -- CCK_DURATION_LIST(true) \ -+ CCK_DURATION_LIST(false, _s), \ -+ CCK_DURATION_LIST(true, _s) \ - } \ - } - -@@ -151,47 +154,47 @@ MODULE_PARM_DESC(minstrel_vht_only, - * BW -> SGI -> #streams - */ - const struct mcs_group minstrel_mcs_groups[] = { -- MCS_GROUP(1, 0, BW_20), -- MCS_GROUP(2, 0, BW_20), -- MCS_GROUP(3, 0, BW_20), -+ MCS_GROUP(1, 0, BW_20, 5), -+ MCS_GROUP(2, 0, BW_20, 4), -+ MCS_GROUP(3, 0, BW_20, 4), - -- MCS_GROUP(1, 1, BW_20), -- MCS_GROUP(2, 1, BW_20), -- MCS_GROUP(3, 1, BW_20), -+ MCS_GROUP(1, 1, BW_20, 5), -+ MCS_GROUP(2, 1, BW_20, 4), -+ MCS_GROUP(3, 1, BW_20, 4), - -- MCS_GROUP(1, 0, BW_40), -- MCS_GROUP(2, 0, BW_40), -- MCS_GROUP(3, 0, BW_40), -+ MCS_GROUP(1, 0, BW_40, 4), -+ MCS_GROUP(2, 0, BW_40, 4), -+ MCS_GROUP(3, 0, BW_40, 4), - -- MCS_GROUP(1, 1, BW_40), -- MCS_GROUP(2, 1, BW_40), -- MCS_GROUP(3, 1, BW_40), -+ MCS_GROUP(1, 1, BW_40, 4), -+ MCS_GROUP(2, 1, BW_40, 4), -+ MCS_GROUP(3, 1, BW_40, 4), - -- CCK_GROUP, -+ CCK_GROUP(8), - -- VHT_GROUP(1, 0, BW_20), -- VHT_GROUP(2, 0, BW_20), -- VHT_GROUP(3, 0, BW_20), -+ VHT_GROUP(1, 0, BW_20, 5), -+ VHT_GROUP(2, 0, BW_20, 4), -+ VHT_GROUP(3, 0, BW_20, 4), - -- VHT_GROUP(1, 1, BW_20), -- VHT_GROUP(2, 1, BW_20), -- VHT_GROUP(3, 1, BW_20), -+ VHT_GROUP(1, 1, BW_20, 5), -+ VHT_GROUP(2, 1, BW_20, 4), -+ VHT_GROUP(3, 1, BW_20, 4), - -- VHT_GROUP(1, 0, BW_40), -- VHT_GROUP(2, 0, BW_40), -- VHT_GROUP(3, 0, BW_40), -+ VHT_GROUP(1, 0, BW_40, 4), -+ VHT_GROUP(2, 0, BW_40, 4), -+ VHT_GROUP(3, 0, BW_40, 4), - -- VHT_GROUP(1, 1, BW_40), -- VHT_GROUP(2, 1, BW_40), -- VHT_GROUP(3, 1, BW_40), -+ VHT_GROUP(1, 1, BW_40, 4), -+ VHT_GROUP(2, 1, BW_40, 4), -+ VHT_GROUP(3, 1, BW_40, 4), - -- VHT_GROUP(1, 0, BW_80), -- VHT_GROUP(2, 0, BW_80), -- VHT_GROUP(3, 0, BW_80), -+ VHT_GROUP(1, 0, BW_80, 4), -+ VHT_GROUP(2, 0, BW_80, 4), -+ VHT_GROUP(3, 0, BW_80, 4), - -- VHT_GROUP(1, 1, BW_80), -- VHT_GROUP(2, 1, BW_80), -- VHT_GROUP(3, 1, BW_80), -+ VHT_GROUP(1, 1, BW_80, 4), -+ VHT_GROUP(2, 1, BW_80, 4), -+ VHT_GROUP(3, 1, BW_80, 4), - }; - - static u8 sample_table[SAMPLE_COLUMNS][MCS_GROUP_RATES] __read_mostly; -@@ -307,7 +310,8 @@ minstrel_ht_get_tp_avg(struct minstrel_h - if (group != MINSTREL_CCK_GROUP) - nsecs = 1000 * mi->overhead / MINSTREL_TRUNC(mi->avg_ampdu_len); - -- nsecs += minstrel_mcs_groups[group].duration[rate]; -+ nsecs += minstrel_mcs_groups[group].duration[rate] << -+ minstrel_mcs_groups[group].shift; - - /* - * For the throughput calculation, limit the probability value to 90% to -@@ -755,12 +759,19 @@ minstrel_ht_tx_status(void *priv, struct - minstrel_ht_update_rates(mp, mi); - } - -+static inline int -+minstrel_get_duration(int index) -+{ -+ const struct mcs_group *group = &minstrel_mcs_groups[index / MCS_GROUP_RATES]; -+ unsigned int duration = group->duration[index % MCS_GROUP_RATES]; -+ return duration << group->shift; -+} -+ - static void - minstrel_calc_retransmit(struct minstrel_priv *mp, struct minstrel_ht_sta *mi, - int index) - { - struct minstrel_rate_stats *mrs; -- const struct mcs_group *group; - unsigned int tx_time, tx_time_rtscts, tx_time_data; - unsigned int cw = mp->cw_min; - unsigned int ctime = 0; -@@ -779,8 +790,7 @@ minstrel_calc_retransmit(struct minstrel - mrs->retry_count_rtscts = 2; - mrs->retry_updated = true; - -- group = &minstrel_mcs_groups[index / MCS_GROUP_RATES]; -- tx_time_data = group->duration[index % MCS_GROUP_RATES] * ampdu_len / 1000; -+ tx_time_data = minstrel_get_duration(index) * ampdu_len / 1000; - - /* Contention time for first 2 tries */ - ctime = (t_slot * cw) >> 1; -@@ -874,20 +884,24 @@ minstrel_ht_get_max_amsdu_len(struct min - int group = mi->max_prob_rate / MCS_GROUP_RATES; - const struct mcs_group *g = &minstrel_mcs_groups[group]; - int rate = mi->max_prob_rate % MCS_GROUP_RATES; -+ unsigned int duration; - - /* Disable A-MSDU if max_prob_rate is bad */ - if (mi->groups[group].rates[rate].prob_ewma < MINSTREL_FRAC(50, 100)) - return 1; - -+ duration = g->duration[rate]; -+ duration <<= g->shift; -+ - /* If the rate is slower than single-stream MCS1, make A-MSDU limit small */ -- if (g->duration[rate] > MCS_DURATION(1, 0, 52)) -+ if (duration > MCS_DURATION(1, 0, 52)) - return 500; - - /* - * If the rate is slower than single-stream MCS4, limit A-MSDU to usual - * data packet size - */ -- if (g->duration[rate] > MCS_DURATION(1, 0, 104)) -+ if (duration > MCS_DURATION(1, 0, 104)) - return 1600; - - /* -@@ -895,7 +909,7 @@ minstrel_ht_get_max_amsdu_len(struct min - * rate success probability is less than 75%, limit A-MSDU to twice the usual - * data packet size - */ -- if (g->duration[rate] > MCS_DURATION(1, 0, 260) || -+ if (duration > MCS_DURATION(1, 0, 260) || - (minstrel_ht_get_prob_ewma(mi, mi->max_tp_rate[0]) < - MINSTREL_FRAC(75, 100))) - return 3200; -@@ -942,13 +956,6 @@ minstrel_ht_update_rates(struct minstrel - rate_control_set_rates(mp->hw, mi->sta, rates); - } - --static inline int --minstrel_get_duration(int index) --{ -- const struct mcs_group *group = &minstrel_mcs_groups[index / MCS_GROUP_RATES]; -- return group->duration[index % MCS_GROUP_RATES]; --} -- - static int - minstrel_get_sample_rate(struct minstrel_priv *mp, struct minstrel_ht_sta *mi) - { ---- a/net/mac80211/rc80211_minstrel_ht.h -+++ b/net/mac80211/rc80211_minstrel_ht.h -@@ -33,9 +33,10 @@ - #define MCS_GROUP_RATES 10 - - struct mcs_group { -- u32 flags; -- unsigned int streams; -- unsigned int duration[MCS_GROUP_RATES]; -+ u16 flags; -+ u8 streams; -+ u8 shift; -+ u16 duration[MCS_GROUP_RATES]; - }; - - extern const struct mcs_group minstrel_mcs_groups[]; ---- a/net/mac80211/rc80211_minstrel_ht_debugfs.c -+++ b/net/mac80211/rc80211_minstrel_ht_debugfs.c -@@ -58,6 +58,7 @@ minstrel_ht_stats_dump(struct minstrel_h - static const int bitrates[4] = { 10, 20, 55, 110 }; - int idx = i * MCS_GROUP_RATES + j; - unsigned int prob_ewmsd; -+ unsigned int duration; - - if (!(mi->supported[i] & BIT(j))) - continue; -@@ -95,7 +96,9 @@ minstrel_ht_stats_dump(struct minstrel_h - p += sprintf(p, " %3u ", idx); - - /* tx_time[rate(i)] in usec */ -- tx_time = DIV_ROUND_CLOSEST(mg->duration[j], 1000); -+ duration = mg->duration[j]; -+ duration <<= mg->shift; -+ tx_time = DIV_ROUND_CLOSEST(duration, 1000); - p += sprintf(p, "%6u ", tx_time); - - tp_max = minstrel_ht_get_tp_avg(mi, i, j, MINSTREL_FRAC(100, 100)); -@@ -204,6 +207,7 @@ minstrel_ht_stats_csv_dump(struct minstr - static const int bitrates[4] = { 10, 20, 55, 110 }; - int idx = i * MCS_GROUP_RATES + j; - unsigned int prob_ewmsd; -+ unsigned int duration; - - if (!(mi->supported[i] & BIT(j))) - continue; -@@ -238,7 +242,10 @@ minstrel_ht_stats_csv_dump(struct minstr - } - - p += sprintf(p, "%u,", idx); -- tx_time = DIV_ROUND_CLOSEST(mg->duration[j], 1000); -+ -+ duration = mg->duration[j]; -+ duration <<= mg->shift; -+ tx_time = DIV_ROUND_CLOSEST(duration, 1000); - p += sprintf(p, "%u,", tx_time); - - tp_max = minstrel_ht_get_tp_avg(mi, i, j, MINSTREL_FRAC(100, 100)); diff --git a/package/kernel/mac80211/patches/329-mac80211-minstrel-fix-using-short-preamble-CCK-rates.patch b/package/kernel/mac80211/patches/329-mac80211-minstrel-fix-using-short-preamble-CCK-rates.patch deleted file mode 100644 index 1255da992c..0000000000 --- a/package/kernel/mac80211/patches/329-mac80211-minstrel-fix-using-short-preamble-CCK-rates.patch +++ /dev/null @@ -1,23 +0,0 @@ -From: Felix Fietkau -Date: Sat, 10 Feb 2018 13:43:07 +0100 -Subject: [PATCH] mac80211: minstrel: fix using short preamble CCK rates on - HT clients - -mi->supported[MINSTREL_CCK_GROUP] needs to be updated - -Fixes: 782dda00ab8e ("mac80211: minstrel_ht: move short preamble check out of get_rate") -Signed-off-by: Felix Fietkau ---- - ---- a/net/mac80211/rc80211_minstrel_ht.c -+++ b/net/mac80211/rc80211_minstrel_ht.c -@@ -1268,7 +1268,8 @@ minstrel_ht_update_caps(void *priv, stru - goto use_legacy; - - if (test_sta_flag(sinfo, WLAN_STA_SHORT_PREAMBLE)) -- mi->cck_supported_short |= mi->cck_supported_short << 4; -+ mi->supported[MINSTREL_CCK_GROUP] |= -+ mi->cck_supported_short << 4; - - /* create an initial rate table with the lowest supported rates */ - minstrel_ht_update_stats(mp, mi); diff --git a/package/kernel/mac80211/patches/330-ath9k-Protect-queue-draining-by-rcu_read_lock.patch b/package/kernel/mac80211/patches/330-ath9k-Protect-queue-draining-by-rcu_read_lock.patch deleted file mode 100644 index 9970574e14..0000000000 --- a/package/kernel/mac80211/patches/330-ath9k-Protect-queue-draining-by-rcu_read_lock.patch +++ /dev/null @@ -1,43 +0,0 @@ -From: =?UTF-8?q?Toke=20H=C3=B8iland-J=C3=B8rgensen?= -Date: Fri, 2 Feb 2018 11:36:45 +0100 -Subject: [PATCH] ath9k: Protect queue draining by rcu_read_lock() -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -When ath9k was switched over to use the mac80211 intermediate queues, -node cleanup now drains the mac80211 queues. However, this call path is -not protected by rcu_read_lock() as it was previously entirely internal -to the driver which uses its own locking. - -This leads to a possible rcu_dereference() without holding -rcu_read_lock(); but only if a station is cleaned up while having -packets queued on the TXQ. Fix this by adding the rcu_read_lock() to the -caller in ath9k. - -Fixes: 50f08edf9809 ("ath9k: Switch to using mac80211 intermediate software queues.") -Cc: stable@vger.kernel.org -Reported-by: Ben Greear -Signed-off-by: Toke Høiland-Jørgensen ---- - ---- a/drivers/net/wireless/ath/ath9k/xmit.c -+++ b/drivers/net/wireless/ath/ath9k/xmit.c -@@ -2930,6 +2930,8 @@ void ath_tx_node_cleanup(struct ath_soft - struct ath_txq *txq; - int tidno; - -+ rcu_read_lock(); -+ - for (tidno = 0; tidno < IEEE80211_NUM_TIDS; tidno++) { - tid = ath_node_to_tid(an, tidno); - txq = tid->txq; -@@ -2947,6 +2949,8 @@ void ath_tx_node_cleanup(struct ath_soft - if (!an->sta) - break; /* just one multicast ath_atx_tid */ - } -+ -+ rcu_read_unlock(); - } - - #ifdef CPTCFG_ATH9K_TX99 diff --git a/package/kernel/mac80211/patches/331-v4.17-mac80211-drop-frames-with-unexpected-DS-bits-from-fa.patch b/package/kernel/mac80211/patches/331-v4.17-mac80211-drop-frames-with-unexpected-DS-bits-from-fa.patch deleted file mode 100644 index a7562996b1..0000000000 --- a/package/kernel/mac80211/patches/331-v4.17-mac80211-drop-frames-with-unexpected-DS-bits-from-fa.patch +++ /dev/null @@ -1,21 +0,0 @@ -From: Felix Fietkau -Date: Fri, 23 Feb 2018 09:59:35 +0100 -Subject: [PATCH] mac80211: drop frames with unexpected DS bits from - fast-rx to slow path - -Fixes rx for 4-addr packets in AP mode - -Signed-off-by: Felix Fietkau ---- - ---- a/net/mac80211/rx.c -+++ b/net/mac80211/rx.c -@@ -3928,7 +3928,7 @@ static bool ieee80211_invoke_fast_rx(str - if ((hdr->frame_control & cpu_to_le16(IEEE80211_FCTL_FROMDS | - IEEE80211_FCTL_TODS)) != - fast_rx->expected_ds_bits) -- goto drop; -+ return false; - - /* assign the key to drop unencrypted frames (later) - * and strip the IV/MIC if necessary diff --git a/package/kernel/mac80211/patches/332-v4.17-mac80211-support-AP-4-addr-mode-fast-rx.patch b/package/kernel/mac80211/patches/332-v4.17-mac80211-support-AP-4-addr-mode-fast-rx.patch deleted file mode 100644 index 3f3eb0a5e1..0000000000 --- a/package/kernel/mac80211/patches/332-v4.17-mac80211-support-AP-4-addr-mode-fast-rx.patch +++ /dev/null @@ -1,25 +0,0 @@ -From: Felix Fietkau -Date: Fri, 23 Feb 2018 10:00:22 +0100 -Subject: [PATCH] mac80211: support AP 4-addr mode fast-rx - -Signed-off-by: Felix Fietkau ---- - ---- a/net/mac80211/rx.c -+++ b/net/mac80211/rx.c -@@ -3774,6 +3774,15 @@ void ieee80211_check_fast_rx(struct sta_ - !(sdata->flags & IEEE80211_SDATA_DONT_BRIDGE_PACKETS) && - (sdata->vif.type != NL80211_IFTYPE_AP_VLAN || - !sdata->u.vlan.sta); -+ -+ if (sdata->vif.type == NL80211_IFTYPE_AP_VLAN && -+ sdata->u.vlan.sta) { -+ fastrx.expected_ds_bits |= -+ cpu_to_le16(IEEE80211_FCTL_FROMDS); -+ fastrx.sa_offs = offsetof(struct ieee80211_hdr, addr4); -+ fastrx.internal_forward = 0; -+ } -+ - break; - default: - goto clear; diff --git a/package/kernel/mac80211/patches/333-v4.17-mac80211-support-fast-rx-with-incompatible-PS-capabi.patch b/package/kernel/mac80211/patches/333-v4.17-mac80211-support-fast-rx-with-incompatible-PS-capabi.patch deleted file mode 100644 index 8c4c724ef7..0000000000 --- a/package/kernel/mac80211/patches/333-v4.17-mac80211-support-fast-rx-with-incompatible-PS-capabi.patch +++ /dev/null @@ -1,53 +0,0 @@ -From: Felix Fietkau -Date: Fri, 23 Feb 2018 10:01:53 +0100 -Subject: [PATCH] mac80211: support fast-rx with incompatible PS - capabilities when PS is disabled - -When powersave is disabled for the interface, we can do fast-rx anyway. - -Signed-off-by: Felix Fietkau ---- - ---- a/net/mac80211/cfg.c -+++ b/net/mac80211/cfg.c -@@ -2658,6 +2658,7 @@ static int ieee80211_set_power_mgmt(stru - - ieee80211_recalc_ps(local); - ieee80211_recalc_ps_vif(sdata); -+ ieee80211_check_fast_rx_iface(sdata); - - return 0; - } ---- a/net/mac80211/rx.c -+++ b/net/mac80211/rx.c -@@ -3741,12 +3741,7 @@ void ieee80211_check_fast_rx(struct sta_ - /* 4-addr is harder to deal with, later maybe */ - if (sdata->u.mgd.use_4addr) - goto clear; -- /* software powersave is a huge mess, avoid all of it */ -- if (ieee80211_hw_check(&local->hw, PS_NULLFUNC_STACK)) -- goto clear; -- if (ieee80211_hw_check(&local->hw, SUPPORTS_PS) && -- !ieee80211_hw_check(&local->hw, SUPPORTS_DYNAMIC_PS)) -- goto clear; -+ - if (sta->sta.tdls) { - fastrx.da_offs = offsetof(struct ieee80211_hdr, addr1); - fastrx.sa_offs = offsetof(struct ieee80211_hdr, addr2); -@@ -3758,6 +3753,16 @@ void ieee80211_check_fast_rx(struct sta_ - fastrx.expected_ds_bits = - cpu_to_le16(IEEE80211_FCTL_FROMDS); - } -+ -+ if (!sdata->u.mgd.powersave) -+ break; -+ -+ /* software powersave is a huge mess, avoid all of it */ -+ if (ieee80211_hw_check(&local->hw, PS_NULLFUNC_STACK)) -+ goto clear; -+ if (ieee80211_hw_check(&local->hw, SUPPORTS_PS) && -+ !ieee80211_hw_check(&local->hw, SUPPORTS_DYNAMIC_PS)) -+ goto clear; - break; - case NL80211_IFTYPE_AP_VLAN: - case NL80211_IFTYPE_AP: diff --git a/package/kernel/mac80211/patches/334-v4.17-mac80211-support-station-4-addr-mode-fast-rx.patch b/package/kernel/mac80211/patches/334-v4.17-mac80211-support-station-4-addr-mode-fast-rx.patch deleted file mode 100644 index 97a5d8beba..0000000000 --- a/package/kernel/mac80211/patches/334-v4.17-mac80211-support-station-4-addr-mode-fast-rx.patch +++ /dev/null @@ -1,34 +0,0 @@ -From: Felix Fietkau -Date: Fri, 23 Feb 2018 10:05:08 +0100 -Subject: [PATCH] mac80211: support station 4-addr mode fast-rx - -Signed-off-by: Felix Fietkau ---- - ---- a/net/mac80211/rx.c -+++ b/net/mac80211/rx.c -@@ -3738,10 +3738,6 @@ void ieee80211_check_fast_rx(struct sta_ - - switch (sdata->vif.type) { - case NL80211_IFTYPE_STATION: -- /* 4-addr is harder to deal with, later maybe */ -- if (sdata->u.mgd.use_4addr) -- goto clear; -- - if (sta->sta.tdls) { - fastrx.da_offs = offsetof(struct ieee80211_hdr, addr1); - fastrx.sa_offs = offsetof(struct ieee80211_hdr, addr2); -@@ -3754,6 +3750,13 @@ void ieee80211_check_fast_rx(struct sta_ - cpu_to_le16(IEEE80211_FCTL_FROMDS); - } - -+ if (sdata->u.mgd.use_4addr && !sta->sta.tdls) { -+ fastrx.expected_ds_bits |= -+ cpu_to_le16(IEEE80211_FCTL_TODS); -+ fastrx.da_offs = offsetof(struct ieee80211_hdr, addr3); -+ fastrx.sa_offs = offsetof(struct ieee80211_hdr, addr4); -+ } -+ - if (!sdata->u.mgd.powersave) - break; - diff --git a/package/kernel/mac80211/patches/335-v4.17-mac80211-support-A-MSDU-in-fast-rx.patch b/package/kernel/mac80211/patches/335-v4.17-mac80211-support-A-MSDU-in-fast-rx.patch deleted file mode 100644 index 3c6d342ff1..0000000000 --- a/package/kernel/mac80211/patches/335-v4.17-mac80211-support-A-MSDU-in-fast-rx.patch +++ /dev/null @@ -1,256 +0,0 @@ -From: Felix Fietkau -Date: Mon, 26 Feb 2018 22:09:29 +0100 -Subject: [PATCH] mac80211: support A-MSDU in fast-rx - -Only works if the IV was stripped from packets. Create a smaller -variant of ieee80211_rx_h_amsdu, which bypasses checks already done -within the fast-rx context. - -Signed-off-by: Felix Fietkau ---- - ---- a/net/mac80211/rx.c -+++ b/net/mac80211/rx.c -@@ -2358,39 +2358,17 @@ ieee80211_deliver_skb(struct ieee80211_r - } - - static ieee80211_rx_result debug_noinline --ieee80211_rx_h_amsdu(struct ieee80211_rx_data *rx) -+__ieee80211_rx_h_amsdu(struct ieee80211_rx_data *rx, u8 data_offset) - { - struct net_device *dev = rx->sdata->dev; - struct sk_buff *skb = rx->skb; - struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)skb->data; - __le16 fc = hdr->frame_control; - struct sk_buff_head frame_list; -- struct ieee80211_rx_status *status = IEEE80211_SKB_RXCB(rx->skb); - struct ethhdr ethhdr; - const u8 *check_da = ethhdr.h_dest, *check_sa = ethhdr.h_source; - -- if (unlikely(!ieee80211_is_data(fc))) -- return RX_CONTINUE; -- -- if (unlikely(!ieee80211_is_data_present(fc))) -- return RX_DROP_MONITOR; -- -- if (!(status->rx_flags & IEEE80211_RX_AMSDU)) -- return RX_CONTINUE; -- - if (unlikely(ieee80211_has_a4(hdr->frame_control))) { -- switch (rx->sdata->vif.type) { -- case NL80211_IFTYPE_AP_VLAN: -- if (!rx->sdata->u.vlan.sta) -- return RX_DROP_UNUSABLE; -- break; -- case NL80211_IFTYPE_STATION: -- if (!rx->sdata->u.mgd.use_4addr) -- return RX_DROP_UNUSABLE; -- break; -- default: -- return RX_DROP_UNUSABLE; -- } - check_da = NULL; - check_sa = NULL; - } else switch (rx->sdata->vif.type) { -@@ -2410,15 +2388,13 @@ ieee80211_rx_h_amsdu(struct ieee80211_rx - break; - } - -- if (is_multicast_ether_addr(hdr->addr1)) -- return RX_DROP_UNUSABLE; -- - skb->dev = dev; - __skb_queue_head_init(&frame_list); - - if (ieee80211_data_to_8023_exthdr(skb, ðhdr, - rx->sdata->vif.addr, -- rx->sdata->vif.type)) -+ rx->sdata->vif.type, -+ data_offset)) - return RX_DROP_UNUSABLE; - - ieee80211_amsdu_to_8023s(skb, &frame_list, dev->dev_addr, -@@ -2440,6 +2416,44 @@ ieee80211_rx_h_amsdu(struct ieee80211_rx - return RX_QUEUED; - } - -+static ieee80211_rx_result debug_noinline -+ieee80211_rx_h_amsdu(struct ieee80211_rx_data *rx) -+{ -+ struct sk_buff *skb = rx->skb; -+ struct ieee80211_rx_status *status = IEEE80211_SKB_RXCB(skb); -+ struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)skb->data; -+ __le16 fc = hdr->frame_control; -+ -+ if (!(status->rx_flags & IEEE80211_RX_AMSDU)) -+ return RX_CONTINUE; -+ -+ if (unlikely(!ieee80211_is_data(fc))) -+ return RX_CONTINUE; -+ -+ if (unlikely(!ieee80211_is_data_present(fc))) -+ return RX_DROP_MONITOR; -+ -+ if (unlikely(ieee80211_has_a4(hdr->frame_control))) { -+ switch (rx->sdata->vif.type) { -+ case NL80211_IFTYPE_AP_VLAN: -+ if (!rx->sdata->u.vlan.sta) -+ return RX_DROP_UNUSABLE; -+ break; -+ case NL80211_IFTYPE_STATION: -+ if (!rx->sdata->u.mgd.use_4addr) -+ return RX_DROP_UNUSABLE; -+ break; -+ default: -+ return RX_DROP_UNUSABLE; -+ } -+ } -+ -+ if (is_multicast_ether_addr(hdr->addr1)) -+ return RX_DROP_UNUSABLE; -+ -+ return __ieee80211_rx_h_amsdu(rx, 0); -+} -+ - #ifdef CPTCFG_MAC80211_MESH - static ieee80211_rx_result - ieee80211_rx_h_mesh_fwding(struct ieee80211_rx_data *rx) -@@ -3889,7 +3903,8 @@ static bool ieee80211_invoke_fast_rx(str - struct ieee80211_rx_status *status = IEEE80211_SKB_RXCB(skb); - struct sta_info *sta = rx->sta; - int orig_len = skb->len; -- int snap_offs = ieee80211_hdrlen(hdr->frame_control); -+ int hdrlen = ieee80211_hdrlen(hdr->frame_control); -+ int snap_offs = hdrlen; - struct { - u8 snap[sizeof(rfc1042_header)]; - __be16 proto; -@@ -3920,10 +3935,6 @@ static bool ieee80211_invoke_fast_rx(str - (status->flag & FAST_RX_CRYPT_FLAGS) != FAST_RX_CRYPT_FLAGS) - return false; - -- /* we don't deal with A-MSDU deaggregation here */ -- if (status->rx_flags & IEEE80211_RX_AMSDU) -- return false; -- - if (unlikely(!ieee80211_is_data_present(hdr->frame_control))) - return false; - -@@ -3955,21 +3966,24 @@ static bool ieee80211_invoke_fast_rx(str - snap_offs += IEEE80211_CCMP_HDR_LEN; - } - -- if (!pskb_may_pull(skb, snap_offs + sizeof(*payload))) -- goto drop; -- payload = (void *)(skb->data + snap_offs); -+ if (!(status->rx_flags & IEEE80211_RX_AMSDU)) { -+ if (!pskb_may_pull(skb, snap_offs + sizeof(*payload))) -+ goto drop; - -- if (!ether_addr_equal(payload->snap, fast_rx->rfc1042_hdr)) -- return false; -+ payload = (void *)(skb->data + snap_offs); - -- /* Don't handle these here since they require special code. -- * Accept AARP and IPX even though they should come with a -- * bridge-tunnel header - but if we get them this way then -- * there's little point in discarding them. -- */ -- if (unlikely(payload->proto == cpu_to_be16(ETH_P_TDLS) || -- payload->proto == fast_rx->control_port_protocol)) -- return false; -+ if (!ether_addr_equal(payload->snap, fast_rx->rfc1042_hdr)) -+ return false; -+ -+ /* Don't handle these here since they require special code. -+ * Accept AARP and IPX even though they should come with a -+ * bridge-tunnel header - but if we get them this way then -+ * there's little point in discarding them. -+ */ -+ if (unlikely(payload->proto == cpu_to_be16(ETH_P_TDLS) || -+ payload->proto == fast_rx->control_port_protocol)) -+ return false; -+ } - - /* after this point, don't punt to the slowpath! */ - -@@ -3983,12 +3997,6 @@ static bool ieee80211_invoke_fast_rx(str - } - - /* statistics part of ieee80211_rx_h_sta_process() */ -- stats->last_rx = jiffies; -- stats->last_rate = sta_stats_encode_rate(status); -- -- stats->fragments++; -- stats->packets++; -- - if (!(status->flag & RX_FLAG_NO_SIGNAL_VAL)) { - stats->last_signal = status->signal; - if (!fast_rx->uses_rss) -@@ -4017,6 +4025,20 @@ static bool ieee80211_invoke_fast_rx(str - if (rx->key && !ieee80211_has_protected(hdr->frame_control)) - goto drop; - -+ if (status->rx_flags & IEEE80211_RX_AMSDU) { -+ if (__ieee80211_rx_h_amsdu(rx, snap_offs - hdrlen) != -+ RX_QUEUED) -+ goto drop; -+ -+ return true; -+ } -+ -+ stats->last_rx = jiffies; -+ stats->last_rate = sta_stats_encode_rate(status); -+ -+ stats->fragments++; -+ stats->packets++; -+ - /* do the header conversion - first grab the addresses */ - ether_addr_copy(addrs.da, skb->data + fast_rx->da_offs); - ether_addr_copy(addrs.sa, skb->data + fast_rx->sa_offs); ---- a/include/net/cfg80211.h -+++ b/include/net/cfg80211.h -@@ -4331,10 +4331,12 @@ unsigned int ieee80211_get_mesh_hdrlen(s - * of it being pushed into the SKB - * @addr: the device MAC address - * @iftype: the virtual interface type -+ * @data_offset: offset of payload after the 802.11 header - * Return: 0 on success. Non-zero on error. - */ - int ieee80211_data_to_8023_exthdr(struct sk_buff *skb, struct ethhdr *ehdr, -- const u8 *addr, enum nl80211_iftype iftype); -+ const u8 *addr, enum nl80211_iftype iftype, -+ u8 data_offset); - - /** - * ieee80211_data_to_8023 - convert an 802.11 data frame to 802.3 -@@ -4346,7 +4348,7 @@ int ieee80211_data_to_8023_exthdr(struct - static inline int ieee80211_data_to_8023(struct sk_buff *skb, const u8 *addr, - enum nl80211_iftype iftype) - { -- return ieee80211_data_to_8023_exthdr(skb, NULL, addr, iftype); -+ return ieee80211_data_to_8023_exthdr(skb, NULL, addr, iftype, 0); - } - - /** ---- a/net/wireless/util.c -+++ b/net/wireless/util.c -@@ -419,7 +419,8 @@ unsigned int ieee80211_get_mesh_hdrlen(s - EXPORT_SYMBOL(ieee80211_get_mesh_hdrlen); - - int ieee80211_data_to_8023_exthdr(struct sk_buff *skb, struct ethhdr *ehdr, -- const u8 *addr, enum nl80211_iftype iftype) -+ const u8 *addr, enum nl80211_iftype iftype, -+ u8 data_offset) - { - struct ieee80211_hdr *hdr = (struct ieee80211_hdr *) skb->data; - struct { -@@ -433,7 +434,7 @@ int ieee80211_data_to_8023_exthdr(struct - if (unlikely(!ieee80211_is_data_present(hdr->frame_control))) - return -1; - -- hdrlen = ieee80211_hdrlen(hdr->frame_control); -+ hdrlen = ieee80211_hdrlen(hdr->frame_control) + data_offset; - if (skb->len < hdrlen + 8) - return -1; - diff --git a/package/kernel/mac80211/patches/336-mac80211-minstrel-fix-CCK-rate-group-streams-value.patch b/package/kernel/mac80211/patches/336-mac80211-minstrel-fix-CCK-rate-group-streams-value.patch deleted file mode 100644 index f0ffcd9655..0000000000 --- a/package/kernel/mac80211/patches/336-mac80211-minstrel-fix-CCK-rate-group-streams-value.patch +++ /dev/null @@ -1,20 +0,0 @@ -From: Felix Fietkau -Date: Thu, 1 Mar 2018 13:27:54 +0100 -Subject: [PATCH] mac80211: minstrel: fix CCK rate group streams value - -Fixes a harmless underflow issue when CCK rates are actively being used - -Signed-off-by: Felix Fietkau ---- - ---- a/net/mac80211/rc80211_minstrel_ht.c -+++ b/net/mac80211/rc80211_minstrel_ht.c -@@ -131,7 +131,7 @@ - - #define CCK_GROUP(_s) \ - [MINSTREL_CCK_GROUP] = { \ -- .streams = 0, \ -+ .streams = 1, \ - .flags = 0, \ - .shift = _s, \ - .duration = { \ diff --git a/package/kernel/mac80211/patches/337-mac80211-minstrel-fix-sampling-reporting-of-CCK-rate.patch b/package/kernel/mac80211/patches/337-mac80211-minstrel-fix-sampling-reporting-of-CCK-rate.patch deleted file mode 100644 index e0049c36eb..0000000000 --- a/package/kernel/mac80211/patches/337-mac80211-minstrel-fix-sampling-reporting-of-CCK-rate.patch +++ /dev/null @@ -1,58 +0,0 @@ -From: Felix Fietkau -Date: Thu, 1 Mar 2018 13:28:48 +0100 -Subject: [PATCH] mac80211: minstrel: fix sampling/reporting of CCK rates - in HT mode - -Long/short preamble selection cannot be sampled separately, since it -depends on the BSS state. Because of that, sampling attempts to -currently not used preamble modes are not counted in the statistics, -which leads to CCK rates being sampled too often. - -Fix statistics accounting for long/short preamble by increasing the -index where necessary. -Fix excessive CCK rate sampling by dropping unsupported sample attempts. - -This improves throughput on 2.4 GHz channels - -Signed-off-by: Felix Fietkau ---- - ---- a/net/mac80211/rc80211_minstrel_ht.c -+++ b/net/mac80211/rc80211_minstrel_ht.c -@@ -281,7 +281,8 @@ minstrel_ht_get_stats(struct minstrel_pr - break; - - /* short preamble */ -- if (!(mi->supported[group] & BIT(idx))) -+ if ((mi->supported[group] & BIT(idx + 4)) && -+ (rate->flags & IEEE80211_TX_RC_USE_SHORT_PREAMBLE)) - idx += 4; - } - return &mi->groups[group].rates[idx]; -@@ -1080,18 +1081,23 @@ minstrel_ht_get_rate(void *priv, struct - return; - - sample_group = &minstrel_mcs_groups[sample_idx / MCS_GROUP_RATES]; -+ sample_idx %= MCS_GROUP_RATES; -+ -+ if (sample_group == &minstrel_mcs_groups[MINSTREL_CCK_GROUP] && -+ (sample_idx >= 4) != txrc->short_preamble) -+ return; -+ - info->flags |= IEEE80211_TX_CTL_RATE_CTRL_PROBE; - rate->count = 1; - -- if (sample_idx / MCS_GROUP_RATES == MINSTREL_CCK_GROUP) { -+ if (sample_group == &minstrel_mcs_groups[MINSTREL_CCK_GROUP]) { - int idx = sample_idx % ARRAY_SIZE(mp->cck_rates); - rate->idx = mp->cck_rates[idx]; - } else if (sample_group->flags & IEEE80211_TX_RC_VHT_MCS) { - ieee80211_rate_set_vht(rate, sample_idx % MCS_GROUP_RATES, - sample_group->streams); - } else { -- rate->idx = sample_idx % MCS_GROUP_RATES + -- (sample_group->streams - 1) * 8; -+ rate->idx = sample_idx + (sample_group->streams - 1) * 8; - } - - rate->flags = sample_group->flags; diff --git a/package/kernel/mac80211/patches/350-ath9k_hw-reset-AHB-WMAC-interface-on-AR91xx.patch b/package/kernel/mac80211/patches/350-ath9k_hw-reset-AHB-WMAC-interface-on-AR91xx.patch new file mode 100644 index 0000000000..a7bcfa549b --- /dev/null +++ b/package/kernel/mac80211/patches/350-ath9k_hw-reset-AHB-WMAC-interface-on-AR91xx.patch @@ -0,0 +1,25 @@ +From: Felix Fietkau +Date: Sat, 9 Jul 2016 15:25:24 +0200 +Subject: [PATCH] ath9k_hw: reset AHB-WMAC interface on AR91xx + +Should fix a few stability issues + +Signed-off-by: Felix Fietkau +--- + +--- a/drivers/net/wireless/ath/ath9k/hw.c ++++ b/drivers/net/wireless/ath/ath9k/hw.c +@@ -1394,8 +1394,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)) { ++ /* Reset the AHB-WMAC interface */ ++ if (ah->external_reset) ++ ah->external_reset(); + udelay(50); ++ } + + return true; + } diff --git a/package/kernel/mac80211/patches/351-ath9k_hw-issue-external-reset-for-QCA955x.patch b/package/kernel/mac80211/patches/351-ath9k_hw-issue-external-reset-for-QCA955x.patch new file mode 100644 index 0000000000..34d7d3b1cf --- /dev/null +++ b/package/kernel/mac80211/patches/351-ath9k_hw-issue-external-reset-for-QCA955x.patch @@ -0,0 +1,126 @@ +From: Felix Fietkau +Date: Sat, 9 Jul 2016 15:26:44 +0200 +Subject: [PATCH] ath9k_hw: issue external reset for QCA955x + +The RTC interface on the SoC needs to be reset along with the rest of +the WMAC. + +Signed-off-by: Felix Fietkau +--- + +--- a/drivers/net/wireless/ath/ath9k/hw.c ++++ b/drivers/net/wireless/ath/ath9k/hw.c +@@ -1271,39 +1271,56 @@ void ath9k_hw_get_delta_slope_vals(struc + *coef_exponent = coef_exp - 16; + } + +-/* AR9330 WAR: +- * call external reset function to reset WMAC if: +- * - doing a cold reset +- * - we have pending frames in the TX queues. +- */ +-static bool ath9k_hw_ar9330_reset_war(struct ath_hw *ah, int type) ++static bool ath9k_hw_need_external_reset(struct ath_hw *ah, int type) + { +- int i, npend = 0; ++ int i; + +- for (i = 0; i < AR_NUM_QCU; i++) { +- npend = ath9k_hw_numtxpending(ah, i); +- if (npend) +- break; ++ if (type == ATH9K_RESET_COLD) ++ return true; ++ ++ if (AR_SREV_9550(ah)) ++ return true; ++ ++ /* AR9330 WAR: ++ * call external reset function to reset WMAC if: ++ * - doing a cold reset ++ * - we have pending frames in the TX queues. ++ */ ++ if (AR_SREV_9330(ah)) { ++ for (i = 0; i < AR_NUM_QCU; i++) { ++ if (ath9k_hw_numtxpending(ah, i)) ++ return true; ++ } + } + +- if (ah->external_reset && +- (npend || type == ATH9K_RESET_COLD)) { +- int reset_err = 0; ++ return false; ++} + +- ath_dbg(ath9k_hw_common(ah), RESET, +- "reset MAC via external reset\n"); ++static bool ath9k_hw_external_reset(struct ath_hw *ah, int type) ++{ ++ int err; + +- reset_err = ah->external_reset(); +- if (reset_err) { +- ath_err(ath9k_hw_common(ah), +- "External reset failed, err=%d\n", +- reset_err); +- return false; +- } ++ if (!ah->external_reset || !ath9k_hw_need_external_reset(ah, type)) ++ return true; + +- REG_WRITE(ah, AR_RTC_RESET, 1); ++ ath_dbg(ath9k_hw_common(ah), RESET, ++ "reset MAC via external reset\n"); ++ ++ err = ah->external_reset(); ++ if (err) { ++ ath_err(ath9k_hw_common(ah), ++ "External reset failed, err=%d\n", err); ++ return false; ++ } ++ ++ if (AR_SREV_9550(ah)) { ++ REG_WRITE(ah, AR_RTC_RESET, 0); ++ udelay(10); + } + ++ REG_WRITE(ah, AR_RTC_RESET, 1); ++ udelay(10); ++ + return true; + } + +@@ -1356,24 +1373,24 @@ static bool ath9k_hw_set_reset(struct at + rst_flags |= AR_RTC_RC_MAC_COLD; + } + +- if (AR_SREV_9330(ah)) { +- if (!ath9k_hw_ar9330_reset_war(ah, type)) +- return false; +- } +- + if (ath9k_hw_mci_is_enabled(ah)) + ar9003_mci_check_gpm_offset(ah); + + /* DMA HALT added to resolve ar9300 and ar9580 bus error during +- * RTC_RC reg read ++ * RTC_RC reg read. Also needed for AR9550 external reset + */ +- if (AR_SREV_9300(ah) || AR_SREV_9580(ah)) { ++ if (AR_SREV_9300(ah) || AR_SREV_9580(ah) || AR_SREV_9550(ah)) { + REG_SET_BIT(ah, AR_CFG, AR_CFG_HALT_REQ); + ath9k_hw_wait(ah, AR_CFG, AR_CFG_HALT_ACK, AR_CFG_HALT_ACK, + 20 * AH_WAIT_TIMEOUT); +- REG_CLR_BIT(ah, AR_CFG, AR_CFG_HALT_REQ); + } + ++ if (!AR_SREV_9100(ah)) ++ ath9k_hw_external_reset(ah, type); ++ ++ if (AR_SREV_9300(ah) || AR_SREV_9580(ah)) ++ REG_CLR_BIT(ah, AR_CFG, AR_CFG_HALT_REQ); ++ + REG_WRITE(ah, AR_RTC_RC, rst_flags); + + REGWRITE_BUFFER_FLUSH(ah); diff --git a/package/kernel/mac80211/patches/352-ath9k_hw-set-spectral-scan-enable-bit-on-trigger-for.patch b/package/kernel/mac80211/patches/352-ath9k_hw-set-spectral-scan-enable-bit-on-trigger-for.patch new file mode 100644 index 0000000000..dfe9aae268 --- /dev/null +++ b/package/kernel/mac80211/patches/352-ath9k_hw-set-spectral-scan-enable-bit-on-trigger-for.patch @@ -0,0 +1,21 @@ +From: Felix Fietkau +Date: Mon, 11 Jul 2016 12:07:40 +0200 +Subject: [PATCH] ath9k_hw: set spectral scan enable bit on trigger for + AR9003+ + +AR9002 code and QCA AR9003+ code do the same. + +Signed-off-by: Felix Fietkau +--- + +--- a/drivers/net/wireless/ath/ath9k/ar9003_phy.c ++++ b/drivers/net/wireless/ath/ath9k/ar9003_phy.c +@@ -1800,6 +1800,8 @@ static void ar9003_hw_spectral_scan_conf + + static void ar9003_hw_spectral_scan_trigger(struct ath_hw *ah) + { ++ REG_SET_BIT(ah, AR_PHY_SPECTRAL_SCAN, ++ AR_PHY_SPECTRAL_SCAN_ENABLE); + /* Activate spectral scan */ + REG_SET_BIT(ah, AR_PHY_SPECTRAL_SCAN, + AR_PHY_SPECTRAL_SCAN_ACTIVE); diff --git a/package/kernel/mac80211/patches/353-ath9k-don-t-run-periodic-and-nf-calibation-at-the-sa.patch b/package/kernel/mac80211/patches/353-ath9k-don-t-run-periodic-and-nf-calibation-at-the-sa.patch new file mode 100644 index 0000000000..22f5154146 --- /dev/null +++ b/package/kernel/mac80211/patches/353-ath9k-don-t-run-periodic-and-nf-calibation-at-the-sa.patch @@ -0,0 +1,27 @@ +From: Felix Fietkau +Date: Tue, 27 Dec 2016 23:16:23 +0100 +Subject: [PATCH] ath9k: don't run periodic and nf calibation at the same + time + +The checks already prevents periodic cal from being started while noise +floor calibration runs. It is missing checks for the other way around. + +Signed-off-by: Felix Fietkau +--- + +--- a/drivers/net/wireless/ath/ath9k/ar9002_calib.c ++++ b/drivers/net/wireless/ath/ath9k/ar9002_calib.c +@@ -676,10 +676,10 @@ static int ar9002_hw_calibrate(struct at + return 0; + + ah->cal_list_curr = currCal = currCal->calNext; +- if (currCal->calState == CAL_WAITING) { ++ if (currCal->calState == CAL_WAITING) + ath9k_hw_reset_calibration(ah, currCal); +- return 0; +- } ++ ++ return 0; + } + + /* Do NF cal only at longer intervals */ diff --git a/package/kernel/mac80211/patches/354-ath9k-force-rx_clear-when-disabling-rx.patch b/package/kernel/mac80211/patches/354-ath9k-force-rx_clear-when-disabling-rx.patch new file mode 100644 index 0000000000..8aaccf49b4 --- /dev/null +++ b/package/kernel/mac80211/patches/354-ath9k-force-rx_clear-when-disabling-rx.patch @@ -0,0 +1,35 @@ +From: Felix Fietkau +Date: Sun, 7 Jun 2015 13:53:35 +0200 +Subject: [PATCH] ath9k: force rx_clear when disabling rx + +This makes stopping Rx more reliable and should reduce the frequency of +Rx related DMA stop warnings. Don't use rx_clear in TX99 mode. + +Cc: stable@vger.kernel.org +Signed-off-by: Felix Fietkau +Signed-off-by: Helmut Schaa +--- + +--- a/drivers/net/wireless/ath/ath9k/mac.c ++++ b/drivers/net/wireless/ath/ath9k/mac.c +@@ -678,13 +678,18 @@ void ath9k_hw_startpcureceive(struct ath + + ath9k_ani_reset(ah, is_scanning); + +- REG_CLR_BIT(ah, AR_DIAG_SW, (AR_DIAG_RX_DIS | AR_DIAG_RX_ABORT)); ++ REG_CLR_BIT(ah, AR_DIAG_SW, ++ AR_DIAG_RX_DIS | AR_DIAG_RX_ABORT | AR_DIAG_FORCE_RX_CLEAR); + } + EXPORT_SYMBOL(ath9k_hw_startpcureceive); + + void ath9k_hw_abortpcurecv(struct ath_hw *ah) + { +- REG_SET_BIT(ah, AR_DIAG_SW, AR_DIAG_RX_ABORT | AR_DIAG_RX_DIS); ++ u32 reg = AR_DIAG_RX_DIS | AR_DIAG_RX_ABORT; ++ ++ if (!IS_ENABLED(CPTCFG_ATH9K_TX99)) ++ reg |= AR_DIAG_FORCE_RX_CLEAR; ++ REG_SET_BIT(ah, AR_DIAG_SW, reg); + + ath9k_hw_disable_mib_counters(ah); + } diff --git a/package/kernel/mac80211/patches/355-ath9k-limit-retries-for-powersave-response-frames.patch b/package/kernel/mac80211/patches/355-ath9k-limit-retries-for-powersave-response-frames.patch new file mode 100644 index 0000000000..31825b819c --- /dev/null +++ b/package/kernel/mac80211/patches/355-ath9k-limit-retries-for-powersave-response-frames.patch @@ -0,0 +1,96 @@ +From: Felix Fietkau +Date: Thu, 2 Jul 2015 15:20:56 +0200 +Subject: [PATCH] ath9k: limit retries for powersave response frames + +In some cases, the channel might be busy enough that an ath9k AP's +response to PS-Poll frames might be too slow and the station has already +gone to sleep. To avoid wasting too much airtime on this, limit the +number of retries on such frames and ensure that no sample rate gets +used. + +Signed-off-by: Felix Fietkau +--- + +--- a/drivers/net/wireless/ath/ath9k/xmit.c ++++ b/drivers/net/wireless/ath/ath9k/xmit.c +@@ -188,10 +188,25 @@ static void ath_send_bar(struct ath_atx_ + } + + static void ath_set_rates(struct ieee80211_vif *vif, struct ieee80211_sta *sta, +- struct ath_buf *bf) ++ struct ath_buf *bf, bool ps) + { ++ struct ieee80211_tx_info *info = IEEE80211_SKB_CB(bf->bf_mpdu); ++ ++ if (ps) { ++ /* Clear the first rate to avoid using a sample rate for PS frames */ ++ info->control.rates[0].idx = -1; ++ info->control.rates[0].count = 0; ++ } ++ + ieee80211_get_tx_rates(vif, sta, bf->bf_mpdu, bf->rates, + ARRAY_SIZE(bf->rates)); ++ if (!ps) ++ return; ++ ++ if (bf->rates[0].count > 2) ++ bf->rates[0].count = 2; ++ ++ bf->rates[1].idx = -1; + } + + static void ath_txq_skb_done(struct ath_softc *sc, struct ath_txq *txq, +@@ -1502,7 +1517,7 @@ ath_tx_form_burst(struct ath_softc *sc, + break; + } + +- ath_set_rates(tid->an->vif, tid->an->sta, bf); ++ ath_set_rates(tid->an->vif, tid->an->sta, bf, false); + } while (1); + } + +@@ -1532,7 +1547,7 @@ static bool ath_tx_sched_aggr(struct ath + return false; + } + +- ath_set_rates(tid->an->vif, tid->an->sta, bf); ++ ath_set_rates(tid->an->vif, tid->an->sta, bf, false); + if (aggr) + aggr_len = ath_tx_form_aggr(sc, txq, tid, &bf_q, bf); + else +@@ -1690,7 +1705,7 @@ void ath9k_release_buffered_frames(struc + break; + + list_add_tail(&bf->list, &bf_q); +- ath_set_rates(tid->an->vif, tid->an->sta, bf); ++ ath_set_rates(tid->an->vif, tid->an->sta, bf, true); + if (bf_isampdu(bf)) { + ath_tx_addto_baw(sc, tid, bf); + bf->bf_state.bf_type &= ~BUF_AGGR; +@@ -2390,7 +2405,7 @@ int ath_tx_start(struct ieee80211_hw *hw + if (txctl->paprd) + bf->bf_state.bfs_paprd_timestamp = jiffies; + +- ath_set_rates(vif, sta, bf); ++ ath_set_rates(vif, sta, bf, ps_resp); + ath_tx_send_normal(sc, txq, tid, skb); + + out: +@@ -2429,7 +2444,7 @@ void ath_tx_cabq(struct ieee80211_hw *hw + break; + + bf->bf_lastbf = bf; +- ath_set_rates(vif, NULL, bf); ++ ath_set_rates(vif, NULL, bf, false); + ath_buf_set_rate(sc, bf, &info, fi->framelen, false); + duration += info.rates[0].PktDuration; + if (bf_tail) +@@ -2946,7 +2961,7 @@ int ath9k_tx99_send(struct ath_softc *sc + return -EINVAL; + } + +- ath_set_rates(sc->tx99_vif, NULL, bf); ++ ath_set_rates(sc->tx99_vif, NULL, bf, false); + + ath9k_hw_set_desc_link(sc->sc_ah, bf->bf_desc, bf->bf_daddr); + ath9k_hw_tx99_start(sc->sc_ah, txctl->txq->axq_qnum); diff --git a/package/kernel/mac80211/patches/356-Revert-ath9k-interpret-requested-txpower-in-EIRP-dom.patch b/package/kernel/mac80211/patches/356-Revert-ath9k-interpret-requested-txpower-in-EIRP-dom.patch new file mode 100644 index 0000000000..35d07430eb --- /dev/null +++ b/package/kernel/mac80211/patches/356-Revert-ath9k-interpret-requested-txpower-in-EIRP-dom.patch @@ -0,0 +1,37 @@ +From: Felix Fietkau +Date: Sat, 14 May 2016 14:51:02 +0200 +Subject: [PATCH] Revert "ath9k: interpret requested txpower in EIRP + domain" + +This reverts commit 71f5137bf010c6faffab50c0ec15374c59c4a411. +--- + +--- a/drivers/net/wireless/ath/ath9k/hw.c ++++ b/drivers/net/wireless/ath/ath9k/hw.c +@@ -2935,7 +2935,8 @@ void ath9k_hw_apply_txpower(struct ath_h + { + struct ath_regulatory *reg = ath9k_hw_regulatory(ah); + struct ieee80211_channel *channel; +- int chan_pwr, new_pwr; ++ int chan_pwr, new_pwr, max_gain; ++ int ant_gain, ant_reduction = 0; + + if (!chan) + return; +@@ -2943,10 +2944,15 @@ void ath9k_hw_apply_txpower(struct ath_h + channel = chan->chan; + chan_pwr = min_t(int, channel->max_power * 2, MAX_RATE_POWER); + new_pwr = min_t(int, chan_pwr, reg->power_limit); ++ max_gain = chan_pwr - new_pwr + channel->max_antenna_gain * 2; ++ ++ ant_gain = get_antenna_gain(ah, chan); ++ if (ant_gain > max_gain) ++ ant_reduction = ant_gain - max_gain; + + ah->eep_ops->set_txpower(ah, chan, + ath9k_regd_get_ctl(reg, chan), +- get_antenna_gain(ah, chan), new_pwr, test); ++ ant_reduction, new_pwr, test); + } + + void ath9k_hw_set_txpowerlimit(struct ath_hw *ah, u32 limit, bool test) diff --git a/package/kernel/mac80211/patches/357-mac80211-add-hdrlen-to-ieee80211_tx_data.patch b/package/kernel/mac80211/patches/357-mac80211-add-hdrlen-to-ieee80211_tx_data.patch new file mode 100644 index 0000000000..83c613434d --- /dev/null +++ b/package/kernel/mac80211/patches/357-mac80211-add-hdrlen-to-ieee80211_tx_data.patch @@ -0,0 +1,219 @@ +From: Janusz Dziedzic +Date: Fri, 19 Feb 2016 11:01:49 +0100 +Subject: [PATCH] mac80211: add hdrlen to ieee80211_tx_data + +Add hdrlen to ieee80211_tx_data and use this +when wep/ccmd/tkip. This is preparation for +aligned4 code. + +Signed-off-by: Janusz Dziedzic +--- + +--- a/net/mac80211/ieee80211_i.h ++++ b/net/mac80211/ieee80211_i.h +@@ -177,6 +177,7 @@ struct ieee80211_tx_data { + struct ieee80211_tx_rate rate; + + unsigned int flags; ++ unsigned int hdrlen; + }; + + +--- a/net/mac80211/tx.c ++++ b/net/mac80211/tx.c +@@ -921,7 +921,7 @@ ieee80211_tx_h_fragment(struct ieee80211 + struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb); + struct ieee80211_hdr *hdr = (void *)skb->data; + int frag_threshold = tx->local->hw.wiphy->frag_threshold; +- int hdrlen; ++ int hdrlen = tx->hdrlen; + int fragnum; + + /* no matter what happens, tx->skb moves to tx->skbs */ +@@ -942,8 +942,6 @@ ieee80211_tx_h_fragment(struct ieee80211 + if (WARN_ON(info->flags & IEEE80211_TX_CTL_AMPDU)) + return TX_DROP; + +- hdrlen = ieee80211_hdrlen(hdr->frame_control); +- + /* internal error, why isn't DONTFRAG set? */ + if (WARN_ON(skb->len + FCS_LEN <= frag_threshold)) + return TX_DROP; +@@ -1175,6 +1173,8 @@ ieee80211_tx_prepare(struct ieee80211_su + + hdr = (struct ieee80211_hdr *) skb->data; + ++ tx->hdrlen = ieee80211_hdrlen(hdr->frame_control); ++ + if (likely(sta)) { + if (!IS_ERR(sta)) + tx->sta = sta; +@@ -3468,6 +3468,7 @@ begin: + tx.local = local; + tx.skb = skb; + tx.sdata = vif_to_sdata(info->control.vif); ++ tx.hdrlen = ieee80211_padded_hdrlen(hw, hdr->frame_control); + + if (txq->sta) + tx.sta = container_of(txq->sta, struct sta_info, sta); +@@ -3796,6 +3797,7 @@ ieee80211_build_data_template(struct iee + hdr = (void *)skb->data; + tx.sta = sta_info_get(sdata, hdr->addr1); + tx.skb = skb; ++ tx.hdrlen = ieee80211_padded_hdrlen(&tx.local->hw, hdr->frame_control); + + if (ieee80211_tx_h_select_key(&tx) != TX_CONTINUE) { + rcu_read_unlock(); +--- a/net/mac80211/util.c ++++ b/net/mac80211/util.c +@@ -1232,6 +1232,7 @@ void ieee80211_send_auth(struct ieee8021 + struct ieee80211_local *local = sdata->local; + struct sk_buff *skb; + struct ieee80211_mgmt *mgmt; ++ unsigned int hdrlen; + int err; + + /* 24 + 6 = header + auth_algo + auth_transaction + status_code */ +@@ -1255,8 +1256,10 @@ void ieee80211_send_auth(struct ieee8021 + skb_put_data(skb, extra, extra_len); + + if (auth_alg == WLAN_AUTH_SHARED_KEY && transaction == 3) { ++ hdrlen = ieee80211_hdrlen(mgmt->frame_control); + mgmt->frame_control |= cpu_to_le16(IEEE80211_FCTL_PROTECTED); +- err = ieee80211_wep_encrypt(local, skb, key, key_len, key_idx); ++ err = ieee80211_wep_encrypt(local, skb, hdrlen, key, ++ key_len, key_idx); + WARN_ON(err); + } + +--- a/net/mac80211/wep.c ++++ b/net/mac80211/wep.c +@@ -89,11 +89,11 @@ static void ieee80211_wep_get_iv(struct + + static u8 *ieee80211_wep_add_iv(struct ieee80211_local *local, + struct sk_buff *skb, ++ unsigned int hdrlen, + int keylen, int keyidx) + { + struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)skb->data; + struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb); +- unsigned int hdrlen; + u8 *newhdr; + + hdr->frame_control |= cpu_to_le16(IEEE80211_FCTL_PROTECTED); +@@ -101,7 +101,6 @@ static u8 *ieee80211_wep_add_iv(struct i + if (WARN_ON(skb_headroom(skb) < IEEE80211_WEP_IV_LEN)) + return NULL; + +- hdrlen = ieee80211_hdrlen(hdr->frame_control); + newhdr = skb_push(skb, IEEE80211_WEP_IV_LEN); + memmove(newhdr, newhdr + IEEE80211_WEP_IV_LEN, hdrlen); + +@@ -160,6 +159,7 @@ int ieee80211_wep_encrypt_data(struct cr + */ + int ieee80211_wep_encrypt(struct ieee80211_local *local, + struct sk_buff *skb, ++ unsigned int hdrlen, + const u8 *key, int keylen, int keyidx) + { + u8 *iv; +@@ -169,7 +169,7 @@ int ieee80211_wep_encrypt(struct ieee802 + if (WARN_ON(skb_tailroom(skb) < IEEE80211_WEP_ICV_LEN)) + return -1; + +- iv = ieee80211_wep_add_iv(local, skb, keylen, keyidx); ++ iv = ieee80211_wep_add_iv(local, skb, hdrlen, keylen, keyidx); + if (!iv) + return -1; + +@@ -307,13 +307,14 @@ static int wep_encrypt_skb(struct ieee80 + struct ieee80211_key_conf *hw_key = info->control.hw_key; + + if (!hw_key) { +- if (ieee80211_wep_encrypt(tx->local, skb, tx->key->conf.key, ++ if (ieee80211_wep_encrypt(tx->local, skb, tx->hdrlen, ++ tx->key->conf.key, + tx->key->conf.keylen, + tx->key->conf.keyidx)) + return -1; + } else if ((hw_key->flags & IEEE80211_KEY_FLAG_GENERATE_IV) || + (hw_key->flags & IEEE80211_KEY_FLAG_PUT_IV_SPACE)) { +- if (!ieee80211_wep_add_iv(tx->local, skb, ++ if (!ieee80211_wep_add_iv(tx->local, skb, tx->hdrlen, + tx->key->conf.keylen, + tx->key->conf.keyidx)) + return -1; +--- a/net/mac80211/wep.h ++++ b/net/mac80211/wep.h +@@ -22,6 +22,7 @@ int ieee80211_wep_encrypt_data(struct cr + size_t klen, u8 *data, size_t data_len); + int ieee80211_wep_encrypt(struct ieee80211_local *local, + struct sk_buff *skb, ++ unsigned int hdrlen, + const u8 *key, int keylen, int keyidx); + int ieee80211_wep_decrypt_data(struct crypto_cipher *tfm, u8 *rc4key, + size_t klen, u8 *data, size_t data_len); +--- a/net/mac80211/wpa.c ++++ b/net/mac80211/wpa.c +@@ -44,7 +44,7 @@ ieee80211_tx_h_michael_mic_add(struct ie + skb->len < 24 || !ieee80211_is_data_present(hdr->frame_control)) + return TX_CONTINUE; + +- hdrlen = ieee80211_hdrlen(hdr->frame_control); ++ hdrlen = tx->hdrlen; + if (skb->len < hdrlen) + return TX_DROP; + +@@ -187,7 +187,6 @@ mic_fail_no_key: + + static int tkip_encrypt_skb(struct ieee80211_tx_data *tx, struct sk_buff *skb) + { +- struct ieee80211_hdr *hdr = (struct ieee80211_hdr *) skb->data; + struct ieee80211_key *key = tx->key; + struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb); + unsigned int hdrlen; +@@ -202,7 +201,7 @@ static int tkip_encrypt_skb(struct ieee8 + return 0; + } + +- hdrlen = ieee80211_hdrlen(hdr->frame_control); ++ hdrlen = tx->hdrlen; + len = skb->len - hdrlen; + + if (info->control.hw_key) +@@ -420,7 +419,7 @@ static int ccmp_encrypt_skb(struct ieee8 + return 0; + } + +- hdrlen = ieee80211_hdrlen(hdr->frame_control); ++ hdrlen = tx->hdrlen; + len = skb->len - hdrlen; + + if (info->control.hw_key) +@@ -653,7 +652,7 @@ static int gcmp_encrypt_skb(struct ieee8 + return 0; + } + +- hdrlen = ieee80211_hdrlen(hdr->frame_control); ++ hdrlen = tx->hdrlen; + len = skb->len - hdrlen; + + if (info->control.hw_key) +@@ -793,7 +792,6 @@ static ieee80211_tx_result + ieee80211_crypto_cs_encrypt(struct ieee80211_tx_data *tx, + struct sk_buff *skb) + { +- struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)skb->data; + struct ieee80211_key *key = tx->key; + struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb); + int hdrlen; +@@ -809,8 +807,7 @@ ieee80211_crypto_cs_encrypt(struct ieee8 + pskb_expand_head(skb, iv_len, 0, GFP_ATOMIC))) + return TX_DROP; + +- hdrlen = ieee80211_hdrlen(hdr->frame_control); +- ++ hdrlen = tx->hdrlen; + pos = skb_push(skb, iv_len); + memmove(pos, pos + iv_len, hdrlen); + diff --git a/package/kernel/mac80211/patches/358-mac80211-add-NEED_ALIGNED4_SKBS-hw-flag.patch b/package/kernel/mac80211/patches/358-mac80211-add-NEED_ALIGNED4_SKBS-hw-flag.patch new file mode 100644 index 0000000000..a9f01b368d --- /dev/null +++ b/package/kernel/mac80211/patches/358-mac80211-add-NEED_ALIGNED4_SKBS-hw-flag.patch @@ -0,0 +1,233 @@ +From: Janusz Dziedzic +Date: Fri, 19 Feb 2016 11:01:50 +0100 +Subject: [PATCH] mac80211: add NEED_ALIGNED4_SKBS hw flag + +HW/driver should set NEED_ALIGNED4_SKBS flag in case +require aligned skbs to four-byte boundaries. +This affect only TX direction. + +Padding is added after ieee80211_hdr, before IV/LLC. + +Before we have to do memmove(hdrlen) twice in the +dirver. Once before we pass this to HW and next +in tx completion (to be sure monitor will report +this tx frame correctly). + +With this patch we can skip this memmove() and save CPU. + +Currently this was tested with ath9k, both hw/sw crypt for +wep/tkip/ccmp. + +Signed-off-by: Janusz Dziedzic +--- + +--- a/include/net/mac80211.h ++++ b/include/net/mac80211.h +@@ -2059,6 +2059,9 @@ struct ieee80211_txq { + * @IEEE80211_HW_SUPPORTS_TDLS_BUFFER_STA: Hardware supports buffer STA on + * TDLS links. + * ++ * @IEEE80211_HW_NEEDS_ALIGNED4_SKBS: Driver need aligned skbs to four-byte. ++ * Padding will be added after ieee80211_hdr, before IV/LLC. ++ * + * @NUM_IEEE80211_HW_FLAGS: number of hardware flags, used for sizing arrays + */ + enum ieee80211_hw_flags { +@@ -2102,6 +2105,7 @@ enum ieee80211_hw_flags { + IEEE80211_HW_REPORTS_LOW_ACK, + IEEE80211_HW_SUPPORTS_TX_FRAG, + IEEE80211_HW_SUPPORTS_TDLS_BUFFER_STA, ++ IEEE80211_HW_NEEDS_ALIGNED4_SKBS, + + /* keep last, obviously */ + NUM_IEEE80211_HW_FLAGS +--- a/net/mac80211/debugfs.c ++++ b/net/mac80211/debugfs.c +@@ -212,6 +212,7 @@ static const char *hw_flag_names[] = { + FLAG(REPORTS_LOW_ACK), + FLAG(SUPPORTS_TX_FRAG), + FLAG(SUPPORTS_TDLS_BUFFER_STA), ++ FLAG(NEEDS_ALIGNED4_SKBS), + #undef FLAG + }; + +--- a/net/mac80211/ieee80211_i.h ++++ b/net/mac80211/ieee80211_i.h +@@ -1548,6 +1548,29 @@ ieee80211_vif_get_num_mcast_if(struct ie + return -1; + } + ++static inline unsigned int ++ieee80211_hdr_padsize(struct ieee80211_hw *hw, unsigned int hdrlen) ++{ ++ /* ++ * While hdrlen is already aligned to two-byte boundaries, ++ * simple check with & 2 will return correct padsize. ++ */ ++ if (ieee80211_hw_check(hw, NEEDS_ALIGNED4_SKBS)) ++ return hdrlen & 2; ++ return 0; ++} ++ ++static inline unsigned int ++ieee80211_padded_hdrlen(struct ieee80211_hw *hw, __le16 fc) ++{ ++ unsigned int hdrlen; ++ ++ hdrlen = ieee80211_hdrlen(fc); ++ hdrlen += ieee80211_hdr_padsize(hw, hdrlen); ++ ++ return hdrlen; ++} ++ + u64 ieee80211_calculate_rx_timestamp(struct ieee80211_local *local, + struct ieee80211_rx_status *status, + unsigned int mpdu_len, +--- a/net/mac80211/sta_info.h ++++ b/net/mac80211/sta_info.h +@@ -300,7 +300,7 @@ struct ieee80211_fast_tx { + u8 hdr_len; + u8 sa_offs, da_offs, pn_offs; + u8 band; +- u8 hdr[30 + 2 + IEEE80211_FAST_XMIT_MAX_IV + ++ u8 hdr[30 + 2 + 2 + IEEE80211_FAST_XMIT_MAX_IV + + sizeof(rfc1042_header)] __aligned(2); + + struct rcu_head rcu_head; +--- a/net/mac80211/status.c ++++ b/net/mac80211/status.c +@@ -642,9 +642,22 @@ void ieee80211_tx_monitor(struct ieee802 + struct sk_buff *skb2; + struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb); + struct ieee80211_sub_if_data *sdata; ++ struct ieee80211_hdr *hdr = (void *)skb->data; + struct net_device *prev_dev = NULL; ++ unsigned int hdrlen, padsize; + int rtap_len; + ++ /* Remove padding if was added */ ++ if (ieee80211_hw_check(&local->hw, NEEDS_ALIGNED4_SKBS)) { ++ hdrlen = ieee80211_hdrlen(hdr->frame_control); ++ padsize = ieee80211_hdr_padsize(&local->hw, hdrlen); ++ ++ if (padsize && skb->len > hdrlen + padsize) { ++ memmove(skb->data + padsize, skb->data, hdrlen); ++ skb_pull(skb, padsize); ++ } ++ } ++ + /* send frame to monitor interfaces now */ + rtap_len = ieee80211_tx_radiotap_len(info); + if (WARN_ON_ONCE(skb_headroom(skb) < rtap_len)) { +--- a/net/mac80211/tkip.c ++++ b/net/mac80211/tkip.c +@@ -201,10 +201,12 @@ void ieee80211_get_tkip_p2k(struct ieee8 + { + struct ieee80211_key *key = (struct ieee80211_key *) + container_of(keyconf, struct ieee80211_key, conf); ++ struct ieee80211_hw *hw = &key->local->hw; + const u8 *tk = &key->conf.key[NL80211_TKIP_DATA_OFFSET_ENCR_KEY]; + struct tkip_ctx *ctx = &key->u.tkip.tx; + struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)skb->data; +- const u8 *data = (u8 *)hdr + ieee80211_hdrlen(hdr->frame_control); ++ const u8 *data = (u8 *)hdr + ieee80211_padded_hdrlen(hw, ++ hdr->frame_control); + u32 iv32 = get_unaligned_le32(&data[4]); + u16 iv16 = data[2] | (data[0] << 8); + +--- a/net/mac80211/tx.c ++++ b/net/mac80211/tx.c +@@ -1172,8 +1172,7 @@ ieee80211_tx_prepare(struct ieee80211_su + info->flags &= ~IEEE80211_TX_INTFL_NEED_TXPROCESSING; + + hdr = (struct ieee80211_hdr *) skb->data; +- +- tx->hdrlen = ieee80211_hdrlen(hdr->frame_control); ++ tx->hdrlen = ieee80211_padded_hdrlen(&local->hw, hdr->frame_control); + + if (likely(sta)) { + if (!IS_ERR(sta)) +@@ -2184,7 +2183,7 @@ netdev_tx_t ieee80211_monitor_start_xmit + goto fail; + + hdr = (struct ieee80211_hdr *)(skb->data + len_rthdr); +- hdrlen = ieee80211_hdrlen(hdr->frame_control); ++ hdrlen = ieee80211_padded_hdrlen(&local->hw, hdr->frame_control); + + if (skb->len < len_rthdr + hdrlen) + goto fail; +@@ -2402,7 +2401,7 @@ static struct sk_buff *ieee80211_build_h + struct ieee80211_chanctx_conf *chanctx_conf; + struct ieee80211_sub_if_data *ap_sdata; + enum nl80211_band band; +- int ret; ++ int padsize, ret; + + if (IS_ERR(sta)) + sta = NULL; +@@ -2622,6 +2621,9 @@ static struct sk_buff *ieee80211_build_h + hdrlen += 2; + } + ++ /* Check aligned4 skb required */ ++ padsize = ieee80211_hdr_padsize(&sdata->local->hw, hdrlen); ++ + /* + * Drop unicast frames to unauthorised stations unless they are + * EAPOL frames from the local station. +@@ -2702,6 +2704,7 @@ static struct sk_buff *ieee80211_build_h + + skb_pull(skb, skip_header_bytes); + head_need = hdrlen + encaps_len + meshhdrlen - skb_headroom(skb); ++ head_need += padsize; + + /* + * So we need to modify the skb header and hence need a copy of +@@ -2734,6 +2737,9 @@ static struct sk_buff *ieee80211_build_h + memcpy(skb_push(skb, meshhdrlen), &mesh_hdr, meshhdrlen); + #endif + ++ if (padsize) ++ memset(skb_push(skb, padsize), 0, padsize); ++ + if (ieee80211_is_data_qos(fc)) { + __le16 *qos_control; + +@@ -2909,6 +2915,9 @@ void ieee80211_check_fast_xmit(struct st + fc |= cpu_to_le16(IEEE80211_STYPE_QOS_DATA); + } + ++ /* Check aligned4 skb required */ ++ build.hdr_len += ieee80211_hdr_padsize(&local->hw, build.hdr_len); ++ + /* We store the key here so there's no point in using rcu_dereference() + * but that's fine because the code that changes the pointers will call + * this function after doing so. For a single CPU that would be enough, +@@ -3495,7 +3504,7 @@ begin: + + if (tx.key && + (tx.key->conf.flags & IEEE80211_KEY_FLAG_GENERATE_IV)) +- pn_offs = ieee80211_hdrlen(hdr->frame_control); ++ pn_offs = tx.hdrlen; + + ieee80211_xmit_fast_finish(sta->sdata, sta, pn_offs, + tx.key, skb); +--- a/net/mac80211/util.c ++++ b/net/mac80211/util.c +@@ -1230,6 +1230,7 @@ void ieee80211_send_auth(struct ieee8021 + u32 tx_flags) + { + struct ieee80211_local *local = sdata->local; ++ struct ieee80211_hw *hw = &local->hw; + struct sk_buff *skb; + struct ieee80211_mgmt *mgmt; + unsigned int hdrlen; +@@ -1256,7 +1257,7 @@ void ieee80211_send_auth(struct ieee8021 + skb_put_data(skb, extra, extra_len); + + if (auth_alg == WLAN_AUTH_SHARED_KEY && transaction == 3) { +- hdrlen = ieee80211_hdrlen(mgmt->frame_control); ++ hdrlen = ieee80211_padded_hdrlen(hw, mgmt->frame_control); + mgmt->frame_control |= cpu_to_le16(IEEE80211_FCTL_PROTECTED); + err = ieee80211_wep_encrypt(local, skb, hdrlen, key, + key_len, key_idx); diff --git a/package/kernel/mac80211/patches/359-mac80211-minstrel-Enable-STBC-and-LDPC-for-VHT-Rates.patch b/package/kernel/mac80211/patches/359-mac80211-minstrel-Enable-STBC-and-LDPC-for-VHT-Rates.patch new file mode 100644 index 0000000000..609b15b832 --- /dev/null +++ b/package/kernel/mac80211/patches/359-mac80211-minstrel-Enable-STBC-and-LDPC-for-VHT-Rates.patch @@ -0,0 +1,82 @@ +From: Chaitanya T K +Date: Mon, 27 Jun 2016 15:23:26 +0530 +Subject: [PATCH] mac80211: minstrel: Enable STBC and LDPC for VHT Rates + +If peer support reception of STBC and LDPC, enable them for better +performance. + +Signed-off-by: Chaitanya TK +--- + +--- a/include/linux/ieee80211.h ++++ b/include/linux/ieee80211.h +@@ -1556,6 +1556,7 @@ struct ieee80211_vht_operation { + #define IEEE80211_VHT_CAP_RXSTBC_3 0x00000300 + #define IEEE80211_VHT_CAP_RXSTBC_4 0x00000400 + #define IEEE80211_VHT_CAP_RXSTBC_MASK 0x00000700 ++#define IEEE80211_VHT_CAP_RXSTBC_SHIFT 8 + #define IEEE80211_VHT_CAP_SU_BEAMFORMER_CAPABLE 0x00000800 + #define IEEE80211_VHT_CAP_SU_BEAMFORMEE_CAPABLE 0x00001000 + #define IEEE80211_VHT_CAP_BEAMFORMEE_STS_SHIFT 13 +--- a/net/mac80211/rc80211_minstrel_ht.c ++++ b/net/mac80211/rc80211_minstrel_ht.c +@@ -1130,7 +1130,7 @@ minstrel_ht_update_caps(void *priv, stru + struct minstrel_ht_sta_priv *msp = priv_sta; + struct minstrel_ht_sta *mi = &msp->ht; + struct ieee80211_mcs_info *mcs = &sta->ht_cap.mcs; +- u16 sta_cap = sta->ht_cap.cap; ++ u16 ht_cap = sta->ht_cap.cap; + struct ieee80211_sta_vht_cap *vht_cap = &sta->vht_cap; + struct sta_info *sinfo = container_of(sta, struct sta_info, sta); + int use_vht; +@@ -1138,6 +1138,7 @@ minstrel_ht_update_caps(void *priv, stru + int ack_dur; + int stbc; + int i; ++ bool ldpc = false; + + /* fall back to the old minstrel for legacy stations */ + if (!sta->ht_cap.ht_supported) +@@ -1175,16 +1176,24 @@ minstrel_ht_update_caps(void *priv, stru + } + mi->sample_tries = 4; + +- /* TODO tx_flags for vht - ATM the RC API is not fine-grained enough */ + if (!use_vht) { +- stbc = (sta_cap & IEEE80211_HT_CAP_RX_STBC) >> ++ stbc = (ht_cap & IEEE80211_HT_CAP_RX_STBC) >> + IEEE80211_HT_CAP_RX_STBC_SHIFT; +- mi->tx_flags |= stbc << IEEE80211_TX_CTL_STBC_SHIFT; + +- if (sta_cap & IEEE80211_HT_CAP_LDPC_CODING) +- mi->tx_flags |= IEEE80211_TX_CTL_LDPC; ++ if (ht_cap & IEEE80211_HT_CAP_LDPC_CODING) ++ ldpc = true; ++ } else { ++ stbc = (vht_cap->cap & IEEE80211_VHT_CAP_RXSTBC_MASK) >> ++ IEEE80211_VHT_CAP_RXSTBC_SHIFT; ++ ++ if (vht_cap->cap & IEEE80211_VHT_CAP_RXLDPC) ++ ldpc = true; + } + ++ mi->tx_flags |= stbc << IEEE80211_TX_CTL_STBC_SHIFT; ++ if (ldpc) ++ mi->tx_flags |= IEEE80211_TX_CTL_LDPC; ++ + for (i = 0; i < ARRAY_SIZE(mi->groups); i++) { + u32 gflags = minstrel_mcs_groups[i].flags; + int bw, nss; +@@ -1197,10 +1206,10 @@ minstrel_ht_update_caps(void *priv, stru + + if (gflags & IEEE80211_TX_RC_SHORT_GI) { + if (gflags & IEEE80211_TX_RC_40_MHZ_WIDTH) { +- if (!(sta_cap & IEEE80211_HT_CAP_SGI_40)) ++ if (!(ht_cap & IEEE80211_HT_CAP_SGI_40)) + continue; + } else { +- if (!(sta_cap & IEEE80211_HT_CAP_SGI_20)) ++ if (!(ht_cap & IEEE80211_HT_CAP_SGI_20)) + continue; + } + } diff --git a/package/kernel/mac80211/patches/360-ath9k-fix-moredata-bit-in-PS-buffered-frame-release.patch b/package/kernel/mac80211/patches/360-ath9k-fix-moredata-bit-in-PS-buffered-frame-release.patch new file mode 100644 index 0000000000..c9c74bb836 --- /dev/null +++ b/package/kernel/mac80211/patches/360-ath9k-fix-moredata-bit-in-PS-buffered-frame-release.patch @@ -0,0 +1,50 @@ +From: Felix Fietkau +Date: Sun, 28 Aug 2016 13:13:01 +0200 +Subject: [PATCH] ath9k: fix moredata bit in PS buffered frame release + +Signed-off-by: Felix Fietkau +--- + +--- a/drivers/net/wireless/ath/ath9k/xmit.c ++++ b/drivers/net/wireless/ath/ath9k/xmit.c +@@ -1674,6 +1674,22 @@ void ath_tx_aggr_wakeup(struct ath_softc + } + } + ++ ++static void ++ath9k_set_moredata(struct ath_softc *sc, struct ath_buf *bf, bool val) ++{ ++ struct ieee80211_hdr *hdr; ++ u16 mask = cpu_to_le16(IEEE80211_FCTL_MOREDATA); ++ u16 mask_val = mask * val; ++ ++ hdr = (struct ieee80211_hdr *) bf->bf_mpdu->data; ++ if ((hdr->frame_control & mask) != mask_val) { ++ hdr->frame_control = (hdr->frame_control & ~mask) | mask_val; ++ dma_sync_single_for_device(sc->dev, bf->bf_buf_addr, ++ sizeof(*hdr), DMA_TO_DEVICE); ++ } ++} ++ + void ath9k_release_buffered_frames(struct ieee80211_hw *hw, + struct ieee80211_sta *sta, + u16 tids, int nframes, +@@ -1704,6 +1720,7 @@ void ath9k_release_buffered_frames(struc + if (!bf) + break; + ++ ath9k_set_moredata(sc, bf, true); + list_add_tail(&bf->list, &bf_q); + ath_set_rates(tid->an->vif, tid->an->sta, bf, true); + if (bf_isampdu(bf)) { +@@ -1727,6 +1744,9 @@ void ath9k_release_buffered_frames(struc + if (list_empty(&bf_q)) + return; + ++ if (!more_data) ++ ath9k_set_moredata(sc, bf_tail, false); ++ + info = IEEE80211_SKB_CB(bf_tail->bf_mpdu); + info->flags |= IEEE80211_TX_STATUS_EOSP; + diff --git a/package/kernel/mac80211/patches/361-ath9k-clear-potentially-stale-EOSP-status-bit-in-int.patch b/package/kernel/mac80211/patches/361-ath9k-clear-potentially-stale-EOSP-status-bit-in-int.patch new file mode 100644 index 0000000000..1893187e8a --- /dev/null +++ b/package/kernel/mac80211/patches/361-ath9k-clear-potentially-stale-EOSP-status-bit-in-int.patch @@ -0,0 +1,22 @@ +From: Felix Fietkau +Date: Sun, 28 Aug 2016 13:13:42 +0200 +Subject: [PATCH] ath9k: clear potentially stale EOSP status bit in + intermediate queues + +Prevents spurious ieee80211_sta_eosp calls. + +Signed-off-by: Felix Fietkau +--- + +--- a/drivers/net/wireless/ath/ath9k/xmit.c ++++ b/drivers/net/wireless/ath/ath9k/xmit.c +@@ -984,7 +984,8 @@ ath_tx_get_tid_subframe(struct ath_softc + bf->bf_lastbf = bf; + + tx_info = IEEE80211_SKB_CB(skb); +- tx_info->flags &= ~IEEE80211_TX_CTL_CLEAR_PS_FILT; ++ tx_info->flags &= ~(IEEE80211_TX_CTL_CLEAR_PS_FILT | ++ IEEE80211_TX_STATUS_EOSP); + + /* + * No aggregation session is running, but there may be frames diff --git a/package/kernel/mac80211/patches/362-ath9k-report-tx-status-on-EOSP.patch b/package/kernel/mac80211/patches/362-ath9k-report-tx-status-on-EOSP.patch new file mode 100644 index 0000000000..80a3074a4d --- /dev/null +++ b/package/kernel/mac80211/patches/362-ath9k-report-tx-status-on-EOSP.patch @@ -0,0 +1,19 @@ +From: Felix Fietkau +Date: Sun, 28 Aug 2016 13:23:27 +0200 +Subject: [PATCH] ath9k: report tx status on EOSP + +Signed-off-by: Felix Fietkau +--- + +--- a/drivers/net/wireless/ath/ath9k/xmit.c ++++ b/drivers/net/wireless/ath/ath9k/xmit.c +@@ -86,7 +86,8 @@ static void ath_tx_status(struct ieee802 + struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb); + struct ieee80211_sta *sta = info->status.status_driver_data[0]; + +- if (info->flags & IEEE80211_TX_CTL_REQ_TX_STATUS) { ++ if (info->flags & (IEEE80211_TX_CTL_REQ_TX_STATUS | ++ IEEE80211_TX_STATUS_EOSP)) { + ieee80211_tx_status(hw, skb); + return; + } diff --git a/package/kernel/mac80211/patches/363-ath9k-fix-block-ack-window-tracking-issues.patch b/package/kernel/mac80211/patches/363-ath9k-fix-block-ack-window-tracking-issues.patch new file mode 100644 index 0000000000..59de1dfe1a --- /dev/null +++ b/package/kernel/mac80211/patches/363-ath9k-fix-block-ack-window-tracking-issues.patch @@ -0,0 +1,114 @@ +From: Felix Fietkau +Date: Tue, 30 Aug 2016 12:44:08 +0200 +Subject: [PATCH] ath9k: fix block-ack window tracking issues + +Ensure that a buffer gets tracked as part of the block-ack window as +soon as it's dequeued from the tid for the first time. Ensure that +double calls to ath_tx_addto_baw (e.g. on retransmission) don't cause +any issues. + +Signed-off-by: Felix Fietkau +--- + +--- a/drivers/net/wireless/ath/ath9k/xmit.c ++++ b/drivers/net/wireless/ath/ath9k/xmit.c +@@ -62,7 +62,7 @@ static void ath_tx_rc_status(struct ath_ + struct ath_tx_status *ts, int nframes, int nbad, + int txok); + static void ath_tx_update_baw(struct ath_softc *sc, struct ath_atx_tid *tid, +- int seqno); ++ struct ath_buf *bf); + static struct ath_buf *ath_tx_setup_buffer(struct ath_softc *sc, + struct ath_txq *txq, + struct ath_atx_tid *tid, +@@ -311,7 +311,7 @@ static void ath_tx_flush_tid(struct ath_ + } + + if (fi->baw_tracked) { +- ath_tx_update_baw(sc, tid, bf->bf_state.seqno); ++ ath_tx_update_baw(sc, tid, bf); + sendbar = true; + } + +@@ -327,10 +327,15 @@ static void ath_tx_flush_tid(struct ath_ + } + + static void ath_tx_update_baw(struct ath_softc *sc, struct ath_atx_tid *tid, +- int seqno) ++ struct ath_buf *bf) + { ++ struct ath_frame_info *fi = get_frame_info(bf->bf_mpdu); ++ u16 seqno = bf->bf_state.seqno; + int index, cindex; + ++ if (!fi->baw_tracked) ++ return; ++ + index = ATH_BA_INDEX(tid->seq_start, seqno); + cindex = (tid->baw_head + index) & (ATH_TID_MAX_BUFS - 1); + +@@ -351,6 +356,9 @@ static void ath_tx_addto_baw(struct ath_ + u16 seqno = bf->bf_state.seqno; + int index, cindex; + ++ if (fi->baw_tracked) ++ return; ++ + index = ATH_BA_INDEX(tid->seq_start, seqno); + cindex = (tid->baw_head + index) & (ATH_TID_MAX_BUFS - 1); + __set_bit(cindex, tid->tx_buf); +@@ -627,7 +635,7 @@ static void ath_tx_complete_aggr(struct + * complete the acked-ones/xretried ones; update + * block-ack window + */ +- ath_tx_update_baw(sc, tid, seqno); ++ ath_tx_update_baw(sc, tid, bf); + + if (rc_update && (acked_cnt == 1 || txfail_cnt == 1)) { + memcpy(tx_info->control.rates, rates, sizeof(rates)); +@@ -657,7 +665,7 @@ static void ath_tx_complete_aggr(struct + * run out of tx buf. + */ + if (!tbf) { +- ath_tx_update_baw(sc, tid, seqno); ++ ath_tx_update_baw(sc, tid, bf); + + ath_tx_complete_buf(sc, bf, txq, + &bf_head, NULL, ts, +@@ -1026,11 +1034,14 @@ ath_tx_get_tid_subframe(struct ath_softc + + INIT_LIST_HEAD(&bf_head); + list_add(&bf->list, &bf_head); +- ath_tx_update_baw(sc, tid, seqno); ++ ath_tx_update_baw(sc, tid, bf); + ath_tx_complete_buf(sc, bf, txq, &bf_head, NULL, &ts, 0); + continue; + } + ++ if (bf_isampdu(bf)) ++ ath_tx_addto_baw(sc, tid, bf); ++ + return bf; + } + +@@ -1088,8 +1099,6 @@ ath_tx_form_aggr(struct ath_softc *sc, s + bf->bf_next = NULL; + + /* link buffers of this frame to the aggregate */ +- if (!fi->baw_tracked) +- ath_tx_addto_baw(sc, tid, bf); + bf->bf_state.ndelim = ndelim; + + list_add_tail(&bf->list, bf_q); +@@ -1725,10 +1734,8 @@ void ath9k_release_buffered_frames(struc + ath9k_set_moredata(sc, bf, true); + list_add_tail(&bf->list, &bf_q); + ath_set_rates(tid->an->vif, tid->an->sta, bf, true); +- if (bf_isampdu(bf)) { +- ath_tx_addto_baw(sc, tid, bf); ++ if (bf_isampdu(bf)) + bf->bf_state.bf_type &= ~BUF_AGGR; +- } + if (bf_tail) + bf_tail->bf_next = bf; + diff --git a/package/kernel/mac80211/patches/364-ath9k_hw-fix-channel-maximum-power-level-test.patch b/package/kernel/mac80211/patches/364-ath9k_hw-fix-channel-maximum-power-level-test.patch new file mode 100644 index 0000000000..67cbe92e59 --- /dev/null +++ b/package/kernel/mac80211/patches/364-ath9k_hw-fix-channel-maximum-power-level-test.patch @@ -0,0 +1,47 @@ +From: Felix Fietkau +Date: Wed, 22 Mar 2017 20:37:04 +0100 +Subject: [PATCH] ath9k_hw: fix channel maximum power level test + +The tx power applied by set_txpower is limited by the CTL (conformance +test limit) entries in the EEPROM. These can change based on the user +configured regulatory domain. +Depending on the EEPROM data this can cause the tx power to become too +limited, if the original regdomain CTLs impose lowr limits than the CTLs +of the user configured regdomain. + +To fix this issue, set the initial channel limits without any CTL +restrictions and only apply the CTL at run time when setting the channel +and the real tx power. + +Cc: stable@vger.kernel.org +Signed-off-by: Felix Fietkau +--- + +--- a/drivers/net/wireless/ath/ath9k/hw.c ++++ b/drivers/net/wireless/ath/ath9k/hw.c +@@ -2937,10 +2937,14 @@ void ath9k_hw_apply_txpower(struct ath_h + struct ieee80211_channel *channel; + int chan_pwr, new_pwr, max_gain; + int ant_gain, ant_reduction = 0; ++ u16 ctl = NO_CTL; + + if (!chan) + return; + ++ if (!test) ++ ctl = ath9k_regd_get_ctl(reg, chan); ++ + channel = chan->chan; + chan_pwr = min_t(int, channel->max_power * 2, MAX_RATE_POWER); + new_pwr = min_t(int, chan_pwr, reg->power_limit); +@@ -2950,9 +2954,7 @@ void ath9k_hw_apply_txpower(struct ath_h + if (ant_gain > max_gain) + ant_reduction = ant_gain - max_gain; + +- ah->eep_ops->set_txpower(ah, chan, +- ath9k_regd_get_ctl(reg, chan), +- ant_reduction, new_pwr, test); ++ ah->eep_ops->set_txpower(ah, chan, ctl, ant_reduction, new_pwr, test); + } + + void ath9k_hw_set_txpowerlimit(struct ath_hw *ah, u32 limit, bool test) diff --git a/package/kernel/mac80211/patches/365-ath9k-adjust-tx-power-reduction-for-US-regulatory-do.patch b/package/kernel/mac80211/patches/365-ath9k-adjust-tx-power-reduction-for-US-regulatory-do.patch new file mode 100644 index 0000000000..78083517bc --- /dev/null +++ b/package/kernel/mac80211/patches/365-ath9k-adjust-tx-power-reduction-for-US-regulatory-do.patch @@ -0,0 +1,24 @@ +From: Felix Fietkau +Date: Wed, 19 Jul 2017 08:49:31 +0200 +Subject: [PATCH] ath9k: adjust tx power reduction for US regulatory + domain + +FCC regulatory rules allow for up to 3 dBi antenna gain. Account for +this in the EEPROM based tx power reduction code. + +Signed-off-by: Felix Fietkau +--- + +--- a/drivers/net/wireless/ath/ath9k/hw.c ++++ b/drivers/net/wireless/ath/ath9k/hw.c +@@ -2954,6 +2954,10 @@ void ath9k_hw_apply_txpower(struct ath_h + if (ant_gain > max_gain) + ant_reduction = ant_gain - max_gain; + ++ /* FCC allows maximum antenna gain of 3 dBi */ ++ if (reg->region == NL80211_DFS_FCC) ++ ant_reduction = max_t(int, ant_reduction - 6, 0); ++ + ah->eep_ops->set_txpower(ah, chan, ctl, ant_reduction, new_pwr, test); + } + diff --git a/package/kernel/mac80211/patches/366-ath9k-fix-more-data-flag-for-buffered-multicast-pack.patch b/package/kernel/mac80211/patches/366-ath9k-fix-more-data-flag-for-buffered-multicast-pack.patch new file mode 100644 index 0000000000..096eb56a2d --- /dev/null +++ b/package/kernel/mac80211/patches/366-ath9k-fix-more-data-flag-for-buffered-multicast-pack.patch @@ -0,0 +1,41 @@ +From: Felix Fietkau +Date: Sun, 23 Jul 2017 14:58:22 +0200 +Subject: [PATCH] ath9k: fix more-data flag for buffered multicast + packets + +The flag needs to be cleared for the last packet in the list, not the +first one. Fixes some issues with multicast packet loss for powersave +clients connected to an ath9k AP. + +Signed-off-by: Felix Fietkau +--- + +--- a/drivers/net/wireless/ath/ath9k/xmit.c ++++ b/drivers/net/wireless/ath/ath9k/xmit.c +@@ -2451,7 +2451,6 @@ void ath_tx_cabq(struct ieee80211_hw *hw + .txq = sc->beacon.cabq + }; + struct ath_tx_info info = {}; +- struct ieee80211_hdr *hdr; + struct ath_buf *bf_tail = NULL; + struct ath_buf *bf; + LIST_HEAD(bf_q); +@@ -2495,15 +2494,10 @@ void ath_tx_cabq(struct ieee80211_hw *hw + if (list_empty(&bf_q)) + return; + +- bf = list_first_entry(&bf_q, struct ath_buf, list); +- hdr = (struct ieee80211_hdr *) bf->bf_mpdu->data; +- +- if (hdr->frame_control & cpu_to_le16(IEEE80211_FCTL_MOREDATA)) { +- hdr->frame_control &= ~cpu_to_le16(IEEE80211_FCTL_MOREDATA); +- dma_sync_single_for_device(sc->dev, bf->bf_buf_addr, +- sizeof(*hdr), DMA_TO_DEVICE); +- } ++ bf = list_last_entry(&bf_q, struct ath_buf, list); ++ ath9k_set_moredata(sc, bf, false); + ++ bf = list_first_entry(&bf_q, struct ath_buf, list); + ath_txq_lock(sc, txctl.txq); + ath_tx_fill_desc(sc, bf, txctl.txq, 0); + ath_tx_txqaddbuf(sc, txctl.txq, &bf_q, false); diff --git a/package/kernel/mac80211/patches/367-Revert-ath10k-disable-wake_tx_queue-for-older-device.patch b/package/kernel/mac80211/patches/367-Revert-ath10k-disable-wake_tx_queue-for-older-device.patch new file mode 100644 index 0000000000..56d86c1525 --- /dev/null +++ b/package/kernel/mac80211/patches/367-Revert-ath10k-disable-wake_tx_queue-for-older-device.patch @@ -0,0 +1,27 @@ +From: dave taht +Date: Wed, 5 Oct 2016 20:09:15 -0700 +Subject: [PATCH] Revert "ath10k: disable wake_tx_queue for older + devices" + +This reverts commit 4ca1807815aa6801aaced7fdefa9edacc2521767 +in the hope that we've fixed all the performance problems now. +--- + +--- a/drivers/net/wireless/ath/ath10k/mac.c ++++ b/drivers/net/wireless/ath/ath10k/mac.c +@@ -8319,15 +8319,6 @@ int ath10k_mac_register(struct ath10k *a + ath10k_warn(ar, "failed to initialise DFS pattern detector\n"); + } + +- /* Current wake_tx_queue implementation imposes a significant +- * performance penalty in some setups. The tx scheduling code needs +- * more work anyway so disable the wake_tx_queue unless firmware +- * supports the pull-push mechanism. +- */ +- if (!test_bit(ATH10K_FW_FEATURE_PEER_FLOW_CONTROL, +- ar->running_fw->fw_file.fw_features)) +- ar->ops->wake_tx_queue = NULL; +- + ret = ath10k_mac_init_rd(ar); + if (ret) { + ath10k_err(ar, "failed to derive regdom: %d\n", ret); diff --git a/package/kernel/mac80211/patches/368-ath10k-fix-recent-bandwidth-conversion-bug.patch b/package/kernel/mac80211/patches/368-ath10k-fix-recent-bandwidth-conversion-bug.patch new file mode 100644 index 0000000000..5d5329f27e --- /dev/null +++ b/package/kernel/mac80211/patches/368-ath10k-fix-recent-bandwidth-conversion-bug.patch @@ -0,0 +1,61 @@ +From: Christian Lamparter +Date: Wed, 1 Nov 2017 21:01:57 +0100 +Subject: [PATCH] ath10k: fix recent bandwidth conversion bug + +The commit "cfg80211: make RATE_INFO_BW_20 the default" changed +the index of RATE_INFO_BW_20, but the updates to ath10k missed +the special bandwidth calculation case in +ath10k_update_per_peer_tx_stats(). + +Fixes: 842be75c77cb ("cfg80211: make RATE_INFO_BW_20 the default") +Signed-off-by: Christian Lamparter +Patchwork-Id: 10037035 +Signed-off-by: Kalle Valo +--- + +--- a/drivers/net/wireless/ath/ath10k/htt_rx.c ++++ b/drivers/net/wireless/ath/ath10k/htt_rx.c +@@ -592,6 +592,9 @@ struct amsdu_subframe_hdr { + + #define GROUP_ID_IS_SU_MIMO(x) ((x) == 0 || (x) == 63) + ++static const u8 ath10k_bw_to_mac80211[] = { RATE_INFO_BW_20, RATE_INFO_BW_40, ++ RATE_INFO_BW_80, RATE_INFO_BW_160 }; ++ + static void ath10k_htt_rx_h_rates(struct ath10k *ar, + struct ieee80211_rx_status *status, + struct htt_rx_desc *rxd) +@@ -694,23 +697,7 @@ static void ath10k_htt_rx_h_rates(struct + if (sgi) + status->enc_flags |= RX_ENC_FLAG_SHORT_GI; + +- switch (bw) { +- /* 20MHZ */ +- case 0: +- break; +- /* 40MHZ */ +- case 1: +- status->bw = RATE_INFO_BW_40; +- break; +- /* 80MHZ */ +- case 2: +- status->bw = RATE_INFO_BW_80; +- break; +- case 3: +- status->bw = RATE_INFO_BW_160; +- break; +- } +- ++ status->bw = ath10k_bw_to_mac80211[bw]; + status->encoding = RX_ENC_VHT; + break; + default: +@@ -2297,7 +2284,7 @@ ath10k_update_per_peer_tx_stats(struct a + arsta->txrate.flags |= RATE_INFO_FLAGS_SHORT_GI; + + arsta->txrate.nss = txrate.nss; +- arsta->txrate.bw = txrate.bw + RATE_INFO_BW_20; ++ arsta->txrate.bw = ath10k_bw_to_mac80211[txrate.bw]; + } + + static void ath10k_htt_fetch_peer_stats(struct ath10k *ar, diff --git a/package/kernel/mac80211/patches/369-cfg80211-use-only-1Mbps-for-basic-rates-in-mesh.patch b/package/kernel/mac80211/patches/369-cfg80211-use-only-1Mbps-for-basic-rates-in-mesh.patch new file mode 100644 index 0000000000..bc4174e4c2 --- /dev/null +++ b/package/kernel/mac80211/patches/369-cfg80211-use-only-1Mbps-for-basic-rates-in-mesh.patch @@ -0,0 +1,55 @@ +From: Johannes Berg +Date: Tue, 30 Jan 2018 13:17:38 +0100 +Subject: [PATCH] cfg80211: use only 1Mbps for basic rates in mesh + +Mesh used to use the mandatory rates as basic rates, but we got +the calculation of mandatory rates wrong until some time ago. +Fix this this broke interoperability with older versions since +now more basic rates are required, and thus the MBSS isn't the +same and the network stops working. + +Fix this by simply using only 1Mbps as the basic rate in 2.4GHz. +Since the changed mandatory rates only affected 2.4GHz, this is +all we need to make it work again. + +Reported-and-tested-by: Matthias Schiffer +Fixes: 1bd773c077de ("wireless: set correct mandatory rate flags") +Signed-off-by: Johannes Berg +--- + net/wireless/mesh.c | 25 ++++++++++++++++++++++--- + 1 file changed, 22 insertions(+), 3 deletions(-) + +--- a/net/wireless/mesh.c ++++ b/net/wireless/mesh.c +@@ -169,9 +169,28 @@ int __cfg80211_join_mesh(struct cfg80211 + enum nl80211_bss_scan_width scan_width; + struct ieee80211_supported_band *sband = + rdev->wiphy.bands[setup->chandef.chan->band]; +- scan_width = cfg80211_chandef_to_scan_width(&setup->chandef); +- setup->basic_rates = ieee80211_mandatory_rates(sband, +- scan_width); ++ ++ if (setup->chandef.chan->band == NL80211_BAND_2GHZ) { ++ int i; ++ ++ /* ++ * Older versions selected the mandatory rates for ++ * 2.4 GHz as well, but were broken in that only ++ * 1 Mbps was regarded as a mandatory rate. Keep ++ * using just 1 Mbps as the default basic rate for ++ * mesh to be interoperable with older versions. ++ */ ++ for (i = 0; i < sband->n_bitrates; i++) { ++ if (sband->bitrates[i].bitrate == 10) { ++ setup->basic_rates = BIT(i); ++ break; ++ } ++ } ++ } else { ++ scan_width = cfg80211_chandef_to_scan_width(&setup->chandef); ++ setup->basic_rates = ieee80211_mandatory_rates(sband, ++ scan_width); ++ } + } + + err = cfg80211_chandef_dfs_required(&rdev->wiphy, diff --git a/package/kernel/mac80211/patches/370-mac80211-minstrel-remove-unnecessary-debugfs-cleanup.patch b/package/kernel/mac80211/patches/370-mac80211-minstrel-remove-unnecessary-debugfs-cleanup.patch new file mode 100644 index 0000000000..14cf6641d8 --- /dev/null +++ b/package/kernel/mac80211/patches/370-mac80211-minstrel-remove-unnecessary-debugfs-cleanup.patch @@ -0,0 +1,150 @@ +From: Felix Fietkau +Date: Sat, 10 Feb 2018 12:41:51 +0100 +Subject: [PATCH] mac80211: minstrel: remove unnecessary debugfs cleanup + code + +debugfs entries are cleaned up by debugfs_remove_recursive already. + +Signed-off-by: Felix Fietkau +--- + +--- a/net/mac80211/rc80211_minstrel.c ++++ b/net/mac80211/rc80211_minstrel.c +@@ -689,8 +689,8 @@ minstrel_alloc(struct ieee80211_hw *hw, + + #ifdef CPTCFG_MAC80211_DEBUGFS + mp->fixed_rate_idx = (u32) -1; +- mp->dbg_fixed_rate = debugfs_create_u32("fixed_rate_idx", +- S_IRUGO | S_IWUGO, debugfsdir, &mp->fixed_rate_idx); ++ debugfs_create_u32("fixed_rate_idx", S_IRUGO | S_IWUGO, debugfsdir, ++ &mp->fixed_rate_idx); + #endif + + minstrel_init_cck_rates(mp); +@@ -701,9 +701,6 @@ minstrel_alloc(struct ieee80211_hw *hw, + static void + minstrel_free(void *priv) + { +-#ifdef CPTCFG_MAC80211_DEBUGFS +- debugfs_remove(((struct minstrel_priv *)priv)->dbg_fixed_rate); +-#endif + kfree(priv); + } + +@@ -735,7 +732,6 @@ const struct rate_control_ops mac80211_m + .free_sta = minstrel_free_sta, + #ifdef CPTCFG_MAC80211_DEBUGFS + .add_sta_debugfs = minstrel_add_sta_debugfs, +- .remove_sta_debugfs = minstrel_remove_sta_debugfs, + #endif + .get_expected_throughput = minstrel_get_expected_throughput, + }; +--- a/net/mac80211/rc80211_minstrel.h ++++ b/net/mac80211/rc80211_minstrel.h +@@ -109,11 +109,6 @@ struct minstrel_sta_info { + + /* sampling table */ + u8 *sample_table; +- +-#ifdef CPTCFG_MAC80211_DEBUGFS +- struct dentry *dbg_stats; +- struct dentry *dbg_stats_csv; +-#endif + }; + + struct minstrel_priv { +@@ -137,7 +132,6 @@ struct minstrel_priv { + * - setting will be applied on next update + */ + u32 fixed_rate_idx; +- struct dentry *dbg_fixed_rate; + #endif + }; + +@@ -156,7 +150,6 @@ minstrel_get_ewmsd10(struct minstrel_rat + + extern const struct rate_control_ops mac80211_minstrel; + void minstrel_add_sta_debugfs(void *priv, void *priv_sta, struct dentry *dir); +-void minstrel_remove_sta_debugfs(void *priv, void *priv_sta); + + /* Recalculate success probabilities and counters for a given rate using EWMA */ + void minstrel_calc_rate_stats(struct minstrel_rate_stats *mrs); +--- a/net/mac80211/rc80211_minstrel_debugfs.c ++++ b/net/mac80211/rc80211_minstrel_debugfs.c +@@ -214,19 +214,7 @@ minstrel_add_sta_debugfs(void *priv, voi + { + struct minstrel_sta_info *mi = priv_sta; + +- mi->dbg_stats = debugfs_create_file("rc_stats", S_IRUGO, dir, mi, +- &minstrel_stat_fops); +- +- mi->dbg_stats_csv = debugfs_create_file("rc_stats_csv", S_IRUGO, dir, +- mi, &minstrel_stat_csv_fops); +-} +- +-void +-minstrel_remove_sta_debugfs(void *priv, void *priv_sta) +-{ +- struct minstrel_sta_info *mi = priv_sta; +- +- debugfs_remove(mi->dbg_stats); +- +- debugfs_remove(mi->dbg_stats_csv); ++ debugfs_create_file("rc_stats", S_IRUGO, dir, mi, &minstrel_stat_fops); ++ debugfs_create_file("rc_stats_csv", S_IRUGO, dir, mi, ++ &minstrel_stat_csv_fops); + } +--- a/net/mac80211/rc80211_minstrel_ht.c ++++ b/net/mac80211/rc80211_minstrel_ht.c +@@ -1393,7 +1393,6 @@ static const struct rate_control_ops mac + .free = minstrel_ht_free, + #ifdef CPTCFG_MAC80211_DEBUGFS + .add_sta_debugfs = minstrel_ht_add_sta_debugfs, +- .remove_sta_debugfs = minstrel_ht_remove_sta_debugfs, + #endif + .get_expected_throughput = minstrel_ht_get_expected_throughput, + }; +--- a/net/mac80211/rc80211_minstrel_ht.h ++++ b/net/mac80211/rc80211_minstrel_ht.h +@@ -110,17 +110,12 @@ struct minstrel_ht_sta_priv { + struct minstrel_ht_sta ht; + struct minstrel_sta_info legacy; + }; +-#ifdef CPTCFG_MAC80211_DEBUGFS +- struct dentry *dbg_stats; +- struct dentry *dbg_stats_csv; +-#endif + void *ratelist; + void *sample_table; + bool is_ht; + }; + + void minstrel_ht_add_sta_debugfs(void *priv, void *priv_sta, struct dentry *dir); +-void minstrel_ht_remove_sta_debugfs(void *priv, void *priv_sta); + int minstrel_ht_get_tp_avg(struct minstrel_ht_sta *mi, int group, int rate, + int prob_ewma); + +--- a/net/mac80211/rc80211_minstrel_ht_debugfs.c ++++ b/net/mac80211/rc80211_minstrel_ht_debugfs.c +@@ -303,17 +303,8 @@ minstrel_ht_add_sta_debugfs(void *priv, + { + struct minstrel_ht_sta_priv *msp = priv_sta; + +- msp->dbg_stats = debugfs_create_file("rc_stats", S_IRUGO, dir, msp, +- &minstrel_ht_stat_fops); +- msp->dbg_stats_csv = debugfs_create_file("rc_stats_csv", S_IRUGO, +- dir, msp, &minstrel_ht_stat_csv_fops); +-} +- +-void +-minstrel_ht_remove_sta_debugfs(void *priv, void *priv_sta) +-{ +- struct minstrel_ht_sta_priv *msp = priv_sta; +- +- debugfs_remove(msp->dbg_stats); +- debugfs_remove(msp->dbg_stats_csv); ++ debugfs_create_file("rc_stats", S_IRUGO, dir, msp, ++ &minstrel_ht_stat_fops); ++ debugfs_create_file("rc_stats_csv", S_IRUGO, dir, msp, ++ &minstrel_ht_stat_csv_fops); + } diff --git a/package/kernel/mac80211/patches/371-mac80211-minstrel-merge-with-minstrel_ht-always-enab.patch b/package/kernel/mac80211/patches/371-mac80211-minstrel-merge-with-minstrel_ht-always-enab.patch new file mode 100644 index 0000000000..a2bdfd81a0 --- /dev/null +++ b/package/kernel/mac80211/patches/371-mac80211-minstrel-merge-with-minstrel_ht-always-enab.patch @@ -0,0 +1,576 @@ +From: Felix Fietkau +Date: Sat, 10 Feb 2018 12:43:30 +0100 +Subject: [PATCH] mac80211: minstrel: merge with minstrel_ht, always enable + VHT support + +Legacy-only devices are not very common and the overhead of the extra +code for HT and VHT rates is not big enough to justify all those extra +lines of code to make it optional. + +Signed-off-by: Felix Fietkau +--- + +--- a/net/mac80211/Kconfig ++++ b/net/mac80211/Kconfig +@@ -25,20 +25,6 @@ config MAC80211_RC_MINSTREL + ---help--- + This option enables the 'minstrel' TX rate control algorithm + +-config MAC80211_RC_MINSTREL_HT +- bool "Minstrel 802.11n support" if EXPERT +- depends on MAC80211_RC_MINSTREL +- default y +- ---help--- +- This option enables the 'minstrel_ht' TX rate control algorithm +- +-config MAC80211_RC_MINSTREL_VHT +- bool "Minstrel 802.11ac support" if EXPERT +- depends on MAC80211_RC_MINSTREL_HT +- default n +- ---help--- +- This option enables VHT in the 'minstrel_ht' TX rate control algorithm +- + choice + prompt "Default rate control algorithm" + depends on MAC80211_HAS_RC +@@ -60,8 +46,7 @@ endchoice + + config MAC80211_RC_DEFAULT + string +- default "minstrel_ht" if MAC80211_RC_DEFAULT_MINSTREL && MAC80211_RC_MINSTREL_HT +- default "minstrel" if MAC80211_RC_DEFAULT_MINSTREL ++ default "minstrel_ht" if MAC80211_RC_DEFAULT_MINSTREL + default "" + + endif +--- a/net/mac80211/Makefile ++++ b/net/mac80211/Makefile +@@ -50,13 +50,14 @@ mac80211-$(CONFIG_PM) += pm.o + + CFLAGS_trace.o := -I$(src) + +-rc80211_minstrel-y := rc80211_minstrel.o +-rc80211_minstrel-$(CPTCFG_MAC80211_DEBUGFS) += rc80211_minstrel_debugfs.o ++rc80211_minstrel-y := \ ++ rc80211_minstrel.o \ ++ rc80211_minstrel_ht.o + +-rc80211_minstrel_ht-y := rc80211_minstrel_ht.o +-rc80211_minstrel_ht-$(CPTCFG_MAC80211_DEBUGFS) += rc80211_minstrel_ht_debugfs.o ++rc80211_minstrel-$(CPTCFG_MAC80211_DEBUGFS) += \ ++ rc80211_minstrel_debugfs.o \ ++ rc80211_minstrel_ht_debugfs.o + + mac80211-$(CPTCFG_MAC80211_RC_MINSTREL) += $(rc80211_minstrel-y) +-mac80211-$(CPTCFG_MAC80211_RC_MINSTREL_HT) += $(rc80211_minstrel_ht-y) + + ccflags-y += -DDEBUG +--- a/net/mac80211/main.c ++++ b/net/mac80211/main.c +@@ -1252,18 +1252,12 @@ static int __init ieee80211_init(void) + if (ret) + return ret; + +- ret = rc80211_minstrel_ht_init(); +- if (ret) +- goto err_minstrel; +- + ret = ieee80211_iface_init(); + if (ret) + goto err_netdev; + + return 0; + err_netdev: +- rc80211_minstrel_ht_exit(); +- err_minstrel: + rc80211_minstrel_exit(); + + return ret; +@@ -1271,7 +1265,6 @@ static int __init ieee80211_init(void) + + static void __exit ieee80211_exit(void) + { +- rc80211_minstrel_ht_exit(); + rc80211_minstrel_exit(); + + ieee80211s_stop(); +--- a/net/mac80211/rate.h ++++ b/net/mac80211/rate.h +@@ -95,18 +95,5 @@ static inline void rc80211_minstrel_exit + } + #endif + +-#ifdef CPTCFG_MAC80211_RC_MINSTREL_HT +-int rc80211_minstrel_ht_init(void); +-void rc80211_minstrel_ht_exit(void); +-#else +-static inline int rc80211_minstrel_ht_init(void) +-{ +- return 0; +-} +-static inline void rc80211_minstrel_ht_exit(void) +-{ +-} +-#endif +- + + #endif /* IEEE80211_RATE_H */ +--- a/net/mac80211/rc80211_minstrel.c ++++ b/net/mac80211/rc80211_minstrel.c +@@ -572,138 +572,6 @@ minstrel_rate_init(void *priv, struct ie + minstrel_update_rates(mp, mi); + } + +-static void * +-minstrel_alloc_sta(void *priv, struct ieee80211_sta *sta, gfp_t gfp) +-{ +- struct ieee80211_supported_band *sband; +- struct minstrel_sta_info *mi; +- struct minstrel_priv *mp = priv; +- struct ieee80211_hw *hw = mp->hw; +- int max_rates = 0; +- int i; +- +- mi = kzalloc(sizeof(struct minstrel_sta_info), gfp); +- if (!mi) +- return NULL; +- +- for (i = 0; i < NUM_NL80211_BANDS; i++) { +- sband = hw->wiphy->bands[i]; +- if (sband && sband->n_bitrates > max_rates) +- max_rates = sband->n_bitrates; +- } +- +- mi->r = kzalloc(sizeof(struct minstrel_rate) * max_rates, gfp); +- if (!mi->r) +- goto error; +- +- mi->sample_table = kmalloc(SAMPLE_COLUMNS * max_rates, gfp); +- if (!mi->sample_table) +- goto error1; +- +- mi->last_stats_update = jiffies; +- return mi; +- +-error1: +- kfree(mi->r); +-error: +- kfree(mi); +- return NULL; +-} +- +-static void +-minstrel_free_sta(void *priv, struct ieee80211_sta *sta, void *priv_sta) +-{ +- struct minstrel_sta_info *mi = priv_sta; +- +- kfree(mi->sample_table); +- kfree(mi->r); +- kfree(mi); +-} +- +-static void +-minstrel_init_cck_rates(struct minstrel_priv *mp) +-{ +- static const int bitrates[4] = { 10, 20, 55, 110 }; +- struct ieee80211_supported_band *sband; +- u32 rate_flags = ieee80211_chandef_rate_flags(&mp->hw->conf.chandef); +- int i, j; +- +- sband = mp->hw->wiphy->bands[NL80211_BAND_2GHZ]; +- if (!sband) +- return; +- +- for (i = 0, j = 0; i < sband->n_bitrates; i++) { +- struct ieee80211_rate *rate = &sband->bitrates[i]; +- +- if (rate->flags & IEEE80211_RATE_ERP_G) +- continue; +- +- if ((rate_flags & sband->bitrates[i].flags) != rate_flags) +- continue; +- +- for (j = 0; j < ARRAY_SIZE(bitrates); j++) { +- if (rate->bitrate != bitrates[j]) +- continue; +- +- mp->cck_rates[j] = i; +- break; +- } +- } +-} +- +-static void * +-minstrel_alloc(struct ieee80211_hw *hw, struct dentry *debugfsdir) +-{ +- struct minstrel_priv *mp; +- +- mp = kzalloc(sizeof(struct minstrel_priv), GFP_ATOMIC); +- if (!mp) +- return NULL; +- +- /* contention window settings +- * Just an approximation. Using the per-queue values would complicate +- * the calculations and is probably unnecessary */ +- mp->cw_min = 15; +- mp->cw_max = 1023; +- +- /* number of packets (in %) to use for sampling other rates +- * sample less often for non-mrr packets, because the overhead +- * is much higher than with mrr */ +- mp->lookaround_rate = 5; +- mp->lookaround_rate_mrr = 10; +- +- /* maximum time that the hw is allowed to stay in one MRR segment */ +- mp->segment_size = 6000; +- +- if (hw->max_rate_tries > 0) +- mp->max_retry = hw->max_rate_tries; +- else +- /* safe default, does not necessarily have to match hw properties */ +- mp->max_retry = 7; +- +- if (hw->max_rates >= 4) +- mp->has_mrr = true; +- +- mp->hw = hw; +- mp->update_interval = 100; +- +-#ifdef CPTCFG_MAC80211_DEBUGFS +- mp->fixed_rate_idx = (u32) -1; +- debugfs_create_u32("fixed_rate_idx", S_IRUGO | S_IWUGO, debugfsdir, +- &mp->fixed_rate_idx); +-#endif +- +- minstrel_init_cck_rates(mp); +- +- return mp; +-} +- +-static void +-minstrel_free(void *priv) +-{ +- kfree(priv); +-} +- + static u32 minstrel_get_expected_throughput(void *priv_sta) + { + struct minstrel_sta_info *mi = priv_sta; +@@ -722,29 +590,8 @@ static u32 minstrel_get_expected_through + } + + const struct rate_control_ops mac80211_minstrel = { +- .name = "minstrel", + .tx_status_ext = minstrel_tx_status, + .get_rate = minstrel_get_rate, + .rate_init = minstrel_rate_init, +- .alloc = minstrel_alloc, +- .free = minstrel_free, +- .alloc_sta = minstrel_alloc_sta, +- .free_sta = minstrel_free_sta, +-#ifdef CPTCFG_MAC80211_DEBUGFS +- .add_sta_debugfs = minstrel_add_sta_debugfs, +-#endif + .get_expected_throughput = minstrel_get_expected_throughput, + }; +- +-int __init +-rc80211_minstrel_init(void) +-{ +- return ieee80211_rate_control_register(&mac80211_minstrel); +-} +- +-void +-rc80211_minstrel_exit(void) +-{ +- ieee80211_rate_control_unregister(&mac80211_minstrel); +-} +- +--- a/net/mac80211/rc80211_minstrel.h ++++ b/net/mac80211/rc80211_minstrel.h +@@ -158,7 +158,5 @@ int minstrel_get_tp_avg(struct minstrel_ + /* debugfs */ + int minstrel_stats_open(struct inode *inode, struct file *file); + int minstrel_stats_csv_open(struct inode *inode, struct file *file); +-ssize_t minstrel_stats_read(struct file *file, char __user *buf, size_t len, loff_t *ppos); +-int minstrel_stats_release(struct inode *inode, struct file *file); + + #endif +--- a/net/mac80211/rc80211_minstrel_debugfs.c ++++ b/net/mac80211/rc80211_minstrel_debugfs.c +@@ -54,22 +54,6 @@ + #include + #include "rc80211_minstrel.h" + +-ssize_t +-minstrel_stats_read(struct file *file, char __user *buf, size_t len, loff_t *ppos) +-{ +- struct minstrel_debugfs_info *ms; +- +- ms = file->private_data; +- return simple_read_from_buffer(buf, len, ppos, ms->buf, ms->len); +-} +- +-int +-minstrel_stats_release(struct inode *inode, struct file *file) +-{ +- kfree(file->private_data); +- return 0; +-} +- + int + minstrel_stats_open(struct inode *inode, struct file *file) + { +@@ -135,14 +119,6 @@ minstrel_stats_open(struct inode *inode, + return 0; + } + +-static const struct file_operations minstrel_stat_fops = { +- .owner = THIS_MODULE, +- .open = minstrel_stats_open, +- .read = minstrel_stats_read, +- .release = minstrel_stats_release, +- .llseek = default_llseek, +-}; +- + int + minstrel_stats_csv_open(struct inode *inode, struct file *file) + { +@@ -200,21 +176,3 @@ minstrel_stats_csv_open(struct inode *in + + return 0; + } +- +-static const struct file_operations minstrel_stat_csv_fops = { +- .owner = THIS_MODULE, +- .open = minstrel_stats_csv_open, +- .read = minstrel_stats_read, +- .release = minstrel_stats_release, +- .llseek = default_llseek, +-}; +- +-void +-minstrel_add_sta_debugfs(void *priv, void *priv_sta, struct dentry *dir) +-{ +- struct minstrel_sta_info *mi = priv_sta; +- +- debugfs_create_file("rc_stats", S_IRUGO, dir, mi, &minstrel_stat_fops); +- debugfs_create_file("rc_stats_csv", S_IRUGO, dir, mi, +- &minstrel_stat_csv_fops); +-} +--- a/net/mac80211/rc80211_minstrel_ht.c ++++ b/net/mac80211/rc80211_minstrel_ht.c +@@ -137,12 +137,10 @@ + } \ + } + +-#ifdef CPTCFG_MAC80211_RC_MINSTREL_VHT + static bool minstrel_vht_only = true; + module_param(minstrel_vht_only, bool, 0644); + MODULE_PARM_DESC(minstrel_vht_only, + "Use only VHT rates when VHT is supported by sta."); +-#endif + + /* + * To enable sufficiently targeted rate sampling, MCS rates are divided into +@@ -171,7 +169,6 @@ const struct mcs_group minstrel_mcs_grou + + CCK_GROUP, + +-#ifdef CPTCFG_MAC80211_RC_MINSTREL_VHT + VHT_GROUP(1, 0, BW_20), + VHT_GROUP(2, 0, BW_20), + VHT_GROUP(3, 0, BW_20), +@@ -195,7 +192,6 @@ const struct mcs_group minstrel_mcs_grou + VHT_GROUP(1, 1, BW_80), + VHT_GROUP(2, 1, BW_80), + VHT_GROUP(3, 1, BW_80), +-#endif + }; + + static u8 sample_table[SAMPLE_COLUMNS][MCS_GROUP_RATES] __read_mostly; +@@ -1146,12 +1142,10 @@ minstrel_ht_update_caps(void *priv, stru + + BUILD_BUG_ON(ARRAY_SIZE(minstrel_mcs_groups) != MINSTREL_GROUPS_NB); + +-#ifdef CPTCFG_MAC80211_RC_MINSTREL_VHT + if (vht_cap->vht_supported) + use_vht = vht_cap->vht_mcs.tx_mcs_map != cpu_to_le16(~0); + else +-#endif +- use_vht = 0; ++ use_vht = 0; + + msp->is_ht = true; + memset(mi, 0, sizeof(*mi)); +@@ -1226,10 +1220,9 @@ minstrel_ht_update_caps(void *priv, stru + + /* HT rate */ + if (gflags & IEEE80211_TX_RC_MCS) { +-#ifdef CPTCFG_MAC80211_RC_MINSTREL_VHT + if (use_vht && minstrel_vht_only) + continue; +-#endif ++ + mi->supported[i] = mcs->rx_mask[nss - 1]; + if (mi->supported[i]) + n_supported++; +@@ -1349,16 +1342,88 @@ minstrel_ht_free_sta(void *priv, struct + kfree(msp); + } + ++static void ++minstrel_ht_init_cck_rates(struct minstrel_priv *mp) ++{ ++ static const int bitrates[4] = { 10, 20, 55, 110 }; ++ struct ieee80211_supported_band *sband; ++ u32 rate_flags = ieee80211_chandef_rate_flags(&mp->hw->conf.chandef); ++ int i, j; ++ ++ sband = mp->hw->wiphy->bands[NL80211_BAND_2GHZ]; ++ if (!sband) ++ return; ++ ++ for (i = 0, j = 0; i < sband->n_bitrates; i++) { ++ struct ieee80211_rate *rate = &sband->bitrates[i]; ++ ++ if (rate->flags & IEEE80211_RATE_ERP_G) ++ continue; ++ ++ if ((rate_flags & sband->bitrates[i].flags) != rate_flags) ++ continue; ++ ++ for (j = 0; j < ARRAY_SIZE(bitrates); j++) { ++ if (rate->bitrate != bitrates[j]) ++ continue; ++ ++ mp->cck_rates[j] = i; ++ break; ++ } ++ } ++} ++ + static void * + minstrel_ht_alloc(struct ieee80211_hw *hw, struct dentry *debugfsdir) + { +- return mac80211_minstrel.alloc(hw, debugfsdir); ++ struct minstrel_priv *mp; ++ ++ mp = kzalloc(sizeof(struct minstrel_priv), GFP_ATOMIC); ++ if (!mp) ++ return NULL; ++ ++ /* contention window settings ++ * Just an approximation. Using the per-queue values would complicate ++ * the calculations and is probably unnecessary */ ++ mp->cw_min = 15; ++ mp->cw_max = 1023; ++ ++ /* number of packets (in %) to use for sampling other rates ++ * sample less often for non-mrr packets, because the overhead ++ * is much higher than with mrr */ ++ mp->lookaround_rate = 5; ++ mp->lookaround_rate_mrr = 10; ++ ++ /* maximum time that the hw is allowed to stay in one MRR segment */ ++ mp->segment_size = 6000; ++ ++ if (hw->max_rate_tries > 0) ++ mp->max_retry = hw->max_rate_tries; ++ else ++ /* safe default, does not necessarily have to match hw properties */ ++ mp->max_retry = 7; ++ ++ if (hw->max_rates >= 4) ++ mp->has_mrr = true; ++ ++ mp->hw = hw; ++ mp->update_interval = 100; ++ ++#ifdef CPTCFG_MAC80211_DEBUGFS ++ mp->fixed_rate_idx = (u32) -1; ++ debugfs_create_u32("fixed_rate_idx", S_IRUGO | S_IWUGO, debugfsdir, ++ &mp->fixed_rate_idx); ++#endif ++ ++ minstrel_ht_init_cck_rates(mp); ++ ++ return mp; + } + + static void + minstrel_ht_free(void *priv) + { +- mac80211_minstrel.free(priv); ++ kfree(priv); + } + + static u32 minstrel_ht_get_expected_throughput(void *priv_sta) +@@ -1417,14 +1482,14 @@ static void __init init_sample_table(voi + } + + int __init +-rc80211_minstrel_ht_init(void) ++rc80211_minstrel_init(void) + { + init_sample_table(); + return ieee80211_rate_control_register(&mac80211_minstrel_ht); + } + + void +-rc80211_minstrel_ht_exit(void) ++rc80211_minstrel_exit(void) + { + ieee80211_rate_control_unregister(&mac80211_minstrel_ht); + } +--- a/net/mac80211/rc80211_minstrel_ht.h ++++ b/net/mac80211/rc80211_minstrel_ht.h +@@ -15,11 +15,7 @@ + */ + #define MINSTREL_MAX_STREAMS 3 + #define MINSTREL_HT_STREAM_GROUPS 4 /* BW(=2) * SGI(=2) */ +-#ifdef CPTCFG_MAC80211_RC_MINSTREL_VHT + #define MINSTREL_VHT_STREAM_GROUPS 6 /* BW(=3) * SGI(=2) */ +-#else +-#define MINSTREL_VHT_STREAM_GROUPS 0 +-#endif + + #define MINSTREL_HT_GROUPS_NB (MINSTREL_MAX_STREAMS * \ + MINSTREL_HT_STREAM_GROUPS) +@@ -34,11 +30,7 @@ + #define MINSTREL_CCK_GROUP (MINSTREL_HT_GROUP_0 + MINSTREL_HT_GROUPS_NB) + #define MINSTREL_VHT_GROUP_0 (MINSTREL_CCK_GROUP + 1) + +-#ifdef CPTCFG_MAC80211_RC_MINSTREL_VHT + #define MCS_GROUP_RATES 10 +-#else +-#define MCS_GROUP_RATES 8 +-#endif + + struct mcs_group { + u32 flags; +--- a/net/mac80211/rc80211_minstrel_ht_debugfs.c ++++ b/net/mac80211/rc80211_minstrel_ht_debugfs.c +@@ -15,6 +15,22 @@ + #include "rc80211_minstrel.h" + #include "rc80211_minstrel_ht.h" + ++static ssize_t ++minstrel_stats_read(struct file *file, char __user *buf, size_t len, loff_t *ppos) ++{ ++ struct minstrel_debugfs_info *ms; ++ ++ ms = file->private_data; ++ return simple_read_from_buffer(buf, len, ppos, ms->buf, ms->len); ++} ++ ++static int ++minstrel_stats_release(struct inode *inode, struct file *file) ++{ ++ kfree(file->private_data); ++ return 0; ++} ++ + static char * + minstrel_ht_stats_dump(struct minstrel_ht_sta *mi, int i, char *p) + { diff --git a/package/kernel/mac80211/patches/372-mac80211-minstrel-reduce-minstrel_mcs_groups-size.patch b/package/kernel/mac80211/patches/372-mac80211-minstrel-reduce-minstrel_mcs_groups-size.patch new file mode 100644 index 0000000000..fa51f1be7e --- /dev/null +++ b/package/kernel/mac80211/patches/372-mac80211-minstrel-reduce-minstrel_mcs_groups-size.patch @@ -0,0 +1,358 @@ +From: Felix Fietkau +Date: Sat, 10 Feb 2018 12:45:47 +0100 +Subject: [PATCH] mac80211: minstrel: reduce minstrel_mcs_groups size + +By storing a shift value for all duration values of a group, we can +reduce precision by a neglegible amount to make it fit into a u16 value. +This improves cache footprint and reduces size: + +Before: + text data bss dec hex filename + 10024 116 0 10140 279c rc80211_minstrel_ht.o + +After: + text data bss dec hex filename + 9368 116 0 9484 250c rc80211_minstrel_ht.o + +Signed-off-by: Felix Fietkau +--- + +--- a/net/mac80211/rc80211_minstrel_ht.c ++++ b/net/mac80211/rc80211_minstrel_ht.c +@@ -52,22 +52,23 @@ + _streams - 1 + + /* MCS rate information for an MCS group */ +-#define MCS_GROUP(_streams, _sgi, _ht40) \ ++#define MCS_GROUP(_streams, _sgi, _ht40, _s) \ + [GROUP_IDX(_streams, _sgi, _ht40)] = { \ + .streams = _streams, \ ++ .shift = _s, \ + .flags = \ + IEEE80211_TX_RC_MCS | \ + (_sgi ? IEEE80211_TX_RC_SHORT_GI : 0) | \ + (_ht40 ? IEEE80211_TX_RC_40_MHZ_WIDTH : 0), \ + .duration = { \ +- MCS_DURATION(_streams, _sgi, _ht40 ? 54 : 26), \ +- MCS_DURATION(_streams, _sgi, _ht40 ? 108 : 52), \ +- MCS_DURATION(_streams, _sgi, _ht40 ? 162 : 78), \ +- MCS_DURATION(_streams, _sgi, _ht40 ? 216 : 104), \ +- MCS_DURATION(_streams, _sgi, _ht40 ? 324 : 156), \ +- MCS_DURATION(_streams, _sgi, _ht40 ? 432 : 208), \ +- MCS_DURATION(_streams, _sgi, _ht40 ? 486 : 234), \ +- MCS_DURATION(_streams, _sgi, _ht40 ? 540 : 260) \ ++ MCS_DURATION(_streams, _sgi, _ht40 ? 54 : 26) >> _s, \ ++ MCS_DURATION(_streams, _sgi, _ht40 ? 108 : 52) >> _s, \ ++ MCS_DURATION(_streams, _sgi, _ht40 ? 162 : 78) >> _s, \ ++ MCS_DURATION(_streams, _sgi, _ht40 ? 216 : 104) >> _s, \ ++ MCS_DURATION(_streams, _sgi, _ht40 ? 324 : 156) >> _s, \ ++ MCS_DURATION(_streams, _sgi, _ht40 ? 432 : 208) >> _s, \ ++ MCS_DURATION(_streams, _sgi, _ht40 ? 486 : 234) >> _s, \ ++ MCS_DURATION(_streams, _sgi, _ht40 ? 540 : 260) >> _s \ + } \ + } + +@@ -80,9 +81,10 @@ + #define BW2VBPS(_bw, r3, r2, r1) \ + (_bw == BW_80 ? r3 : _bw == BW_40 ? r2 : r1) + +-#define VHT_GROUP(_streams, _sgi, _bw) \ ++#define VHT_GROUP(_streams, _sgi, _bw, _s) \ + [VHT_GROUP_IDX(_streams, _sgi, _bw)] = { \ + .streams = _streams, \ ++ .shift = _s, \ + .flags = \ + IEEE80211_TX_RC_VHT_MCS | \ + (_sgi ? IEEE80211_TX_RC_SHORT_GI : 0) | \ +@@ -90,25 +92,25 @@ + _bw == BW_40 ? IEEE80211_TX_RC_40_MHZ_WIDTH : 0), \ + .duration = { \ + MCS_DURATION(_streams, _sgi, \ +- BW2VBPS(_bw, 117, 54, 26)), \ ++ BW2VBPS(_bw, 117, 54, 26)) >> _s, \ + MCS_DURATION(_streams, _sgi, \ +- BW2VBPS(_bw, 234, 108, 52)), \ ++ BW2VBPS(_bw, 234, 108, 52)) >> _s, \ + MCS_DURATION(_streams, _sgi, \ +- BW2VBPS(_bw, 351, 162, 78)), \ ++ BW2VBPS(_bw, 351, 162, 78)) >> _s, \ + MCS_DURATION(_streams, _sgi, \ +- BW2VBPS(_bw, 468, 216, 104)), \ ++ BW2VBPS(_bw, 468, 216, 104)) >> _s, \ + MCS_DURATION(_streams, _sgi, \ +- BW2VBPS(_bw, 702, 324, 156)), \ ++ BW2VBPS(_bw, 702, 324, 156)) >> _s, \ + MCS_DURATION(_streams, _sgi, \ +- BW2VBPS(_bw, 936, 432, 208)), \ ++ BW2VBPS(_bw, 936, 432, 208)) >> _s, \ + MCS_DURATION(_streams, _sgi, \ +- BW2VBPS(_bw, 1053, 486, 234)), \ ++ BW2VBPS(_bw, 1053, 486, 234)) >> _s, \ + MCS_DURATION(_streams, _sgi, \ +- BW2VBPS(_bw, 1170, 540, 260)), \ ++ BW2VBPS(_bw, 1170, 540, 260)) >> _s, \ + MCS_DURATION(_streams, _sgi, \ +- BW2VBPS(_bw, 1404, 648, 312)), \ ++ BW2VBPS(_bw, 1404, 648, 312)) >> _s, \ + MCS_DURATION(_streams, _sgi, \ +- BW2VBPS(_bw, 1560, 720, 346)) \ ++ BW2VBPS(_bw, 1560, 720, 346)) >> _s \ + } \ + } + +@@ -121,19 +123,20 @@ + (CCK_DURATION((_bitrate > 10 ? 20 : 10), false, 60) + \ + CCK_DURATION(_bitrate, _short, AVG_PKT_SIZE)) + +-#define CCK_DURATION_LIST(_short) \ +- CCK_ACK_DURATION(10, _short), \ +- CCK_ACK_DURATION(20, _short), \ +- CCK_ACK_DURATION(55, _short), \ +- CCK_ACK_DURATION(110, _short) ++#define CCK_DURATION_LIST(_short, _s) \ ++ CCK_ACK_DURATION(10, _short) >> _s, \ ++ CCK_ACK_DURATION(20, _short) >> _s, \ ++ CCK_ACK_DURATION(55, _short) >> _s, \ ++ CCK_ACK_DURATION(110, _short) >> _s + +-#define CCK_GROUP \ ++#define CCK_GROUP(_s) \ + [MINSTREL_CCK_GROUP] = { \ + .streams = 0, \ + .flags = 0, \ ++ .shift = _s, \ + .duration = { \ +- CCK_DURATION_LIST(false), \ +- CCK_DURATION_LIST(true) \ ++ CCK_DURATION_LIST(false, _s), \ ++ CCK_DURATION_LIST(true, _s) \ + } \ + } + +@@ -151,47 +154,47 @@ MODULE_PARM_DESC(minstrel_vht_only, + * BW -> SGI -> #streams + */ + const struct mcs_group minstrel_mcs_groups[] = { +- MCS_GROUP(1, 0, BW_20), +- MCS_GROUP(2, 0, BW_20), +- MCS_GROUP(3, 0, BW_20), ++ MCS_GROUP(1, 0, BW_20, 5), ++ MCS_GROUP(2, 0, BW_20, 4), ++ MCS_GROUP(3, 0, BW_20, 4), + +- MCS_GROUP(1, 1, BW_20), +- MCS_GROUP(2, 1, BW_20), +- MCS_GROUP(3, 1, BW_20), ++ MCS_GROUP(1, 1, BW_20, 5), ++ MCS_GROUP(2, 1, BW_20, 4), ++ MCS_GROUP(3, 1, BW_20, 4), + +- MCS_GROUP(1, 0, BW_40), +- MCS_GROUP(2, 0, BW_40), +- MCS_GROUP(3, 0, BW_40), ++ MCS_GROUP(1, 0, BW_40, 4), ++ MCS_GROUP(2, 0, BW_40, 4), ++ MCS_GROUP(3, 0, BW_40, 4), + +- MCS_GROUP(1, 1, BW_40), +- MCS_GROUP(2, 1, BW_40), +- MCS_GROUP(3, 1, BW_40), ++ MCS_GROUP(1, 1, BW_40, 4), ++ MCS_GROUP(2, 1, BW_40, 4), ++ MCS_GROUP(3, 1, BW_40, 4), + +- CCK_GROUP, ++ CCK_GROUP(8), + +- VHT_GROUP(1, 0, BW_20), +- VHT_GROUP(2, 0, BW_20), +- VHT_GROUP(3, 0, BW_20), ++ VHT_GROUP(1, 0, BW_20, 5), ++ VHT_GROUP(2, 0, BW_20, 4), ++ VHT_GROUP(3, 0, BW_20, 4), + +- VHT_GROUP(1, 1, BW_20), +- VHT_GROUP(2, 1, BW_20), +- VHT_GROUP(3, 1, BW_20), ++ VHT_GROUP(1, 1, BW_20, 5), ++ VHT_GROUP(2, 1, BW_20, 4), ++ VHT_GROUP(3, 1, BW_20, 4), + +- VHT_GROUP(1, 0, BW_40), +- VHT_GROUP(2, 0, BW_40), +- VHT_GROUP(3, 0, BW_40), ++ VHT_GROUP(1, 0, BW_40, 4), ++ VHT_GROUP(2, 0, BW_40, 4), ++ VHT_GROUP(3, 0, BW_40, 4), + +- VHT_GROUP(1, 1, BW_40), +- VHT_GROUP(2, 1, BW_40), +- VHT_GROUP(3, 1, BW_40), ++ VHT_GROUP(1, 1, BW_40, 4), ++ VHT_GROUP(2, 1, BW_40, 4), ++ VHT_GROUP(3, 1, BW_40, 4), + +- VHT_GROUP(1, 0, BW_80), +- VHT_GROUP(2, 0, BW_80), +- VHT_GROUP(3, 0, BW_80), ++ VHT_GROUP(1, 0, BW_80, 4), ++ VHT_GROUP(2, 0, BW_80, 4), ++ VHT_GROUP(3, 0, BW_80, 4), + +- VHT_GROUP(1, 1, BW_80), +- VHT_GROUP(2, 1, BW_80), +- VHT_GROUP(3, 1, BW_80), ++ VHT_GROUP(1, 1, BW_80, 4), ++ VHT_GROUP(2, 1, BW_80, 4), ++ VHT_GROUP(3, 1, BW_80, 4), + }; + + static u8 sample_table[SAMPLE_COLUMNS][MCS_GROUP_RATES] __read_mostly; +@@ -307,7 +310,8 @@ minstrel_ht_get_tp_avg(struct minstrel_h + if (group != MINSTREL_CCK_GROUP) + nsecs = 1000 * mi->overhead / MINSTREL_TRUNC(mi->avg_ampdu_len); + +- nsecs += minstrel_mcs_groups[group].duration[rate]; ++ nsecs += minstrel_mcs_groups[group].duration[rate] << ++ minstrel_mcs_groups[group].shift; + + /* + * For the throughput calculation, limit the probability value to 90% to +@@ -755,12 +759,19 @@ minstrel_ht_tx_status(void *priv, struct + minstrel_ht_update_rates(mp, mi); + } + ++static inline int ++minstrel_get_duration(int index) ++{ ++ const struct mcs_group *group = &minstrel_mcs_groups[index / MCS_GROUP_RATES]; ++ unsigned int duration = group->duration[index % MCS_GROUP_RATES]; ++ return duration << group->shift; ++} ++ + static void + minstrel_calc_retransmit(struct minstrel_priv *mp, struct minstrel_ht_sta *mi, + int index) + { + struct minstrel_rate_stats *mrs; +- const struct mcs_group *group; + unsigned int tx_time, tx_time_rtscts, tx_time_data; + unsigned int cw = mp->cw_min; + unsigned int ctime = 0; +@@ -779,8 +790,7 @@ minstrel_calc_retransmit(struct minstrel + mrs->retry_count_rtscts = 2; + mrs->retry_updated = true; + +- group = &minstrel_mcs_groups[index / MCS_GROUP_RATES]; +- tx_time_data = group->duration[index % MCS_GROUP_RATES] * ampdu_len / 1000; ++ tx_time_data = minstrel_get_duration(index) * ampdu_len / 1000; + + /* Contention time for first 2 tries */ + ctime = (t_slot * cw) >> 1; +@@ -874,20 +884,24 @@ minstrel_ht_get_max_amsdu_len(struct min + int group = mi->max_prob_rate / MCS_GROUP_RATES; + const struct mcs_group *g = &minstrel_mcs_groups[group]; + int rate = mi->max_prob_rate % MCS_GROUP_RATES; ++ unsigned int duration; + + /* Disable A-MSDU if max_prob_rate is bad */ + if (mi->groups[group].rates[rate].prob_ewma < MINSTREL_FRAC(50, 100)) + return 1; + ++ duration = g->duration[rate]; ++ duration <<= g->shift; ++ + /* If the rate is slower than single-stream MCS1, make A-MSDU limit small */ +- if (g->duration[rate] > MCS_DURATION(1, 0, 52)) ++ if (duration > MCS_DURATION(1, 0, 52)) + return 500; + + /* + * If the rate is slower than single-stream MCS4, limit A-MSDU to usual + * data packet size + */ +- if (g->duration[rate] > MCS_DURATION(1, 0, 104)) ++ if (duration > MCS_DURATION(1, 0, 104)) + return 1600; + + /* +@@ -895,7 +909,7 @@ minstrel_ht_get_max_amsdu_len(struct min + * rate success probability is less than 75%, limit A-MSDU to twice the usual + * data packet size + */ +- if (g->duration[rate] > MCS_DURATION(1, 0, 260) || ++ if (duration > MCS_DURATION(1, 0, 260) || + (minstrel_ht_get_prob_ewma(mi, mi->max_tp_rate[0]) < + MINSTREL_FRAC(75, 100))) + return 3200; +@@ -942,13 +956,6 @@ minstrel_ht_update_rates(struct minstrel + rate_control_set_rates(mp->hw, mi->sta, rates); + } + +-static inline int +-minstrel_get_duration(int index) +-{ +- const struct mcs_group *group = &minstrel_mcs_groups[index / MCS_GROUP_RATES]; +- return group->duration[index % MCS_GROUP_RATES]; +-} +- + static int + minstrel_get_sample_rate(struct minstrel_priv *mp, struct minstrel_ht_sta *mi) + { +--- a/net/mac80211/rc80211_minstrel_ht.h ++++ b/net/mac80211/rc80211_minstrel_ht.h +@@ -33,9 +33,10 @@ + #define MCS_GROUP_RATES 10 + + struct mcs_group { +- u32 flags; +- unsigned int streams; +- unsigned int duration[MCS_GROUP_RATES]; ++ u16 flags; ++ u8 streams; ++ u8 shift; ++ u16 duration[MCS_GROUP_RATES]; + }; + + extern const struct mcs_group minstrel_mcs_groups[]; +--- a/net/mac80211/rc80211_minstrel_ht_debugfs.c ++++ b/net/mac80211/rc80211_minstrel_ht_debugfs.c +@@ -58,6 +58,7 @@ minstrel_ht_stats_dump(struct minstrel_h + static const int bitrates[4] = { 10, 20, 55, 110 }; + int idx = i * MCS_GROUP_RATES + j; + unsigned int prob_ewmsd; ++ unsigned int duration; + + if (!(mi->supported[i] & BIT(j))) + continue; +@@ -95,7 +96,9 @@ minstrel_ht_stats_dump(struct minstrel_h + p += sprintf(p, " %3u ", idx); + + /* tx_time[rate(i)] in usec */ +- tx_time = DIV_ROUND_CLOSEST(mg->duration[j], 1000); ++ duration = mg->duration[j]; ++ duration <<= mg->shift; ++ tx_time = DIV_ROUND_CLOSEST(duration, 1000); + p += sprintf(p, "%6u ", tx_time); + + tp_max = minstrel_ht_get_tp_avg(mi, i, j, MINSTREL_FRAC(100, 100)); +@@ -204,6 +207,7 @@ minstrel_ht_stats_csv_dump(struct minstr + static const int bitrates[4] = { 10, 20, 55, 110 }; + int idx = i * MCS_GROUP_RATES + j; + unsigned int prob_ewmsd; ++ unsigned int duration; + + if (!(mi->supported[i] & BIT(j))) + continue; +@@ -238,7 +242,10 @@ minstrel_ht_stats_csv_dump(struct minstr + } + + p += sprintf(p, "%u,", idx); +- tx_time = DIV_ROUND_CLOSEST(mg->duration[j], 1000); ++ ++ duration = mg->duration[j]; ++ duration <<= mg->shift; ++ tx_time = DIV_ROUND_CLOSEST(duration, 1000); + p += sprintf(p, "%u,", tx_time); + + tp_max = minstrel_ht_get_tp_avg(mi, i, j, MINSTREL_FRAC(100, 100)); diff --git a/package/kernel/mac80211/patches/373-mac80211-minstrel-fix-using-short-preamble-CCK-rates.patch b/package/kernel/mac80211/patches/373-mac80211-minstrel-fix-using-short-preamble-CCK-rates.patch new file mode 100644 index 0000000000..1255da992c --- /dev/null +++ b/package/kernel/mac80211/patches/373-mac80211-minstrel-fix-using-short-preamble-CCK-rates.patch @@ -0,0 +1,23 @@ +From: Felix Fietkau +Date: Sat, 10 Feb 2018 13:43:07 +0100 +Subject: [PATCH] mac80211: minstrel: fix using short preamble CCK rates on + HT clients + +mi->supported[MINSTREL_CCK_GROUP] needs to be updated + +Fixes: 782dda00ab8e ("mac80211: minstrel_ht: move short preamble check out of get_rate") +Signed-off-by: Felix Fietkau +--- + +--- a/net/mac80211/rc80211_minstrel_ht.c ++++ b/net/mac80211/rc80211_minstrel_ht.c +@@ -1268,7 +1268,8 @@ minstrel_ht_update_caps(void *priv, stru + goto use_legacy; + + if (test_sta_flag(sinfo, WLAN_STA_SHORT_PREAMBLE)) +- mi->cck_supported_short |= mi->cck_supported_short << 4; ++ mi->supported[MINSTREL_CCK_GROUP] |= ++ mi->cck_supported_short << 4; + + /* create an initial rate table with the lowest supported rates */ + minstrel_ht_update_stats(mp, mi); diff --git a/package/kernel/mac80211/patches/374-ath9k-Protect-queue-draining-by-rcu_read_lock.patch b/package/kernel/mac80211/patches/374-ath9k-Protect-queue-draining-by-rcu_read_lock.patch new file mode 100644 index 0000000000..9970574e14 --- /dev/null +++ b/package/kernel/mac80211/patches/374-ath9k-Protect-queue-draining-by-rcu_read_lock.patch @@ -0,0 +1,43 @@ +From: =?UTF-8?q?Toke=20H=C3=B8iland-J=C3=B8rgensen?= +Date: Fri, 2 Feb 2018 11:36:45 +0100 +Subject: [PATCH] ath9k: Protect queue draining by rcu_read_lock() +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +When ath9k was switched over to use the mac80211 intermediate queues, +node cleanup now drains the mac80211 queues. However, this call path is +not protected by rcu_read_lock() as it was previously entirely internal +to the driver which uses its own locking. + +This leads to a possible rcu_dereference() without holding +rcu_read_lock(); but only if a station is cleaned up while having +packets queued on the TXQ. Fix this by adding the rcu_read_lock() to the +caller in ath9k. + +Fixes: 50f08edf9809 ("ath9k: Switch to using mac80211 intermediate software queues.") +Cc: stable@vger.kernel.org +Reported-by: Ben Greear +Signed-off-by: Toke Høiland-Jørgensen +--- + +--- a/drivers/net/wireless/ath/ath9k/xmit.c ++++ b/drivers/net/wireless/ath/ath9k/xmit.c +@@ -2930,6 +2930,8 @@ void ath_tx_node_cleanup(struct ath_soft + struct ath_txq *txq; + int tidno; + ++ rcu_read_lock(); ++ + for (tidno = 0; tidno < IEEE80211_NUM_TIDS; tidno++) { + tid = ath_node_to_tid(an, tidno); + txq = tid->txq; +@@ -2947,6 +2949,8 @@ void ath_tx_node_cleanup(struct ath_soft + if (!an->sta) + break; /* just one multicast ath_atx_tid */ + } ++ ++ rcu_read_unlock(); + } + + #ifdef CPTCFG_ATH9K_TX99 diff --git a/package/kernel/mac80211/patches/375-mac80211-minstrel-fix-CCK-rate-group-streams-value.patch b/package/kernel/mac80211/patches/375-mac80211-minstrel-fix-CCK-rate-group-streams-value.patch new file mode 100644 index 0000000000..f0ffcd9655 --- /dev/null +++ b/package/kernel/mac80211/patches/375-mac80211-minstrel-fix-CCK-rate-group-streams-value.patch @@ -0,0 +1,20 @@ +From: Felix Fietkau +Date: Thu, 1 Mar 2018 13:27:54 +0100 +Subject: [PATCH] mac80211: minstrel: fix CCK rate group streams value + +Fixes a harmless underflow issue when CCK rates are actively being used + +Signed-off-by: Felix Fietkau +--- + +--- a/net/mac80211/rc80211_minstrel_ht.c ++++ b/net/mac80211/rc80211_minstrel_ht.c +@@ -131,7 +131,7 @@ + + #define CCK_GROUP(_s) \ + [MINSTREL_CCK_GROUP] = { \ +- .streams = 0, \ ++ .streams = 1, \ + .flags = 0, \ + .shift = _s, \ + .duration = { \ diff --git a/package/kernel/mac80211/patches/376-mac80211-minstrel-fix-sampling-reporting-of-CCK-rate.patch b/package/kernel/mac80211/patches/376-mac80211-minstrel-fix-sampling-reporting-of-CCK-rate.patch new file mode 100644 index 0000000000..e0049c36eb --- /dev/null +++ b/package/kernel/mac80211/patches/376-mac80211-minstrel-fix-sampling-reporting-of-CCK-rate.patch @@ -0,0 +1,58 @@ +From: Felix Fietkau +Date: Thu, 1 Mar 2018 13:28:48 +0100 +Subject: [PATCH] mac80211: minstrel: fix sampling/reporting of CCK rates + in HT mode + +Long/short preamble selection cannot be sampled separately, since it +depends on the BSS state. Because of that, sampling attempts to +currently not used preamble modes are not counted in the statistics, +which leads to CCK rates being sampled too often. + +Fix statistics accounting for long/short preamble by increasing the +index where necessary. +Fix excessive CCK rate sampling by dropping unsupported sample attempts. + +This improves throughput on 2.4 GHz channels + +Signed-off-by: Felix Fietkau +--- + +--- a/net/mac80211/rc80211_minstrel_ht.c ++++ b/net/mac80211/rc80211_minstrel_ht.c +@@ -281,7 +281,8 @@ minstrel_ht_get_stats(struct minstrel_pr + break; + + /* short preamble */ +- if (!(mi->supported[group] & BIT(idx))) ++ if ((mi->supported[group] & BIT(idx + 4)) && ++ (rate->flags & IEEE80211_TX_RC_USE_SHORT_PREAMBLE)) + idx += 4; + } + return &mi->groups[group].rates[idx]; +@@ -1080,18 +1081,23 @@ minstrel_ht_get_rate(void *priv, struct + return; + + sample_group = &minstrel_mcs_groups[sample_idx / MCS_GROUP_RATES]; ++ sample_idx %= MCS_GROUP_RATES; ++ ++ if (sample_group == &minstrel_mcs_groups[MINSTREL_CCK_GROUP] && ++ (sample_idx >= 4) != txrc->short_preamble) ++ return; ++ + info->flags |= IEEE80211_TX_CTL_RATE_CTRL_PROBE; + rate->count = 1; + +- if (sample_idx / MCS_GROUP_RATES == MINSTREL_CCK_GROUP) { ++ if (sample_group == &minstrel_mcs_groups[MINSTREL_CCK_GROUP]) { + int idx = sample_idx % ARRAY_SIZE(mp->cck_rates); + rate->idx = mp->cck_rates[idx]; + } else if (sample_group->flags & IEEE80211_TX_RC_VHT_MCS) { + ieee80211_rate_set_vht(rate, sample_idx % MCS_GROUP_RATES, + sample_group->streams); + } else { +- rate->idx = sample_idx % MCS_GROUP_RATES + +- (sample_group->streams - 1) * 8; ++ rate->idx = sample_idx + (sample_group->streams - 1) * 8; + } + + rate->flags = sample_group->flags;