From: Felix Fietkau Date: Sat, 8 Oct 2016 11:53:14 +0000 (+0200) Subject: mac80211: update to wireless-testing 2016-10-08 X-Git-Url: http://git.lede-project.org./?a=commitdiff_plain;h=ad51e09fd1301484820a466a49447a34d7504882;p=openwrt%2Fstaging%2Fstintel.git mac80211: update to wireless-testing 2016-10-08 Signed-off-by: Felix Fietkau --- diff --git a/package/kernel/mac80211/Makefile b/package/kernel/mac80211/Makefile index 91c9362e93..f9f50932e3 100644 --- a/package/kernel/mac80211/Makefile +++ b/package/kernel/mac80211/Makefile @@ -10,11 +10,11 @@ include $(INCLUDE_DIR)/kernel.mk PKG_NAME:=mac80211 -PKG_VERSION:=2016-06-20 +PKG_VERSION:=2016-10-08 PKG_RELEASE:=1 PKG_SOURCE_URL:=http://mirror2.openwrt.org/sources PKG_BACKPORT_VERSION:= -PKG_MD5SUM:=29c79bdc3928ef5113b17042ebda9237 +PKG_MD5SUM:=4f6350e3b75815060bfdf47ef266ad613c7bfea5b7b1dc4552dee69e1bebe4fb PKG_SOURCE:=compat-wireless-$(PKG_VERSION)$(PKG_BACKPORT_VERSION).tar.bz2 PKG_BUILD_DIR:=$(KERNEL_BUILD_DIR)/compat-wireless-$(PKG_VERSION) diff --git a/package/kernel/mac80211/patches/004-fix_duplicate_skcipher_backport.patch b/package/kernel/mac80211/patches/004-fix_duplicate_skcipher_backport.patch index 38b31795a4..22819f7ed2 100644 --- a/package/kernel/mac80211/patches/004-fix_duplicate_skcipher_backport.patch +++ b/package/kernel/mac80211/patches/004-fix_duplicate_skcipher_backport.patch @@ -1,6 +1,6 @@ --- a/compat/Makefile +++ b/compat/Makefile -@@ -35,8 +35,6 @@ compat-$(CPTCFG_KERNEL_4_6) += backport- +@@ -36,8 +36,6 @@ compat-$(CPTCFG_KERNEL_4_7) += backport- compat-$(CPTCFG_BPAUTO_BUILD_CRYPTO_CCM) += crypto-ccm.o compat-$(CPTCFG_BPAUTO_CRYPTO_SKCIPHER) += crypto-skcipher.o diff --git a/package/kernel/mac80211/patches/006-add-basic-register-field-manipulation-macros.patch b/package/kernel/mac80211/patches/006-add-basic-register-field-manipulation-macros.patch deleted file mode 100644 index a51edf8182..0000000000 --- a/package/kernel/mac80211/patches/006-add-basic-register-field-manipulation-macros.patch +++ /dev/null @@ -1,145 +0,0 @@ -From: Jakub Kicinski -Date: Wed, 31 Aug 2016 12:46:44 +0100 -Subject: [PATCH] add basic register-field manipulation macros - -Common approach to accessing register fields is to define -structures or sets of macros containing mask and shift pair. -Operations on the register are then performed as follows: - - field = (reg >> shift) & mask; - - reg &= ~(mask << shift); - reg |= (field & mask) << shift; - -Defining shift and mask separately is tedious. Ivo van Doorn -came up with an idea of computing them at compilation time -based on a single shifted mask (later refined by Felix) which -can be used like this: - - #define REG_FIELD 0x000ff000 - - field = FIELD_GET(REG_FIELD, reg); - - reg &= ~REG_FIELD; - reg |= FIELD_PREP(REG_FIELD, field); - -FIELD_{GET,PREP} macros take care of finding out what the -appropriate shift is based on compilation time ffs operation. - -GENMASK can be used to define registers (which is usually -less error-prone and easier to match with datasheets). - -This approach is the most convenient I've seen so to limit code -multiplication let's move the macros to a global header file. -Attempts to use static inlines instead of macros failed due -to false positive triggering of BUILD_BUG_ON()s, especially with -GCC < 6.0. - -Signed-off-by: Jakub Kicinski -Reviewed-by: Dinan Gunawardena ---- - create mode 100644 include/linux/bitfield.h - ---- /dev/null -+++ b/include/linux/bitfield.h -@@ -0,0 +1,100 @@ -+/* -+ * Copyright (C) 2014 Felix Fietkau -+ * Copyright (C) 2004 - 2009 Ivo van Doorn -+ * -+ * This program is free software; you can redistribute it and/or modify -+ * it under the terms of the GNU General Public License version 2 -+ * as published by the Free Software Foundation -+ * -+ * This program is distributed in the hope that it will be useful, -+ * but WITHOUT ANY WARRANTY; without even the implied warranty of -+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -+ * GNU General Public License for more details. -+ */ -+ -+#ifndef _LINUX_BITFIELD_H -+#define _LINUX_BITFIELD_H -+ -+#include -+ -+#ifdef __CHECKER__ -+#define __BUILD_BUG_ON_NOT_POWER_OF_2(n) (0) -+#else -+#define __BUILD_BUG_ON_NOT_POWER_OF_2(n) \ -+ BUILD_BUG_ON(((n) & ((n) - 1)) != 0) -+#endif -+ -+/* -+ * Bitfield access macros -+ * -+ * FIELD_{GET,PREP} macros take as first parameter shifted mask -+ * from which they extract the base mask and shift amount. -+ * Mask must be a compilation time constant. -+ * -+ * Example: -+ * -+ * #define REG_FIELD_A GENMASK(6, 0) -+ * #define REG_FIELD_B BIT(7) -+ * #define REG_FIELD_C GENMASK(15, 8) -+ * #define REG_FIELD_D GENMASK(31, 16) -+ * -+ * Get: -+ * a = FIELD_GET(REG_FIELD_A, reg); -+ * b = FIELD_GET(REG_FIELD_B, reg); -+ * -+ * Set: -+ * reg = FIELD_PREP(REG_FIELD_A, 1) | -+ * FIELD_PREP(REG_FIELD_B, 0) | -+ * FIELD_PREP(REG_FIELD_C, c) | -+ * FIELD_PREP(REG_FIELD_D, 0x40); -+ * -+ * Modify: -+ * reg &= ~REG_FIELD_C; -+ * reg |= FIELD_PREP(REG_FIELD_C, c); -+ */ -+ -+#define __bf_shf(x) (__builtin_ffsll(x) - 1) -+ -+#define __BF_FIELD_CHECK(_mask, _reg, _val, _pfx) \ -+ ({ \ -+ BUILD_BUG_ON_MSG(!__builtin_constant_p(_mask), \ -+ _pfx "mask is not constant"); \ -+ BUILD_BUG_ON_MSG(!(_mask), _pfx "mask is zero"); \ -+ BUILD_BUG_ON_MSG(__builtin_constant_p(_val) ? \ -+ ~((_mask) >> __bf_shf(_mask)) & (_val) : 0, \ -+ _pfx "value too large for the field"); \ -+ BUILD_BUG_ON_MSG((_mask) > (typeof(_reg))~0ull, \ -+ _pfx "type of reg too small for mask"); \ -+ __BUILD_BUG_ON_NOT_POWER_OF_2((_mask) + \ -+ (1ULL << __bf_shf(_mask))); \ -+ }) -+ -+/** -+ * FIELD_PREP() - prepare a bitfield element -+ * @_mask: shifted mask defining the field's length and position -+ * @_val: value to put in the field -+ * -+ * FIELD_PREP() masks and shifts up the value. The result should -+ * be combined with other fields of the bitfield using logical OR. -+ */ -+#define FIELD_PREP(_mask, _val) \ -+ ({ \ -+ __BF_FIELD_CHECK(_mask, 0ULL, _val, "FIELD_PREP: "); \ -+ ((typeof(_mask))(_val) << __bf_shf(_mask)) & (_mask); \ -+ }) -+ -+/** -+ * FIELD_GET() - extract a bitfield element -+ * @_mask: shifted mask defining the field's length and position -+ * @_reg: 32bit value of entire bitfield -+ * -+ * FIELD_GET() extracts the field specified by @_mask from the -+ * bitfield passed in as @_reg by masking and shifting it down. -+ */ -+#define FIELD_GET(_mask, _reg) \ -+ ({ \ -+ __BF_FIELD_CHECK(_mask, _reg, 0U, "FIELD_GET: "); \ -+ (typeof(_mask))(((_reg) & (_mask)) >> __bf_shf(_mask)); \ -+ }) -+ -+#endif diff --git a/package/kernel/mac80211/patches/060-no_local_ssb_bcma.patch b/package/kernel/mac80211/patches/060-no_local_ssb_bcma.patch index 8be5fa15e9..4df5ac57f0 100644 --- a/package/kernel/mac80211/patches/060-no_local_ssb_bcma.patch +++ b/package/kernel/mac80211/patches/060-no_local_ssb_bcma.patch @@ -1,6 +1,6 @@ --- a/.local-symbols +++ b/.local-symbols -@@ -481,45 +481,6 @@ USB_IPHETH= +@@ -477,45 +477,6 @@ USB_IPHETH= USB_SIERRA_NET= USB_VL600= USB_NET_CH9200= diff --git a/package/kernel/mac80211/patches/100-remove-cryptoapi-dependencies.patch b/package/kernel/mac80211/patches/100-remove-cryptoapi-dependencies.patch index fbe22e51b7..b65b0bd00e 100644 --- a/package/kernel/mac80211/patches/100-remove-cryptoapi-dependencies.patch +++ b/package/kernel/mac80211/patches/100-remove-cryptoapi-dependencies.patch @@ -34,12 +34,9 @@ #include "aes_ccm.h" -void ieee80211_aes_ccm_encrypt(struct crypto_aead *tfm, u8 *b_0, u8 *aad, -- u8 *data, size_t data_len, u8 *mic, -- size_t mic_len) +static void aes_ccm_prepare(struct crypto_cipher *tfm, u8 *b_0, u8 *aad, u8 *s_0, + u8 *a, u8 *b) - { -- struct scatterlist sg[3]; ++{ + int i; + + crypto_cipher_encrypt_one(tfm, b, b_0); @@ -54,55 +51,56 @@ + for (i = 0; i < AES_BLOCK_SIZE; i++) + aad[i] ^= b[i]; + crypto_cipher_encrypt_one(tfm, a, aad); - -- char aead_req_data[sizeof(struct aead_request) + -- crypto_aead_reqsize(tfm)] -- __aligned(__alignof__(struct aead_request)); -- struct aead_request *aead_req = (void *) aead_req_data; ++ + /* Mask out bits from auth-only-b_0 */ + b_0[0] &= 0x07; - -- memset(aead_req, 0, sizeof(aead_req_data)); ++ + /* S_0 is used to encrypt T (= MIC) */ + b_0[14] = 0; + b_0[15] = 0; + crypto_cipher_encrypt_one(tfm, s_0, b_0); +} - -- sg_init_table(sg, 3); -- sg_set_buf(&sg[0], &aad[2], be16_to_cpup((__be16 *)aad)); -- sg_set_buf(&sg[1], data, data_len); -- sg_set_buf(&sg[2], mic, mic_len); - -- aead_request_set_tfm(aead_req, tfm); -- aead_request_set_crypt(aead_req, sg, sg, data_len, b_0); -- aead_request_set_ad(aead_req, sg[0].length); ++ ++ +void ieee80211_aes_ccm_encrypt(struct crypto_cipher *tfm, u8 *b_0, u8 *aad, -+ u8 *data, size_t data_len, u8 *mic, -+ size_t mic_len) -+{ + u8 *data, size_t data_len, u8 *mic, + size_t mic_len) + { +- struct scatterlist sg[3]; + int i, j, last_len, num_blocks; + u8 b[AES_BLOCK_SIZE]; + u8 s_0[AES_BLOCK_SIZE]; + u8 e[AES_BLOCK_SIZE]; + u8 *pos, *cpos; -+ + +- char aead_req_data[sizeof(struct aead_request) + +- crypto_aead_reqsize(tfm)] +- __aligned(__alignof__(struct aead_request)); +- struct aead_request *aead_req = (void *) aead_req_data; + num_blocks = DIV_ROUND_UP(data_len, AES_BLOCK_SIZE); + last_len = data_len % AES_BLOCK_SIZE; + aes_ccm_prepare(tfm, b_0, aad, s_0, b, b); -+ + +- memset(aead_req, 0, sizeof(aead_req_data)); + /* Process payload blocks */ + pos = data; + cpos = data; + for (j = 1; j <= num_blocks; j++) { + int blen = (j == num_blocks && last_len) ? + last_len : AES_BLOCK_SIZE; -+ + +- sg_init_table(sg, 3); +- sg_set_buf(&sg[0], &aad[2], be16_to_cpup((__be16 *)aad)); +- sg_set_buf(&sg[1], data, data_len); +- sg_set_buf(&sg[2], mic, mic_len); + /* Authentication followed by encryption */ + for (i = 0; i < blen; i++) + b[i] ^= pos[i]; + crypto_cipher_encrypt_one(tfm, b, b); -+ + +- aead_request_set_tfm(aead_req, tfm); +- aead_request_set_crypt(aead_req, sg, sg, data_len, b_0); +- aead_request_set_ad(aead_req, sg[0].length); + b_0[14] = (j >> 8) & 0xff; + b_0[15] = j & 0xff; + crypto_cipher_encrypt_one(tfm, e, b_0); @@ -125,37 +123,30 @@ - crypto_aead_reqsize(tfm)] - __aligned(__alignof__(struct aead_request)); - struct aead_request *aead_req = (void *) aead_req_data; -- -- if (data_len == 0) -- return -EINVAL; -- -- memset(aead_req, 0, sizeof(aead_req_data)); -- -- sg_init_table(sg, 3); -- sg_set_buf(&sg[0], &aad[2], be16_to_cpup((__be16 *)aad)); -- sg_set_buf(&sg[1], data, data_len); -- sg_set_buf(&sg[2], mic, mic_len); -- -- aead_request_set_tfm(aead_req, tfm); -- aead_request_set_crypt(aead_req, sg, sg, data_len + mic_len, b_0); -- aead_request_set_ad(aead_req, sg[0].length); + int i, j, last_len, num_blocks; + u8 *pos, *cpos; + u8 a[AES_BLOCK_SIZE]; + u8 b[AES_BLOCK_SIZE]; + u8 s_0[AES_BLOCK_SIZE]; -+ + +- if (data_len == 0) +- return -EINVAL; + num_blocks = DIV_ROUND_UP(data_len, AES_BLOCK_SIZE); + last_len = data_len % AES_BLOCK_SIZE; + aes_ccm_prepare(tfm, b_0, aad, s_0, a, b); -+ + +- memset(aead_req, 0, sizeof(aead_req_data)); + /* Process payload blocks */ + cpos = data; + pos = data; + for (j = 1; j <= num_blocks; j++) { + int blen = (j == num_blocks && last_len) ? + last_len : AES_BLOCK_SIZE; -+ + +- sg_init_table(sg, 3); +- sg_set_buf(&sg[0], &aad[2], be16_to_cpup((__be16 *)aad)); +- sg_set_buf(&sg[1], data, data_len); +- sg_set_buf(&sg[2], mic, mic_len); + /* Decryption followed by authentication */ + b_0[14] = (j >> 8) & 0xff; + b_0[15] = j & 0xff; @@ -166,7 +157,10 @@ + } + crypto_cipher_encrypt_one(tfm, a, a); + } -+ + +- aead_request_set_tfm(aead_req, tfm); +- aead_request_set_crypt(aead_req, sg, sg, data_len + mic_len, b_0); +- aead_request_set_ad(aead_req, sg[0].length); + for (i = 0; i < mic_len; i++) { + if ((mic[i] ^ s_0[i]) != a[i]) + return -1; @@ -185,12 +179,12 @@ { - struct crypto_aead *tfm; - int err; -+ struct crypto_cipher *tfm; - +- - tfm = crypto_alloc_aead("ccm(aes)", 0, CRYPTO_ALG_ASYNC); - if (IS_ERR(tfm)) - return tfm; -- ++ struct crypto_cipher *tfm; + - err = crypto_aead_setkey(tfm, key, key_len); - if (err) - goto free_aead; diff --git a/package/kernel/mac80211/patches/110-mac80211_keep_keys_on_stop_ap.patch b/package/kernel/mac80211/patches/110-mac80211_keep_keys_on_stop_ap.patch index 3ca166ff45..c42b17de38 100644 --- a/package/kernel/mac80211/patches/110-mac80211_keep_keys_on_stop_ap.patch +++ b/package/kernel/mac80211/patches/110-mac80211_keep_keys_on_stop_ap.patch @@ -2,7 +2,7 @@ Used for AP+STA support in OpenWrt - preserve AP mode keys across STA reconnects --- a/net/mac80211/cfg.c +++ b/net/mac80211/cfg.c -@@ -850,7 +850,6 @@ static int ieee80211_stop_ap(struct wiph +@@ -1016,7 +1016,6 @@ static int ieee80211_stop_ap(struct wiph sdata->u.ap.driver_smps_mode = IEEE80211_SMPS_OFF; __sta_info_flush(sdata, true); diff --git a/package/kernel/mac80211/patches/130-mac80211-hwsim-hrtimer-clock.patch b/package/kernel/mac80211/patches/130-mac80211-hwsim-hrtimer-clock.patch index cdcd5c8d28..29d70343bb 100644 --- a/package/kernel/mac80211/patches/130-mac80211-hwsim-hrtimer-clock.patch +++ b/package/kernel/mac80211/patches/130-mac80211-hwsim-hrtimer-clock.patch @@ -1,6 +1,6 @@ --- a/drivers/net/wireless/mac80211_hwsim.c +++ b/drivers/net/wireless/mac80211_hwsim.c -@@ -2631,7 +2631,7 @@ static int mac80211_hwsim_new_radio(stru +@@ -2662,7 +2662,7 @@ static int mac80211_hwsim_new_radio(stru tasklet_hrtimer_init(&data->beacon_timer, mac80211_hwsim_beacon, diff --git a/package/kernel/mac80211/patches/150-disable_addr_notifier.patch b/package/kernel/mac80211/patches/150-disable_addr_notifier.patch index 16fab84535..f4cb41cd30 100644 --- a/package/kernel/mac80211/patches/150-disable_addr_notifier.patch +++ b/package/kernel/mac80211/patches/150-disable_addr_notifier.patch @@ -18,7 +18,7 @@ static int ieee80211_ifa6_changed(struct notifier_block *nb, unsigned long data, void *arg) { -@@ -1090,14 +1090,14 @@ int ieee80211_register_hw(struct ieee802 +@@ -1101,14 +1101,14 @@ int ieee80211_register_hw(struct ieee802 if (result) goto fail_flows; @@ -35,7 +35,7 @@ local->ifa6_notifier.notifier_call = ieee80211_ifa6_changed; result = register_inet6addr_notifier(&local->ifa6_notifier); if (result) -@@ -1106,13 +1106,13 @@ int ieee80211_register_hw(struct ieee802 +@@ -1117,13 +1117,13 @@ int ieee80211_register_hw(struct ieee802 return 0; @@ -52,7 +52,7 @@ fail_ifa: #endif ieee80211_txq_teardown_flows(local); -@@ -1142,10 +1142,10 @@ void ieee80211_unregister_hw(struct ieee +@@ -1153,10 +1153,10 @@ void ieee80211_unregister_hw(struct ieee tasklet_kill(&local->tx_pending_tasklet); tasklet_kill(&local->tasklet); diff --git a/package/kernel/mac80211/patches/210-ap_scan.patch b/package/kernel/mac80211/patches/210-ap_scan.patch index 29f05c44d6..94f5f397c9 100644 --- a/package/kernel/mac80211/patches/210-ap_scan.patch +++ b/package/kernel/mac80211/patches/210-ap_scan.patch @@ -1,6 +1,6 @@ --- a/net/mac80211/cfg.c +++ b/net/mac80211/cfg.c -@@ -2008,7 +2008,7 @@ static int ieee80211_scan(struct wiphy * +@@ -2175,7 +2175,7 @@ static int ieee80211_scan(struct wiphy * * the frames sent while scanning on other channel will be * lost) */ diff --git a/package/kernel/mac80211/patches/300-ath9k-Switch-to-using-mac80211-intermediate-software.patch b/package/kernel/mac80211/patches/300-ath9k-Switch-to-using-mac80211-intermediate-software.patch new file mode 100644 index 0000000000..57917c5b45 --- /dev/null +++ b/package/kernel/mac80211/patches/300-ath9k-Switch-to-using-mac80211-intermediate-software.patch @@ -0,0 +1,953 @@ +From: =?UTF-8?q?Toke=20H=C3=B8iland-J=C3=B8rgensen?= +Date: Fri, 2 Sep 2016 16:00:30 +0200 +Subject: [PATCH] ath9k: Switch to using mac80211 intermediate software + queues. +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +This switches ath9k over to using the mac80211 intermediate software +queueing mechanism for data packets. It removes the queueing inside the +driver, except for the retry queue, and instead pulls from mac80211 when +a packet is needed. The retry queue is used to store a packet that was +pulled but can't be sent immediately. + +The old code path in ath_tx_start that would queue packets has been +removed completely, as has the qlen limit tunables (since there's no +longer a queue in the driver to limit). + +Based on Tim's original patch set, but reworked quite thoroughly. + +Cc: Tim Shepard +Cc: Felix Fietkau +Signed-off-by: Toke Høiland-Jørgensen +--- + +--- a/drivers/net/wireless/ath/ath9k/ath9k.h ++++ b/drivers/net/wireless/ath/ath9k/ath9k.h +@@ -91,7 +91,6 @@ int ath_descdma_setup(struct ath_softc * + #define ATH_RXBUF 512 + #define ATH_TXBUF 512 + #define ATH_TXBUF_RESERVE 5 +-#define ATH_MAX_QDEPTH (ATH_TXBUF / 4 - ATH_TXBUF_RESERVE) + #define ATH_TXMAXTRY 13 + #define ATH_MAX_SW_RETRIES 30 + +@@ -145,7 +144,7 @@ int ath_descdma_setup(struct ath_softc * + #define BAW_WITHIN(_start, _bawsz, _seqno) \ + ((((_seqno) - (_start)) & 4095) < (_bawsz)) + +-#define ATH_AN_2_TID(_an, _tidno) (&(_an)->tid[(_tidno)]) ++#define ATH_AN_2_TID(_an, _tidno) ath_node_to_tid(_an, _tidno) + + #define IS_HT_RATE(rate) (rate & 0x80) + #define IS_CCK_RATE(rate) ((rate >= 0x18) && (rate <= 0x1e)) +@@ -164,7 +163,6 @@ struct ath_txq { + spinlock_t axq_lock; + u32 axq_depth; + u32 axq_ampdu_depth; +- bool stopped; + bool axq_tx_inprogress; + struct list_head txq_fifo[ATH_TXFIFO_DEPTH]; + u8 txq_headidx; +@@ -232,7 +230,6 @@ struct ath_buf { + + struct ath_atx_tid { + struct list_head list; +- struct sk_buff_head buf_q; + struct sk_buff_head retry_q; + struct ath_node *an; + struct ath_txq *txq; +@@ -247,13 +244,13 @@ struct ath_atx_tid { + s8 bar_index; + bool active; + bool clear_ps_filter; ++ bool has_queued; + }; + + struct ath_node { + struct ath_softc *sc; + struct ieee80211_sta *sta; /* station struct we're part of */ + struct ieee80211_vif *vif; /* interface with which we're associated */ +- struct ath_atx_tid tid[IEEE80211_NUM_TIDS]; + + u16 maxampdu; + u8 mpdudensity; +@@ -276,7 +273,6 @@ struct ath_tx_control { + struct ath_node *an; + struct ieee80211_sta *sta; + u8 paprd; +- bool force_channel; + }; + + +@@ -293,7 +289,6 @@ struct ath_tx { + struct ath_descdma txdma; + struct ath_txq *txq_map[IEEE80211_NUM_ACS]; + struct ath_txq *uapsdq; +- u32 txq_max_pending[IEEE80211_NUM_ACS]; + u16 max_aggr_framelen[IEEE80211_NUM_ACS][4][32]; + }; + +@@ -421,6 +416,22 @@ struct ath_offchannel { + int duration; + }; + ++static inline struct ath_atx_tid * ++ath_node_to_tid(struct ath_node *an, u8 tidno) ++{ ++ struct ieee80211_sta *sta = an->sta; ++ struct ieee80211_vif *vif = an->vif; ++ struct ieee80211_txq *txq; ++ ++ BUG_ON(!vif); ++ if (sta) ++ txq = sta->txq[tidno % ARRAY_SIZE(sta->txq)]; ++ else ++ txq = vif->txq; ++ ++ return (struct ath_atx_tid *) txq->drv_priv; ++} ++ + #define case_rtn_string(val) case val: return #val + + #define ath_for_each_chanctx(_sc, _ctx) \ +@@ -575,7 +586,6 @@ void ath_tx_edma_tasklet(struct ath_soft + int ath_tx_aggr_start(struct ath_softc *sc, struct ieee80211_sta *sta, + u16 tid, u16 *ssn); + void ath_tx_aggr_stop(struct ath_softc *sc, struct ieee80211_sta *sta, u16 tid); +-void ath_tx_aggr_resume(struct ath_softc *sc, struct ieee80211_sta *sta, u16 tid); + + void ath_tx_aggr_wakeup(struct ath_softc *sc, struct ath_node *an); + void ath_tx_aggr_sleep(struct ieee80211_sta *sta, struct ath_softc *sc, +@@ -585,6 +595,7 @@ void ath9k_release_buffered_frames(struc + u16 tids, int nframes, + enum ieee80211_frame_release_type reason, + bool more_data); ++void ath9k_wake_tx_queue(struct ieee80211_hw *hw, struct ieee80211_txq *queue); + + /********/ + /* VIFs */ +--- a/drivers/net/wireless/ath/ath9k/channel.c ++++ b/drivers/net/wireless/ath/ath9k/channel.c +@@ -1010,7 +1010,6 @@ static void ath_scan_send_probe(struct a + goto error; + + txctl.txq = sc->tx.txq_map[IEEE80211_AC_VO]; +- txctl.force_channel = true; + if (ath_tx_start(sc->hw, skb, &txctl)) + goto error; + +@@ -1133,7 +1132,6 @@ ath_chanctx_send_vif_ps_frame(struct ath + memset(&txctl, 0, sizeof(txctl)); + txctl.txq = sc->tx.txq_map[IEEE80211_AC_VO]; + txctl.sta = sta; +- txctl.force_channel = true; + if (ath_tx_start(sc->hw, skb, &txctl)) { + ieee80211_free_txskb(sc->hw, skb); + return false; +--- a/drivers/net/wireless/ath/ath9k/debug.c ++++ b/drivers/net/wireless/ath/ath9k/debug.c +@@ -600,7 +600,6 @@ static int read_file_xmit(struct seq_fil + PR("MPDUs XRetried: ", xretries); + PR("Aggregates: ", a_aggr); + PR("AMPDUs Queued HW:", a_queued_hw); +- PR("AMPDUs Queued SW:", a_queued_sw); + PR("AMPDUs Completed:", a_completed); + PR("AMPDUs Retried: ", a_retries); + PR("AMPDUs XRetried: ", a_xretries); +@@ -629,8 +628,7 @@ static void print_queue(struct ath_softc + seq_printf(file, "%s: %d ", "qnum", txq->axq_qnum); + seq_printf(file, "%s: %2d ", "qdepth", txq->axq_depth); + seq_printf(file, "%s: %2d ", "ampdu-depth", txq->axq_ampdu_depth); +- seq_printf(file, "%s: %3d ", "pending", txq->pending_frames); +- seq_printf(file, "%s: %d\n", "stopped", txq->stopped); ++ seq_printf(file, "%s: %3d\n", "pending", txq->pending_frames); + + ath_txq_unlock(sc, txq); + } +@@ -1208,7 +1206,6 @@ static const char ath9k_gstrings_stats[] + AMKSTR(d_tx_mpdu_xretries), + AMKSTR(d_tx_aggregates), + AMKSTR(d_tx_ampdus_queued_hw), +- AMKSTR(d_tx_ampdus_queued_sw), + AMKSTR(d_tx_ampdus_completed), + AMKSTR(d_tx_ampdu_retries), + AMKSTR(d_tx_ampdu_xretries), +@@ -1288,7 +1285,6 @@ void ath9k_get_et_stats(struct ieee80211 + AWDATA(xretries); + AWDATA(a_aggr); + AWDATA(a_queued_hw); +- AWDATA(a_queued_sw); + AWDATA(a_completed); + AWDATA(a_retries); + AWDATA(a_xretries); +@@ -1346,14 +1342,6 @@ int ath9k_init_debug(struct ath_hw *ah) + read_file_xmit); + debugfs_create_devm_seqfile(sc->dev, "queues", sc->debug.debugfs_phy, + read_file_queues); +- debugfs_create_u32("qlen_bk", S_IRUSR | S_IWUSR, sc->debug.debugfs_phy, +- &sc->tx.txq_max_pending[IEEE80211_AC_BK]); +- debugfs_create_u32("qlen_be", S_IRUSR | S_IWUSR, sc->debug.debugfs_phy, +- &sc->tx.txq_max_pending[IEEE80211_AC_BE]); +- debugfs_create_u32("qlen_vi", S_IRUSR | S_IWUSR, sc->debug.debugfs_phy, +- &sc->tx.txq_max_pending[IEEE80211_AC_VI]); +- debugfs_create_u32("qlen_vo", S_IRUSR | S_IWUSR, sc->debug.debugfs_phy, +- &sc->tx.txq_max_pending[IEEE80211_AC_VO]); + debugfs_create_devm_seqfile(sc->dev, "misc", sc->debug.debugfs_phy, + read_file_misc); + debugfs_create_devm_seqfile(sc->dev, "reset", sc->debug.debugfs_phy, +--- a/drivers/net/wireless/ath/ath9k/debug.h ++++ b/drivers/net/wireless/ath/ath9k/debug.h +@@ -147,7 +147,6 @@ struct ath_interrupt_stats { + * @completed: Total MPDUs (non-aggr) completed + * @a_aggr: Total no. of aggregates queued + * @a_queued_hw: Total AMPDUs queued to hardware +- * @a_queued_sw: Total AMPDUs queued to software queues + * @a_completed: Total AMPDUs completed + * @a_retries: No. of AMPDUs retried (SW) + * @a_xretries: No. of AMPDUs dropped due to xretries +@@ -174,7 +173,6 @@ struct ath_tx_stats { + u32 xretries; + u32 a_aggr; + u32 a_queued_hw; +- u32 a_queued_sw; + u32 a_completed; + u32 a_retries; + u32 a_xretries; +--- a/drivers/net/wireless/ath/ath9k/debug_sta.c ++++ b/drivers/net/wireless/ath/ath9k/debug_sta.c +@@ -52,8 +52,8 @@ static ssize_t read_file_node_aggr(struc + "TID", "SEQ_START", "SEQ_NEXT", "BAW_SIZE", + "BAW_HEAD", "BAW_TAIL", "BAR_IDX", "SCHED", "PAUSED"); + +- for (tidno = 0, tid = &an->tid[tidno]; +- tidno < IEEE80211_NUM_TIDS; tidno++, tid++) { ++ for (tidno = 0; tidno < IEEE80211_NUM_TIDS; tidno++) { ++ tid = ath_node_to_tid(an, tidno); + txq = tid->txq; + ath_txq_lock(sc, txq); + if (tid->active) { +--- a/drivers/net/wireless/ath/ath9k/init.c ++++ b/drivers/net/wireless/ath/ath9k/init.c +@@ -358,7 +358,6 @@ static int ath9k_init_queues(struct ath_ + for (i = 0; i < IEEE80211_NUM_ACS; i++) { + sc->tx.txq_map[i] = ath_txq_setup(sc, ATH9K_TX_QUEUE_DATA, i); + sc->tx.txq_map[i]->mac80211_qnum = i; +- sc->tx.txq_max_pending[i] = ATH_MAX_QDEPTH; + } + return 0; + } +@@ -877,6 +876,7 @@ static void ath9k_set_hw_capab(struct at + hw->max_rate_tries = 10; + hw->sta_data_size = sizeof(struct ath_node); + hw->vif_data_size = sizeof(struct ath_vif); ++ hw->txq_data_size = sizeof(struct ath_atx_tid); + hw->extra_tx_headroom = 4; + + hw->wiphy->available_antennas_rx = BIT(ah->caps.max_rxchains) - 1; +--- a/drivers/net/wireless/ath/ath9k/main.c ++++ b/drivers/net/wireless/ath/ath9k/main.c +@@ -1902,9 +1902,11 @@ static int ath9k_ampdu_action(struct iee + bool flush = false; + int ret = 0; + struct ieee80211_sta *sta = params->sta; ++ struct ath_node *an = (struct ath_node *)sta->drv_priv; + enum ieee80211_ampdu_mlme_action action = params->action; + u16 tid = params->tid; + u16 *ssn = ¶ms->ssn; ++ struct ath_atx_tid *atid; + + mutex_lock(&sc->mutex); + +@@ -1937,9 +1939,9 @@ static int ath9k_ampdu_action(struct iee + ath9k_ps_restore(sc); + break; + case IEEE80211_AMPDU_TX_OPERATIONAL: +- ath9k_ps_wakeup(sc); +- ath_tx_aggr_resume(sc, sta, tid); +- ath9k_ps_restore(sc); ++ atid = ath_node_to_tid(an, tid); ++ atid->baw_size = IEEE80211_MIN_AMPDU_BUF << ++ sta->ht_cap.ampdu_factor; + break; + default: + ath_err(ath9k_hw_common(sc->sc_ah), "Unknown AMPDU action\n"); +@@ -2701,4 +2703,5 @@ struct ieee80211_ops ath9k_ops = { + .sw_scan_start = ath9k_sw_scan_start, + .sw_scan_complete = ath9k_sw_scan_complete, + .get_txpower = ath9k_get_txpower, ++ .wake_tx_queue = ath9k_wake_tx_queue, + }; +--- a/drivers/net/wireless/ath/ath9k/xmit.c ++++ b/drivers/net/wireless/ath/ath9k/xmit.c +@@ -67,6 +67,8 @@ static struct ath_buf *ath_tx_setup_buff + struct ath_txq *txq, + struct ath_atx_tid *tid, + struct sk_buff *skb); ++static int ath_tx_prepare(struct ieee80211_hw *hw, struct sk_buff *skb, ++ struct ath_tx_control *txctl); + + enum { + MCS_HT20, +@@ -137,6 +139,26 @@ static void ath_tx_queue_tid(struct ath_ + list_add_tail(&tid->list, list); + } + ++void ath9k_wake_tx_queue(struct ieee80211_hw *hw, struct ieee80211_txq *queue) ++{ ++ struct ath_softc *sc = hw->priv; ++ struct ath_common *common = ath9k_hw_common(sc->sc_ah); ++ struct ath_atx_tid *tid = (struct ath_atx_tid *) queue->drv_priv; ++ struct ath_txq *txq = tid->txq; ++ ++ ath_dbg(common, QUEUE, "Waking TX queue: %pM (%d)\n", ++ queue->sta ? queue->sta->addr : queue->vif->addr, ++ tid->tidno); ++ ++ ath_txq_lock(sc, txq); ++ ++ tid->has_queued = true; ++ ath_tx_queue_tid(sc, txq, tid); ++ ath_txq_schedule(sc, txq); ++ ++ ath_txq_unlock(sc, txq); ++} ++ + static struct ath_frame_info *get_frame_info(struct sk_buff *skb) + { + struct ieee80211_tx_info *tx_info = IEEE80211_SKB_CB(skb); +@@ -164,7 +186,6 @@ static void ath_set_rates(struct ieee802 + static void ath_txq_skb_done(struct ath_softc *sc, struct ath_txq *txq, + struct sk_buff *skb) + { +- struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb); + struct ath_frame_info *fi = get_frame_info(skb); + int q = fi->txq; + +@@ -175,14 +196,6 @@ static void ath_txq_skb_done(struct ath_ + if (WARN_ON(--txq->pending_frames < 0)) + txq->pending_frames = 0; + +- if (txq->stopped && +- txq->pending_frames < sc->tx.txq_max_pending[q]) { +- if (ath9k_is_chanctx_enabled()) +- ieee80211_wake_queue(sc->hw, info->hw_queue); +- else +- ieee80211_wake_queue(sc->hw, q); +- txq->stopped = false; +- } + } + + static struct ath_atx_tid * +@@ -192,9 +205,48 @@ ath_get_skb_tid(struct ath_softc *sc, st + return ATH_AN_2_TID(an, tidno); + } + ++static struct sk_buff * ++ath_tid_pull(struct ath_atx_tid *tid) ++{ ++ struct ieee80211_txq *txq = container_of((void*)tid, struct ieee80211_txq, drv_priv); ++ struct ath_softc *sc = tid->an->sc; ++ struct ieee80211_hw *hw = sc->hw; ++ struct ath_tx_control txctl = { ++ .txq = tid->txq, ++ .sta = tid->an->sta, ++ }; ++ struct sk_buff *skb; ++ struct ath_frame_info *fi; ++ int q; ++ ++ if (!tid->has_queued) ++ return NULL; ++ ++ skb = ieee80211_tx_dequeue(hw, txq); ++ if (!skb) { ++ tid->has_queued = false; ++ return NULL; ++ } ++ ++ if (ath_tx_prepare(hw, skb, &txctl)) { ++ ieee80211_free_txskb(hw, skb); ++ return NULL; ++ } ++ ++ q = skb_get_queue_mapping(skb); ++ if (tid->txq == sc->tx.txq_map[q]) { ++ fi = get_frame_info(skb); ++ fi->txq = q; ++ ++tid->txq->pending_frames; ++ } ++ ++ return skb; ++ } ++ ++ + static bool ath_tid_has_buffered(struct ath_atx_tid *tid) + { +- return !skb_queue_empty(&tid->buf_q) || !skb_queue_empty(&tid->retry_q); ++ return !skb_queue_empty(&tid->retry_q) || tid->has_queued; + } + + static struct sk_buff *ath_tid_dequeue(struct ath_atx_tid *tid) +@@ -203,46 +255,11 @@ static struct sk_buff *ath_tid_dequeue(s + + skb = __skb_dequeue(&tid->retry_q); + if (!skb) +- skb = __skb_dequeue(&tid->buf_q); ++ skb = ath_tid_pull(tid); + + return skb; + } + +-/* +- * ath_tx_tid_change_state: +- * - clears a-mpdu flag of previous session +- * - force sequence number allocation to fix next BlockAck Window +- */ +-static void +-ath_tx_tid_change_state(struct ath_softc *sc, struct ath_atx_tid *tid) +-{ +- struct ath_txq *txq = tid->txq; +- struct ieee80211_tx_info *tx_info; +- struct sk_buff *skb, *tskb; +- struct ath_buf *bf; +- struct ath_frame_info *fi; +- +- skb_queue_walk_safe(&tid->buf_q, skb, tskb) { +- fi = get_frame_info(skb); +- bf = fi->bf; +- +- tx_info = IEEE80211_SKB_CB(skb); +- tx_info->flags &= ~IEEE80211_TX_CTL_AMPDU; +- +- if (bf) +- continue; +- +- bf = ath_tx_setup_buffer(sc, txq, tid, skb); +- if (!bf) { +- __skb_unlink(skb, &tid->buf_q); +- ath_txq_skb_done(sc, txq, skb); +- ieee80211_free_txskb(sc->hw, skb); +- continue; +- } +- } +- +-} +- + static void ath_tx_flush_tid(struct ath_softc *sc, struct ath_atx_tid *tid) + { + struct ath_txq *txq = tid->txq; +@@ -883,20 +900,16 @@ static int ath_compute_num_delims(struct + + static struct ath_buf * + ath_tx_get_tid_subframe(struct ath_softc *sc, struct ath_txq *txq, +- struct ath_atx_tid *tid, struct sk_buff_head **q) ++ struct ath_atx_tid *tid) + { + struct ieee80211_tx_info *tx_info; + struct ath_frame_info *fi; +- struct sk_buff *skb; ++ struct sk_buff *skb, *first_skb = NULL; + struct ath_buf *bf; + u16 seqno; + + while (1) { +- *q = &tid->retry_q; +- if (skb_queue_empty(*q)) +- *q = &tid->buf_q; +- +- skb = skb_peek(*q); ++ skb = ath_tid_dequeue(tid); + if (!skb) + break; + +@@ -908,7 +921,6 @@ ath_tx_get_tid_subframe(struct ath_softc + bf->bf_state.stale = false; + + if (!bf) { +- __skb_unlink(skb, *q); + ath_txq_skb_done(sc, txq, skb); + ieee80211_free_txskb(sc->hw, skb); + continue; +@@ -937,8 +949,20 @@ ath_tx_get_tid_subframe(struct ath_softc + seqno = bf->bf_state.seqno; + + /* do not step over block-ack window */ +- if (!BAW_WITHIN(tid->seq_start, tid->baw_size, seqno)) ++ if (!BAW_WITHIN(tid->seq_start, tid->baw_size, seqno)) { ++ __skb_queue_tail(&tid->retry_q, skb); ++ ++ /* If there are other skbs in the retry q, they are ++ * probably within the BAW, so loop immediately to get ++ * one of them. Otherwise the queue can get stuck. */ ++ if (!skb_queue_is_first(&tid->retry_q, skb) && ++ !WARN_ON(skb == first_skb)) { ++ if(!first_skb) /* infinite loop prevention */ ++ first_skb = skb; ++ continue; ++ } + break; ++ } + + if (tid->bar_index > ATH_BA_INDEX(tid->seq_start, seqno)) { + struct ath_tx_status ts = {}; +@@ -946,7 +970,6 @@ ath_tx_get_tid_subframe(struct ath_softc + + INIT_LIST_HEAD(&bf_head); + list_add(&bf->list, &bf_head); +- __skb_unlink(skb, *q); + ath_tx_update_baw(sc, tid, seqno); + ath_tx_complete_buf(sc, bf, txq, &bf_head, NULL, &ts, 0); + continue; +@@ -958,11 +981,10 @@ ath_tx_get_tid_subframe(struct ath_softc + return NULL; + } + +-static bool ++static int + ath_tx_form_aggr(struct ath_softc *sc, struct ath_txq *txq, + struct ath_atx_tid *tid, struct list_head *bf_q, +- struct ath_buf *bf_first, struct sk_buff_head *tid_q, +- int *aggr_len) ++ struct ath_buf *bf_first) + { + #define PADBYTES(_len) ((4 - ((_len) % 4)) % 4) + struct ath_buf *bf = bf_first, *bf_prev = NULL; +@@ -972,12 +994,13 @@ ath_tx_form_aggr(struct ath_softc *sc, s + struct ieee80211_tx_info *tx_info; + struct ath_frame_info *fi; + struct sk_buff *skb; +- bool closed = false; ++ + + bf = bf_first; + aggr_limit = ath_lookup_rate(sc, bf, tid); + +- do { ++ while (bf) ++ { + skb = bf->bf_mpdu; + fi = get_frame_info(skb); + +@@ -986,12 +1009,12 @@ ath_tx_form_aggr(struct ath_softc *sc, s + if (nframes) { + if (aggr_limit < al + bpad + al_delta || + ath_lookup_legacy(bf) || nframes >= h_baw) +- break; ++ goto stop; + + tx_info = IEEE80211_SKB_CB(bf->bf_mpdu); + if ((tx_info->flags & IEEE80211_TX_CTL_RATE_CTRL_PROBE) || + !(tx_info->flags & IEEE80211_TX_CTL_AMPDU)) +- break; ++ goto stop; + } + + /* add padding for previous frame to aggregation length */ +@@ -1013,20 +1036,18 @@ ath_tx_form_aggr(struct ath_softc *sc, s + ath_tx_addto_baw(sc, tid, bf); + bf->bf_state.ndelim = ndelim; + +- __skb_unlink(skb, tid_q); + list_add_tail(&bf->list, bf_q); + if (bf_prev) + bf_prev->bf_next = bf; + + bf_prev = bf; + +- bf = ath_tx_get_tid_subframe(sc, txq, tid, &tid_q); +- if (!bf) { +- closed = true; +- break; +- } +- } while (ath_tid_has_buffered(tid)); +- ++ bf = ath_tx_get_tid_subframe(sc, txq, tid); ++ } ++ goto finish; ++stop: ++ __skb_queue_tail(&tid->retry_q, bf->bf_mpdu); ++finish: + bf = bf_first; + bf->bf_lastbf = bf_prev; + +@@ -1037,9 +1058,7 @@ ath_tx_form_aggr(struct ath_softc *sc, s + TX_STAT_INC(txq->axq_qnum, a_aggr); + } + +- *aggr_len = al; +- +- return closed; ++ return al; + #undef PADBYTES + } + +@@ -1416,18 +1435,15 @@ static void ath_tx_fill_desc(struct ath_ + static void + ath_tx_form_burst(struct ath_softc *sc, struct ath_txq *txq, + struct ath_atx_tid *tid, struct list_head *bf_q, +- struct ath_buf *bf_first, struct sk_buff_head *tid_q) ++ struct ath_buf *bf_first) + { + struct ath_buf *bf = bf_first, *bf_prev = NULL; +- struct sk_buff *skb; + int nframes = 0; + + do { + struct ieee80211_tx_info *tx_info; +- skb = bf->bf_mpdu; + + nframes++; +- __skb_unlink(skb, tid_q); + list_add_tail(&bf->list, bf_q); + if (bf_prev) + bf_prev->bf_next = bf; +@@ -1436,13 +1452,15 @@ ath_tx_form_burst(struct ath_softc *sc, + if (nframes >= 2) + break; + +- bf = ath_tx_get_tid_subframe(sc, txq, tid, &tid_q); ++ bf = ath_tx_get_tid_subframe(sc, txq, tid); + if (!bf) + break; + + tx_info = IEEE80211_SKB_CB(bf->bf_mpdu); +- if (tx_info->flags & IEEE80211_TX_CTL_AMPDU) ++ if (tx_info->flags & IEEE80211_TX_CTL_AMPDU) { ++ __skb_queue_tail(&tid->retry_q, bf->bf_mpdu); + break; ++ } + + ath_set_rates(tid->an->vif, tid->an->sta, bf); + } while (1); +@@ -1453,34 +1471,33 @@ static bool ath_tx_sched_aggr(struct ath + { + struct ath_buf *bf; + struct ieee80211_tx_info *tx_info; +- struct sk_buff_head *tid_q; + struct list_head bf_q; + int aggr_len = 0; +- bool aggr, last = true; ++ bool aggr; + + if (!ath_tid_has_buffered(tid)) + return false; + + INIT_LIST_HEAD(&bf_q); + +- bf = ath_tx_get_tid_subframe(sc, txq, tid, &tid_q); ++ bf = ath_tx_get_tid_subframe(sc, txq, tid); + if (!bf) + return false; + + tx_info = IEEE80211_SKB_CB(bf->bf_mpdu); + aggr = !!(tx_info->flags & IEEE80211_TX_CTL_AMPDU); + if ((aggr && txq->axq_ampdu_depth >= ATH_AGGR_MIN_QDEPTH) || +- (!aggr && txq->axq_depth >= ATH_NON_AGGR_MIN_QDEPTH)) { ++ (!aggr && txq->axq_depth >= ATH_NON_AGGR_MIN_QDEPTH)) { ++ __skb_queue_tail(&tid->retry_q, bf->bf_mpdu); + *stop = true; + return false; + } + + ath_set_rates(tid->an->vif, tid->an->sta, bf); + if (aggr) +- last = ath_tx_form_aggr(sc, txq, tid, &bf_q, bf, +- tid_q, &aggr_len); ++ aggr_len = ath_tx_form_aggr(sc, txq, tid, &bf_q, bf); + else +- ath_tx_form_burst(sc, txq, tid, &bf_q, bf, tid_q); ++ ath_tx_form_burst(sc, txq, tid, &bf_q, bf); + + if (list_empty(&bf_q)) + return false; +@@ -1523,9 +1540,6 @@ int ath_tx_aggr_start(struct ath_softc * + an->mpdudensity = density; + } + +- /* force sequence number allocation for pending frames */ +- ath_tx_tid_change_state(sc, txtid); +- + txtid->active = true; + *ssn = txtid->seq_start = txtid->seq_next; + txtid->bar_index = -1; +@@ -1550,7 +1564,6 @@ void ath_tx_aggr_stop(struct ath_softc * + ath_txq_lock(sc, txq); + txtid->active = false; + ath_tx_flush_tid(sc, txtid); +- ath_tx_tid_change_state(sc, txtid); + ath_txq_unlock_complete(sc, txq); + } + +@@ -1560,14 +1573,12 @@ void ath_tx_aggr_sleep(struct ieee80211_ + struct ath_common *common = ath9k_hw_common(sc->sc_ah); + struct ath_atx_tid *tid; + struct ath_txq *txq; +- bool buffered; + int tidno; + + ath_dbg(common, XMIT, "%s called\n", __func__); + +- for (tidno = 0, tid = &an->tid[tidno]; +- tidno < IEEE80211_NUM_TIDS; tidno++, tid++) { +- ++ for (tidno = 0; tidno < IEEE80211_NUM_TIDS; tidno++) { ++ tid = ath_node_to_tid(an, tidno); + txq = tid->txq; + + ath_txq_lock(sc, txq); +@@ -1577,13 +1588,12 @@ void ath_tx_aggr_sleep(struct ieee80211_ + continue; + } + +- buffered = ath_tid_has_buffered(tid); ++ if (!skb_queue_empty(&tid->retry_q)) ++ ieee80211_sta_set_buffered(sta, tid->tidno, true); + + list_del_init(&tid->list); + + ath_txq_unlock(sc, txq); +- +- ieee80211_sta_set_buffered(sta, tidno, buffered); + } + } + +@@ -1596,49 +1606,20 @@ void ath_tx_aggr_wakeup(struct ath_softc + + ath_dbg(common, XMIT, "%s called\n", __func__); + +- for (tidno = 0, tid = &an->tid[tidno]; +- tidno < IEEE80211_NUM_TIDS; tidno++, tid++) { +- ++ for (tidno = 0; tidno < IEEE80211_NUM_TIDS; tidno++) { ++ tid = ath_node_to_tid(an, tidno); + txq = tid->txq; + + ath_txq_lock(sc, txq); + tid->clear_ps_filter = true; +- + if (ath_tid_has_buffered(tid)) { + ath_tx_queue_tid(sc, txq, tid); + ath_txq_schedule(sc, txq); + } +- + ath_txq_unlock_complete(sc, txq); + } + } + +-void ath_tx_aggr_resume(struct ath_softc *sc, struct ieee80211_sta *sta, +- u16 tidno) +-{ +- struct ath_common *common = ath9k_hw_common(sc->sc_ah); +- struct ath_atx_tid *tid; +- struct ath_node *an; +- struct ath_txq *txq; +- +- ath_dbg(common, XMIT, "%s called\n", __func__); +- +- an = (struct ath_node *)sta->drv_priv; +- tid = ATH_AN_2_TID(an, tidno); +- txq = tid->txq; +- +- ath_txq_lock(sc, txq); +- +- tid->baw_size = IEEE80211_MIN_AMPDU_BUF << sta->ht_cap.ampdu_factor; +- +- if (ath_tid_has_buffered(tid)) { +- ath_tx_queue_tid(sc, txq, tid); +- ath_txq_schedule(sc, txq); +- } +- +- ath_txq_unlock_complete(sc, txq); +-} +- + void ath9k_release_buffered_frames(struct ieee80211_hw *hw, + struct ieee80211_sta *sta, + u16 tids, int nframes, +@@ -1651,7 +1632,6 @@ void ath9k_release_buffered_frames(struc + struct ieee80211_tx_info *info; + struct list_head bf_q; + struct ath_buf *bf_tail = NULL, *bf; +- struct sk_buff_head *tid_q; + int sent = 0; + int i; + +@@ -1666,11 +1646,10 @@ void ath9k_release_buffered_frames(struc + + ath_txq_lock(sc, tid->txq); + while (nframes > 0) { +- bf = ath_tx_get_tid_subframe(sc, sc->tx.uapsdq, tid, &tid_q); ++ bf = ath_tx_get_tid_subframe(sc, sc->tx.uapsdq, tid); + if (!bf) + break; + +- __skb_unlink(bf->bf_mpdu, tid_q); + list_add_tail(&bf->list, &bf_q); + ath_set_rates(tid->an->vif, tid->an->sta, bf); + if (bf_isampdu(bf)) { +@@ -1685,7 +1664,7 @@ void ath9k_release_buffered_frames(struc + sent++; + TX_STAT_INC(txq->axq_qnum, a_queued_hw); + +- if (an->sta && !ath_tid_has_buffered(tid)) ++ if (an->sta && skb_queue_empty(&tid->retry_q)) + ieee80211_sta_set_buffered(an->sta, i, false); + } + ath_txq_unlock_complete(sc, tid->txq); +@@ -1914,13 +1893,7 @@ bool ath_drain_all_txq(struct ath_softc + if (!ATH_TXQ_SETUP(sc, i)) + continue; + +- /* +- * The caller will resume queues with ieee80211_wake_queues. +- * Mark the queue as not stopped to prevent ath_tx_complete +- * from waking the queue too early. +- */ + txq = &sc->tx.txq[i]; +- txq->stopped = false; + ath_draintxq(sc, txq); + } + +@@ -2319,16 +2292,14 @@ int ath_tx_start(struct ieee80211_hw *hw + struct ath_softc *sc = hw->priv; + struct ath_txq *txq = txctl->txq; + struct ath_atx_tid *tid = NULL; ++ struct ath_node *an = NULL; + struct ath_buf *bf; +- bool queue, skip_uapsd = false, ps_resp; ++ bool ps_resp; + int q, ret; + + if (vif) + avp = (void *)vif->drv_priv; + +- if (info->flags & IEEE80211_TX_CTL_TX_OFFCHAN) +- txctl->force_channel = true; +- + ps_resp = !!(info->control.flags & IEEE80211_TX_CTRL_PS_RESPONSE); + + ret = ath_tx_prepare(hw, skb, txctl); +@@ -2343,63 +2314,18 @@ int ath_tx_start(struct ieee80211_hw *hw + + q = skb_get_queue_mapping(skb); + +- ath_txq_lock(sc, txq); +- if (txq == sc->tx.txq_map[q]) { +- fi->txq = q; +- if (++txq->pending_frames > sc->tx.txq_max_pending[q] && +- !txq->stopped) { +- if (ath9k_is_chanctx_enabled()) +- ieee80211_stop_queue(sc->hw, info->hw_queue); +- else +- ieee80211_stop_queue(sc->hw, q); +- txq->stopped = true; +- } +- } +- +- queue = ieee80211_is_data_present(hdr->frame_control); +- +- /* If chanctx, queue all null frames while NOA could be there */ +- if (ath9k_is_chanctx_enabled() && +- ieee80211_is_nullfunc(hdr->frame_control) && +- !txctl->force_channel) +- queue = true; +- +- /* Force queueing of all frames that belong to a virtual interface on +- * a different channel context, to ensure that they are sent on the +- * correct channel. +- */ +- if (((avp && avp->chanctx != sc->cur_chan) || +- sc->cur_chan->stopped) && !txctl->force_channel) { +- if (!txctl->an) +- txctl->an = &avp->mcast_node; +- queue = true; +- skip_uapsd = true; +- } +- +- if (txctl->an && queue) +- tid = ath_get_skb_tid(sc, txctl->an, skb); +- +- if (!skip_uapsd && ps_resp) { +- ath_txq_unlock(sc, txq); ++ if (ps_resp) + txq = sc->tx.uapsdq; +- ath_txq_lock(sc, txq); +- } else if (txctl->an && queue) { +- WARN_ON(tid->txq != txctl->txq); +- +- if (info->flags & IEEE80211_TX_CTL_CLEAR_PS_FILT) +- tid->clear_ps_filter = true; + +- /* +- * Add this frame to software queue for scheduling later +- * for aggregation. +- */ +- TX_STAT_INC(txq->axq_qnum, a_queued_sw); +- __skb_queue_tail(&tid->buf_q, skb); +- if (!txctl->an->sleeping) +- ath_tx_queue_tid(sc, txq, tid); ++ if (txctl->sta) { ++ an = (struct ath_node *) sta->drv_priv; ++ tid = ath_get_skb_tid(sc, an, skb); ++ } + +- ath_txq_schedule(sc, txq); +- goto out; ++ ath_txq_lock(sc, txq); ++ if (txq == sc->tx.txq_map[q]) { ++ fi->txq = q; ++ ++txq->pending_frames; + } + + bf = ath_tx_setup_buffer(sc, txq, tid, skb); +@@ -2892,9 +2818,8 @@ void ath_tx_node_init(struct ath_softc * + struct ath_atx_tid *tid; + int tidno, acno; + +- for (tidno = 0, tid = &an->tid[tidno]; +- tidno < IEEE80211_NUM_TIDS; +- tidno++, tid++) { ++ for (tidno = 0; tidno < IEEE80211_NUM_TIDS; tidno++) { ++ tid = ath_node_to_tid(an, tidno); + tid->an = an; + tid->tidno = tidno; + tid->seq_start = tid->seq_next = 0; +@@ -2902,11 +2827,14 @@ void ath_tx_node_init(struct ath_softc * + tid->baw_head = tid->baw_tail = 0; + tid->active = false; + tid->clear_ps_filter = true; +- __skb_queue_head_init(&tid->buf_q); ++ tid->has_queued = false; + __skb_queue_head_init(&tid->retry_q); + INIT_LIST_HEAD(&tid->list); + acno = TID_TO_WME_AC(tidno); + tid->txq = sc->tx.txq_map[acno]; ++ ++ if (!an->sta) ++ break; /* just one multicast ath_atx_tid */ + } + } + +@@ -2916,9 +2844,8 @@ void ath_tx_node_cleanup(struct ath_soft + struct ath_txq *txq; + int tidno; + +- for (tidno = 0, tid = &an->tid[tidno]; +- tidno < IEEE80211_NUM_TIDS; tidno++, tid++) { +- ++ for (tidno = 0; tidno < IEEE80211_NUM_TIDS; tidno++) { ++ tid = ath_node_to_tid(an, tidno); + txq = tid->txq; + + ath_txq_lock(sc, txq); +@@ -2930,6 +2857,9 @@ void ath_tx_node_cleanup(struct ath_soft + tid->active = false; + + ath_txq_unlock(sc, txq); ++ ++ if (!an->sta) ++ break; /* just one multicast ath_atx_tid */ + } + } + diff --git a/package/kernel/mac80211/patches/300-ath9k-force-rx_clear-when-disabling-rx.patch b/package/kernel/mac80211/patches/300-ath9k-force-rx_clear-when-disabling-rx.patch deleted file mode 100644 index 098bda7e93..0000000000 --- a/package/kernel/mac80211/patches/300-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 -@@ -677,13 +677,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 (!config_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/301-ath9k-force-rx_clear-when-disabling-rx.patch b/package/kernel/mac80211/patches/301-ath9k-force-rx_clear-when-disabling-rx.patch new file mode 100644 index 0000000000..098bda7e93 --- /dev/null +++ b/package/kernel/mac80211/patches/301-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 +@@ -677,13 +677,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 (!config_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/301-ath9k-limit-retries-for-powersave-response-frames.patch b/package/kernel/mac80211/patches/301-ath9k-limit-retries-for-powersave-response-frames.patch deleted file mode 100644 index a160dc4f02..0000000000 --- a/package/kernel/mac80211/patches/301-ath9k-limit-retries-for-powersave-response-frames.patch +++ /dev/null @@ -1,121 +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 -@@ -136,10 +136,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, -@@ -1419,7 +1434,7 @@ ath_tx_form_burst(struct ath_softc *sc, - if (tx_info->flags & IEEE80211_TX_CTL_AMPDU) - break; - -- ath_set_rates(tid->an->vif, tid->an->sta, bf); -+ ath_set_rates(tid->an->vif, tid->an->sta, bf, false); - } while (1); - } - -@@ -1450,7 +1465,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) - last = ath_tx_form_aggr(sc, txq, tid, &bf_q, bf, - tid_q, &aggr_len); -@@ -1647,7 +1662,7 @@ void ath9k_release_buffered_frames(struc - - __skb_unlink(bf->bf_mpdu, tid_q); - 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; -@@ -2293,7 +2308,7 @@ int ath_tx_start(struct ieee80211_hw *hw - struct ath_txq *txq = txctl->txq; - struct ath_atx_tid *tid = NULL; - struct ath_buf *bf; -- bool queue, skip_uapsd = false, ps_resp; -+ bool queue, ps_resp; - int q, ret; - - if (vif) -@@ -2346,13 +2361,13 @@ int ath_tx_start(struct ieee80211_hw *hw - if (!txctl->an) - txctl->an = &avp->mcast_node; - queue = true; -- skip_uapsd = true; -+ ps_resp = false; - } - - if (txctl->an && queue) - tid = ath_get_skb_tid(sc, txctl->an, skb); - -- if (!skip_uapsd && ps_resp) { -+ if (ps_resp) { - ath_txq_unlock(sc, txq); - txq = sc->tx.uapsdq; - ath_txq_lock(sc, txq); -@@ -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) -@@ -2932,7 +2947,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/302-Revert-ath9k-interpret-requested-txpower-in-EIRP-dom.patch b/package/kernel/mac80211/patches/302-Revert-ath9k-interpret-requested-txpower-in-EIRP-dom.patch deleted file mode 100644 index 7caa9be5a8..0000000000 --- a/package/kernel/mac80211/patches/302-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 -@@ -2914,7 +2914,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; -@@ -2922,10 +2923,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/302-ath9k-limit-retries-for-powersave-response-frames.patch b/package/kernel/mac80211/patches/302-ath9k-limit-retries-for-powersave-response-frames.patch new file mode 100644 index 0000000000..8c19ea22f4 --- /dev/null +++ b/package/kernel/mac80211/patches/302-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 +@@ -177,10 +177,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, +@@ -1462,7 +1477,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); + } + +@@ -1493,7 +1508,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 +@@ -1651,7 +1666,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; +@@ -2343,7 +2358,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: +@@ -2382,7 +2397,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) +@@ -2898,7 +2913,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/303-Revert-ath9k-interpret-requested-txpower-in-EIRP-dom.patch b/package/kernel/mac80211/patches/303-Revert-ath9k-interpret-requested-txpower-in-EIRP-dom.patch new file mode 100644 index 0000000000..57f45c1c93 --- /dev/null +++ b/package/kernel/mac80211/patches/303-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 +@@ -2910,7 +2910,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; +@@ -2918,10 +2919,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/303-ath10k-Ensure-txrx-compl-task-is-stopped-when-cleani.patch b/package/kernel/mac80211/patches/303-ath10k-Ensure-txrx-compl-task-is-stopped-when-cleani.patch deleted file mode 100644 index 73accd866b..0000000000 --- a/package/kernel/mac80211/patches/303-ath10k-Ensure-txrx-compl-task-is-stopped-when-cleani.patch +++ /dev/null @@ -1,21 +0,0 @@ -From: Ben Greear -Date: Fri, 1 Apr 2016 14:12:08 -0700 -Subject: [PATCH] ath10k: Ensure txrx-compl-task is stopped when cleaning - htt-tx. - -Otherwise, the txrx-compl-task may access some bad memory? - -Signed-off-by: Ben Greear ---- - ---- a/drivers/net/wireless/ath/ath10k/htt_tx.c -+++ b/drivers/net/wireless/ath/ath10k/htt_tx.c -@@ -388,6 +388,8 @@ void ath10k_htt_tx_free(struct ath10k_ht - { - int size; - -+ tasklet_kill(&htt->txrx_compl_task); -+ - idr_for_each(&htt->pending_tx, ath10k_htt_tx_clean_up_pending, htt->ar); - idr_destroy(&htt->pending_tx); - diff --git a/package/kernel/mac80211/patches/304-ath10k-Ensure-peer_map-references-are-cleaned-up.patch b/package/kernel/mac80211/patches/304-ath10k-Ensure-peer_map-references-are-cleaned-up.patch deleted file mode 100644 index 7dec1fb55a..0000000000 --- a/package/kernel/mac80211/patches/304-ath10k-Ensure-peer_map-references-are-cleaned-up.patch +++ /dev/null @@ -1,60 +0,0 @@ -From: Ben Greear -Date: Fri, 1 Apr 2016 14:12:09 -0700 -Subject: [PATCH] ath10k: Ensure peer_map references are cleaned up. - -While debugging OS crashes due to firmware crashes, I enabled -kasan, and it noticed that peer objects were being used-after-freed. - -Looks like there are two places we could be leaving stale references -in the peer-map, so clean that up. - -Signed-off-by: Ben Greear ---- - ---- a/drivers/net/wireless/ath/ath10k/mac.c -+++ b/drivers/net/wireless/ath/ath10k/mac.c -@@ -802,6 +802,7 @@ static void ath10k_peer_cleanup(struct a - { - struct ath10k_peer *peer, *tmp; - int peer_id; -+ int i; - - lockdep_assert_held(&ar->conf_mutex); - -@@ -818,6 +819,17 @@ static void ath10k_peer_cleanup(struct a - ar->peer_map[peer_id] = NULL; - } - -+ /* Double check that peer is properly un-referenced from -+ * the peer_map -+ */ -+ for (i = 0; i < ARRAY_SIZE(ar->peer_map); i++) { -+ if (ar->peer_map[i] == peer) { -+ ath10k_warn(ar, "removing stale peer_map entry for %pM (ptr %p idx %d)\n", -+ peer->addr, peer, i); -+ ar->peer_map[i] = NULL; -+ } -+ } -+ - list_del(&peer->list); - kfree(peer); - ar->num_peers--; -@@ -828,6 +840,7 @@ static void ath10k_peer_cleanup(struct a - static void ath10k_peer_cleanup_all(struct ath10k *ar) - { - struct ath10k_peer *peer, *tmp; -+ int i; - - lockdep_assert_held(&ar->conf_mutex); - -@@ -836,6 +849,10 @@ static void ath10k_peer_cleanup_all(stru - list_del(&peer->list); - kfree(peer); - } -+ -+ for (i = 0; i < ARRAY_SIZE(ar->peer_map); i++) -+ ar->peer_map[i] = NULL; -+ - spin_unlock_bh(&ar->data_lock); - - ar->num_peers = 0; diff --git a/package/kernel/mac80211/patches/304-mac80211-add-hdrlen-to-ieee80211_tx_data.patch b/package/kernel/mac80211/patches/304-mac80211-add-hdrlen-to-ieee80211_tx_data.patch new file mode 100644 index 0000000000..72e81ee1b0 --- /dev/null +++ b/package/kernel/mac80211/patches/304-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 +@@ -175,6 +175,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 +@@ -955,7 +955,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 */ +@@ -976,8 +976,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; +@@ -1209,6 +1207,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; +@@ -3414,6 +3414,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); +@@ -3584,6 +3585,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 +@@ -1227,6 +1227,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 */ +@@ -1251,8 +1252,10 @@ void ieee80211_send_auth(struct ieee8021 + memcpy(skb_put(skb, extra_len), 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; + +@@ -306,13 +306,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 +@@ -43,7 +43,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; + +@@ -186,7 +186,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; +@@ -201,7 +200,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) +@@ -418,7 +417,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) +@@ -651,7 +650,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) +@@ -791,7 +790,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; +@@ -807,8 +805,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/305-ath10k-Clean-up-peer-when-sta-goes-away.patch b/package/kernel/mac80211/patches/305-ath10k-Clean-up-peer-when-sta-goes-away.patch deleted file mode 100644 index 7248a8cecf..0000000000 --- a/package/kernel/mac80211/patches/305-ath10k-Clean-up-peer-when-sta-goes-away.patch +++ /dev/null @@ -1,32 +0,0 @@ -From: Ben Greear -Date: Fri, 1 Apr 2016 14:12:11 -0700 -Subject: [PATCH] ath10k: Clean up peer when sta goes away. - -If WMI and/or firmware has issues removing the peer object, -then we still need to clean up the peer object in the driver. - -Signed-off-by: Ben Greear ---- - ---- a/drivers/net/wireless/ath/ath10k/mac.c -+++ b/drivers/net/wireless/ath/ath10k/mac.c -@@ -5992,9 +5992,17 @@ static int ath10k_sta_state(struct ieee8 - continue; - - if (peer->sta == sta) { -- ath10k_warn(ar, "found sta peer %pM entry on vdev %i after it was supposedly removed\n", -- sta->addr, arvif->vdev_id); -+ ath10k_warn(ar, "found sta peer %pM (ptr %p id %d) entry on vdev %i after it was supposedly removed\n", -+ sta->addr, peer, i, arvif->vdev_id); - peer->sta = NULL; -+ -+ /* Clean up the peer object as well since we -+ * must have failed to do this above. -+ */ -+ list_del(&peer->list); -+ ar->peer_map[i] = NULL; -+ kfree(peer); -+ ar->num_peers--; - } - } - spin_unlock_bh(&ar->data_lock); diff --git a/package/kernel/mac80211/patches/305-mac80211-add-NEED_ALIGNED4_SKBS-hw-flag.patch b/package/kernel/mac80211/patches/305-mac80211-add-NEED_ALIGNED4_SKBS-hw-flag.patch new file mode 100644 index 0000000000..508cc92411 --- /dev/null +++ b/package/kernel/mac80211/patches/305-mac80211-add-NEED_ALIGNED4_SKBS-hw-flag.patch @@ -0,0 +1,224 @@ +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 +@@ -2025,6 +2025,9 @@ struct ieee80211_txq { + * drivers, mac80211 packet loss mechanism will not be triggered and driver + * is completely depending on firmware event for station kickout. + * ++ * @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 { +@@ -2066,6 +2069,7 @@ enum ieee80211_hw_flags { + IEEE80211_HW_TX_AMSDU, + IEEE80211_HW_TX_FRAG_LIST, + IEEE80211_HW_REPORTS_LOW_ACK, ++ IEEE80211_HW_NEEDS_ALIGNED4_SKBS, + + /* keep last, obviously */ + NUM_IEEE80211_HW_FLAGS +--- a/net/mac80211/debugfs.c ++++ b/net/mac80211/debugfs.c +@@ -210,6 +210,7 @@ static const char *hw_flag_names[] = { + FLAG(TX_AMSDU), + FLAG(TX_FRAG_LIST), + FLAG(REPORTS_LOW_ACK), ++ FLAG(NEEDS_ALIGNED4_SKBS), + #undef FLAG + }; + +--- a/net/mac80211/ieee80211_i.h ++++ b/net/mac80211/ieee80211_i.h +@@ -1529,6 +1529,29 @@ ieee80211_have_rx_timestamp(struct ieee8 + return false; + } + ++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 +@@ -282,7 +282,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 +@@ -689,9 +689,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 +@@ -1206,8 +1206,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)) +@@ -2158,7 +2157,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; +@@ -2376,7 +2375,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; +@@ -2596,6 +2595,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. +@@ -2676,6 +2678,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 +@@ -2708,6 +2711,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; + +@@ -2883,6 +2889,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, +--- a/net/mac80211/util.c ++++ b/net/mac80211/util.c +@@ -1225,6 +1225,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; +@@ -1252,7 +1253,7 @@ void ieee80211_send_auth(struct ieee8021 + memcpy(skb_put(skb, extra_len), 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/306-mac80211-add-hdrlen-to-ieee80211_tx_data.patch b/package/kernel/mac80211/patches/306-mac80211-add-hdrlen-to-ieee80211_tx_data.patch deleted file mode 100644 index 4a8f143946..0000000000 --- a/package/kernel/mac80211/patches/306-mac80211-add-hdrlen-to-ieee80211_tx_data.patch +++ /dev/null @@ -1,203 +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 -@@ -173,6 +173,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 -@@ -922,7 +922,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 */ -@@ -943,8 +943,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; -@@ -1176,6 +1174,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; ---- a/net/mac80211/util.c -+++ b/net/mac80211/util.c -@@ -1226,6 +1226,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 */ -@@ -1250,8 +1251,10 @@ void ieee80211_send_auth(struct ieee8021 - memcpy(skb_put(skb, extra_len), 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; - -@@ -306,13 +306,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 -@@ -43,7 +43,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; - -@@ -186,7 +186,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; -@@ -201,7 +200,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) -@@ -418,7 +417,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) -@@ -651,7 +650,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) -@@ -791,7 +790,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; -@@ -807,8 +805,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/306-mac80211-minstrel-Enable-STBC-and-LDPC-for-VHT-Rates.patch b/package/kernel/mac80211/patches/306-mac80211-minstrel-Enable-STBC-and-LDPC-for-VHT-Rates.patch new file mode 100644 index 0000000000..6e7ecb9c4d --- /dev/null +++ b/package/kernel/mac80211/patches/306-mac80211-minstrel-Enable-STBC-and-LDPC-for-VHT-Rates.patch @@ -0,0 +1,81 @@ +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 +@@ -1551,6 +1551,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 +@@ -1166,13 +1166,14 @@ 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; + int use_vht; + int n_supported = 0; + 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) +@@ -1210,16 +1211,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; +@@ -1232,10 +1241,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/307-ath9k-fix-moredata-bit-in-PS-buffered-frame-release.patch b/package/kernel/mac80211/patches/307-ath9k-fix-moredata-bit-in-PS-buffered-frame-release.patch new file mode 100644 index 0000000000..4fc6dc1ec3 --- /dev/null +++ b/package/kernel/mac80211/patches/307-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 +@@ -1635,6 +1635,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, +@@ -1665,6 +1681,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)) { +@@ -1688,6 +1705,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/307-mac80211-add-NEED_ALIGNED4_SKBS-hw-flag.patch b/package/kernel/mac80211/patches/307-mac80211-add-NEED_ALIGNED4_SKBS-hw-flag.patch deleted file mode 100644 index eeb881e030..0000000000 --- a/package/kernel/mac80211/patches/307-mac80211-add-NEED_ALIGNED4_SKBS-hw-flag.patch +++ /dev/null @@ -1,235 +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 -@@ -2014,6 +2014,9 @@ struct ieee80211_txq { - * @IEEE80211_HW_TX_FRAG_LIST: Hardware (or driver) supports sending frag_list - * skbs, needed for zero-copy software A-MSDU. - * -+ * @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 { -@@ -2054,6 +2057,7 @@ enum ieee80211_hw_flags { - IEEE80211_HW_USES_RSS, - IEEE80211_HW_TX_AMSDU, - IEEE80211_HW_TX_FRAG_LIST, -+ IEEE80211_HW_NEEDS_ALIGNED4_SKBS, - - /* keep last, obviously */ - NUM_IEEE80211_HW_FLAGS ---- a/net/mac80211/debugfs.c -+++ b/net/mac80211/debugfs.c -@@ -302,6 +302,7 @@ static const char *hw_flag_names[] = { - FLAG(USES_RSS), - FLAG(TX_AMSDU), - FLAG(TX_FRAG_LIST), -+ FLAG(NEEDS_ALIGNED4_SKBS), - #undef FLAG - }; - ---- a/net/mac80211/ieee80211_i.h -+++ b/net/mac80211/ieee80211_i.h -@@ -1497,6 +1497,29 @@ ieee80211_have_rx_timestamp(struct ieee8 - return false; - } - -+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 -@@ -279,7 +279,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 -@@ -683,9 +683,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 -@@ -1173,8 +1173,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)) -@@ -2108,7 +2107,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; -@@ -2334,7 +2333,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; -@@ -2554,6 +2553,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. -@@ -2640,6 +2642,7 @@ static struct sk_buff *ieee80211_build_h - h_pos -= 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 -@@ -2678,6 +2681,9 @@ static struct sk_buff *ieee80211_build_h - } - #endif - -+ if (padsize) -+ memset(skb_push(skb, padsize), 0, padsize); -+ - if (ieee80211_is_data_qos(fc)) { - __le16 *qos_control; - -@@ -2691,8 +2697,8 @@ static struct sk_buff *ieee80211_build_h - } else - memcpy(skb_push(skb, hdrlen), &hdr, hdrlen); - -- nh_pos += hdrlen; -- h_pos += hdrlen; -+ nh_pos += hdrlen + padsize; -+ h_pos += hdrlen + padsize; - - /* Update skb pointers to various headers since this modified frame - * is going to go through Linux networking code that may potentially -@@ -2861,6 +2867,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, ---- a/net/mac80211/util.c -+++ b/net/mac80211/util.c -@@ -1224,6 +1224,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; -@@ -1251,7 +1252,7 @@ void ieee80211_send_auth(struct ieee8021 - memcpy(skb_put(skb, extra_len), 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-ath10k-Fix-sending-NULL-Qos-NULL-data-frames-for-QCA.patch b/package/kernel/mac80211/patches/308-ath10k-Fix-sending-NULL-Qos-NULL-data-frames-for-QCA.patch deleted file mode 100644 index 8590aadabe..0000000000 --- a/package/kernel/mac80211/patches/308-ath10k-Fix-sending-NULL-Qos-NULL-data-frames-for-QCA.patch +++ /dev/null @@ -1,72 +0,0 @@ -From: Mohammed Shafi Shajakhan -Date: Thu, 23 Jun 2016 22:10:01 +0530 -Subject: [PATCH] ath10k: Fix sending NULL/ Qos NULL data frames for - QCA99X0 and later - -For chipsets like QCA99X0, IPQ4019 and later we are not getting proper -NULL func status (always acked/successs !!) when hostapd does a -PROBE_CLIENT via nullfunc frames when the station is powered off -abruptly (inactive timer probes client via null func after the inactive -time reaches beyond the threshold). Fix this by disabling the workaround -(getting the ACK status of NULL func frames by sending via HTT mgmt-tx - path) introduced by the change ("ath10k: fix beacon loss handling ") -for QCA99X0 and later chipsets. The normal tx path provides the proper -ACK status for NULL data frames. As of now disable this workaround for -chipsets QCA99X0 and later, once the 10.1 firmware is obselete we can -completely get rid of this workaround for all the chipsets - -Signed-off-by: Tamizh chelvam -Signed-off-by: Mohammed Shafi Shajakhan ---- - ---- a/drivers/net/wireless/ath/ath10k/core.c -+++ b/drivers/net/wireless/ath/ath10k/core.c -@@ -181,6 +181,7 @@ static const struct ath10k_hw_params ath - .board = QCA99X0_HW_2_0_BOARD_DATA_FILE, - .board_size = QCA99X0_BOARD_DATA_SZ, - .board_ext_size = QCA99X0_BOARD_EXT_DATA_SZ, -+ .disable_null_func_workaround = true, - }, - }, - { -@@ -204,6 +205,7 @@ static const struct ath10k_hw_params ath - .board = QCA9984_HW_1_0_BOARD_DATA_FILE, - .board_size = QCA99X0_BOARD_DATA_SZ, - .board_ext_size = QCA99X0_BOARD_EXT_DATA_SZ, -+ .disable_null_func_workaround = true, - }, - }, - { -@@ -262,6 +264,7 @@ static const struct ath10k_hw_params ath - .board = QCA4019_HW_1_0_BOARD_DATA_FILE, - .board_size = QCA4019_BOARD_DATA_SZ, - .board_ext_size = QCA4019_BOARD_EXT_DATA_SZ, -+ .disable_null_func_workaround = true, - }, - }, - }; ---- a/drivers/net/wireless/ath/ath10k/core.h -+++ b/drivers/net/wireless/ath/ath10k/core.h -@@ -750,6 +750,12 @@ struct ath10k { - const char *board; - size_t board_size; - size_t board_ext_size; -+ /* Workaround of sending NULL data frames via -+ * HTT mgmt TX and getting the proper ACK status does -+ * not works for chipsets QCA99X0 and later, while -+ * Tx data path reports the ACK status properly. -+ */ -+ bool disable_null_func_workaround; - } fw; - } hw_params; - ---- a/drivers/net/wireless/ath/ath10k/mac.c -+++ b/drivers/net/wireless/ath/ath10k/mac.c -@@ -3253,6 +3253,7 @@ ath10k_mac_tx_h_get_txmode(struct ath10k - * mode though because AP don't sleep. - */ - if (ar->htt.target_version_major < 3 && -+ !ar->hw_params.fw.disable_null_func_workaround && - (ieee80211_is_nullfunc(fc) || ieee80211_is_qos_nullfunc(fc)) && - !test_bit(ATH10K_FW_FEATURE_HAS_WMI_MGMT_TX, - ar->running_fw->fw_file.fw_features)) diff --git a/package/kernel/mac80211/patches/308-ath9k-clear-potentially-stale-EOSP-status-bit-in-int.patch b/package/kernel/mac80211/patches/308-ath9k-clear-potentially-stale-EOSP-status-bit-in-int.patch new file mode 100644 index 0000000000..929da25d75 --- /dev/null +++ b/package/kernel/mac80211/patches/308-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 +@@ -945,7 +945,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/309-ath9k-report-tx-status-on-EOSP.patch b/package/kernel/mac80211/patches/309-ath9k-report-tx-status-on-EOSP.patch new file mode 100644 index 0000000000..80a3074a4d --- /dev/null +++ b/package/kernel/mac80211/patches/309-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/309-cfg80211-fix-proto-in-ieee80211_data_to_8023-for-fra.patch b/package/kernel/mac80211/patches/309-cfg80211-fix-proto-in-ieee80211_data_to_8023-for-fra.patch deleted file mode 100644 index 41c27cac41..0000000000 --- a/package/kernel/mac80211/patches/309-cfg80211-fix-proto-in-ieee80211_data_to_8023-for-fra.patch +++ /dev/null @@ -1,37 +0,0 @@ -From: Felix Fietkau -Date: Wed, 29 Jun 2016 10:02:32 +0200 -Subject: [PATCH] cfg80211: fix proto in ieee80211_data_to_8023 for frames - without LLC header - -The PDU length of incoming LLC frames is set to the total skb payload size -in __ieee80211_data_to_8023() of net/wireless/util.c which incorrectly -includes the length of the IEEE 802.11 header. - -The resulting LLC frame header has a too large PDU length, causing the -llc_fixup_skb() function of net/llc/llc_input.c to reject the incoming -skb, effectively breaking STP. - -Solve the problem by properly substracting the IEEE 802.11 frame header size -from the PDU length, allowing the LLC processor to pick up the incoming -control messages. - -Special thanks to Gerry Rozema for tracking down the regression and proposing -a suitable patch. - -Fixes: 2d1c304cb2d5 ("cfg80211: add function for 802.3 conversion with separate output buffer") -Cc: stable@vger.kernel.org -Reported-by: Gerry Rozema -Signed-off-by: Felix Fietkau ---- - ---- a/net/wireless/util.c -+++ b/net/wireless/util.c -@@ -509,7 +509,7 @@ static int __ieee80211_data_to_8023(stru - * replace EtherType */ - hdrlen += ETH_ALEN + 2; - else -- tmp.h_proto = htons(skb->len); -+ tmp.h_proto = htons(skb->len - hdrlen); - - pskb_pull(skb, hdrlen); - diff --git a/package/kernel/mac80211/patches/310-ath9k-fix-block-ack-window-tracking-issues.patch b/package/kernel/mac80211/patches/310-ath9k-fix-block-ack-window-tracking-issues.patch new file mode 100644 index 0000000000..2993cbab74 --- /dev/null +++ b/package/kernel/mac80211/patches/310-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, +@@ -300,7 +300,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; + } + +@@ -316,10 +316,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); + +@@ -340,6 +345,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); +@@ -616,7 +624,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)); +@@ -646,7 +654,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, +@@ -987,11 +995,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; + } + +@@ -1049,8 +1060,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); +@@ -1686,10 +1695,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/310-mac80211-minstrel-Enable-STBC-and-LDPC-for-VHT-Rates.patch b/package/kernel/mac80211/patches/310-mac80211-minstrel-Enable-STBC-and-LDPC-for-VHT-Rates.patch deleted file mode 100644 index 25929c9813..0000000000 --- a/package/kernel/mac80211/patches/310-mac80211-minstrel-Enable-STBC-and-LDPC-for-VHT-Rates.patch +++ /dev/null @@ -1,81 +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 -@@ -1550,6 +1550,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 -@@ -1166,13 +1166,14 @@ 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; - int use_vht; - int n_supported = 0; - 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) -@@ -1210,16 +1211,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; -@@ -1232,10 +1241,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/311-ath10k-Add-support-for-160Mhz.patch b/package/kernel/mac80211/patches/311-ath10k-Add-support-for-160Mhz.patch new file mode 100644 index 0000000000..372ce58772 --- /dev/null +++ b/package/kernel/mac80211/patches/311-ath10k-Add-support-for-160Mhz.patch @@ -0,0 +1,285 @@ +From: Ben Greear +Date: Thu, 6 Oct 2016 17:34:14 -0700 +Subject: [PATCH] ath10k: Add support for 160Mhz. + +This patch was written by Sebastian Gottschall. + +Signed-off-by: Ben Greear +Signed-off-by: Sebastian Gottschall +--- + +--- a/drivers/net/wireless/ath/ath10k/htt_rx.c ++++ b/drivers/net/wireless/ath/ath10k/htt_rx.c +@@ -702,6 +702,10 @@ static void ath10k_htt_rx_h_rates(struct + /* 80MHZ */ + case 2: + status->vht_flag |= RX_VHT_FLAG_80MHZ; ++ break; ++ case 3: ++ status->vht_flag |= RX_VHT_FLAG_160MHZ; ++ break; + } + + status->flag |= RX_FLAG_VHT; +@@ -926,7 +930,7 @@ static void ath10k_process_rx(struct ath + *status = *rx_status; + + ath10k_dbg(ar, ATH10K_DBG_DATA, +- "rx skb %pK len %u peer %pM %s %s sn %u %s%s%s%s%s %srate_idx %u vht_nss %u freq %u band %u flag 0x%llx fcs-err %i mic-err %i amsdu-more %i\n", ++ "rx skb %pK len %u peer %pM %s %s sn %u %s%s%s%s%s%s %srate_idx %u vht_nss %u freq %u band %u flag 0x%llx fcs-err %i mic-err %i amsdu-more %i\n", + skb, + skb->len, + ieee80211_get_SA(hdr), +@@ -940,6 +944,7 @@ static void ath10k_process_rx(struct ath + status->flag & RX_FLAG_VHT ? "vht" : "", + status->flag & RX_FLAG_40MHZ ? "40" : "", + status->vht_flag & RX_VHT_FLAG_80MHZ ? "80" : "", ++ status->vht_flag & RX_VHT_FLAG_160MHZ ? "160" : "", + status->flag & RX_FLAG_SHORT_GI ? "sgi " : "", + status->rate_idx, + status->vht_nss, +--- a/drivers/net/wireless/ath/ath10k/mac.c ++++ b/drivers/net/wireless/ath/ath10k/mac.c +@@ -568,10 +568,14 @@ chan_to_phymode(const struct cfg80211_ch + case NL80211_CHAN_WIDTH_80: + phymode = MODE_11AC_VHT80; + break; ++ case NL80211_CHAN_WIDTH_160: ++ phymode = MODE_11AC_VHT160; ++ break; ++ case NL80211_CHAN_WIDTH_80P80: ++ phymode = MODE_11AC_VHT80_80; ++ break; + case NL80211_CHAN_WIDTH_5: + case NL80211_CHAN_WIDTH_10: +- case NL80211_CHAN_WIDTH_80P80: +- case NL80211_CHAN_WIDTH_160: + phymode = MODE_UNKNOWN; + break; + } +@@ -970,6 +974,7 @@ static int ath10k_monitor_vdev_start(str + arg.vdev_id = vdev_id; + arg.channel.freq = channel->center_freq; + arg.channel.band_center_freq1 = chandef->center_freq1; ++ arg.channel.band_center_freq2 = chandef->center_freq2; + + /* TODO setup this dynamically, what in case we + don't have any vifs? */ +@@ -1381,6 +1386,7 @@ static int ath10k_vdev_start_restart(str + + arg.channel.freq = chandef->chan->center_freq; + arg.channel.band_center_freq1 = chandef->center_freq1; ++ arg.channel.band_center_freq2 = chandef->center_freq2; + arg.channel.mode = chan_to_phymode(chandef); + + arg.channel.min_power = 0; +@@ -2444,6 +2450,9 @@ static void ath10k_peer_assoc_h_vht(stru + if (sta->bandwidth == IEEE80211_STA_RX_BW_80) + arg->peer_flags |= ar->wmi.peer_flags->bw80; + ++ if (sta->bandwidth == IEEE80211_STA_RX_BW_160) ++ arg->peer_flags |= ar->wmi.peer_flags->bw160; ++ + arg->peer_vht_rates.rx_max_rate = + __le16_to_cpu(vht_cap->vht_mcs.rx_highest); + arg->peer_vht_rates.rx_mcs_set = +@@ -2545,7 +2554,17 @@ static void ath10k_peer_assoc_h_phymode( + !ath10k_peer_assoc_h_vht_masked(vht_mcs_mask)) { + if (sta->bandwidth == IEEE80211_STA_RX_BW_80) + phymode = MODE_11AC_VHT80; +- else if (sta->bandwidth == IEEE80211_STA_RX_BW_40) ++ else if (sta->bandwidth == IEEE80211_STA_RX_BW_160) { ++ phymode = MODE_11AC_VHT160; ++ switch (sta->vht_cap.cap & IEEE80211_VHT_CAP_SUPP_CHAN_WIDTH_MASK) { ++ case IEEE80211_VHT_CAP_SUPP_CHAN_WIDTH_160MHZ: ++ phymode = MODE_11AC_VHT160; ++ break; ++ case IEEE80211_VHT_CAP_SUPP_CHAN_WIDTH_160_80PLUS80MHZ: ++ phymode = MODE_11AC_VHT80_80; ++ break; ++ } ++ } else if (sta->bandwidth == IEEE80211_STA_RX_BW_40) + phymode = MODE_11AC_VHT40; + else if (sta->bandwidth == IEEE80211_STA_RX_BW_20) + phymode = MODE_11AC_VHT20; +@@ -4277,6 +4296,10 @@ static struct ieee80211_sta_vht_cap ath1 + vht_cap.cap |= val; + } + ++ if ((ar->vht_cap_info & IEEE80211_VHT_CAP_SHORT_GI_160) && !(ar->vht_cap_info & IEEE80211_VHT_CAP_SUPP_CHAN_WIDTH_160_80PLUS80MHZ)) { ++ vht_cap.cap |= IEEE80211_VHT_CAP_SUPP_CHAN_WIDTH_160MHZ; ++ } ++ + mcs_map = 0; + for (i = 0; i < 8; i++) { + if ((i < ar->num_rf_chains) && (ar->cfg_tx_chainmask & BIT(i))) +@@ -6913,6 +6936,9 @@ static void ath10k_sta_rc_update(struct + bw = WMI_PEER_CHWIDTH_80MHZ; + break; + case IEEE80211_STA_RX_BW_160: ++ bw = WMI_PEER_CHWIDTH_160MHZ; ++ break; ++ default: + ath10k_warn(ar, "Invalid bandwidth %d in rc update for %pM\n", + sta->bandwidth, sta->addr); + bw = WMI_PEER_CHWIDTH_20MHZ; +--- a/drivers/net/wireless/ath/ath10k/wmi-tlv.c ++++ b/drivers/net/wireless/ath/ath10k/wmi-tlv.c +@@ -3560,6 +3560,7 @@ static const struct wmi_peer_flags_map w + .vht = WMI_TLV_PEER_VHT, + .bw80 = WMI_TLV_PEER_80MHZ, + .pmf = WMI_TLV_PEER_PMF, ++ .bw160 = WMI_TLV_PEER_160MHZ, + }; + + /************/ +--- a/drivers/net/wireless/ath/ath10k/wmi-tlv.h ++++ b/drivers/net/wireless/ath/ath10k/wmi-tlv.h +@@ -543,6 +543,7 @@ enum wmi_tlv_peer_flags { + WMI_TLV_PEER_VHT = 0x02000000, + WMI_TLV_PEER_80MHZ = 0x04000000, + WMI_TLV_PEER_PMF = 0x08000000, ++ WMI_TLV_PEER_160MHZ = 0x20000000, + }; + + enum wmi_tlv_tag { +--- a/drivers/net/wireless/ath/ath10k/wmi.c ++++ b/drivers/net/wireless/ath/ath10k/wmi.c +@@ -1576,6 +1576,7 @@ static const struct wmi_peer_flags_map w + .bw80 = WMI_PEER_80MHZ, + .vht_2g = WMI_PEER_VHT_2G, + .pmf = WMI_PEER_PMF, ++ .bw160 = WMI_PEER_160MHZ, + }; + + static const struct wmi_peer_flags_map wmi_10x_peer_flags_map = { +@@ -1593,6 +1594,7 @@ static const struct wmi_peer_flags_map w + .spatial_mux = WMI_10X_PEER_SPATIAL_MUX, + .vht = WMI_10X_PEER_VHT, + .bw80 = WMI_10X_PEER_80MHZ, ++ .bw160 = WMI_10X_PEER_160MHZ, + }; + + static const struct wmi_peer_flags_map wmi_10_2_peer_flags_map = { +@@ -1612,6 +1614,7 @@ static const struct wmi_peer_flags_map w + .bw80 = WMI_10_2_PEER_80MHZ, + .vht_2g = WMI_10_2_PEER_VHT_2G, + .pmf = WMI_10_2_PEER_PMF, ++ .bw160 = WMI_10_2_PEER_160MHZ, + }; + + void ath10k_wmi_put_wmi_channel(struct wmi_channel *ch, +@@ -1636,7 +1639,10 @@ void ath10k_wmi_put_wmi_channel(struct w + + ch->mhz = __cpu_to_le32(arg->freq); + ch->band_center_freq1 = __cpu_to_le32(arg->band_center_freq1); +- ch->band_center_freq2 = 0; ++ if (arg->mode == MODE_11AC_VHT80_80) ++ ch->band_center_freq2 = __cpu_to_le32(arg->band_center_freq2); ++ else ++ ch->band_center_freq2 = 0; + ch->min_power = arg->min_power; + ch->max_power = arg->max_power; + ch->reg_power = arg->max_reg_power; +--- a/drivers/net/wireless/ath/ath10k/wmi.h ++++ b/drivers/net/wireless/ath/ath10k/wmi.h +@@ -1728,8 +1728,10 @@ enum wmi_phy_mode { + MODE_11AC_VHT20_2G = 11, + MODE_11AC_VHT40_2G = 12, + MODE_11AC_VHT80_2G = 13, +- MODE_UNKNOWN = 14, +- MODE_MAX = 14 ++ MODE_11AC_VHT80_80 = 14, ++ MODE_11AC_VHT160 = 15, ++ MODE_UNKNOWN = 16, ++ MODE_MAX = 16 + }; + + static inline const char *ath10k_wmi_phymode_str(enum wmi_phy_mode mode) +@@ -1757,6 +1759,10 @@ static inline const char *ath10k_wmi_phy + return "11ac-vht40"; + case MODE_11AC_VHT80: + return "11ac-vht80"; ++ case MODE_11AC_VHT160: ++ return "11ac-vht160"; ++ case MODE_11AC_VHT80_80: ++ return "11ac-vht80+80"; + case MODE_11AC_VHT20_2G: + return "11ac-vht20-2g"; + case MODE_11AC_VHT40_2G: +@@ -1811,6 +1817,7 @@ struct wmi_channel { + struct wmi_channel_arg { + u32 freq; + u32 band_center_freq1; ++ u32 band_center_freq2; + bool passive; + bool allow_ibss; + bool allow_ht; +@@ -1875,9 +1882,18 @@ enum wmi_channel_change_cause { + #define WMI_VHT_CAP_MAX_MPDU_LEN_MASK 0x00000003 + #define WMI_VHT_CAP_RX_LDPC 0x00000010 + #define WMI_VHT_CAP_SGI_80MHZ 0x00000020 ++#define WMI_VHT_CAP_SGI_160MHZ 0x00000040 + #define WMI_VHT_CAP_TX_STBC 0x00000080 + #define WMI_VHT_CAP_RX_STBC_MASK 0x00000300 + #define WMI_VHT_CAP_RX_STBC_MASK_SHIFT 8 ++#define WMI_VHT_CAP_SU_BFER 0x00000800 ++#define WMI_VHT_CAP_SU_BFEE 0x00001000 ++#define WMI_VHT_CAP_MAX_CS_ANT_MASK 0x0000E000 ++#define WMI_VHT_CAP_MAX_CS_ANT_MASK_SHIFT 13 ++#define WMI_VHT_CAP_MAX_SND_DIM_MASK 0x00070000 ++#define WMI_VHT_CAP_MAX_SND_DIM_MASK_SHIFT 16 ++#define WMI_VHT_CAP_MU_BFER 0x00080000 ++#define WMI_VHT_CAP_MU_BFEE 0x00100000 + #define WMI_VHT_CAP_MAX_AMPDU_LEN_EXP 0x03800000 + #define WMI_VHT_CAP_MAX_AMPDU_LEN_EXP_SHIFT 23 + #define WMI_VHT_CAP_RX_FIXED_ANT 0x10000000 +@@ -1926,6 +1942,8 @@ enum { + REGDMN_MODE_11AC_VHT40PLUS = 0x40000, /* 5Ghz, VHT40 + channels */ + REGDMN_MODE_11AC_VHT40MINUS = 0x80000, /* 5Ghz VHT40 - channels */ + REGDMN_MODE_11AC_VHT80 = 0x100000, /* 5Ghz, VHT80 channels */ ++ REGDMN_MODE_11AC_VHT160 = 0x200000, /* 5Ghz, VHT160 channels */ ++ REGDMN_MODE_11AC_VHT80_80 = 0x400000, /* 5Ghz, VHT80+80 channels */ + REGDMN_MODE_ALL = 0xffffffff + }; + +@@ -5769,6 +5787,7 @@ enum wmi_peer_chwidth { + WMI_PEER_CHWIDTH_20MHZ = 0, + WMI_PEER_CHWIDTH_40MHZ = 1, + WMI_PEER_CHWIDTH_80MHZ = 2, ++ WMI_PEER_CHWIDTH_160MHZ = 3, + }; + + enum wmi_peer_param { +@@ -5859,6 +5878,7 @@ struct wmi_peer_flags_map { + u32 bw80; + u32 vht_2g; + u32 pmf; ++ u32 bw160; + }; + + enum wmi_peer_flags { +@@ -5878,6 +5898,7 @@ enum wmi_peer_flags { + WMI_PEER_80MHZ = 0x04000000, + WMI_PEER_VHT_2G = 0x08000000, + WMI_PEER_PMF = 0x10000000, ++ WMI_PEER_160MHZ = 0x20000000 + }; + + enum wmi_10x_peer_flags { +@@ -5895,6 +5916,7 @@ enum wmi_10x_peer_flags { + WMI_10X_PEER_SPATIAL_MUX = 0x00200000, + WMI_10X_PEER_VHT = 0x02000000, + WMI_10X_PEER_80MHZ = 0x04000000, ++ WMI_10X_PEER_160MHZ = 0x20000000 + }; + + enum wmi_10_2_peer_flags { +@@ -5914,6 +5936,7 @@ enum wmi_10_2_peer_flags { + WMI_10_2_PEER_80MHZ = 0x04000000, + WMI_10_2_PEER_VHT_2G = 0x08000000, + WMI_10_2_PEER_PMF = 0x10000000, ++ WMI_10_2_PEER_160MHZ = 0x20000000 + }; + + /* diff --git a/package/kernel/mac80211/patches/311-ath10k-disable-wake_tx_queue-for-older-devices.patch b/package/kernel/mac80211/patches/311-ath10k-disable-wake_tx_queue-for-older-devices.patch deleted file mode 100644 index 4cf26a631f..0000000000 --- a/package/kernel/mac80211/patches/311-ath10k-disable-wake_tx_queue-for-older-devices.patch +++ /dev/null @@ -1,73 +0,0 @@ -From: Michal Kazior -Date: Tue, 17 May 2016 14:47:01 +0200 -Subject: [PATCH] ath10k: disable wake_tx_queue for older devices - -Some setups suffer performance regressions with -current wake_tx_queue implementation. - -Signed-off-by: Michal Kazior ---- - ---- a/drivers/net/wireless/ath/ath10k/core.h -+++ b/drivers/net/wireless/ath/ath10k/core.h -@@ -667,6 +667,7 @@ struct ath10k_fw_components { - struct ath10k { - struct ath_common ath_common; - struct ieee80211_hw *hw; -+ struct ieee80211_ops *ops; - struct device *dev; - u8 mac_addr[ETH_ALEN]; - ---- a/drivers/net/wireless/ath/ath10k/mac.c -+++ b/drivers/net/wireless/ath/ath10k/mac.c -@@ -7497,21 +7497,32 @@ static const struct ieee80211_channel at - struct ath10k *ath10k_mac_create(size_t priv_size) - { - struct ieee80211_hw *hw; -+ struct ieee80211_ops *ops; - struct ath10k *ar; - -- hw = ieee80211_alloc_hw(sizeof(struct ath10k) + priv_size, &ath10k_ops); -- if (!hw) -+ ops = kmemdup(&ath10k_ops, sizeof(ath10k_ops), GFP_KERNEL); -+ if (!ops) -+ return NULL; -+ -+ hw = ieee80211_alloc_hw(sizeof(struct ath10k) + priv_size, ops); -+ if (!hw) { -+ kfree(ops); - return NULL; -+ } - - ar = hw->priv; - ar->hw = hw; -+ ar->ops = ops; - - return ar; - } - - void ath10k_mac_destroy(struct ath10k *ar) - { -+ struct ieee80211_ops *ops = ar->ops; -+ - ieee80211_free_hw(ar->hw); -+ kfree(ops); - } - - static const struct ieee80211_iface_limit ath10k_if_limits[] = { -@@ -7945,6 +7956,15 @@ 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 = ath_regd_init(&ar->ath_common.regulatory, ar->hw->wiphy, - ath10k_reg_notifier); - if (ret) { diff --git a/package/kernel/mac80211/patches/312-ath9k-Correct-TSF-adjustment-to-align-the-beacon-tim.patch b/package/kernel/mac80211/patches/312-ath9k-Correct-TSF-adjustment-to-align-the-beacon-tim.patch deleted file mode 100644 index df43105cb8..0000000000 --- a/package/kernel/mac80211/patches/312-ath9k-Correct-TSF-adjustment-to-align-the-beacon-tim.patch +++ /dev/null @@ -1,45 +0,0 @@ -From: Benjamin Berg -Date: Mon, 4 Jul 2016 14:37:20 +0200 -Subject: [PATCH] ath9k: Correct TSF adjustment to align the beacon time - correctly - -Beacons were not send out at (timestamp % beacon_time == 0) for interfaces -other than the primary one. To send out beacons with the correct timestamp -according to 10.1.3.2 of the 802.11 standard the tsf_adjustment has to be -set to the negative time difference instead of positive. This way the -later beacons get corrected to have a lower (and similar) timestamp with -regard to the beacon from slot 0. - -I am not aware about any issues that have been caused by this. - -Signed-off-by: Benjamin Berg ---- - ---- a/drivers/net/wireless/ath/ath9k/beacon.c -+++ b/drivers/net/wireless/ath/ath9k/beacon.c -@@ -279,17 +279,21 @@ static void ath9k_set_tsfadjust(struct a - struct ath_common *common = ath9k_hw_common(sc->sc_ah); - struct ath_vif *avp = (void *)vif->drv_priv; - struct ath_beacon_config *cur_conf = &avp->chanctx->beacon; -- u32 tsfadjust; -+ s64 tsfadjust; - - if (avp->av_bslot == 0) - return; - -+ /* tsf_adjust is added to the TSF value. We send out the beacon late, -+ * so need to adjust the TSF starting point to be later in time (i.e. -+ * the theoretical first beacon has a TSF of 0 after correction). -+ */ - tsfadjust = cur_conf->beacon_interval * avp->av_bslot; -- tsfadjust = TU_TO_USEC(tsfadjust) / ATH_BCBUF; -+ tsfadjust = -TU_TO_USEC(tsfadjust) / ATH_BCBUF; - avp->tsf_adjust = cpu_to_le64(tsfadjust); - -- ath_dbg(common, CONFIG, "tsfadjust is: %llu for bslot: %d\n", -- (unsigned long long)tsfadjust, avp->av_bslot); -+ ath_dbg(common, CONFIG, "tsfadjust is: %lld for bslot: %d\n", -+ (signed long long)tsfadjust, avp->av_bslot); - } - - bool ath9k_csa_is_finished(struct ath_softc *sc, struct ieee80211_vif *vif) diff --git a/package/kernel/mac80211/patches/312-mac80211-Use-rhltable-instead-of-rhashtable.patch b/package/kernel/mac80211/patches/312-mac80211-Use-rhltable-instead-of-rhashtable.patch new file mode 100644 index 0000000000..4c5fff1274 --- /dev/null +++ b/package/kernel/mac80211/patches/312-mac80211-Use-rhltable-instead-of-rhashtable.patch @@ -0,0 +1,275 @@ +From: Herbert Xu +Date: Mon, 19 Sep 2016 19:00:10 +0800 +Subject: [PATCH] mac80211: Use rhltable instead of rhashtable + +mac80211 currently uses rhashtable with insecure_elasticity set +to true. The latter is because of duplicate objects. What's +more, mac80211 walks the rhashtable chains by hand which is broken +as rhashtable may contain multiple tables due to resizing or +rehashing. + +This patch fixes it by converting it to the newly added rhltable +interface which is designed for use with duplicate objects. + +With rhltable a lookup returns a list of objects instead of a +single one. This is then fed into the existing for_each_sta_info +macro. + +This patch also deletes the sta_addr_hash function since rhashtable +defaults to jhash. + +Signed-off-by: Herbert Xu +--- + +--- a/net/mac80211/ieee80211_i.h ++++ b/net/mac80211/ieee80211_i.h +@@ -1233,7 +1233,7 @@ struct ieee80211_local { + spinlock_t tim_lock; + unsigned long num_sta; + struct list_head sta_list; +- struct rhashtable sta_hash; ++ struct rhltable sta_hash; + struct timer_list sta_cleanup; + int sta_generation; + +--- a/net/mac80211/rx.c ++++ b/net/mac80211/rx.c +@@ -4004,7 +4004,7 @@ static void __ieee80211_rx_handle_packet + __le16 fc; + struct ieee80211_rx_data rx; + struct ieee80211_sub_if_data *prev; +- struct rhash_head *tmp; ++ struct rhlist_head *tmp; + int err = 0; + + fc = ((struct ieee80211_hdr *)skb->data)->frame_control; +@@ -4047,13 +4047,10 @@ static void __ieee80211_rx_handle_packet + goto out; + } else if (ieee80211_is_data(fc)) { + struct sta_info *sta, *prev_sta; +- const struct bucket_table *tbl; + + prev_sta = NULL; + +- tbl = rht_dereference_rcu(local->sta_hash.tbl, &local->sta_hash); +- +- for_each_sta_info(local, tbl, hdr->addr2, sta, tmp) { ++ for_each_sta_info(local, hdr->addr2, sta, tmp) { + if (!prev_sta) { + prev_sta = sta; + continue; +--- a/net/mac80211/sta_info.c ++++ b/net/mac80211/sta_info.c +@@ -67,12 +67,10 @@ + + static const struct rhashtable_params sta_rht_params = { + .nelem_hint = 3, /* start small */ +- .insecure_elasticity = true, /* Disable chain-length checks. */ + .automatic_shrinking = true, + .head_offset = offsetof(struct sta_info, hash_node), + .key_offset = offsetof(struct sta_info, addr), + .key_len = ETH_ALEN, +- .hashfn = sta_addr_hash, + .max_size = CPTCFG_MAC80211_STA_HASH_MAX_SIZE, + }; + +@@ -80,8 +78,8 @@ static const struct rhashtable_params st + static int sta_info_hash_del(struct ieee80211_local *local, + struct sta_info *sta) + { +- return rhashtable_remove_fast(&local->sta_hash, &sta->hash_node, +- sta_rht_params); ++ return rhltable_remove(&local->sta_hash, &sta->hash_node, ++ sta_rht_params); + } + + static void __cleanup_single_sta(struct sta_info *sta) +@@ -157,19 +155,22 @@ static void cleanup_single_sta(struct st + sta_info_free(local, sta); + } + ++struct rhlist_head *sta_info_hash_lookup(struct ieee80211_local *local, ++ const u8 *addr) ++{ ++ return rhltable_lookup(&local->sta_hash, addr, sta_rht_params); ++} ++ + /* protected by RCU */ + struct sta_info *sta_info_get(struct ieee80211_sub_if_data *sdata, + const u8 *addr) + { + struct ieee80211_local *local = sdata->local; ++ struct rhlist_head *tmp; + struct sta_info *sta; +- struct rhash_head *tmp; +- const struct bucket_table *tbl; + + rcu_read_lock(); +- tbl = rht_dereference_rcu(local->sta_hash.tbl, &local->sta_hash); +- +- for_each_sta_info(local, tbl, addr, sta, tmp) { ++ for_each_sta_info(local, addr, sta, tmp) { + if (sta->sdata == sdata) { + rcu_read_unlock(); + /* this is safe as the caller must already hold +@@ -190,14 +191,11 @@ struct sta_info *sta_info_get_bss(struct + const u8 *addr) + { + struct ieee80211_local *local = sdata->local; ++ struct rhlist_head *tmp; + struct sta_info *sta; +- struct rhash_head *tmp; +- const struct bucket_table *tbl; + + rcu_read_lock(); +- tbl = rht_dereference_rcu(local->sta_hash.tbl, &local->sta_hash); +- +- for_each_sta_info(local, tbl, addr, sta, tmp) { ++ for_each_sta_info(local, addr, sta, tmp) { + if (sta->sdata == sdata || + (sta->sdata->bss && sta->sdata->bss == sdata->bss)) { + rcu_read_unlock(); +@@ -263,8 +261,8 @@ void sta_info_free(struct ieee80211_loca + static int sta_info_hash_add(struct ieee80211_local *local, + struct sta_info *sta) + { +- return rhashtable_insert_fast(&local->sta_hash, &sta->hash_node, +- sta_rht_params); ++ return rhltable_insert(&local->sta_hash, &sta->hash_node, ++ sta_rht_params); + } + + static void sta_deliver_ps_frames(struct work_struct *wk) +@@ -453,9 +451,9 @@ static int sta_info_insert_check(struct + is_multicast_ether_addr(sta->sta.addr))) + return -EINVAL; + +- /* Strictly speaking this isn't necessary as we hold the mutex, but +- * the rhashtable code can't really deal with that distinction. We +- * do require the mutex for correctness though. ++ /* The RCU read lock is required by rhashtable due to ++ * asynchronous resize/rehash. We also require the mutex ++ * for correctness. + */ + rcu_read_lock(); + lockdep_assert_held(&sdata->local->sta_mtx); +@@ -1043,16 +1041,11 @@ static void sta_info_cleanup(unsigned lo + round_jiffies(jiffies + STA_INFO_CLEANUP_INTERVAL)); + } + +-u32 sta_addr_hash(const void *key, u32 length, u32 seed) +-{ +- return jhash(key, ETH_ALEN, seed); +-} +- + int sta_info_init(struct ieee80211_local *local) + { + int err; + +- err = rhashtable_init(&local->sta_hash, &sta_rht_params); ++ err = rhltable_init(&local->sta_hash, &sta_rht_params); + if (err) + return err; + +@@ -1068,7 +1061,7 @@ int sta_info_init(struct ieee80211_local + void sta_info_stop(struct ieee80211_local *local) + { + del_timer_sync(&local->sta_cleanup); +- rhashtable_destroy(&local->sta_hash); ++ rhltable_destroy(&local->sta_hash); + } + + +@@ -1138,17 +1131,14 @@ struct ieee80211_sta *ieee80211_find_sta + const u8 *localaddr) + { + struct ieee80211_local *local = hw_to_local(hw); ++ struct rhlist_head *tmp; + struct sta_info *sta; +- struct rhash_head *tmp; +- const struct bucket_table *tbl; +- +- tbl = rht_dereference_rcu(local->sta_hash.tbl, &local->sta_hash); + + /* + * Just return a random station if localaddr is NULL + * ... first in list. + */ +- for_each_sta_info(local, tbl, addr, sta, tmp) { ++ for_each_sta_info(local, addr, sta, tmp) { + if (localaddr && + !ether_addr_equal(sta->sdata->vif.addr, localaddr)) + continue; +--- a/net/mac80211/sta_info.h ++++ b/net/mac80211/sta_info.h +@@ -455,7 +455,7 @@ struct sta_info { + /* General information, mostly static */ + struct list_head list, free_list; + struct rcu_head rcu_head; +- struct rhash_head hash_node; ++ struct rhlist_head hash_node; + u8 addr[ETH_ALEN]; + struct ieee80211_local *local; + struct ieee80211_sub_if_data *sdata; +@@ -638,6 +638,9 @@ rcu_dereference_protected_tid_tx(struct + */ + #define STA_INFO_CLEANUP_INTERVAL (10 * HZ) + ++struct rhlist_head *sta_info_hash_lookup(struct ieee80211_local *local, ++ const u8 *addr); ++ + /* + * Get a STA info, must be under RCU read lock. + */ +@@ -647,17 +650,9 @@ struct sta_info *sta_info_get(struct iee + struct sta_info *sta_info_get_bss(struct ieee80211_sub_if_data *sdata, + const u8 *addr); + +-u32 sta_addr_hash(const void *key, u32 length, u32 seed); +- +-#define _sta_bucket_idx(_tbl, _a) \ +- rht_bucket_index(_tbl, sta_addr_hash(_a, ETH_ALEN, (_tbl)->hash_rnd)) +- +-#define for_each_sta_info(local, tbl, _addr, _sta, _tmp) \ +- rht_for_each_entry_rcu(_sta, _tmp, tbl, \ +- _sta_bucket_idx(tbl, _addr), \ +- hash_node) \ +- /* compare address and run code only if it matches */ \ +- if (ether_addr_equal(_sta->addr, (_addr))) ++#define for_each_sta_info(local, _addr, _sta, _tmp) \ ++ rhl_for_each_entry_rcu(_sta, _tmp, \ ++ sta_info_hash_lookup(local, _addr), hash_node) + + /* + * Get STA info by index, BROKEN! +--- a/net/mac80211/status.c ++++ b/net/mac80211/status.c +@@ -759,8 +759,8 @@ void ieee80211_tx_status(struct ieee8021 + struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb); + __le16 fc; + struct ieee80211_supported_band *sband; ++ struct rhlist_head *tmp; + struct sta_info *sta; +- struct rhash_head *tmp; + int retry_count; + int rates_idx; + bool send_to_cooked; +@@ -768,7 +768,6 @@ void ieee80211_tx_status(struct ieee8021 + struct ieee80211_bar *bar; + int shift = 0; + int tid = IEEE80211_NUM_TIDS; +- const struct bucket_table *tbl; + + rates_idx = ieee80211_tx_get_rates(hw, info, &retry_count); + +@@ -777,9 +776,7 @@ void ieee80211_tx_status(struct ieee8021 + sband = local->hw.wiphy->bands[info->band]; + fc = hdr->frame_control; + +- tbl = rht_dereference_rcu(local->sta_hash.tbl, &local->sta_hash); +- +- for_each_sta_info(local, tbl, hdr->addr1, sta, tmp) { ++ for_each_sta_info(local, hdr->addr1, sta, tmp) { + /* skip wrong virtual interface */ + if (!ether_addr_equal(hdr->addr2, sta->sdata->vif.addr)) + continue; diff --git a/package/kernel/mac80211/patches/313-ath9k-Handle-channel-context-in-get_-set_-reset_tsf.patch b/package/kernel/mac80211/patches/313-ath9k-Handle-channel-context-in-get_-set_-reset_tsf.patch deleted file mode 100644 index ef0afbea9c..0000000000 --- a/package/kernel/mac80211/patches/313-ath9k-Handle-channel-context-in-get_-set_-reset_tsf.patch +++ /dev/null @@ -1,70 +0,0 @@ -From: Benjamin Berg -Date: Mon, 4 Jul 2016 14:37:21 +0200 -Subject: [PATCH] ath9k: Handle channel context in get_/set_/reset_tsf - -The ath9k TSF handling routines need to be aware of the channel context that -is being modified. With this change the TSF related values that are stored -in each channel context will be correctly tracked and the harware will only -be updated if the modified context is currently the active one. - -Without this change the TSF modifications done using these routines would -for example be lost during a hardware reset as done by ath_complete_reset. - -Signed-off-by: Benjamin Berg ---- - ---- a/drivers/net/wireless/ath/ath9k/main.c -+++ b/drivers/net/wireless/ath/ath9k/main.c -@@ -1823,11 +1823,18 @@ static void ath9k_bss_info_changed(struc - static u64 ath9k_get_tsf(struct ieee80211_hw *hw, struct ieee80211_vif *vif) - { - struct ath_softc *sc = hw->priv; -+ struct ath_vif *avp = (void *)vif->drv_priv; - u64 tsf; - - mutex_lock(&sc->mutex); - ath9k_ps_wakeup(sc); -- tsf = ath9k_hw_gettsf64(sc->sc_ah); -+ /* Get current TSF either from HW or kernel time. */ -+ if (sc->cur_chan == avp->chanctx) { -+ tsf = ath9k_hw_gettsf64(sc->sc_ah); -+ } else { -+ tsf = sc->cur_chan->tsf_val + -+ ath9k_hw_get_tsf_offset(&sc->cur_chan->tsf_ts, NULL); -+ } - ath9k_ps_restore(sc); - mutex_unlock(&sc->mutex); - -@@ -1839,10 +1846,14 @@ static void ath9k_set_tsf(struct ieee802 - u64 tsf) - { - struct ath_softc *sc = hw->priv; -+ struct ath_vif *avp = (void *)vif->drv_priv; - - mutex_lock(&sc->mutex); - ath9k_ps_wakeup(sc); -- ath9k_hw_settsf64(sc->sc_ah, tsf); -+ getrawmonotonic(&avp->chanctx->tsf_ts); -+ if (sc->cur_chan == avp->chanctx) -+ ath9k_hw_settsf64(sc->sc_ah, tsf); -+ avp->chanctx->tsf_val = tsf; - ath9k_ps_restore(sc); - mutex_unlock(&sc->mutex); - } -@@ -1850,11 +1861,15 @@ static void ath9k_set_tsf(struct ieee802 - static void ath9k_reset_tsf(struct ieee80211_hw *hw, struct ieee80211_vif *vif) - { - struct ath_softc *sc = hw->priv; -+ struct ath_vif *avp = (void *)vif->drv_priv; - - mutex_lock(&sc->mutex); - - ath9k_ps_wakeup(sc); -- ath9k_hw_reset_tsf(sc->sc_ah); -+ getrawmonotonic(&avp->chanctx->tsf_ts); -+ if (sc->cur_chan == avp->chanctx) -+ ath9k_hw_reset_tsf(sc->sc_ah); -+ avp->chanctx->tsf_val = 0; - ath9k_ps_restore(sc); - - mutex_unlock(&sc->mutex); diff --git a/package/kernel/mac80211/patches/313-mac80211-fix-sequence-number-allocation-regression.patch b/package/kernel/mac80211/patches/313-mac80211-fix-sequence-number-allocation-regression.patch new file mode 100644 index 0000000000..c1548be0d2 --- /dev/null +++ b/package/kernel/mac80211/patches/313-mac80211-fix-sequence-number-allocation-regression.patch @@ -0,0 +1,37 @@ +From: Felix Fietkau +Date: Tue, 11 Oct 2016 11:24:07 +0200 +Subject: [PATCH] mac80211: fix sequence number allocation regression + +The recent commit that moved around TX handlers dropped the sequence +number allocation at the end of ieee80211_tx_dequeue and calls +ieee80211_tx_h_sequence instead (for the non-fast-xmit case). +However, it did not change the fast-xmit sequence allocation condition +in ieee80211_xmit_fast_finish, which skipped seqno alloc if intermediate +tx queues are being used. + +Drop the now obsolete condition. + +Fixes: bb42f2d13ffc ("mac80211: Move reorder-sensitive TX handlers to after TXQ dequeue") +Signed-off-by: Felix Fietkau +--- + +--- a/net/mac80211/tx.c ++++ b/net/mac80211/tx.c +@@ -3212,7 +3212,6 @@ static void ieee80211_xmit_fast_finish(s + struct sk_buff *skb) + { + struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb); +- struct ieee80211_local *local = sdata->local; + struct ieee80211_hdr *hdr = (void *)skb->data; + u8 tid = IEEE80211_NUM_TIDS; + +@@ -3224,8 +3223,7 @@ static void ieee80211_xmit_fast_finish(s + if (hdr->frame_control & cpu_to_le16(IEEE80211_STYPE_QOS_DATA)) { + tid = skb->priority & IEEE80211_QOS_CTL_TAG1D_MASK; + *ieee80211_get_qos_ctl(hdr) = tid; +- if (!ieee80211_get_txq(local, &sdata->vif, &sta->sta, skb)) +- hdr->seq_ctrl = ieee80211_tx_next_seq(sta, tid); ++ hdr->seq_ctrl = ieee80211_tx_next_seq(sta, tid); + } else { + info->flags |= IEEE80211_TX_CTL_ASSIGN_SEQ; + hdr->seq_ctrl = cpu_to_le16(sdata->sequence_number); diff --git a/package/kernel/mac80211/patches/314-ath9k-Use-tsf-offset-helper-in-ath9k_hw_reset.patch b/package/kernel/mac80211/patches/314-ath9k-Use-tsf-offset-helper-in-ath9k_hw_reset.patch deleted file mode 100644 index e725a8bd60..0000000000 --- a/package/kernel/mac80211/patches/314-ath9k-Use-tsf-offset-helper-in-ath9k_hw_reset.patch +++ /dev/null @@ -1,65 +0,0 @@ -From: Benjamin Berg -Date: Mon, 4 Jul 2016 14:37:22 +0200 -Subject: [PATCH] ath9k: Use tsf offset helper in ath9k_hw_reset - -These changes make ath9k_hw_reset more consistent with other places that -handle the TSF value by using the same helper routine. - -A slight improvement is to not assume that a fixed time of 1.5ms has -passed for the initval writes when compared to the first write attempt. -Instead the TSF value is re-calculated which will yield a higher accuracy -of the restored TSF timer. - -Signed-off-by: Benjamin Berg ---- - ---- a/drivers/net/wireless/ath/ath9k/hw.c -+++ b/drivers/net/wireless/ath/ath9k/hw.c -@@ -1832,8 +1832,9 @@ int ath9k_hw_reset(struct ath_hw *ah, st - u32 saveLedState; - u32 saveDefAntenna; - u32 macStaId1; -+ struct timespec tsf_ts; -+ u32 tsf_offset; - u64 tsf = 0; -- s64 usec = 0; - int r; - bool start_mci_reset = false; - bool save_fullsleep = ah->chip_fullsleep; -@@ -1877,8 +1878,8 @@ int ath9k_hw_reset(struct ath_hw *ah, st - macStaId1 = REG_READ(ah, AR_STA_ID1) & AR_STA_ID1_BASE_RATE_11B; - - /* Save TSF before chip reset, a cold reset clears it */ -+ getrawmonotonic(&tsf_ts); - tsf = ath9k_hw_gettsf64(ah); -- usec = ktime_to_us(ktime_get_raw()); - - saveLedState = REG_READ(ah, AR_CFG_LED) & - (AR_CFG_LED_ASSOC_CTL | AR_CFG_LED_MODE_SEL | -@@ -1911,8 +1912,8 @@ int ath9k_hw_reset(struct ath_hw *ah, st - } - - /* Restore TSF */ -- usec = ktime_to_us(ktime_get_raw()) - usec; -- ath9k_hw_settsf64(ah, tsf + usec); -+ tsf_offset = ath9k_hw_get_tsf_offset(&tsf_ts, NULL); -+ ath9k_hw_settsf64(ah, tsf + tsf_offset); - - if (AR_SREV_9280_20_OR_LATER(ah)) - REG_SET_BIT(ah, AR_GPIO_INPUT_EN_VAL, AR_GPIO_JTAG_DISABLE); -@@ -1932,12 +1933,11 @@ int ath9k_hw_reset(struct ath_hw *ah, st - /* - * Some AR91xx SoC devices frequently fail to accept TSF writes - * right after the chip reset. When that happens, write a new -- * value after the initvals have been applied, with an offset -- * based on measured time difference -+ * value after the initvals have been applied. - */ - if (AR_SREV_9100(ah) && (ath9k_hw_gettsf64(ah) < tsf)) { -- tsf += 1500; -- ath9k_hw_settsf64(ah, tsf); -+ tsf_offset = ath9k_hw_get_tsf_offset(&tsf_ts, NULL); -+ ath9k_hw_settsf64(ah, tsf + tsf_offset); - } - - ath9k_hw_init_mfp(ah); diff --git a/package/kernel/mac80211/patches/314-ath9k_hw-reset-AHB-WMAC-interface-on-AR91xx.patch b/package/kernel/mac80211/patches/314-ath9k_hw-reset-AHB-WMAC-interface-on-AR91xx.patch new file mode 100644 index 0000000000..a7bcfa549b --- /dev/null +++ b/package/kernel/mac80211/patches/314-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/315-ath9k-Expose-tsf_adjustment-in-mac80211-tsf-getters-.patch b/package/kernel/mac80211/patches/315-ath9k-Expose-tsf_adjustment-in-mac80211-tsf-getters-.patch deleted file mode 100644 index c95ab7e644..0000000000 --- a/package/kernel/mac80211/patches/315-ath9k-Expose-tsf_adjustment-in-mac80211-tsf-getters-.patch +++ /dev/null @@ -1,32 +0,0 @@ -From: Benjamin Berg -Date: Mon, 4 Jul 2016 14:37:23 +0200 -Subject: [PATCH] ath9k: Expose tsf_adjustment in mac80211 tsf getters and - setters. - -The ath9k driver modifies the TSF for VIFs for the purpose of sending -beacons in a staggered fashion. This patch exposes this VIF specific -adjustment of the TSF value to mac80211. Without the change the TSF -routines handle the hardware TSF value instead of the actual TSF value as -seen on the air. - -Signed-off-by: Benjamin Berg ---- - ---- a/drivers/net/wireless/ath/ath9k/main.c -+++ b/drivers/net/wireless/ath/ath9k/main.c -@@ -1835,6 +1835,7 @@ static u64 ath9k_get_tsf(struct ieee8021 - tsf = sc->cur_chan->tsf_val + - ath9k_hw_get_tsf_offset(&sc->cur_chan->tsf_ts, NULL); - } -+ tsf += le64_to_cpu(avp->tsf_adjust); - ath9k_ps_restore(sc); - mutex_unlock(&sc->mutex); - -@@ -1850,6 +1851,7 @@ static void ath9k_set_tsf(struct ieee802 - - mutex_lock(&sc->mutex); - ath9k_ps_wakeup(sc); -+ tsf -= le64_to_cpu(avp->tsf_adjust); - getrawmonotonic(&avp->chanctx->tsf_ts); - if (sc->cur_chan == avp->chanctx) - ath9k_hw_settsf64(sc->sc_ah, tsf); diff --git a/package/kernel/mac80211/patches/315-ath9k_hw-issue-external-reset-for-QCA955x.patch b/package/kernel/mac80211/patches/315-ath9k_hw-issue-external-reset-for-QCA955x.patch new file mode 100644 index 0000000000..6a958a4132 --- /dev/null +++ b/package/kernel/mac80211/patches/315-ath9k_hw-issue-external-reset-for-QCA955x.patch @@ -0,0 +1,125 @@ +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,23 @@ 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); + } + ++ 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/316-ath9k-Remove-some-defined-constants-to-decrease-verb.patch b/package/kernel/mac80211/patches/316-ath9k-Remove-some-defined-constants-to-decrease-verb.patch deleted file mode 100644 index 36aaa1030e..0000000000 --- a/package/kernel/mac80211/patches/316-ath9k-Remove-some-defined-constants-to-decrease-verb.patch +++ /dev/null @@ -1,137 +0,0 @@ -From: Benjamin Berg -Date: Mon, 4 Jul 2016 14:37:24 +0200 -Subject: [PATCH] ath9k: Remove some #defined constants to decrease - verbosity - -The removed ATH9K_SLOT_TIME_X constants simply map the value in microseconds -to the same integer. These constants were not used consistently, so fix the -inconsistency issue by replacing all occurances with the integer equivalent. - -Signed-off-by: Benjamin Berg ---- - ---- a/drivers/net/wireless/ath/ath9k/beacon.c -+++ b/drivers/net/wireless/ath/ath9k/beacon.c -@@ -50,7 +50,7 @@ static void ath9k_beaconq_config(struct - txq = sc->tx.txq_map[IEEE80211_AC_BE]; - ath9k_hw_get_txq_props(ah, txq->axq_qnum, &qi_be); - qi.tqi_aifs = qi_be.tqi_aifs; -- if (ah->slottime == ATH9K_SLOT_TIME_20) -+ if (ah->slottime == 20) - qi.tqi_cwmin = 2*qi_be.tqi_cwmin; - else - qi.tqi_cwmin = 4*qi_be.tqi_cwmin; ---- a/drivers/net/wireless/ath/ath9k/dynack.c -+++ b/drivers/net/wireless/ath/ath9k/dynack.c -@@ -280,7 +280,7 @@ EXPORT_SYMBOL(ath_dynack_sample_ack_ts); - void ath_dynack_node_init(struct ath_hw *ah, struct ath_node *an) - { - /* ackto = slottime + sifs + air delay */ -- u32 ackto = ATH9K_SLOT_TIME_9 + 16 + 64; -+ u32 ackto = 9 + 16 + 64; - struct ath_dynack *da = &ah->dynack; - - an->ackto = ackto; -@@ -315,7 +315,7 @@ EXPORT_SYMBOL(ath_dynack_node_deinit); - void ath_dynack_reset(struct ath_hw *ah) - { - /* ackto = slottime + sifs + air delay */ -- u32 ackto = ATH9K_SLOT_TIME_9 + 16 + 64; -+ u32 ackto = 9 + 16 + 64; - struct ath_dynack *da = &ah->dynack; - - da->lto = jiffies; ---- a/drivers/net/wireless/ath/ath9k/htc_drv_beacon.c -+++ b/drivers/net/wireless/ath/ath9k/htc_drv_beacon.c -@@ -45,7 +45,7 @@ void ath9k_htc_beaconq_config(struct ath - * Long slot time : 2x cwmin - * Short slot time : 4x cwmin - */ -- if (ah->slottime == ATH9K_SLOT_TIME_20) -+ if (ah->slottime == 20) - qi.tqi_cwmin = 2*qi_be.tqi_cwmin; - else - qi.tqi_cwmin = 4*qi_be.tqi_cwmin; ---- a/drivers/net/wireless/ath/ath9k/htc_drv_init.c -+++ b/drivers/net/wireless/ath/ath9k/htc_drv_init.c -@@ -678,7 +678,7 @@ static int ath9k_init_priv(struct ath9k_ - - for (i = 0; i < ATH9K_HTC_MAX_BCN_VIF; i++) - priv->beacon.bslot[i] = NULL; -- priv->beacon.slottime = ATH9K_SLOT_TIME_9; -+ priv->beacon.slottime = 9; - - ath9k_cmn_init_channels_rates(common); - ath9k_cmn_init_crypto(ah); ---- a/drivers/net/wireless/ath/ath9k/hw.c -+++ b/drivers/net/wireless/ath/ath9k/hw.c -@@ -454,7 +454,7 @@ static void ath9k_hw_init_defaults(struc - if (AR_SREV_9100(ah)) - ah->sta_id1_defaults |= AR_STA_ID1_AR9100_BA_FIX; - -- ah->slottime = ATH9K_SLOT_TIME_9; -+ ah->slottime = 9; - ah->globaltxtimeout = (u32) -1; - ah->power_mode = ATH9K_PM_UNDEFINED; - ah->htc_reset_init = true; ---- a/drivers/net/wireless/ath/ath9k/init.c -+++ b/drivers/net/wireless/ath/ath9k/init.c -@@ -372,7 +372,7 @@ static void ath9k_init_misc(struct ath_s - - common->last_rssi = ATH_RSSI_DUMMY_MARKER; - memcpy(common->bssidmask, ath_bcast_mac, ETH_ALEN); -- sc->beacon.slottime = ATH9K_SLOT_TIME_9; -+ sc->beacon.slottime = 9; - - for (i = 0; i < ARRAY_SIZE(sc->beacon.bslot); i++) - sc->beacon.bslot[i] = NULL; ---- a/drivers/net/wireless/ath/ath9k/mac.h -+++ b/drivers/net/wireless/ath/ath9k/mac.h -@@ -65,10 +65,6 @@ - #define INIT_SSH_RETRY 32 - #define INIT_SLG_RETRY 32 - --#define ATH9K_SLOT_TIME_6 6 --#define ATH9K_SLOT_TIME_9 9 --#define ATH9K_SLOT_TIME_20 20 -- - #define ATH9K_TXERR_XRETRY 0x01 - #define ATH9K_TXERR_FILT 0x02 - #define ATH9K_TXERR_FIFO 0x04 ---- a/drivers/net/wireless/ath/ath9k/main.c -+++ b/drivers/net/wireless/ath/ath9k/main.c -@@ -926,7 +926,7 @@ static void ath9k_vif_iter(struct ath9k_ - } - - if (!vif->bss_conf.use_short_slot) -- iter_data->slottime = ATH9K_SLOT_TIME_20; -+ iter_data->slottime = 20; - - switch (vif->type) { - case NL80211_IFTYPE_AP: -@@ -999,7 +999,7 @@ void ath9k_calculate_iter_data(struct at - */ - memset(iter_data, 0, sizeof(*iter_data)); - eth_broadcast_addr(iter_data->mask); -- iter_data->slottime = ATH9K_SLOT_TIME_9; -+ iter_data->slottime = 9; - - list_for_each_entry(avp, &ctx->vifs, list) - ath9k_vif_iter(iter_data, avp->vif->addr, avp->vif); -@@ -1061,7 +1061,7 @@ static void ath9k_set_offchannel_state(s - ah->opmode = vif->type; - ah->imask &= ~ATH9K_INT_SWBA; - ah->imask &= ~ATH9K_INT_TSFOOR; -- ah->slottime = ATH9K_SLOT_TIME_9; -+ ah->slottime = 9; - - ath_hw_setbssidmask(common); - ath9k_hw_setopmode(ah); -@@ -1788,6 +1788,7 @@ static void ath9k_bss_info_changed(struc - slottime = 9; - else - slottime = 20; -+ - if (vif->type == NL80211_IFTYPE_AP) { - /* - * Defer update, so that connected stations can adjust diff --git a/package/kernel/mac80211/patches/316-ath9k_hw-set-spectral-scan-enable-bit-on-trigger-for.patch b/package/kernel/mac80211/patches/316-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/316-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/317-Revert-ath9k_hw-implement-temperature-compensation-s.patch b/package/kernel/mac80211/patches/317-Revert-ath9k_hw-implement-temperature-compensation-s.patch new file mode 100644 index 0000000000..687df35a9e --- /dev/null +++ b/package/kernel/mac80211/patches/317-Revert-ath9k_hw-implement-temperature-compensation-s.patch @@ -0,0 +1,101 @@ +From: Felix Fietkau +Date: Tue, 11 Oct 2016 19:45:41 +0200 +Subject: [PATCH] Revert "ath9k_hw: implement temperature compensation support + for AR9003+" + +This reverts commit 171f6402e4aa5cd3b8407f82501f7ea21fa54ccc. +Some users report that this commit causes a regression in performance +under some conditions. + +Signed-off-by: Felix Fietkau +--- + +--- a/drivers/net/wireless/ath/ath9k/ar9003_calib.c ++++ b/drivers/net/wireless/ath/ath9k/ar9003_calib.c +@@ -33,7 +33,6 @@ struct coeff { + + enum ar9003_cal_types { + IQ_MISMATCH_CAL = BIT(0), +- TEMP_COMP_CAL = BIT(1), + }; + + static void ar9003_hw_setup_calibration(struct ath_hw *ah, +@@ -59,12 +58,6 @@ static void ar9003_hw_setup_calibration( + /* Kick-off cal */ + REG_SET_BIT(ah, AR_PHY_TIMING4, AR_PHY_TIMING4_DO_CAL); + break; +- case TEMP_COMP_CAL: +- ath_dbg(common, CALIBRATE, +- "starting Temperature Compensation Calibration\n"); +- REG_SET_BIT(ah, AR_CH0_THERM, AR_CH0_THERM_LOCAL); +- REG_SET_BIT(ah, AR_CH0_THERM, AR_CH0_THERM_START); +- break; + default: + ath_err(common, "Invalid calibration type\n"); + break; +@@ -93,8 +86,7 @@ static bool ar9003_hw_per_calibration(st + /* + * Accumulate cal measures for active chains + */ +- if (cur_caldata->calCollect) +- cur_caldata->calCollect(ah); ++ cur_caldata->calCollect(ah); + ah->cal_samples++; + + if (ah->cal_samples >= cur_caldata->calNumSamples) { +@@ -107,8 +99,7 @@ static bool ar9003_hw_per_calibration(st + /* + * Process accumulated data + */ +- if (cur_caldata->calPostProc) +- cur_caldata->calPostProc(ah, numChains); ++ cur_caldata->calPostProc(ah, numChains); + + /* Calibration has finished. */ + caldata->CalValid |= cur_caldata->calType; +@@ -323,16 +314,9 @@ static const struct ath9k_percal_data iq + ar9003_hw_iqcalibrate + }; + +-static const struct ath9k_percal_data temp_cal_single_sample = { +- TEMP_COMP_CAL, +- MIN_CAL_SAMPLES, +- PER_MAX_LOG_COUNT, +-}; +- + static void ar9003_hw_init_cal_settings(struct ath_hw *ah) + { + ah->iq_caldata.calData = &iq_cal_single_sample; +- ah->temp_caldata.calData = &temp_cal_single_sample; + + if (AR_SREV_9300_20_OR_LATER(ah)) { + ah->enabled_cals |= TX_IQ_CAL; +@@ -340,7 +324,7 @@ static void ar9003_hw_init_cal_settings( + ah->enabled_cals |= TX_IQ_ON_AGC_CAL; + } + +- ah->supp_cals = IQ_MISMATCH_CAL | TEMP_COMP_CAL; ++ ah->supp_cals = IQ_MISMATCH_CAL; + } + + #define OFF_UPPER_LT 24 +@@ -1399,9 +1383,6 @@ static void ar9003_hw_init_cal_common(st + INIT_CAL(&ah->iq_caldata); + INSERT_CAL(ah, &ah->iq_caldata); + +- INIT_CAL(&ah->temp_caldata); +- INSERT_CAL(ah, &ah->temp_caldata); +- + /* Initialize current pointer to first element in list */ + ah->cal_list_curr = ah->cal_list; + +--- a/drivers/net/wireless/ath/ath9k/hw.h ++++ b/drivers/net/wireless/ath/ath9k/hw.h +@@ -830,7 +830,6 @@ struct ath_hw { + /* Calibration */ + u32 supp_cals; + struct ath9k_cal_list iq_caldata; +- struct ath9k_cal_list temp_caldata; + struct ath9k_cal_list adcgain_caldata; + struct ath9k_cal_list adcdc_caldata; + struct ath9k_cal_list *cal_list; diff --git a/package/kernel/mac80211/patches/317-ath9k-Fix-beacon-configuration-for-addition-removal-.patch b/package/kernel/mac80211/patches/317-ath9k-Fix-beacon-configuration-for-addition-removal-.patch deleted file mode 100644 index 360dfbfafb..0000000000 --- a/package/kernel/mac80211/patches/317-ath9k-Fix-beacon-configuration-for-addition-removal-.patch +++ /dev/null @@ -1,544 +0,0 @@ -From: Benjamin Berg -Date: Mon, 4 Jul 2016 14:37:25 +0200 -Subject: [PATCH] ath9k: Fix beacon configuration for addition/removal of - interfaces - -This patch fixes some issues with interface reconfiguration. It could -for example happen that an AP interface in beacon slot 0 was removed -leaving an IBSS station in one of the other slots. When this happens -the driver never sends out the beacon as it only tries to send a beacon -from slot 0. - -Appart from that the tracking of required changes to the beacon config is -relatively complicated and prone to errors. - -The approach taken here is to solve reconfiguration issues is to -reconfigure the beacons when any interface changes. This means that -the complexity of deciding whether an interface change may modify the -beacon configuration is gone. It also means that the beacon config will -be reliably updated when an interface is removed. - -The issue that a single non-AP interface might not be in beacon -slot 0 and wouldn't be send out is solved by moving it into the -first slot. The TSF value in hardware is adjusted accordingly so -that the timestamp of the beacons stay consistent. - -Signed-off-by: Benjamin Berg ---- - ---- a/drivers/net/wireless/ath/ath9k/ath9k.h -+++ b/drivers/net/wireless/ath/ath9k/ath9k.h -@@ -637,6 +637,8 @@ struct ath9k_vif_iter_data { - int nwds; /* number of WDS vifs */ - int nadhocs; /* number of adhoc vifs */ - int nocbs; /* number of OCB vifs */ -+ int nbcnvifs; /* number of beaconing vifs */ -+ struct ieee80211_vif *primary_beacon_vif; - struct ieee80211_vif *primary_sta; - }; - -@@ -685,10 +687,11 @@ struct ath_beacon { - }; - - void ath9k_beacon_tasklet(unsigned long data); --void ath9k_beacon_config(struct ath_softc *sc, struct ieee80211_vif *vif, -- u32 changed); -+void ath9k_beacon_config(struct ath_softc *sc, struct ieee80211_vif *main_vif, -+ bool beacons); - void ath9k_beacon_assign_slot(struct ath_softc *sc, struct ieee80211_vif *vif); - void ath9k_beacon_remove_slot(struct ath_softc *sc, struct ieee80211_vif *vif); -+void ath9k_beacon_ensure_primary_slot(struct ath_softc *sc); - void ath9k_set_beacon(struct ath_softc *sc); - bool ath9k_csa_is_finished(struct ath_softc *sc, struct ieee80211_vif *vif); - void ath9k_csa_update(struct ath_softc *sc); ---- a/drivers/net/wireless/ath/ath9k/beacon.c -+++ b/drivers/net/wireless/ath/ath9k/beacon.c -@@ -209,7 +209,6 @@ void ath9k_beacon_assign_slot(struct ath - } - - sc->beacon.bslot[avp->av_bslot] = vif; -- sc->nbcnvifs++; - - ath_dbg(common, CONFIG, "Added interface at beacon slot: %d\n", - avp->av_bslot); -@@ -220,15 +219,12 @@ void ath9k_beacon_remove_slot(struct ath - struct ath_common *common = ath9k_hw_common(sc->sc_ah); - struct ath_vif *avp = (void *)vif->drv_priv; - struct ath_buf *bf = avp->av_bcbuf; -- struct ath_beacon_config *cur_conf = &sc->cur_chan->beacon; - - ath_dbg(common, CONFIG, "Removing interface at beacon slot: %d\n", - avp->av_bslot); - - tasklet_disable(&sc->bcon_tasklet); - -- cur_conf->enable_beacon &= ~BIT(avp->av_bslot); -- - if (bf && bf->bf_mpdu) { - struct sk_buff *skb = bf->bf_mpdu; - dma_unmap_single(sc->dev, bf->bf_buf_addr, -@@ -240,12 +236,73 @@ void ath9k_beacon_remove_slot(struct ath - - avp->av_bcbuf = NULL; - sc->beacon.bslot[avp->av_bslot] = NULL; -- sc->nbcnvifs--; - list_add_tail(&bf->list, &sc->beacon.bbuf); - - tasklet_enable(&sc->bcon_tasklet); - } - -+void ath9k_beacon_ensure_primary_slot(struct ath_softc *sc) -+{ -+ struct ath_common *common = ath9k_hw_common(sc->sc_ah); -+ struct ieee80211_vif *vif; -+ struct ath_vif *avp; -+ s64 tsfadjust; -+ u32 offset; -+ int first_slot = ATH_BCBUF; -+ int slot; -+ -+ tasklet_disable(&sc->bcon_tasklet); -+ -+ /* Find first taken slot. */ -+ for (slot = 0; slot < ATH_BCBUF; slot++) { -+ if (sc->beacon.bslot[slot]) { -+ first_slot = slot; -+ break; -+ } -+ } -+ if (first_slot == 0) -+ goto out; -+ -+ /* Re-enumarate all slots, moving them forward. */ -+ for (slot = 0; slot < ATH_BCBUF; slot++) { -+ if (slot + first_slot < ATH_BCBUF) { -+ vif = sc->beacon.bslot[slot + first_slot]; -+ sc->beacon.bslot[slot] = vif; -+ -+ if (vif) { -+ avp = (void *)vif->drv_priv; -+ avp->av_bslot = slot; -+ } -+ } else { -+ sc->beacon.bslot[slot] = NULL; -+ } -+ } -+ -+ vif = sc->beacon.bslot[0]; -+ if (WARN_ON(!vif)) -+ goto out; -+ -+ /* Get the tsf_adjust value for the new first slot. */ -+ avp = (void *)vif->drv_priv; -+ tsfadjust = le64_to_cpu(avp->tsf_adjust); -+ -+ ath_dbg(common, CONFIG, -+ "Adjusting global TSF after beacon slot reassignment: %lld\n", -+ (signed long long)tsfadjust); -+ -+ /* Modify TSF as required and update the HW. */ -+ avp->chanctx->tsf_val += tsfadjust; -+ if (sc->cur_chan == avp->chanctx) { -+ offset = ath9k_hw_get_tsf_offset(&avp->chanctx->tsf_ts, NULL); -+ ath9k_hw_settsf64(sc->sc_ah, avp->chanctx->tsf_val + offset); -+ } -+ -+ /* The slots tsf_adjust will be updated by ath9k_beacon_config later. */ -+ -+out: -+ tasklet_enable(&sc->bcon_tasklet); -+} -+ - static int ath9k_beacon_choose_slot(struct ath_softc *sc) - { - struct ath_common *common = ath9k_hw_common(sc->sc_ah); -@@ -274,26 +331,33 @@ static int ath9k_beacon_choose_slot(stru - return slot; - } - --static void ath9k_set_tsfadjust(struct ath_softc *sc, struct ieee80211_vif *vif) -+static void ath9k_set_tsfadjust(struct ath_softc *sc, -+ struct ath_beacon_config *cur_conf) - { - struct ath_common *common = ath9k_hw_common(sc->sc_ah); -- struct ath_vif *avp = (void *)vif->drv_priv; -- struct ath_beacon_config *cur_conf = &avp->chanctx->beacon; - s64 tsfadjust; -+ int slot; - -- if (avp->av_bslot == 0) -- return; -+ for (slot = 0; slot < ATH_BCBUF; slot++) { -+ struct ath_vif *avp; - -- /* tsf_adjust is added to the TSF value. We send out the beacon late, -- * so need to adjust the TSF starting point to be later in time (i.e. -- * the theoretical first beacon has a TSF of 0 after correction). -- */ -- tsfadjust = cur_conf->beacon_interval * avp->av_bslot; -- tsfadjust = -TU_TO_USEC(tsfadjust) / ATH_BCBUF; -- avp->tsf_adjust = cpu_to_le64(tsfadjust); -+ if (!sc->beacon.bslot[slot]) -+ continue; - -- ath_dbg(common, CONFIG, "tsfadjust is: %lld for bslot: %d\n", -- (signed long long)tsfadjust, avp->av_bslot); -+ avp = (void *)sc->beacon.bslot[slot]->drv_priv; -+ -+ /* tsf_adjust is added to the TSF value. We send out the -+ * beacon late, so need to adjust the TSF starting point to be -+ * later in time (i.e. the theoretical first beacon has a TSF -+ * of 0 after correction). -+ */ -+ tsfadjust = cur_conf->beacon_interval * avp->av_bslot; -+ tsfadjust = -TU_TO_USEC(tsfadjust) / ATH_BCBUF; -+ avp->tsf_adjust = cpu_to_le64(tsfadjust); -+ -+ ath_dbg(common, CONFIG, "tsfadjust is: %lld for bslot: %d\n", -+ (signed long long)tsfadjust, avp->av_bslot); -+ } - } - - bool ath9k_csa_is_finished(struct ath_softc *sc, struct ieee80211_vif *vif) -@@ -447,20 +511,28 @@ void ath9k_beacon_tasklet(unsigned long - * Both nexttbtt and intval have to be in usecs. - */ - static void ath9k_beacon_init(struct ath_softc *sc, u32 nexttbtt, -- u32 intval, bool reset_tsf) -+ u32 intval) - { - struct ath_hw *ah = sc->sc_ah; - - ath9k_hw_disable_interrupts(ah); -- if (reset_tsf) -- ath9k_hw_reset_tsf(ah); - ath9k_beaconq_config(sc); - ath9k_hw_beaconinit(ah, nexttbtt, intval); -+ ah->imask |= ATH9K_INT_SWBA; - sc->beacon.bmisscnt = 0; - ath9k_hw_set_interrupts(ah); - ath9k_hw_enable_interrupts(ah); - } - -+static void ath9k_beacon_stop(struct ath_softc *sc) -+{ -+ ath9k_hw_disable_interrupts(sc->sc_ah); -+ sc->sc_ah->imask &= ~(ATH9K_INT_SWBA | ATH9K_INT_BMISS); -+ sc->beacon.bmisscnt = 0; -+ ath9k_hw_set_interrupts(sc->sc_ah); -+ ath9k_hw_enable_interrupts(sc->sc_ah); -+} -+ - /* - * For multi-bss ap support beacons are either staggered evenly over N slots or - * burst together. For the former arrange for the SWBA to be delivered for each -@@ -472,7 +544,7 @@ static void ath9k_beacon_config_ap(struc - struct ath_hw *ah = sc->sc_ah; - - ath9k_cmn_beacon_config_ap(ah, conf, ATH_BCBUF); -- ath9k_beacon_init(sc, conf->nexttbtt, conf->intval, false); -+ ath9k_beacon_init(sc, conf->nexttbtt, conf->intval); - } - - static void ath9k_beacon_config_sta(struct ath_hw *ah, -@@ -501,7 +573,7 @@ static void ath9k_beacon_config_adhoc(st - - ath9k_cmn_beacon_config_adhoc(ah, conf); - -- ath9k_beacon_init(sc, conf->nexttbtt, conf->intval, conf->ibss_creator); -+ ath9k_beacon_init(sc, conf->nexttbtt, conf->intval); - - /* - * Set the global 'beacon has been configured' flag for the -@@ -511,44 +583,6 @@ static void ath9k_beacon_config_adhoc(st - set_bit(ATH_OP_BEACONS, &common->op_flags); - } - --static bool ath9k_allow_beacon_config(struct ath_softc *sc, -- struct ieee80211_vif *vif) --{ -- struct ath_common *common = ath9k_hw_common(sc->sc_ah); -- struct ath_vif *avp = (void *)vif->drv_priv; -- -- if (ath9k_is_chanctx_enabled()) { -- /* -- * If the VIF is not present in the current channel context, -- * then we can't do the usual opmode checks. Allow the -- * beacon config for the VIF to be updated in this case and -- * return immediately. -- */ -- if (sc->cur_chan != avp->chanctx) -- return true; -- } -- -- if (sc->sc_ah->opmode == NL80211_IFTYPE_AP) { -- if (vif->type != NL80211_IFTYPE_AP) { -- ath_dbg(common, CONFIG, -- "An AP interface is already present !\n"); -- return false; -- } -- } -- -- if (sc->sc_ah->opmode == NL80211_IFTYPE_STATION) { -- if ((vif->type == NL80211_IFTYPE_STATION) && -- test_bit(ATH_OP_BEACONS, &common->op_flags) && -- vif != sc->cur_chan->primary_sta) { -- ath_dbg(common, CONFIG, -- "Beacon already configured for a station interface\n"); -- return false; -- } -- } -- -- return true; --} -- - static void ath9k_cache_beacon_config(struct ath_softc *sc, - struct ath_chanctx *ctx, - struct ieee80211_bss_conf *bss_conf) -@@ -584,87 +618,79 @@ static void ath9k_cache_beacon_config(st - if (cur_conf->dtim_period == 0) - cur_conf->dtim_period = 1; - -+ ath9k_set_tsfadjust(sc, cur_conf); - } - --void ath9k_beacon_config(struct ath_softc *sc, struct ieee80211_vif *vif, -- u32 changed) -+void ath9k_beacon_config(struct ath_softc *sc, struct ieee80211_vif *main_vif, -+ bool beacons) - { -- struct ieee80211_bss_conf *bss_conf = &vif->bss_conf; -- struct ath_hw *ah = sc->sc_ah; -- struct ath_common *common = ath9k_hw_common(ah); -- struct ath_vif *avp = (void *)vif->drv_priv; -- struct ath_chanctx *ctx = avp->chanctx; -+ struct ath_hw *ah = sc->sc_ah; -+ struct ath_common *common = ath9k_hw_common(ah); -+ struct ath_vif *avp; -+ struct ath_chanctx *ctx; - struct ath_beacon_config *cur_conf; - unsigned long flags; -+ bool enabled; - bool skip_beacon = false; - -- if (!ctx) -+ if (!beacons) { -+ clear_bit(ATH_OP_BEACONS, &common->op_flags); -+ ath9k_beacon_stop(sc); - return; -+ } - -- cur_conf = &avp->chanctx->beacon; -- if (vif->type == NL80211_IFTYPE_AP) -- ath9k_set_tsfadjust(sc, vif); -- -- if (!ath9k_allow_beacon_config(sc, vif)) -+ if (WARN_ON(!main_vif)) - return; - -- if (vif->type == NL80211_IFTYPE_STATION) { -- ath9k_cache_beacon_config(sc, ctx, bss_conf); -- if (ctx != sc->cur_chan) -- return; -+ avp = (void *)main_vif->drv_priv; -+ ctx = avp->chanctx; -+ cur_conf = &ctx->beacon; -+ enabled = cur_conf->enable_beacon; -+ cur_conf->enable_beacon = beacons; -+ -+ if (sc->sc_ah->opmode == NL80211_IFTYPE_STATION) { -+ ath9k_cache_beacon_config(sc, ctx, &main_vif->bss_conf); - - ath9k_set_beacon(sc); - set_bit(ATH_OP_BEACONS, &common->op_flags); - return; - } - -- /* -- * Take care of multiple interfaces when -- * enabling/disabling SWBA. -- */ -- if (changed & BSS_CHANGED_BEACON_ENABLED) { -- bool enabled = cur_conf->enable_beacon; -- -- if (!bss_conf->enable_beacon) { -- cur_conf->enable_beacon &= ~BIT(avp->av_bslot); -- } else { -- cur_conf->enable_beacon |= BIT(avp->av_bslot); -- if (!enabled) -- ath9k_cache_beacon_config(sc, ctx, bss_conf); -- } -- } -- -- if (ctx != sc->cur_chan) -- return; -+ /* Update the beacon configuration. */ -+ ath9k_cache_beacon_config(sc, ctx, &main_vif->bss_conf); - - /* - * Configure the HW beacon registers only when we have a valid - * beacon interval. - */ - if (cur_conf->beacon_interval) { -- /* -- * If we are joining an existing IBSS network, start beaconing -- * only after a TSF-sync has taken place. Ensure that this -- * happens by setting the appropriate flags. -+ /* Special case to sync the TSF when joining an existing IBSS. -+ * This is only done if no AP interface is active. -+ * Note that mac80211 always resets the TSF when creating a new -+ * IBSS interface. - */ -- if ((changed & BSS_CHANGED_IBSS) && !bss_conf->ibss_creator && -- bss_conf->enable_beacon) { -+ if (sc->sc_ah->opmode == NL80211_IFTYPE_ADHOC && -+ !enabled && beacons && !main_vif->bss_conf.ibss_creator) { - spin_lock_irqsave(&sc->sc_pm_lock, flags); - sc->ps_flags |= PS_BEACON_SYNC | PS_WAIT_FOR_BEACON; - spin_unlock_irqrestore(&sc->sc_pm_lock, flags); - skip_beacon = true; -- } else { -- ath9k_set_beacon(sc); - } - - /* - * Do not set the ATH_OP_BEACONS flag for IBSS joiner mode - * here, it is done in ath9k_beacon_config_adhoc(). - */ -- if (cur_conf->enable_beacon && !skip_beacon) -+ if (beacons && !skip_beacon) { - set_bit(ATH_OP_BEACONS, &common->op_flags); -- else -+ ath9k_set_beacon(sc); -+ } else { - clear_bit(ATH_OP_BEACONS, &common->op_flags); -+ ath9k_beacon_stop(sc); -+ } -+ } else { -+ clear_bit(ATH_OP_BEACONS, &common->op_flags); -+ ath9k_beacon_stop(sc); - } - } - ---- a/drivers/net/wireless/ath/ath9k/common.h -+++ b/drivers/net/wireless/ath/ath9k/common.h -@@ -50,6 +50,7 @@ - #define IEEE80211_MS_TO_TU(x) (((x) * 1000) / 1024) - - struct ath_beacon_config { -+ struct ieee80211_vif *main_vif; - int beacon_interval; - u16 dtim_period; - u16 bmiss_timeout; ---- a/drivers/net/wireless/ath/ath9k/main.c -+++ b/drivers/net/wireless/ath/ath9k/main.c -@@ -910,6 +910,22 @@ static bool ath9k_uses_beacons(int type) - } - } - -+static void ath9k_vif_iter_set_beacon(struct ath9k_vif_iter_data *iter_data, -+ struct ieee80211_vif *vif) -+{ -+ /* Use the first (configured) interface, but prefering AP interfaces. */ -+ if (!iter_data->primary_beacon_vif) { -+ iter_data->primary_beacon_vif = vif; -+ } else { -+ if (iter_data->primary_beacon_vif->type != NL80211_IFTYPE_AP && -+ vif->type == NL80211_IFTYPE_AP) -+ iter_data->primary_beacon_vif = vif; -+ } -+ -+ iter_data->beacons = true; -+ iter_data->nbcnvifs += 1; -+} -+ - static void ath9k_vif_iter(struct ath9k_vif_iter_data *iter_data, - u8 *mac, struct ieee80211_vif *vif) - { -@@ -931,6 +947,8 @@ static void ath9k_vif_iter(struct ath9k_ - switch (vif->type) { - case NL80211_IFTYPE_AP: - iter_data->naps++; -+ if (vif->bss_conf.enable_beacon) -+ ath9k_vif_iter_set_beacon(iter_data, vif); - break; - case NL80211_IFTYPE_STATION: - iter_data->nstations++; -@@ -943,12 +961,12 @@ static void ath9k_vif_iter(struct ath9k_ - case NL80211_IFTYPE_ADHOC: - iter_data->nadhocs++; - if (vif->bss_conf.enable_beacon) -- iter_data->beacons = true; -+ ath9k_vif_iter_set_beacon(iter_data, vif); - break; - case NL80211_IFTYPE_MESH_POINT: - iter_data->nmeshes++; - if (vif->bss_conf.enable_beacon) -- iter_data->beacons = true; -+ ath9k_vif_iter_set_beacon(iter_data, vif); - break; - case NL80211_IFTYPE_WDS: - iter_data->nwds++; -@@ -1081,7 +1099,6 @@ void ath9k_calculate_summary_state(struc - struct ath_hw *ah = sc->sc_ah; - struct ath_common *common = ath9k_hw_common(ah); - struct ath9k_vif_iter_data iter_data; -- struct ath_beacon_config *cur_conf; - - ath_chanctx_check_active(sc, ctx); - -@@ -1103,13 +1120,12 @@ void ath9k_calculate_summary_state(struc - ath_hw_setbssidmask(common); - - if (iter_data.naps > 0) { -- cur_conf = &ctx->beacon; - ath9k_hw_set_tsfadjust(ah, true); - ah->opmode = NL80211_IFTYPE_AP; -- if (cur_conf->enable_beacon) -- iter_data.beacons = true; - } else { - ath9k_hw_set_tsfadjust(ah, false); -+ if (iter_data.beacons) -+ ath9k_beacon_ensure_primary_slot(sc); - - if (iter_data.nmeshes) - ah->opmode = NL80211_IFTYPE_MESH_POINT; -@@ -1134,7 +1150,6 @@ void ath9k_calculate_summary_state(struc - ctx->switch_after_beacon = true; - } - -- ah->imask &= ~ATH9K_INT_SWBA; - if (ah->opmode == NL80211_IFTYPE_STATION) { - bool changed = (iter_data.primary_sta != ctx->primary_sta); - -@@ -1151,16 +1166,12 @@ void ath9k_calculate_summary_state(struc - if (ath9k_hw_mci_is_enabled(sc->sc_ah)) - ath9k_mci_update_wlan_channels(sc, true); - } -- } else if (iter_data.beacons) { -- ah->imask |= ATH9K_INT_SWBA; - } -+ sc->nbcnvifs = iter_data.nbcnvifs; -+ ath9k_beacon_config(sc, iter_data.primary_beacon_vif, -+ iter_data.beacons); - ath9k_hw_set_interrupts(ah); - -- if (iter_data.beacons) -- set_bit(ATH_OP_BEACONS, &common->op_flags); -- else -- clear_bit(ATH_OP_BEACONS, &common->op_flags); -- - if (ah->slottime != iter_data.slottime) { - ah->slottime = iter_data.slottime; - ath9k_hw_init_global_settings(ah); -@@ -1777,9 +1788,7 @@ static void ath9k_bss_info_changed(struc - if ((changed & BSS_CHANGED_BEACON_ENABLED) || - (changed & BSS_CHANGED_BEACON_INT) || - (changed & BSS_CHANGED_BEACON_INFO)) { -- ath9k_beacon_config(sc, vif, changed); -- if (changed & BSS_CHANGED_BEACON_ENABLED) -- ath9k_calculate_summary_state(sc, avp->chanctx); -+ ath9k_calculate_summary_state(sc, avp->chanctx); - } - - if ((avp->chanctx == sc->cur_chan) && diff --git a/package/kernel/mac80211/patches/318-brcmfmac-slightly-simplify-building-interface-combin.patch b/package/kernel/mac80211/patches/318-brcmfmac-slightly-simplify-building-interface-combin.patch deleted file mode 100644 index d946ecce19..0000000000 --- a/package/kernel/mac80211/patches/318-brcmfmac-slightly-simplify-building-interface-combin.patch +++ /dev/null @@ -1,108 +0,0 @@ -From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= -Date: Tue, 7 Jun 2016 21:10:18 +0200 -Subject: [PATCH] brcmfmac: slightly simplify building interface combinations -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -This change reorders some operations in brcmf_setup_ifmodes in hope to -make it simpler: -1) It allocates arrays right before filling them. This way it's easier - to follow requested array length as it's immediately followed by - code filling it. It's easier to check e.g. why we need 4 entries for - P2P. Other than that it deduplicates some checks (e.g. for P2P). -2) It reorders code to first prepare limits and then define a new combo. - Previously this was mixed (e.g. we were setting num of channels - before preparing limits). -3) It modifies mbss code to use i variable just like other combos do. - -Signed-off-by: Rafał Miłecki -Acked-by: Arend van Spriel -Signed-off-by: Kalle Valo ---- - ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c -@@ -6284,29 +6284,15 @@ static int brcmf_setup_ifmodes(struct wi - if (!combo) - goto err; - -- c0_limits = kcalloc(p2p ? 3 : 2, sizeof(*c0_limits), GFP_KERNEL); -- if (!c0_limits) -- goto err; -- -- if (p2p) { -- p2p_limits = kcalloc(4, sizeof(*p2p_limits), GFP_KERNEL); -- if (!p2p_limits) -- goto err; -- } -- -- if (mbss) { -- mbss_limits = kcalloc(1, sizeof(*mbss_limits), GFP_KERNEL); -- if (!mbss_limits) -- goto err; -- } -- - wiphy->interface_modes = BIT(NL80211_IFTYPE_STATION) | - BIT(NL80211_IFTYPE_ADHOC) | - BIT(NL80211_IFTYPE_AP); - - c = 0; - i = 0; -- combo[c].num_different_channels = 1; -+ c0_limits = kcalloc(p2p ? 3 : 2, sizeof(*c0_limits), GFP_KERNEL); -+ if (!c0_limits) -+ goto err; - c0_limits[i].max = 1; - c0_limits[i++].types = BIT(NL80211_IFTYPE_STATION); - if (p2p) { -@@ -6324,6 +6310,7 @@ static int brcmf_setup_ifmodes(struct wi - c0_limits[i].max = 1; - c0_limits[i++].types = BIT(NL80211_IFTYPE_AP); - } -+ combo[c].num_different_channels = 1; - combo[c].max_interfaces = i; - combo[c].n_limits = i; - combo[c].limits = c0_limits; -@@ -6331,7 +6318,9 @@ static int brcmf_setup_ifmodes(struct wi - if (p2p) { - c++; - i = 0; -- combo[c].num_different_channels = 1; -+ p2p_limits = kcalloc(4, sizeof(*p2p_limits), GFP_KERNEL); -+ if (!p2p_limits) -+ goto err; - p2p_limits[i].max = 1; - p2p_limits[i++].types = BIT(NL80211_IFTYPE_STATION); - p2p_limits[i].max = 1; -@@ -6340,6 +6329,7 @@ static int brcmf_setup_ifmodes(struct wi - p2p_limits[i++].types = BIT(NL80211_IFTYPE_P2P_CLIENT); - p2p_limits[i].max = 1; - p2p_limits[i++].types = BIT(NL80211_IFTYPE_P2P_DEVICE); -+ combo[c].num_different_channels = 1; - combo[c].max_interfaces = i; - combo[c].n_limits = i; - combo[c].limits = p2p_limits; -@@ -6347,14 +6337,19 @@ static int brcmf_setup_ifmodes(struct wi - - if (mbss) { - c++; -+ i = 0; -+ mbss_limits = kcalloc(1, sizeof(*mbss_limits), GFP_KERNEL); -+ if (!mbss_limits) -+ goto err; -+ mbss_limits[i].max = 4; -+ mbss_limits[i++].types = BIT(NL80211_IFTYPE_AP); - combo[c].beacon_int_infra_match = true; - combo[c].num_different_channels = 1; -- mbss_limits[0].max = 4; -- mbss_limits[0].types = BIT(NL80211_IFTYPE_AP); - combo[c].max_interfaces = 4; -- combo[c].n_limits = 1; -+ combo[c].n_limits = i; - combo[c].limits = mbss_limits; - } -+ - wiphy->n_iface_combinations = n_combos; - wiphy->iface_combinations = combo; - return 0; diff --git a/package/kernel/mac80211/patches/318-mac80211-fix-up-mismerge-of-ieee80211_tx_dequeue.patch b/package/kernel/mac80211/patches/318-mac80211-fix-up-mismerge-of-ieee80211_tx_dequeue.patch new file mode 100644 index 0000000000..2e742e4484 --- /dev/null +++ b/package/kernel/mac80211/patches/318-mac80211-fix-up-mismerge-of-ieee80211_tx_dequeue.patch @@ -0,0 +1,35 @@ +From: Bob Copeland +Date: Wed, 12 Oct 2016 08:24:54 -0400 +Subject: [PATCH] mac80211: fix up mismerge of ieee80211_tx_dequeue + +Looks like this spinlock wound up on the wrong side of the +linearize, and I also lost the part that re-enters the loop. +Fix up to match mac80211-next. + +Signed-off-by: Bob Copeland +--- + +--- a/net/mac80211/tx.c ++++ b/net/mac80211/tx.c +@@ -3457,17 +3457,17 @@ begin: + skb_queue_splice_tail(&tx.skbs, &txqi->frags); + } + +-out: +- spin_unlock_bh(&fq->lock); +- + if (skb && skb_has_frag_list(skb) && + !ieee80211_hw_check(&local->hw, TX_FRAG_LIST)) { + if (skb_linearize(skb)) { + ieee80211_free_txskb(&local->hw, skb); +- return NULL; ++ goto begin; + } + } + ++out: ++ spin_unlock_bh(&fq->lock); ++ + return skb; + } + EXPORT_SYMBOL(ieee80211_tx_dequeue); diff --git a/package/kernel/mac80211/patches/319-0001-brcmfmac-fix-lockup-when-removing-P2P-interface-afte.patch b/package/kernel/mac80211/patches/319-0001-brcmfmac-fix-lockup-when-removing-P2P-interface-afte.patch deleted file mode 100644 index 073d012dea..0000000000 --- a/package/kernel/mac80211/patches/319-0001-brcmfmac-fix-lockup-when-removing-P2P-interface-afte.patch +++ /dev/null @@ -1,154 +0,0 @@ -From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= -Date: Fri, 17 Jun 2016 12:29:21 +0200 -Subject: [PATCH] brcmfmac: fix lockup when removing P2P interface after - event timeout -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -Removing P2P interface is handled by sending a proper request to the -firmware. On success firmware triggers an event and driver's handler -removes a matching interface. - -However on event timeout we remove interface directly from the cfg80211 -callback. Current code doesn't handle this case correctly as it always -assumes rtnl to be unlocked. - -Fix it by adding an extra rtnl_locked parameter to functions and calling -unregister_netdevice when needed. - -Signed-off-by: Rafał Miłecki -Signed-off-by: Kalle Valo ---- - ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c -@@ -548,12 +548,16 @@ fail: - return -EBADE; - } - --static void brcmf_net_detach(struct net_device *ndev) -+static void brcmf_net_detach(struct net_device *ndev, bool rtnl_locked) - { -- if (ndev->reg_state == NETREG_REGISTERED) -- unregister_netdev(ndev); -- else -+ if (ndev->reg_state == NETREG_REGISTERED) { -+ if (rtnl_locked) -+ unregister_netdevice(ndev); -+ else -+ unregister_netdev(ndev); -+ } else { - brcmf_cfg80211_free_netdev(ndev); -+ } - } - - void brcmf_net_setcarrier(struct brcmf_if *ifp, bool on) -@@ -651,7 +655,7 @@ struct brcmf_if *brcmf_add_if(struct brc - brcmf_err("ERROR: netdev:%s already exists\n", - ifp->ndev->name); - netif_stop_queue(ifp->ndev); -- brcmf_net_detach(ifp->ndev); -+ brcmf_net_detach(ifp->ndev, false); - drvr->iflist[bsscfgidx] = NULL; - } else { - brcmf_dbg(INFO, "netdev:%s ignore IF event\n", -@@ -699,7 +703,8 @@ struct brcmf_if *brcmf_add_if(struct brc - return ifp; - } - --static void brcmf_del_if(struct brcmf_pub *drvr, s32 bsscfgidx) -+static void brcmf_del_if(struct brcmf_pub *drvr, s32 bsscfgidx, -+ bool rtnl_locked) - { - struct brcmf_if *ifp; - -@@ -729,7 +734,7 @@ static void brcmf_del_if(struct brcmf_pu - cancel_work_sync(&ifp->multicast_work); - cancel_work_sync(&ifp->ndoffload_work); - } -- brcmf_net_detach(ifp->ndev); -+ brcmf_net_detach(ifp->ndev, rtnl_locked); - } else { - /* Only p2p device interfaces which get dynamically created - * end up here. In this case the p2p module should be informed -@@ -743,14 +748,14 @@ static void brcmf_del_if(struct brcmf_pu - } - } - --void brcmf_remove_interface(struct brcmf_if *ifp) -+void brcmf_remove_interface(struct brcmf_if *ifp, bool rtnl_locked) - { - if (!ifp || WARN_ON(ifp->drvr->iflist[ifp->bsscfgidx] != ifp)) - return; - brcmf_dbg(TRACE, "Enter, bsscfgidx=%d, ifidx=%d\n", ifp->bsscfgidx, - ifp->ifidx); - brcmf_fws_del_interface(ifp); -- brcmf_del_if(ifp->drvr, ifp->bsscfgidx); -+ brcmf_del_if(ifp->drvr, ifp->bsscfgidx, rtnl_locked); - } - - #ifdef CONFIG_INET -@@ -1057,9 +1062,9 @@ fail: - brcmf_fws_deinit(drvr); - } - if (ifp) -- brcmf_net_detach(ifp->ndev); -+ brcmf_net_detach(ifp->ndev, false); - if (p2p_ifp) -- brcmf_net_detach(p2p_ifp->ndev); -+ brcmf_net_detach(p2p_ifp->ndev, false); - drvr->iflist[0] = NULL; - drvr->iflist[1] = NULL; - if (drvr->settings->ignore_probe_fail) -@@ -1128,7 +1133,7 @@ void brcmf_detach(struct device *dev) - - /* make sure primary interface removed last */ - for (i = BRCMF_MAX_IFS-1; i > -1; i--) -- brcmf_remove_interface(drvr->iflist[i]); -+ brcmf_remove_interface(drvr->iflist[i], false); - - brcmf_cfg80211_detach(drvr->config); - ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.h -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.h -@@ -216,7 +216,7 @@ struct brcmf_if *brcmf_get_ifp(struct br - int brcmf_net_attach(struct brcmf_if *ifp, bool rtnl_locked); - struct brcmf_if *brcmf_add_if(struct brcmf_pub *drvr, s32 bsscfgidx, s32 ifidx, - bool is_p2pdev, char *name, u8 *mac_addr); --void brcmf_remove_interface(struct brcmf_if *ifp); -+void brcmf_remove_interface(struct brcmf_if *ifp, bool rtnl_locked); - void brcmf_txflowblock_if(struct brcmf_if *ifp, - enum brcmf_netif_stop_reason reason, bool state); - void brcmf_txfinalize(struct brcmf_if *ifp, struct sk_buff *txp, bool success); ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/fweh.c -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/fweh.c -@@ -183,7 +183,7 @@ static void brcmf_fweh_handle_if_event(s - err = brcmf_fweh_call_event_handler(ifp, emsg->event_code, emsg, data); - - if (ifp && ifevent->action == BRCMF_E_IF_DEL) -- brcmf_remove_interface(ifp); -+ brcmf_remove_interface(ifp, false); - } - - /** ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/p2p.c -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/p2p.c -@@ -2289,7 +2289,7 @@ int brcmf_p2p_del_vif(struct wiphy *wiph - err = 0; - } - if (err) -- brcmf_remove_interface(vif->ifp); -+ brcmf_remove_interface(vif->ifp, true); - - brcmf_cfg80211_arm_vif_event(cfg, NULL); - if (vif->wdev.iftype != NL80211_IFTYPE_P2P_DEVICE) -@@ -2395,7 +2395,7 @@ void brcmf_p2p_detach(struct brcmf_p2p_i - if (vif != NULL) { - brcmf_p2p_cancel_remain_on_channel(vif->ifp); - brcmf_p2p_deinit_discovery(p2p); -- brcmf_remove_interface(vif->ifp); -+ brcmf_remove_interface(vif->ifp, false); - } - /* just set it all to zero */ - memset(p2p, 0, sizeof(*p2p)); diff --git a/package/kernel/mac80211/patches/319-0002-brcmfmac-use-const-char-for-interface-name-in-brcmf_.patch b/package/kernel/mac80211/patches/319-0002-brcmfmac-use-const-char-for-interface-name-in-brcmf_.patch deleted file mode 100644 index 6d3f3c640c..0000000000 --- a/package/kernel/mac80211/patches/319-0002-brcmfmac-use-const-char-for-interface-name-in-brcmf_.patch +++ /dev/null @@ -1,40 +0,0 @@ -From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= -Date: Fri, 17 Jun 2016 12:48:44 +0200 -Subject: [PATCH] brcmfmac: use const char * for interface name in - brcmf_add_if -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -This function can work just fine with const pointer, it only calls -alloc_netdev which take const as well. Moreover it makes this function -more flexible as some cfg80211 callback may provide const char * as -well, e.g. add_virtual_intf. This will be needed for more advanced -interface management. - -Signed-off-by: Rafał Miłecki -Signed-off-by: Kalle Valo ---- - ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c -@@ -638,7 +638,7 @@ fail: - } - - struct brcmf_if *brcmf_add_if(struct brcmf_pub *drvr, s32 bsscfgidx, s32 ifidx, -- bool is_p2pdev, char *name, u8 *mac_addr) -+ bool is_p2pdev, const char *name, u8 *mac_addr) - { - struct brcmf_if *ifp; - struct net_device *ndev; ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.h -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.h -@@ -215,7 +215,7 @@ char *brcmf_ifname(struct brcmf_if *ifp) - struct brcmf_if *brcmf_get_ifp(struct brcmf_pub *drvr, int ifidx); - int brcmf_net_attach(struct brcmf_if *ifp, bool rtnl_locked); - struct brcmf_if *brcmf_add_if(struct brcmf_pub *drvr, s32 bsscfgidx, s32 ifidx, -- bool is_p2pdev, char *name, u8 *mac_addr); -+ bool is_p2pdev, const char *name, u8 *mac_addr); - void brcmf_remove_interface(struct brcmf_if *ifp, bool rtnl_locked); - void brcmf_txflowblock_if(struct brcmf_if *ifp, - enum brcmf_netif_stop_reason reason, bool state); diff --git a/package/kernel/mac80211/patches/319-0003-brcmfmac-include-also-core.h-header-in-cfg80211.h.patch b/package/kernel/mac80211/patches/319-0003-brcmfmac-include-also-core.h-header-in-cfg80211.h.patch deleted file mode 100644 index eeda76661c..0000000000 --- a/package/kernel/mac80211/patches/319-0003-brcmfmac-include-also-core.h-header-in-cfg80211.h.patch +++ /dev/null @@ -1,33 +0,0 @@ -From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= -Date: Sat, 18 Jun 2016 18:49:38 +0200 -Subject: [PATCH] brcmfmac: include also core.h header in cfg80211.h -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -This header provides two inline functions using struct brcmf_if so we -need core.h to avoid: - -drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.h: In function ‘ndev_to_prof’: -drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.h:368:13: error: dereferencing pointer to incomplete type - return &ifp->vif->profile; - ^ -drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.h: In function ‘ndev_to_vif’: -drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.h:374:12: error: dereferencing pointer to incomplete type - return ifp->vif; - ^ - -Signed-off-by: Rafał Miłecki -Signed-off-by: Kalle Valo ---- - ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.h -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.h -@@ -20,6 +20,7 @@ - /* for brcmu_d11inf */ - #include - -+#include "core.h" - #include "fwil_types.h" - #include "p2p.h" - diff --git a/package/kernel/mac80211/patches/319-0004-brcmfmac-add-missing-break-when-deleting-P2P_DEVICE.patch b/package/kernel/mac80211/patches/319-0004-brcmfmac-add-missing-break-when-deleting-P2P_DEVICE.patch deleted file mode 100644 index 3819248b0f..0000000000 --- a/package/kernel/mac80211/patches/319-0004-brcmfmac-add-missing-break-when-deleting-P2P_DEVICE.patch +++ /dev/null @@ -1,27 +0,0 @@ -From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= -Date: Sun, 19 Jun 2016 01:55:57 +0200 -Subject: [PATCH] brcmfmac: add missing break when deleting P2P_DEVICE -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -We obviously don't want to fall through in that switch. With this change -1) We wait for event (triggered by p2p_disc) as expected -2) We remove interface manually on timeout -3) We return 0 on success instead of -ENOTSUPP - -Signed-off-by: Rafał Miłecki -Signed-off-by: Kalle Valo ---- - ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/p2p.c -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/p2p.c -@@ -2263,6 +2263,8 @@ int brcmf_p2p_del_vif(struct wiphy *wiph - return 0; - brcmf_p2p_cancel_remain_on_channel(vif->ifp); - brcmf_p2p_deinit_discovery(p2p); -+ break; -+ - default: - return -ENOTSUPP; - } diff --git a/package/kernel/mac80211/patches/319-0005-brcmfmac-delete-interface-directly-in-code-that-sent.patch b/package/kernel/mac80211/patches/319-0005-brcmfmac-delete-interface-directly-in-code-that-sent.patch deleted file mode 100644 index 12d7eb4887..0000000000 --- a/package/kernel/mac80211/patches/319-0005-brcmfmac-delete-interface-directly-in-code-that-sent.patch +++ /dev/null @@ -1,75 +0,0 @@ -From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= -Date: Wed, 29 Jun 2016 21:54:26 +0200 -Subject: [PATCH] brcmfmac: delete interface directly in code that sent fw - request -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -So far when receiving event about in-firmware-interface removal our -event worker was notifying listener and afterwards it was removing Linux -interface. - -First of all it was resulting in slightly unexpected order. The listener -(del_virtual_intf callback) was (usually) returning with success before -we even called unregister_netdev(ice). - -Please note this couldn't be simply fixed by changing order of calls in -brcmf_fweh_handle_if_event as unregistering interface earlier could free -struct brcmf_if. - -Another problem of current implementation are possible lockups. Focus on -the time slot between calling event handler and removing Linux -interface. During that time original caller may leave (unlocking rtnl -semaphore) *and* another call to the same code may be done (locking it -again). If that happens our event handler will stuck at removing Linux -interface, it won't handle another event and will block process holding -rtnl lock. - -This can be simply solved by unregistering interface in a proper -callback, right after receiving confirmation event from firmware. This -only required modifying worker to don't unregister on its own if there -is someone waiting for the event. - -Signed-off-by: Rafał Miłecki -Signed-off-by: Kalle Valo ---- - ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/fweh.c -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/fweh.c -@@ -18,6 +18,7 @@ - #include "brcmu_wifi.h" - #include "brcmu_utils.h" - -+#include "cfg80211.h" - #include "core.h" - #include "debug.h" - #include "tracepoint.h" -@@ -182,8 +183,13 @@ static void brcmf_fweh_handle_if_event(s - - err = brcmf_fweh_call_event_handler(ifp, emsg->event_code, emsg, data); - -- if (ifp && ifevent->action == BRCMF_E_IF_DEL) -- brcmf_remove_interface(ifp, false); -+ if (ifp && ifevent->action == BRCMF_E_IF_DEL) { -+ bool armed = brcmf_cfg80211_vif_event_armed(drvr->config); -+ -+ /* Default handling in case no-one waits for this event */ -+ if (!armed) -+ brcmf_remove_interface(ifp, false); -+ } - } - - /** ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/p2p.c -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/p2p.c -@@ -2290,8 +2290,7 @@ int brcmf_p2p_del_vif(struct wiphy *wiph - else - err = 0; - } -- if (err) -- brcmf_remove_interface(vif->ifp, true); -+ brcmf_remove_interface(vif->ifp, true); - - brcmf_cfg80211_arm_vif_event(cfg, NULL); - if (vif->wdev.iftype != NL80211_IFTYPE_P2P_DEVICE) diff --git a/package/kernel/mac80211/patches/319-0006-brcmfmac-support-removing-AP-interfaces-with-interfa.patch b/package/kernel/mac80211/patches/319-0006-brcmfmac-support-removing-AP-interfaces-with-interfa.patch deleted file mode 100644 index 2f7165eade..0000000000 --- a/package/kernel/mac80211/patches/319-0006-brcmfmac-support-removing-AP-interfaces-with-interfa.patch +++ /dev/null @@ -1,84 +0,0 @@ -From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= -Date: Wed, 29 Jun 2016 21:54:27 +0200 -Subject: [PATCH] brcmfmac: support removing AP interfaces with - "interface_remove" -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -New firmwares (e.g. 10.10.69.36 for BCM4366) support "interface_remove" -for removing interfaces. Try to use this method on cfg80211 request. In -case of older firmwares (e.g. 7.35.177.56 for BCM43602 as I tested) this -will just result in firmware rejecting command and this won't change any -behavior. - -Signed-off-by: Rafał Miłecki -Signed-off-by: Kalle Valo ---- - ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c -@@ -785,12 +785,48 @@ s32 brcmf_notify_escan_complete(struct b - return err; - } - -+static int brcmf_cfg80211_del_ap_iface(struct wiphy *wiphy, -+ struct wireless_dev *wdev) -+{ -+ struct brcmf_cfg80211_info *cfg = wiphy_priv(wiphy); -+ struct net_device *ndev = wdev->netdev; -+ struct brcmf_if *ifp = netdev_priv(ndev); -+ int ret; -+ int err; -+ -+ brcmf_cfg80211_arm_vif_event(cfg, ifp->vif); -+ -+ err = brcmf_fil_bsscfg_data_set(ifp, "interface_remove", NULL, 0); -+ if (err) { -+ brcmf_err("interface_remove failed %d\n", err); -+ goto err_unarm; -+ } -+ -+ /* wait for firmware event */ -+ ret = brcmf_cfg80211_wait_vif_event(cfg, BRCMF_E_IF_DEL, -+ BRCMF_VIF_EVENT_TIMEOUT); -+ if (!ret) { -+ brcmf_err("timeout occurred\n"); -+ err = -EIO; -+ goto err_unarm; -+ } -+ -+ brcmf_remove_interface(ifp, true); -+ -+err_unarm: -+ brcmf_cfg80211_arm_vif_event(cfg, NULL); -+ return err; -+} -+ - static - int brcmf_cfg80211_del_iface(struct wiphy *wiphy, struct wireless_dev *wdev) - { - struct brcmf_cfg80211_info *cfg = wiphy_priv(wiphy); - struct net_device *ndev = wdev->netdev; - -+ if (ndev && ndev == cfg_to_ndev(cfg)) -+ return -ENOTSUPP; -+ - /* vif event pending in firmware */ - if (brcmf_cfg80211_vif_event_armed(cfg)) - return -EBUSY; -@@ -807,12 +843,13 @@ int brcmf_cfg80211_del_iface(struct wiph - switch (wdev->iftype) { - case NL80211_IFTYPE_ADHOC: - case NL80211_IFTYPE_STATION: -- case NL80211_IFTYPE_AP: - case NL80211_IFTYPE_AP_VLAN: - case NL80211_IFTYPE_WDS: - case NL80211_IFTYPE_MONITOR: - case NL80211_IFTYPE_MESH_POINT: - return -EOPNOTSUPP; -+ case NL80211_IFTYPE_AP: -+ return brcmf_cfg80211_del_ap_iface(wiphy, wdev); - case NL80211_IFTYPE_P2P_CLIENT: - case NL80211_IFTYPE_P2P_GO: - case NL80211_IFTYPE_P2P_DEVICE: diff --git a/package/kernel/mac80211/patches/319-0007-brcmfmac-respect-hidden_ssid-for-AP-interfaces.patch b/package/kernel/mac80211/patches/319-0007-brcmfmac-respect-hidden_ssid-for-AP-interfaces.patch deleted file mode 100644 index 26721d6f68..0000000000 --- a/package/kernel/mac80211/patches/319-0007-brcmfmac-respect-hidden_ssid-for-AP-interfaces.patch +++ /dev/null @@ -1,46 +0,0 @@ -From c940de10d45efc5664ee993a6da281f45c804e59 Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= -Date: Wed, 6 Jul 2016 12:22:54 +0200 -Subject: [PATCH] brcmfmac: respect hidden_ssid for AP interfaces -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -This was succesfully tested with 4366B1. A small workaround is needed -for the main interface otherwise it would stuck at the hidden state. - -Signed-off-by: Rafał Miłecki -Signed-off-by: Kalle Valo ---- - drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c | 13 +++++++++++++ - 1 file changed, 13 insertions(+) - ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c -@@ -4662,6 +4662,15 @@ brcmf_cfg80211_start_ap(struct wiphy *wi - brcmf_err("SET SSID error (%d)\n", err); - goto exit; - } -+ -+ if (settings->hidden_ssid) { -+ err = brcmf_fil_iovar_int_set(ifp, "closednet", 1); -+ if (err) { -+ brcmf_err("closednet error (%d)\n", err); -+ goto exit; -+ } -+ } -+ - brcmf_dbg(TRACE, "AP mode configuration complete\n"); - } else if (dev_role == NL80211_IFTYPE_P2P_GO) { - err = brcmf_fil_iovar_int_set(ifp, "chanspec", chanspec); -@@ -4720,6 +4729,10 @@ static int brcmf_cfg80211_stop_ap(struct - return err; - } - -+ /* First BSS doesn't get a full reset */ -+ if (ifp->bsscfgidx == 0) -+ brcmf_fil_iovar_int_set(ifp, "closednet", 0); -+ - memset(&join_params, 0, sizeof(join_params)); - err = brcmf_fil_cmd_data_set(ifp, BRCMF_C_SET_SSID, - &join_params, sizeof(join_params)); diff --git a/package/kernel/mac80211/patches/319-0008-brcmfmac-restore-stopping-netdev-queue-when-bus-clog.patch b/package/kernel/mac80211/patches/319-0008-brcmfmac-restore-stopping-netdev-queue-when-bus-clog.patch deleted file mode 100644 index 740f84ef27..0000000000 --- a/package/kernel/mac80211/patches/319-0008-brcmfmac-restore-stopping-netdev-queue-when-bus-clog.patch +++ /dev/null @@ -1,56 +0,0 @@ -From 82bc9ab6a8f577d2174a736c33f3d4ecf7d9ef47 Mon Sep 17 00:00:00 2001 -From: Arend Van Spriel -Date: Fri, 15 Jul 2016 12:16:12 +0200 -Subject: [PATCH] brcmfmac: restore stopping netdev queue when bus clogs up -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -When the host-interface bus has hard time handling transmit packets -it informs higher layer about this and it would stop the netdev -queue when needed. However, since commit 9cd18359d31e ("brcmfmac: -Make FWS queueing configurable.") this was broken. With this patch -the behaviour is restored. - -Cc: stable@vger.kernel.org # v4.5, v4.6, v4.7 -Fixes: 9cd18359d31e ("brcmfmac: Make FWS queueing configurable.") -Tested-by: Per Förlin -Reviewed-by: Hante Meuleman -Reviewed-by: Pieter-Paul Giesberts -Reviewed-by: Franky Lin -Signed-off-by: Arend van Spriel -Signed-off-by: Kalle Valo ---- - .../broadcom/brcm80211/brcmfmac/fwsignal.c | 22 +++++++++++++++++----- - 1 file changed, 17 insertions(+), 5 deletions(-) - ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/fwsignal.c -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/fwsignal.c -@@ -2469,10 +2469,22 @@ void brcmf_fws_bustxfail(struct brcmf_fw - void brcmf_fws_bus_blocked(struct brcmf_pub *drvr, bool flow_blocked) - { - struct brcmf_fws_info *fws = drvr->fws; -+ struct brcmf_if *ifp; -+ int i; - -- fws->bus_flow_blocked = flow_blocked; -- if (!flow_blocked) -- brcmf_fws_schedule_deq(fws); -- else -- fws->stats.bus_flow_block++; -+ if (fws->avoid_queueing) { -+ for (i = 0; i < BRCMF_MAX_IFS; i++) { -+ ifp = drvr->iflist[i]; -+ if (!ifp || !ifp->ndev) -+ continue; -+ brcmf_txflowblock_if(ifp, BRCMF_NETIF_STOP_REASON_FLOW, -+ flow_blocked); -+ } -+ } else { -+ fws->bus_flow_blocked = flow_blocked; -+ if (!flow_blocked) -+ brcmf_fws_schedule_deq(fws); -+ else -+ fws->stats.bus_flow_block++; -+ } - } diff --git a/package/kernel/mac80211/patches/319-0009-brcmfmac-defer-DPC-processing-during-probe.patch b/package/kernel/mac80211/patches/319-0009-brcmfmac-defer-DPC-processing-during-probe.patch deleted file mode 100644 index 2fbf5e3fdb..0000000000 --- a/package/kernel/mac80211/patches/319-0009-brcmfmac-defer-DPC-processing-during-probe.patch +++ /dev/null @@ -1,42 +0,0 @@ -From fd3ed33f51c2a586412d35b4f64803f019ab589f Mon Sep 17 00:00:00 2001 -From: Arend Van Spriel -Date: Fri, 15 Jul 2016 12:39:13 +0200 -Subject: [PATCH] brcmfmac: defer DPC processing during probe - -The sdio dpc starts processing when in SDIOD_STATE_DATA. This state was -entered right after firmware download. This patch moves that transition -just before enabling sdio interrupt handling thus avoiding watchdog -expiry which would put the bus to sleep while probing. - -Reviewed-by: Hante Meuleman -Reviewed-by: Pieter-Paul Giesberts -Reviewed-by: Franky Lin -Signed-off-by: Arend van Spriel -Signed-off-by: Kalle Valo ---- - drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c | 7 +++---- - 1 file changed, 3 insertions(+), 4 deletions(-) - ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c -@@ -3305,10 +3305,6 @@ static int brcmf_sdio_download_firmware( - goto err; - } - -- /* Allow full data communication using DPC from now on. */ -- brcmf_sdiod_change_state(bus->sdiodev, BRCMF_SDIOD_DATA); -- bcmerror = 0; -- - err: - brcmf_sdio_clkctl(bus, CLK_SDONLY, false); - sdio_release_host(bus->sdiodev->func[1]); -@@ -4046,6 +4042,9 @@ static void brcmf_sdio_firmware_callback - } - - if (err == 0) { -+ /* Allow full data communication using DPC from now on. */ -+ brcmf_sdiod_change_state(bus->sdiodev, BRCMF_SDIOD_DATA); -+ - err = brcmf_sdiod_intr_register(sdiodev); - if (err != 0) - brcmf_err("intr register failed:%d\n", err); diff --git a/package/kernel/mac80211/patches/319-0010-brcmfmac-Fix-glob_skb-leak-in-brcmf_sdiod_recv_chain.patch b/package/kernel/mac80211/patches/319-0010-brcmfmac-Fix-glob_skb-leak-in-brcmf_sdiod_recv_chain.patch deleted file mode 100644 index c33aa2dab9..0000000000 --- a/package/kernel/mac80211/patches/319-0010-brcmfmac-Fix-glob_skb-leak-in-brcmf_sdiod_recv_chain.patch +++ /dev/null @@ -1,32 +0,0 @@ -From 3bdae810721b33061d2e541bd78a70f86ca42af3 Mon Sep 17 00:00:00 2001 -From: Florian Fainelli -Date: Mon, 18 Jul 2016 16:24:34 -0700 -Subject: [PATCH] brcmfmac: Fix glob_skb leak in brcmf_sdiod_recv_chain - -In case brcmf_sdiod_recv_chain() cannot complete a succeful call to -brcmf_sdiod_buffrw, we would be leaking glom_skb and not free it as we -should, fix this. - -Reported-by: coverity (CID 1164856) -Fixes: a413e39a38573 ("brcmfmac: fix brcmf_sdcard_recv_chain() for host without sg support") -Signed-off-by: Florian Fainelli -Acked-by: Arend van Spriel -Signed-off-by: Kalle Valo ---- - drivers/net/wireless/broadcom/brcm80211/brcmfmac/bcmsdh.c | 4 +++- - 1 file changed, 3 insertions(+), 1 deletion(-) - ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/bcmsdh.c -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/bcmsdh.c -@@ -726,8 +726,10 @@ int brcmf_sdiod_recv_chain(struct brcmf_ - return -ENOMEM; - err = brcmf_sdiod_buffrw(sdiodev, SDIO_FUNC_2, false, addr, - glom_skb); -- if (err) -+ if (err) { -+ brcmu_pkt_buf_free_skb(glom_skb); - goto done; -+ } - - skb_queue_walk(pktq, skb) { - memcpy(skb->data, glom_skb->data, skb->len); diff --git a/package/kernel/mac80211/patches/319-0011-net-wireless-broadcom-brcm80211-brcmfmac-usb-don-t-p.patch b/package/kernel/mac80211/patches/319-0011-net-wireless-broadcom-brcm80211-brcmfmac-usb-don-t-p.patch deleted file mode 100644 index 540b7f08bf..0000000000 --- a/package/kernel/mac80211/patches/319-0011-net-wireless-broadcom-brcm80211-brcmfmac-usb-don-t-p.patch +++ /dev/null @@ -1,34 +0,0 @@ -From 938f89e50a41c2d56710805fb019ad7618cef84b Mon Sep 17 00:00:00 2001 -From: Wolfram Sang -Date: Thu, 11 Aug 2016 23:05:31 +0200 -Subject: [PATCH] net: wireless: broadcom: brcm80211: brcmfmac: usb: don't - print error when allocating urb fails - -kmalloc will print enough information in case of failure. - -Signed-off-by: Wolfram Sang -Signed-off-by: David S. Miller ---- - drivers/net/wireless/broadcom/brcm80211/brcmfmac/usb.c | 8 ++------ - 1 file changed, 2 insertions(+), 6 deletions(-) - ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/usb.c -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/usb.c -@@ -1099,15 +1099,11 @@ struct brcmf_usbdev *brcmf_usb_attach(st - devinfo->tx_freecount = ntxq; - - devinfo->ctl_urb = usb_alloc_urb(0, GFP_ATOMIC); -- if (!devinfo->ctl_urb) { -- brcmf_err("usb_alloc_urb (ctl) failed\n"); -+ if (!devinfo->ctl_urb) - goto error; -- } - devinfo->bulk_urb = usb_alloc_urb(0, GFP_ATOMIC); -- if (!devinfo->bulk_urb) { -- brcmf_err("usb_alloc_urb (bulk) failed\n"); -+ if (!devinfo->bulk_urb) - goto error; -- } - - return &devinfo->bus_pub; - diff --git a/package/kernel/mac80211/patches/319-0012-brcmfmac-Check-rtnl_lock-is-locked-when-removing-int.patch b/package/kernel/mac80211/patches/319-0012-brcmfmac-Check-rtnl_lock-is-locked-when-removing-int.patch deleted file mode 100644 index 6105e6e57f..0000000000 --- a/package/kernel/mac80211/patches/319-0012-brcmfmac-Check-rtnl_lock-is-locked-when-removing-int.patch +++ /dev/null @@ -1,111 +0,0 @@ -From 15dacf880e49ce3ecee05eb1a0c6b8e363dbacdc Mon Sep 17 00:00:00 2001 -From: "mhiramat@kernel.org" -Date: Mon, 15 Aug 2016 18:40:57 +0900 -Subject: [PATCH] brcmfmac: Check rtnl_lock is locked when removing interface -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -Check rtnl_lock is locked in brcmf_p2p_ifp_removed() by passing -rtnl_locked flag. Actually the caller brcmf_del_if() checks whether -the rtnl_lock is locked, but doesn't pass it to brcmf_p2p_ifp_removed(). - -Without this fix, wpa_supplicant goes softlockup with rtnl_lock -holding (this means all other process using netlink are locked up too) - -e.g. -[ 4495.876627] INFO: task wpa_supplicant:7307 blocked for more than 10 seconds. -[ 4495.876632] Tainted: G W 4.8.0-rc1+ #8 -[ 4495.876635] "echo 0 > /proc/sys/kernel/hung_task_timeout_secs" disables this message. -[ 4495.876638] wpa_supplicant D ffff974c647b39a0 0 7307 1 0x00000000 -[ 4495.876644] ffff974c647b39a0 0000000000000000 ffff974c00000000 ffff974c7dc59c58 -[ 4495.876651] ffff974c6b7417c0 ffff974c645017c0 ffff974c647b4000 ffffffff86f16c08 -[ 4495.876657] ffff974c645017c0 0000000000000246 00000000ffffffff ffff974c647b39b8 -[ 4495.876664] Call Trace: -[ 4495.876671] [] schedule+0x3c/0x90 -[ 4495.876676] [] schedule_preempt_disabled+0x15/0x20 -[ 4495.876682] [] mutex_lock_nested+0x176/0x3b0 -[ 4495.876686] [] ? rtnl_lock+0x17/0x20 -[ 4495.876690] [] rtnl_lock+0x17/0x20 -[ 4495.876720] [] brcmf_p2p_ifp_removed+0x4d/0x70 [brcmfmac] -[ 4495.876741] [] brcmf_remove_interface+0x196/0x1b0 [brcmfmac] -[ 4495.876760] [] brcmf_p2p_del_vif+0x111/0x220 [brcmfmac] -[ 4495.876777] [] brcmf_cfg80211_del_iface+0x21b/0x270 [brcmfmac] -[ 4495.876820] [] nl80211_del_interface+0xfe/0x3a0 [cfg80211] -[ 4495.876825] [] genl_family_rcv_msg+0x1b5/0x370 -[ 4495.876832] [] ? trace_hardirqs_on+0xd/0x10 -[ 4495.876836] [] genl_rcv_msg+0x7d/0xb0 -[ 4495.876839] [] ? genl_family_rcv_msg+0x370/0x370 -[ 4495.876846] [] netlink_rcv_skb+0x97/0xb0 -[ 4495.876849] [] genl_rcv+0x28/0x40 -[ 4495.876854] [] netlink_unicast+0x1d3/0x2f0 -[ 4495.876860] [] ? netlink_unicast+0x14b/0x2f0 -[ 4495.876866] [] netlink_sendmsg+0x2eb/0x3a0 -[ 4495.876870] [] sock_sendmsg+0x38/0x50 -[ 4495.876874] [] ___sys_sendmsg+0x27f/0x290 -[ 4495.876882] [] ? mntput_no_expire+0x5/0x3f0 -[ 4495.876888] [] ? mntput_no_expire+0x8e/0x3f0 -[ 4495.876894] [] ? mntput_no_expire+0x5/0x3f0 -[ 4495.876899] [] ? mntput+0x24/0x40 -[ 4495.876904] [] ? __fput+0x190/0x200 -[ 4495.876909] [] __sys_sendmsg+0x45/0x80 -[ 4495.876914] [] SyS_sendmsg+0x12/0x20 -[ 4495.876918] [] entry_SYSCALL_64_fastpath+0x23/0xc1 -[ 4495.876924] [] ? trace_hardirqs_off_caller+0x1f/0xc0 - -Signed-off-by: Masami Hiramatsu -Acked-by: Rafał Miłecki -Signed-off-by: Kalle Valo ---- - drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c | 2 +- - drivers/net/wireless/broadcom/brcm80211/brcmfmac/p2p.c | 8 +++++--- - drivers/net/wireless/broadcom/brcm80211/brcmfmac/p2p.h | 2 +- - 3 files changed, 7 insertions(+), 5 deletions(-) - ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c -@@ -743,7 +743,7 @@ static void brcmf_del_if(struct brcmf_pu - * serious troublesome side effects. The p2p module will clean - * up the ifp if needed. - */ -- brcmf_p2p_ifp_removed(ifp); -+ brcmf_p2p_ifp_removed(ifp, rtnl_locked); - kfree(ifp); - } - } ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/p2p.c -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/p2p.c -@@ -2299,7 +2299,7 @@ int brcmf_p2p_del_vif(struct wiphy *wiph - return err; - } - --void brcmf_p2p_ifp_removed(struct brcmf_if *ifp) -+void brcmf_p2p_ifp_removed(struct brcmf_if *ifp, bool rtnl_locked) - { - struct brcmf_cfg80211_info *cfg; - struct brcmf_cfg80211_vif *vif; -@@ -2308,9 +2308,11 @@ void brcmf_p2p_ifp_removed(struct brcmf_ - vif = ifp->vif; - cfg = wdev_to_cfg(&vif->wdev); - cfg->p2p.bss_idx[P2PAPI_BSSCFG_DEVICE].vif = NULL; -- rtnl_lock(); -+ if (!rtnl_locked) -+ rtnl_lock(); - cfg80211_unregister_wdev(&vif->wdev); -- rtnl_unlock(); -+ if (!rtnl_locked) -+ rtnl_unlock(); - brcmf_free_vif(vif); - } - ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/p2p.h -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/p2p.h -@@ -155,7 +155,7 @@ struct wireless_dev *brcmf_p2p_add_vif(s - int brcmf_p2p_del_vif(struct wiphy *wiphy, struct wireless_dev *wdev); - int brcmf_p2p_ifchange(struct brcmf_cfg80211_info *cfg, - enum brcmf_fil_p2p_if_types if_type); --void brcmf_p2p_ifp_removed(struct brcmf_if *ifp); -+void brcmf_p2p_ifp_removed(struct brcmf_if *ifp, bool rtnl_locked); - int brcmf_p2p_start_device(struct wiphy *wiphy, struct wireless_dev *wdev); - void brcmf_p2p_stop_device(struct wiphy *wiphy, struct wireless_dev *wdev); - int brcmf_p2p_scan_prep(struct wiphy *wiphy, diff --git a/package/kernel/mac80211/patches/319-0013-brcmfmac-Change-vif_event_lock-to-spinlock.patch b/package/kernel/mac80211/patches/319-0013-brcmfmac-Change-vif_event_lock-to-spinlock.patch deleted file mode 100644 index 6e788a728a..0000000000 --- a/package/kernel/mac80211/patches/319-0013-brcmfmac-Change-vif_event_lock-to-spinlock.patch +++ /dev/null @@ -1,175 +0,0 @@ -From b64abcb7dae6060c67ab0e548da3ef923c49641d Mon Sep 17 00:00:00 2001 -From: "mhiramat@kernel.org" -Date: Mon, 15 Aug 2016 18:41:12 +0900 -Subject: [PATCH] brcmfmac: Change vif_event_lock to spinlock - -Change vif_event_lock to spinlock from mutex, since this lock is -used in wait_event_timeout() via vif_event_equals(). This caused -a warning report as below. - -As far as I can see, this lock protects regions where updating -structure members, not function calls. Also, since those -regions are not called from interrupt handlers (of course, it -was a mutex), spin_lock is used instead of spin_lock_irqsave. - -[ 186.678550] ------------[ cut here ]------------ -[ 186.678556] WARNING: CPU: 2 PID: 7140 at /home/mhiramat/ksrc/linux/kernel/sched/core.c:7545 __might_sleep+0x7c/0x80 -[ 186.678560] do not call blocking ops when !TASK_RUNNING; state=2 set at [] prepare_to_wait_event+0x60/0x100 -[ 186.678560] Modules linked in: brcmfmac xt_CHECKSUM rfcomm ipt_MASQUERADE nf_nat_masquerade_ipv4 xt_addrtype br_netfilter xt_tcpudp ip6t_rpfilter ip6t_REJECT nf_reject_ipv6 ipt_REJECT nf_reject_ipv4 xt_conntrack ip_set nfnetlink ebtable_nat ebtable_broute bridge stp llc ebtable_filter ebtables ip6table_raw ip6table_security ip6table_nat nf_conntrack_ipv6 nf_defrag_ipv6 nf_nat_ipv6 ip6table_mangle ip6table_filter ip6_tables iptable_raw iptable_security iptable_nat nf_conntrack_ipv4 nf_defrag_ipv4 nf_nat_ipv4 nf_nat nf_conntrack iptable_mangle iptable_filter ip_tables x_tables bnep nls_iso8859_1 i2c_designware_platform i2c_designware_core snd_hda_codec_hdmi snd_hda_codec_realtek dcdbas snd_hda_codec_generic snd_hda_intel snd_hda_codec intel_rapl snd_hda_core x86_pkg_temp_thermal intel_powerclamp coretemp -[ 186.678594] snd_pcm crct10dif_pclmul crc32_pclmul aesni_intel aes_x86_64 joydev glue_helper snd_hwdep lrw gf128mul uvcvideo ablk_helper snd_seq_midi cryptd snd_seq_midi_event snd_rawmidi videobuf2_vmalloc videobuf2_memops snd_seq input_leds videobuf2_v4l2 cfg80211 videobuf2_core snd_timer videodev serio_raw btusb snd_seq_device media btrtl rtsx_pci_ms snd mei_me memstick hid_multitouch mei soundcore brcmutil idma64 virt_dma intel_lpss_pci processor_thermal_device intel_soc_dts_iosf hci_uart btbcm btqca btintel bluetooth int3403_thermal dell_smo8800 intel_lpss_acpi intel_lpss int3402_thermal int340x_thermal_zone intel_hid mac_hid int3400_thermal shpchp sparse_keymap acpi_pad acpi_thermal_rel acpi_als kfifo_buf industrialio kvm_intel kvm irqbypass parport_pc ppdev lp parport autofs4 btrfs xor raid6_pq -[ 186.678631] usbhid nouveau ttm i915 rtsx_pci_sdmmc mxm_wmi i2c_algo_bit drm_kms_helper syscopyarea sysfillrect sysimgblt fb_sys_fops psmouse drm ahci rtsx_pci nvme nvme_core libahci i2c_hid hid pinctrl_sunrisepoint video wmi pinctrl_intel fjes [last unloaded: brcmfmac] -[ 186.678646] CPU: 2 PID: 7140 Comm: wpa_supplicant Not tainted 4.8.0-rc1+ #8 -[ 186.678647] Hardware name: Dell Inc. XPS 15 9550/0N7TVV, BIOS 01.02.00 04/07/2016 -[ 186.678648] 0000000000000000 ffff9d8c64b5b900 ffffffff98442f23 ffff9d8c64b5b950 -[ 186.678651] 0000000000000000 ffff9d8c64b5b940 ffffffff9808b22b 00001d790000000d -[ 186.678653] ffffffff98c75e78 000000000000026c 0000000000000000 ffff9d8c2706d058 -[ 186.678655] Call Trace: -[ 186.678659] [] dump_stack+0x85/0xc2 -[ 186.678666] [] __warn+0xcb/0xf0 -[ 186.678668] [] warn_slowpath_fmt+0x4f/0x60 -[ 186.678671] [] ? prepare_to_wait_event+0x60/0x100 -[ 186.678672] [] ? prepare_to_wait_event+0x60/0x100 -[ 186.678674] [] __might_sleep+0x7c/0x80 -[ 186.678680] [] mutex_lock_nested+0x33/0x3b0 -[ 186.678682] [] ? trace_hardirqs_on+0xd/0x10 -[ 186.678689] [] brcmf_cfg80211_wait_vif_event+0xcd/0x130 [brcmfmac] -[ 186.678691] [] ? wake_atomic_t_function+0x60/0x60 -[ 186.678697] [] brcmf_p2p_del_vif+0xf9/0x220 [brcmfmac] -[ 186.678702] [] brcmf_cfg80211_del_iface+0x21b/0x270 [brcmfmac] -[ 186.678716] [] nl80211_del_interface+0xfe/0x3a0 [cfg80211] -[ 186.678718] [] genl_family_rcv_msg+0x1b5/0x370 -[ 186.678720] [] ? trace_hardirqs_on+0xd/0x10 -[ 186.678721] [] genl_rcv_msg+0x7d/0xb0 -[ 186.678722] [] ? genl_family_rcv_msg+0x370/0x370 -[ 186.678724] [] netlink_rcv_skb+0x97/0xb0 -[ 186.678726] [] genl_rcv+0x28/0x40 -[ 186.678727] [] netlink_unicast+0x1d3/0x2f0 -[ 186.678729] [] ? netlink_unicast+0x14b/0x2f0 -[ 186.678731] [] netlink_sendmsg+0x2eb/0x3a0 -[ 186.678733] [] sock_sendmsg+0x38/0x50 -[ 186.678734] [] ___sys_sendmsg+0x27f/0x290 -[ 186.678737] [] ? mntput_no_expire+0x5/0x3f0 -[ 186.678739] [] ? mntput_no_expire+0x8e/0x3f0 -[ 186.678741] [] ? mntput_no_expire+0x5/0x3f0 -[ 186.678743] [] ? mntput+0x24/0x40 -[ 186.678744] [] ? __fput+0x190/0x200 -[ 186.678746] [] __sys_sendmsg+0x45/0x80 -[ 186.678748] [] SyS_sendmsg+0x12/0x20 -[ 186.678749] [] entry_SYSCALL_64_fastpath+0x23/0xc1 -[ 186.678751] [] ? trace_hardirqs_off_caller+0x1f/0xc0 -[ 186.678752] ---[ end trace e224d66c5d8408b5 ]--- - -Signed-off-by: Masami Hiramatsu -Acked-by: Arend van Spriel -Signed-off-by: Kalle Valo ---- - .../broadcom/brcm80211/brcmfmac/cfg80211.c | 26 +++++++++++----------- - .../broadcom/brcm80211/brcmfmac/cfg80211.h | 2 +- - 2 files changed, 14 insertions(+), 14 deletions(-) - ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c -@@ -5631,7 +5631,7 @@ static s32 brcmf_notify_vif_event(struct - ifevent->action, ifevent->flags, ifevent->ifidx, - ifevent->bsscfgidx); - -- mutex_lock(&event->vif_event_lock); -+ spin_lock(&event->vif_event_lock); - event->action = ifevent->action; - vif = event->vif; - -@@ -5639,7 +5639,7 @@ static s32 brcmf_notify_vif_event(struct - case BRCMF_E_IF_ADD: - /* waiting process may have timed out */ - if (!cfg->vif_event.vif) { -- mutex_unlock(&event->vif_event_lock); -+ spin_unlock(&event->vif_event_lock); - return -EBADF; - } - -@@ -5650,24 +5650,24 @@ static s32 brcmf_notify_vif_event(struct - ifp->ndev->ieee80211_ptr = &vif->wdev; - SET_NETDEV_DEV(ifp->ndev, wiphy_dev(cfg->wiphy)); - } -- mutex_unlock(&event->vif_event_lock); -+ spin_unlock(&event->vif_event_lock); - wake_up(&event->vif_wq); - return 0; - - case BRCMF_E_IF_DEL: -- mutex_unlock(&event->vif_event_lock); -+ spin_unlock(&event->vif_event_lock); - /* event may not be upon user request */ - if (brcmf_cfg80211_vif_event_armed(cfg)) - wake_up(&event->vif_wq); - return 0; - - case BRCMF_E_IF_CHANGE: -- mutex_unlock(&event->vif_event_lock); -+ spin_unlock(&event->vif_event_lock); - wake_up(&event->vif_wq); - return 0; - - default: -- mutex_unlock(&event->vif_event_lock); -+ spin_unlock(&event->vif_event_lock); - break; - } - return -EINVAL; -@@ -5788,7 +5788,7 @@ static void wl_deinit_priv(struct brcmf_ - static void init_vif_event(struct brcmf_cfg80211_vif_event *event) - { - init_waitqueue_head(&event->vif_wq); -- mutex_init(&event->vif_event_lock); -+ spin_lock_init(&event->vif_event_lock); - } - - static s32 brcmf_dongle_roam(struct brcmf_if *ifp) -@@ -6687,9 +6687,9 @@ static inline bool vif_event_equals(stru - { - u8 evt_action; - -- mutex_lock(&event->vif_event_lock); -+ spin_lock(&event->vif_event_lock); - evt_action = event->action; -- mutex_unlock(&event->vif_event_lock); -+ spin_unlock(&event->vif_event_lock); - return evt_action == action; - } - -@@ -6698,10 +6698,10 @@ void brcmf_cfg80211_arm_vif_event(struct - { - struct brcmf_cfg80211_vif_event *event = &cfg->vif_event; - -- mutex_lock(&event->vif_event_lock); -+ spin_lock(&event->vif_event_lock); - event->vif = vif; - event->action = 0; -- mutex_unlock(&event->vif_event_lock); -+ spin_unlock(&event->vif_event_lock); - } - - bool brcmf_cfg80211_vif_event_armed(struct brcmf_cfg80211_info *cfg) -@@ -6709,9 +6709,9 @@ bool brcmf_cfg80211_vif_event_armed(stru - struct brcmf_cfg80211_vif_event *event = &cfg->vif_event; - bool armed; - -- mutex_lock(&event->vif_event_lock); -+ spin_lock(&event->vif_event_lock); - armed = event->vif != NULL; -- mutex_unlock(&event->vif_event_lock); -+ spin_unlock(&event->vif_event_lock); - - return armed; - } ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.h -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.h -@@ -227,7 +227,7 @@ struct escan_info { - */ - struct brcmf_cfg80211_vif_event { - wait_queue_head_t vif_wq; -- struct mutex vif_event_lock; -+ spinlock_t vif_event_lock; - u8 action; - struct brcmf_cfg80211_vif *vif; - }; diff --git a/package/kernel/mac80211/patches/319-0014-brcmfmac-add-missing-header-dependencies.patch b/package/kernel/mac80211/patches/319-0014-brcmfmac-add-missing-header-dependencies.patch deleted file mode 100644 index 1a7947b39a..0000000000 --- a/package/kernel/mac80211/patches/319-0014-brcmfmac-add-missing-header-dependencies.patch +++ /dev/null @@ -1,29 +0,0 @@ -From 8af92af3f2d55db143417a5d401696f4b642009a Mon Sep 17 00:00:00 2001 -From: Baoyou Xie -Date: Mon, 29 Aug 2016 20:39:35 +0800 -Subject: [PATCH] brcmfmac: add missing header dependencies - -We get 1 warning when building kernel with W=1: - -drivers/net/wireless/broadcom/brcm80211/brcmfmac/tracepoint.c:23:6: warning: no previous prototype for '__brcmf_err' [-Wmissing-prototypes] - -In fact, this function is declared in brcmfmac/debug.h, so this patch -adds missing header dependencies. - -Signed-off-by: Baoyou Xie -Acked-by: Arnd Bergmann -Signed-off-by: Kalle Valo ---- - drivers/net/wireless/broadcom/brcm80211/brcmfmac/tracepoint.c | 1 + - 1 file changed, 1 insertion(+) - ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/tracepoint.c -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/tracepoint.c -@@ -19,6 +19,7 @@ - #ifndef __CHECKER__ - #define CREATE_TRACE_POINTS - #include "tracepoint.h" -+#include "debug.h" - - void __brcmf_err(const char *func, const char *fmt, ...) - { diff --git a/package/kernel/mac80211/patches/319-0015-brcmfmac-Add-USB-ID-for-Cisco-Linksys-AE1200.patch b/package/kernel/mac80211/patches/319-0015-brcmfmac-Add-USB-ID-for-Cisco-Linksys-AE1200.patch deleted file mode 100644 index b33175e1f7..0000000000 --- a/package/kernel/mac80211/patches/319-0015-brcmfmac-Add-USB-ID-for-Cisco-Linksys-AE1200.patch +++ /dev/null @@ -1,51 +0,0 @@ -From bccf3ffc8c6d8e0251a15541bb4d12b423c4f729 Mon Sep 17 00:00:00 2001 -From: Ismael Luceno -Date: Mon, 22 Aug 2016 19:40:07 -0300 -Subject: [PATCH] brcmfmac: Add USB ID for Cisco Linksys AE1200 - -The AE1200 comes with different revisions of the BCM43235 chipset, -but all have the same USB ID. Only revision 3 can be supported. - -Signed-off-by: Ismael Luceno -Signed-off-by: Kalle Valo ---- - drivers/net/wireless/broadcom/brcm80211/brcmfmac/usb.c | 4 ++++ - drivers/net/wireless/broadcom/brcm80211/include/brcm_hw_ids.h | 2 ++ - 2 files changed, 6 insertions(+) - ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/usb.c -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/usb.c -@@ -1458,11 +1458,15 @@ static int brcmf_usb_reset_resume(struct - #define BRCMF_USB_DEVICE(dev_id) \ - { USB_DEVICE(BRCM_USB_VENDOR_ID_BROADCOM, dev_id) } - -+#define LINKSYS_USB_DEVICE(dev_id) \ -+ { USB_DEVICE(BRCM_USB_VENDOR_ID_LINKSYS, dev_id) } -+ - static struct usb_device_id brcmf_usb_devid_table[] = { - BRCMF_USB_DEVICE(BRCM_USB_43143_DEVICE_ID), - BRCMF_USB_DEVICE(BRCM_USB_43236_DEVICE_ID), - BRCMF_USB_DEVICE(BRCM_USB_43242_DEVICE_ID), - BRCMF_USB_DEVICE(BRCM_USB_43569_DEVICE_ID), -+ LINKSYS_USB_DEVICE(BRCM_USB_43235_LINKSYS_DEVICE_ID), - { USB_DEVICE(BRCM_USB_VENDOR_ID_LG, BRCM_USB_43242_LG_DEVICE_ID) }, - /* special entry for device with firmware loaded and running */ - BRCMF_USB_DEVICE(BRCM_USB_BCMFW_DEVICE_ID), ---- a/drivers/net/wireless/broadcom/brcm80211/include/brcm_hw_ids.h -+++ b/drivers/net/wireless/broadcom/brcm80211/include/brcm_hw_ids.h -@@ -22,6 +22,7 @@ - - #define BRCM_USB_VENDOR_ID_BROADCOM 0x0a5c - #define BRCM_USB_VENDOR_ID_LG 0x043e -+#define BRCM_USB_VENDOR_ID_LINKSYS 0x13b1 - #define BRCM_PCIE_VENDOR_ID_BROADCOM PCI_VENDOR_ID_BROADCOM - - /* Chipcommon Core Chip IDs */ -@@ -58,6 +59,7 @@ - - /* USB Device IDs */ - #define BRCM_USB_43143_DEVICE_ID 0xbd1e -+#define BRCM_USB_43235_LINKSYS_DEVICE_ID 0x0039 - #define BRCM_USB_43236_DEVICE_ID 0xbd17 - #define BRCM_USB_43242_DEVICE_ID 0xbd1f - #define BRCM_USB_43242_LG_DEVICE_ID 0x3101 diff --git a/package/kernel/mac80211/patches/319-0016-brcmfmac-fix-pmksa-bssid-usage.patch b/package/kernel/mac80211/patches/319-0016-brcmfmac-fix-pmksa-bssid-usage.patch deleted file mode 100644 index c6bc1c8294..0000000000 --- a/package/kernel/mac80211/patches/319-0016-brcmfmac-fix-pmksa-bssid-usage.patch +++ /dev/null @@ -1,51 +0,0 @@ -From 7703773ef1d85b40433902a8da20167331597e4a Mon Sep 17 00:00:00 2001 -From: Nicolas Iooss -Date: Tue, 23 Aug 2016 11:37:17 +0200 -Subject: [PATCH] brcmfmac: fix pmksa->bssid usage - -The struct cfg80211_pmksa defines its bssid field as: - - const u8 *bssid; - -contrary to struct brcmf_pmksa, which uses: - - u8 bssid[ETH_ALEN]; - -Therefore in brcmf_cfg80211_del_pmksa(), &pmksa->bssid takes the address -of this field (of type u8**), not the one of its content (which would be -u8*). Remove the & operator to make brcmf_dbg("%pM") and memcmp() -behave as expected. - -This bug have been found using a custom static checker (which checks the -usage of %p... attributes at build time). It has been introduced in -commit 6c404f34f2bd ("brcmfmac: Cleanup pmksa cache handling code"), -which replaced pmksa->bssid by &pmksa->bssid while refactoring the code, -without modifying struct cfg80211_pmksa definition. - -Replace &pmk[i].bssid with pmk[i].bssid too to make the code clearer, -this change does not affect the semantic. - -Fixes: 6c404f34f2bd ("brcmfmac: Cleanup pmksa cache handling code") -Cc: stable@vger.kernel.org -Signed-off-by: Nicolas Iooss -Signed-off-by: Kalle Valo ---- - drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c | 4 ++-- - 1 file changed, 2 insertions(+), 2 deletions(-) - ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c -@@ -3880,11 +3880,11 @@ brcmf_cfg80211_del_pmksa(struct wiphy *w - if (!check_vif_up(ifp->vif)) - return -EIO; - -- brcmf_dbg(CONN, "del_pmksa - PMK bssid = %pM\n", &pmksa->bssid); -+ brcmf_dbg(CONN, "del_pmksa - PMK bssid = %pM\n", pmksa->bssid); - - npmk = le32_to_cpu(cfg->pmk_list.npmk); - for (i = 0; i < npmk; i++) -- if (!memcmp(&pmksa->bssid, &pmk[i].bssid, ETH_ALEN)) -+ if (!memcmp(pmksa->bssid, pmk[i].bssid, ETH_ALEN)) - break; - - if ((npmk > 0) && (i < npmk)) { diff --git a/package/kernel/mac80211/patches/319-0017-brcmfmac-avoid-potential-stack-overflow-in-brcmf_cfg.patch b/package/kernel/mac80211/patches/319-0017-brcmfmac-avoid-potential-stack-overflow-in-brcmf_cfg.patch deleted file mode 100644 index a56dd72c46..0000000000 --- a/package/kernel/mac80211/patches/319-0017-brcmfmac-avoid-potential-stack-overflow-in-brcmf_cfg.patch +++ /dev/null @@ -1,34 +0,0 @@ -From ded89912156b1a47d940a0c954c43afbabd0c42c Mon Sep 17 00:00:00 2001 -From: Arend Van Spriel -Date: Mon, 5 Sep 2016 10:45:47 +0100 -Subject: [PATCH] brcmfmac: avoid potential stack overflow in - brcmf_cfg80211_start_ap() - -User-space can choose to omit NL80211_ATTR_SSID and only provide raw -IE TLV data. When doing so it can provide SSID IE with length exceeding -the allowed size. The driver further processes this IE copying it -into a local variable without checking the length. Hence stack can be -corrupted and used as exploit. - -Cc: stable@vger.kernel.org # v4.7 -Reported-by: Daxing Guo -Reviewed-by: Hante Meuleman -Reviewed-by: Pieter-Paul Giesberts -Reviewed-by: Franky Lin -Signed-off-by: Arend van Spriel -Signed-off-by: Kalle Valo ---- - drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c -@@ -4523,7 +4523,7 @@ brcmf_cfg80211_start_ap(struct wiphy *wi - (u8 *)&settings->beacon.head[ie_offset], - settings->beacon.head_len - ie_offset, - WLAN_EID_SSID); -- if (!ssid_ie) -+ if (!ssid_ie || ssid_ie->len > IEEE80211_MAX_SSID_LEN) - return -EINVAL; - - memcpy(ssid_le.SSID, ssid_ie->data, ssid_ie->len); diff --git a/package/kernel/mac80211/patches/319-0018-brcmfmac-add-support-for-bcm4339-chip-with-modalias-.patch b/package/kernel/mac80211/patches/319-0018-brcmfmac-add-support-for-bcm4339-chip-with-modalias-.patch deleted file mode 100644 index 20461b7015..0000000000 --- a/package/kernel/mac80211/patches/319-0018-brcmfmac-add-support-for-bcm4339-chip-with-modalias-.patch +++ /dev/null @@ -1,55 +0,0 @@ -From 634faf3686900ccdee87b77e2c56df8b2159912b Mon Sep 17 00:00:00 2001 -From: Arend Van Spriel -Date: Mon, 5 Sep 2016 11:42:12 +0100 -Subject: [PATCH] brcmfmac: add support for bcm4339 chip with modalias - sdio:c00v02D0d4339 - -The driver already supports the bcm4339 chipset but only for the variant -that shares the same modalias as the bcm4335, ie. sdio:c00v02D0d4335. -It turns out that there are also bcm4339 devices out there that have a -more distiguishable modalias sdio:c00v02D0d4339. - -Reported-by: Steve deRosier -Reviewed-by: Hante Meuleman -Reviewed-by: Pieter-Paul Giesberts -Reviewed-by: Franky Lin -Signed-off-by: Arend van Spriel -Signed-off-by: Kalle Valo ---- - drivers/net/wireless/broadcom/brcm80211/brcmfmac/bcmsdh.c | 1 + - drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c | 3 ++- - include/linux/mmc/sdio_ids.h | 1 + - 3 files changed, 4 insertions(+), 1 deletion(-) - ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/bcmsdh.c -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/bcmsdh.c -@@ -1101,6 +1101,7 @@ static const struct sdio_device_id brcmf - BRCMF_SDIO_DEVICE(SDIO_DEVICE_ID_BROADCOM_43341), - BRCMF_SDIO_DEVICE(SDIO_DEVICE_ID_BROADCOM_43362), - BRCMF_SDIO_DEVICE(SDIO_DEVICE_ID_BROADCOM_4335_4339), -+ BRCMF_SDIO_DEVICE(SDIO_DEVICE_ID_BROADCOM_4339), - BRCMF_SDIO_DEVICE(SDIO_DEVICE_ID_BROADCOM_43430), - BRCMF_SDIO_DEVICE(SDIO_DEVICE_ID_BROADCOM_4345), - BRCMF_SDIO_DEVICE(SDIO_DEVICE_ID_BROADCOM_4354), ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c -@@ -3757,7 +3757,8 @@ static u32 brcmf_sdio_buscore_read32(voi - u32 val, rev; - - val = brcmf_sdiod_regrl(sdiodev, addr, NULL); -- if (sdiodev->func[0]->device == SDIO_DEVICE_ID_BROADCOM_4335_4339 && -+ if ((sdiodev->func[0]->device == SDIO_DEVICE_ID_BROADCOM_4335_4339 || -+ sdiodev->func[0]->device == SDIO_DEVICE_ID_BROADCOM_4339) && - addr == CORE_CC_REG(SI_ENUM_BASE, chipid)) { - rev = (val & CID_REV_MASK) >> CID_REV_SHIFT; - if (rev >= 2) { ---- a/include/linux/mmc/sdio_ids.h -+++ b/include/linux/mmc/sdio_ids.h -@@ -32,6 +32,7 @@ - #define SDIO_DEVICE_ID_BROADCOM_43340 0xa94c - #define SDIO_DEVICE_ID_BROADCOM_43341 0xa94d - #define SDIO_DEVICE_ID_BROADCOM_4335_4339 0x4335 -+#define SDIO_DEVICE_ID_BROADCOM_4339 0x4339 - #define SDIO_DEVICE_ID_BROADCOM_43362 0xa962 - #define SDIO_DEVICE_ID_BROADCOM_43430 0xa9a6 - #define SDIO_DEVICE_ID_BROADCOM_4345 0x4345 diff --git a/package/kernel/mac80211/patches/319-0019-brcmfmac-sdio-shorten-retry-loop-in-brcmf_sdio_kso_c.patch b/package/kernel/mac80211/patches/319-0019-brcmfmac-sdio-shorten-retry-loop-in-brcmf_sdio_kso_c.patch deleted file mode 100644 index fb78fbe3ce..0000000000 --- a/package/kernel/mac80211/patches/319-0019-brcmfmac-sdio-shorten-retry-loop-in-brcmf_sdio_kso_c.patch +++ /dev/null @@ -1,56 +0,0 @@ -From 5251b6be8bb5c5675bdf12347c7b83937a5c91e5 Mon Sep 17 00:00:00 2001 -From: Arend Van Spriel -Date: Mon, 5 Sep 2016 11:42:13 +0100 -Subject: [PATCH] brcmfmac: sdio: shorten retry loop in - brcmf_sdio_kso_control() - -In brcmf_sdio_kso_control() there is a retry loop as hardware may take -time to settle. However, when the call to brcmf_sdiod_regrb() returns -an error it is due to SDIO access failure and it makes no sense to wait -for hardware to settle. This patch aborts the loop after a number of -subsequent access errors. - -Reviewed-by: Hante Meuleman -Reviewed-by: Pieter-Paul Giesberts -Reviewed-by: Franky Lin -Signed-off-by: Arend van Spriel -Signed-off-by: Kalle Valo ---- - drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c | 11 +++++++++-- - 1 file changed, 9 insertions(+), 2 deletions(-) - ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c -@@ -313,6 +313,7 @@ struct rte_console { - - #define KSO_WAIT_US 50 - #define MAX_KSO_ATTEMPTS (PMU_MAX_TRANSITION_DLY/KSO_WAIT_US) -+#define BRCMF_SDIO_MAX_ACCESS_ERRORS 5 - - /* - * Conversion of 802.1D priority to precedence level -@@ -677,6 +678,7 @@ brcmf_sdio_kso_control(struct brcmf_sdio - { - u8 wr_val = 0, rd_val, cmp_val, bmask; - int err = 0; -+ int err_cnt = 0; - int try_cnt = 0; - - brcmf_dbg(TRACE, "Enter: on=%d\n", on); -@@ -712,9 +714,14 @@ brcmf_sdio_kso_control(struct brcmf_sdio - */ - rd_val = brcmf_sdiod_regrb(bus->sdiodev, SBSDIO_FUNC1_SLEEPCSR, - &err); -- if (((rd_val & bmask) == cmp_val) && !err) -+ if (!err) { -+ if ((rd_val & bmask) == cmp_val) -+ break; -+ err_cnt = 0; -+ } -+ /* bail out upon subsequent access errors */ -+ if (err && (err_cnt++ > BRCMF_SDIO_MAX_ACCESS_ERRORS)) - break; -- - udelay(KSO_WAIT_US); - brcmf_sdiod_regwb(bus->sdiodev, SBSDIO_FUNC1_SLEEPCSR, - wr_val, &err); diff --git a/package/kernel/mac80211/patches/319-0020-brcmfmac-ignore-11d-configuration-errors.patch b/package/kernel/mac80211/patches/319-0020-brcmfmac-ignore-11d-configuration-errors.patch deleted file mode 100644 index 1c24f2dd94..0000000000 --- a/package/kernel/mac80211/patches/319-0020-brcmfmac-ignore-11d-configuration-errors.patch +++ /dev/null @@ -1,84 +0,0 @@ -From b3589dfe02123a0d0ea82076a9f8ef84a46852c0 Mon Sep 17 00:00:00 2001 -From: Hante Meuleman -Date: Mon, 19 Sep 2016 12:09:51 +0100 -Subject: [PATCH] brcmfmac: ignore 11d configuration errors - -802.11d is not always supported by firmware anymore. Currently the -AP configuration of 11d will cause an abort if the ioctl set is -failing. This behavior is not correct and the error should be -ignored. - -Reviewed-by: Arend Van Spriel -Reviewed-by: Franky Lin -Reviewed-by: Pieter-Paul Giesberts -Signed-off-by: Hante Meuleman -Signed-off-by: Arend van Spriel -Signed-off-by: Kalle Valo ---- - .../broadcom/brcm80211/brcmfmac/cfg80211.c | 27 ++++++++++++---------- - 1 file changed, 15 insertions(+), 12 deletions(-) - ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c -@@ -4498,6 +4498,7 @@ brcmf_cfg80211_start_ap(struct wiphy *wi - u16 chanspec = chandef_to_chanspec(&cfg->d11inf, &settings->chandef); - bool mbss; - int is_11d; -+ bool supports_11d; - - brcmf_dbg(TRACE, "ctrlchn=%d, center=%d, bw=%d, beacon_interval=%d, dtim_period=%d,\n", - settings->chandef.chan->hw_value, -@@ -4510,11 +4511,16 @@ brcmf_cfg80211_start_ap(struct wiphy *wi - mbss = ifp->vif->mbss; - - /* store current 11d setting */ -- brcmf_fil_cmd_int_get(ifp, BRCMF_C_GET_REGULATORY, &ifp->vif->is_11d); -- country_ie = brcmf_parse_tlvs((u8 *)settings->beacon.tail, -- settings->beacon.tail_len, -- WLAN_EID_COUNTRY); -- is_11d = country_ie ? 1 : 0; -+ if (brcmf_fil_cmd_int_get(ifp, BRCMF_C_GET_REGULATORY, -+ &ifp->vif->is_11d)) { -+ supports_11d = false; -+ } else { -+ country_ie = brcmf_parse_tlvs((u8 *)settings->beacon.tail, -+ settings->beacon.tail_len, -+ WLAN_EID_COUNTRY); -+ is_11d = country_ie ? 1 : 0; -+ supports_11d = true; -+ } - - memset(&ssid_le, 0, sizeof(ssid_le)); - if (settings->ssid == NULL || settings->ssid_len == 0) { -@@ -4573,7 +4579,7 @@ brcmf_cfg80211_start_ap(struct wiphy *wi - - /* Parameters shared by all radio interfaces */ - if (!mbss) { -- if (is_11d != ifp->vif->is_11d) { -+ if ((supports_11d) && (is_11d != ifp->vif->is_11d)) { - err = brcmf_fil_cmd_int_set(ifp, BRCMF_C_SET_REGULATORY, - is_11d); - if (err < 0) { -@@ -4615,7 +4621,7 @@ brcmf_cfg80211_start_ap(struct wiphy *wi - brcmf_err("SET INFRA error %d\n", err); - goto exit; - } -- } else if (WARN_ON(is_11d != ifp->vif->is_11d)) { -+ } else if (WARN_ON(supports_11d && (is_11d != ifp->vif->is_11d))) { - /* Multiple-BSS should use same 11d configuration */ - err = -EINVAL; - goto exit; -@@ -4749,11 +4755,8 @@ static int brcmf_cfg80211_stop_ap(struct - brcmf_err("setting INFRA mode failed %d\n", err); - if (brcmf_feat_is_enabled(ifp, BRCMF_FEAT_MBSS)) - brcmf_fil_iovar_int_set(ifp, "mbss", 0); -- err = brcmf_fil_cmd_int_set(ifp, BRCMF_C_SET_REGULATORY, -- ifp->vif->is_11d); -- if (err < 0) -- brcmf_err("restoring REGULATORY setting failed %d\n", -- err); -+ brcmf_fil_cmd_int_set(ifp, BRCMF_C_SET_REGULATORY, -+ ifp->vif->is_11d); - /* Bring device back up so it can be used again */ - err = brcmf_fil_cmd_int_set(ifp, BRCMF_C_UP, 1); - if (err < 0) diff --git a/package/kernel/mac80211/patches/319-0021-brcmfmac-rework-pointer-trickery-in-brcmf_proto_bcdc.patch b/package/kernel/mac80211/patches/319-0021-brcmfmac-rework-pointer-trickery-in-brcmf_proto_bcdc.patch deleted file mode 100644 index 9461164523..0000000000 --- a/package/kernel/mac80211/patches/319-0021-brcmfmac-rework-pointer-trickery-in-brcmf_proto_bcdc.patch +++ /dev/null @@ -1,32 +0,0 @@ -From 704d1c6b56f4ee2ad6a5f012a72a278d17c1a223 Mon Sep 17 00:00:00 2001 -From: Arend Van Spriel -Date: Mon, 19 Sep 2016 12:09:52 +0100 -Subject: [PATCH] brcmfmac: rework pointer trickery in - brcmf_proto_bcdc_query_dcmd() - -The variable info is assigned to point to bcdc->msg[1], which is the -same as pointing to bcdc->buf. As that is what we want to access -make it clear by fixing the assignment. This also avoid out-of-bounds -errors from static analyzers are bcdc->msg[1] is not in the structure -definition. - -Reviewed-by: Hante Meuleman -Reviewed-by: Pieter-Paul Giesberts -Reviewed-by: Franky Lin -Signed-off-by: Arend van Spriel -Signed-off-by: Kalle Valo ---- - drivers/net/wireless/broadcom/brcm80211/brcmfmac/bcdc.c | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/bcdc.c -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/bcdc.c -@@ -194,7 +194,7 @@ retry: - } - - /* Check info buffer */ -- info = (void *)&msg[1]; -+ info = (void *)&bcdc->buf[0]; - - /* Copy info buffer */ - if (buf) { diff --git a/package/kernel/mac80211/patches/319-0022-brcmfmac-fix-memory-leak-in-brcmf_flowring_add_tdls_.patch b/package/kernel/mac80211/patches/319-0022-brcmfmac-fix-memory-leak-in-brcmf_flowring_add_tdls_.patch deleted file mode 100644 index 2ececdf197..0000000000 --- a/package/kernel/mac80211/patches/319-0022-brcmfmac-fix-memory-leak-in-brcmf_flowring_add_tdls_.patch +++ /dev/null @@ -1,39 +0,0 @@ -From bc981641360183990de59da17f9f560f9150b801 Mon Sep 17 00:00:00 2001 -From: Arend Van Spriel -Date: Mon, 19 Sep 2016 12:09:53 +0100 -Subject: [PATCH] brcmfmac: fix memory leak in brcmf_flowring_add_tdls_peer() - -In the error paths in brcmf_flowring_add_tdls_peer() the allocated -resource should be freed. - -Reviewed-by: Hante Meuleman -Reviewed-by: Pieter-Paul Giesberts -Signed-off-by: Arend van Spriel -Signed-off-by: Kalle Valo ---- - drivers/net/wireless/broadcom/brcm80211/brcmfmac/flowring.c | 8 ++++++-- - 1 file changed, 6 insertions(+), 2 deletions(-) - ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/flowring.c -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/flowring.c -@@ -495,14 +495,18 @@ void brcmf_flowring_add_tdls_peer(struct - } else { - search = flow->tdls_entry; - if (memcmp(search->mac, peer, ETH_ALEN) == 0) -- return; -+ goto free_entry; - while (search->next) { - search = search->next; - if (memcmp(search->mac, peer, ETH_ALEN) == 0) -- return; -+ goto free_entry; - } - search->next = tdls_entry; - } - - flow->tdls_active = true; -+ return; -+ -+free_entry: -+ kfree(tdls_entry); - } diff --git a/package/kernel/mac80211/patches/319-0023-brcmfmac-initialize-variable-in-brcmf_sdiod_regrl.patch b/package/kernel/mac80211/patches/319-0023-brcmfmac-initialize-variable-in-brcmf_sdiod_regrl.patch deleted file mode 100644 index a231100a55..0000000000 --- a/package/kernel/mac80211/patches/319-0023-brcmfmac-initialize-variable-in-brcmf_sdiod_regrl.patch +++ /dev/null @@ -1,28 +0,0 @@ -From 26305d3d7298d1ddf8fd4ce95a382aa90534f0a3 Mon Sep 17 00:00:00 2001 -From: Arend Van Spriel -Date: Mon, 19 Sep 2016 12:09:54 +0100 -Subject: [PATCH] brcmfmac: initialize variable in brcmf_sdiod_regrl() - -In case of an error the variable returned is uninitialized. The caller -will probably check the error code before using it, but better assure -it is set to zero. - -Reviewed-by: Hante Meuleman -Reviewed-by: Pieter-Paul Giesberts -Signed-off-by: Arend van Spriel -Signed-off-by: Kalle Valo ---- - drivers/net/wireless/broadcom/brcm80211/brcmfmac/bcmsdh.c | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/bcmsdh.c -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/bcmsdh.c -@@ -420,7 +420,7 @@ u8 brcmf_sdiod_regrb(struct brcmf_sdio_d - - u32 brcmf_sdiod_regrl(struct brcmf_sdio_dev *sdiodev, u32 addr, int *ret) - { -- u32 data; -+ u32 data = 0; - int retval; - - brcmf_dbg(SDIO, "addr:0x%08x\n", addr); diff --git a/package/kernel/mac80211/patches/319-0024-brcmfmac-remove-worker-from-.ndo_set_mac_address-cal.patch b/package/kernel/mac80211/patches/319-0024-brcmfmac-remove-worker-from-.ndo_set_mac_address-cal.patch deleted file mode 100644 index 67af30e4fd..0000000000 --- a/package/kernel/mac80211/patches/319-0024-brcmfmac-remove-worker-from-.ndo_set_mac_address-cal.patch +++ /dev/null @@ -1,107 +0,0 @@ -From 8fa5fdec09cd379c9ecb8972f344f8f308e0ccf3 Mon Sep 17 00:00:00 2001 -From: Arend Van Spriel -Date: Mon, 19 Sep 2016 12:09:55 +0100 -Subject: [PATCH] brcmfmac: remove worker from .ndo_set_mac_address() callback - -As it turns out there is no need to use a worker for the callback -because it is not called from atomic context. - -Reported-by: Dan Williams -Reviewed-by: Hante Meuleman -Reviewed-by: Pieter-Paul Giesberts -Reviewed-by: Franky Lin -Signed-off-by: Arend van Spriel -Signed-off-by: Kalle Valo ---- - .../wireless/broadcom/brcm80211/brcmfmac/core.c | 39 ++++++++-------------- - .../wireless/broadcom/brcm80211/brcmfmac/core.h | 2 -- - 2 files changed, 13 insertions(+), 28 deletions(-) - ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c -@@ -136,27 +136,6 @@ static void _brcmf_set_multicast_list(st - err); - } - --static void --_brcmf_set_mac_address(struct work_struct *work) --{ -- struct brcmf_if *ifp; -- s32 err; -- -- ifp = container_of(work, struct brcmf_if, setmacaddr_work); -- -- brcmf_dbg(TRACE, "Enter, bsscfgidx=%d\n", ifp->bsscfgidx); -- -- err = brcmf_fil_iovar_data_set(ifp, "cur_etheraddr", ifp->mac_addr, -- ETH_ALEN); -- if (err < 0) { -- brcmf_err("Setting cur_etheraddr failed, %d\n", err); -- } else { -- brcmf_dbg(TRACE, "MAC address updated to %pM\n", -- ifp->mac_addr); -- memcpy(ifp->ndev->dev_addr, ifp->mac_addr, ETH_ALEN); -- } --} -- - #if IS_ENABLED(CONFIG_IPV6) - static void _brcmf_update_ndtable(struct work_struct *work) - { -@@ -190,10 +169,20 @@ static int brcmf_netdev_set_mac_address( - { - struct brcmf_if *ifp = netdev_priv(ndev); - struct sockaddr *sa = (struct sockaddr *)addr; -+ int err; - -- memcpy(&ifp->mac_addr, sa->sa_data, ETH_ALEN); -- schedule_work(&ifp->setmacaddr_work); -- return 0; -+ brcmf_dbg(TRACE, "Enter, bsscfgidx=%d\n", ifp->bsscfgidx); -+ -+ err = brcmf_fil_iovar_data_set(ifp, "cur_etheraddr", sa->sa_data, -+ ETH_ALEN); -+ if (err < 0) { -+ brcmf_err("Setting cur_etheraddr failed, %d\n", err); -+ } else { -+ brcmf_dbg(TRACE, "updated to %pM\n", sa->sa_data); -+ memcpy(ifp->mac_addr, sa->sa_data, ETH_ALEN); -+ memcpy(ifp->ndev->dev_addr, ifp->mac_addr, ETH_ALEN); -+ } -+ return err; - } - - static void brcmf_netdev_set_multicast_list(struct net_device *ndev) -@@ -525,7 +514,6 @@ int brcmf_net_attach(struct brcmf_if *if - /* set the mac address */ - memcpy(ndev->dev_addr, ifp->mac_addr, ETH_ALEN); - -- INIT_WORK(&ifp->setmacaddr_work, _brcmf_set_mac_address); - INIT_WORK(&ifp->multicast_work, _brcmf_set_multicast_list); - INIT_WORK(&ifp->ndoffload_work, _brcmf_update_ndtable); - -@@ -730,7 +718,6 @@ static void brcmf_del_if(struct brcmf_pu - } - - if (ifp->ndev->netdev_ops == &brcmf_netdev_ops_pri) { -- cancel_work_sync(&ifp->setmacaddr_work); - cancel_work_sync(&ifp->multicast_work); - cancel_work_sync(&ifp->ndoffload_work); - } ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.h -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.h -@@ -176,7 +176,6 @@ enum brcmf_netif_stop_reason { - * @vif: points to cfg80211 specific interface information. - * @ndev: associated network device. - * @stats: interface specific network statistics. -- * @setmacaddr_work: worker object for setting mac address. - * @multicast_work: worker object for multicast provisioning. - * @ndoffload_work: worker object for neighbor discovery offload configuration. - * @fws_desc: interface specific firmware-signalling descriptor. -@@ -193,7 +192,6 @@ struct brcmf_if { - struct brcmf_cfg80211_vif *vif; - struct net_device *ndev; - struct net_device_stats stats; -- struct work_struct setmacaddr_work; - struct work_struct multicast_work; - struct work_struct ndoffload_work; - struct brcmf_fws_mac_descriptor *fws_desc; diff --git a/package/kernel/mac80211/patches/319-0025-brcmfmac-remove-unnecessary-null-pointer-check.patch b/package/kernel/mac80211/patches/319-0025-brcmfmac-remove-unnecessary-null-pointer-check.patch deleted file mode 100644 index 5a08479329..0000000000 --- a/package/kernel/mac80211/patches/319-0025-brcmfmac-remove-unnecessary-null-pointer-check.patch +++ /dev/null @@ -1,31 +0,0 @@ -From 835680b82f029818c813324aed3073cdcf63241f Mon Sep 17 00:00:00 2001 -From: Hante Meuleman -Date: Mon, 19 Sep 2016 12:09:56 +0100 -Subject: [PATCH] brcmfmac: remove unnecessary null pointer check - -in the function brcmf_bus_start() in the exception handling a -check is made to dermine whether ifp is null, though this is not -possible. Removing the unnessary check. - -Reviewed-by: Arend Van Spriel -Reviewed-by: Franky Lin -Reviewed-by: Pieter-Paul Giesberts -Signed-off-by: Hante Meuleman -Signed-off-by: Arend van Spriel -Signed-off-by: Kalle Valo ---- - drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c | 3 +-- - 1 file changed, 1 insertion(+), 2 deletions(-) - ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c -@@ -1048,8 +1048,7 @@ fail: - brcmf_fws_del_interface(ifp); - brcmf_fws_deinit(drvr); - } -- if (ifp) -- brcmf_net_detach(ifp->ndev, false); -+ brcmf_net_detach(ifp->ndev, false); - if (p2p_ifp) - brcmf_net_detach(p2p_ifp->ndev, false); - drvr->iflist[0] = NULL; diff --git a/package/kernel/mac80211/patches/319-0026-brcmfmac-fix-clearing-entry-IPv6-address.patch b/package/kernel/mac80211/patches/319-0026-brcmfmac-fix-clearing-entry-IPv6-address.patch deleted file mode 100644 index 0b3a23edc0..0000000000 --- a/package/kernel/mac80211/patches/319-0026-brcmfmac-fix-clearing-entry-IPv6-address.patch +++ /dev/null @@ -1,37 +0,0 @@ -From 2b7425f3629b38c438f890c20c5faeca64b144ff Mon Sep 17 00:00:00 2001 -From: Hante Meuleman -Date: Mon, 19 Sep 2016 12:09:57 +0100 -Subject: [PATCH] brcmfmac: fix clearing entry IPv6 address - -When IPv6 address is to be cleared there is a possible out of -bound access. But also the clearing of the last entry and the -adjustment of total number of stored IPv6 addresses is not -updated. This patch fixes that bug. Bug was found using coverity. - -Reviewed-by: Arend Van Spriel -Reviewed-by: Franky Lin -Reviewed-by: Pieter-Paul Giesberts -Signed-off-by: Hante Meuleman -Signed-off-by: Arend van Spriel -Signed-off-by: Kalle Valo ---- - drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c | 7 +++++-- - 1 file changed, 5 insertions(+), 2 deletions(-) - ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c -@@ -873,9 +873,12 @@ static int brcmf_inet6addr_changed(struc - } - break; - case NETDEV_DOWN: -- if (i < NDOL_MAX_ENTRIES) -- for (; i < ifp->ipv6addr_idx; i++) -+ if (i < NDOL_MAX_ENTRIES) { -+ for (; i < ifp->ipv6addr_idx - 1; i++) - table[i] = table[i + 1]; -+ memset(&table[i], 0, sizeof(table[i])); -+ ifp->ipv6addr_idx--; -+ } - break; - default: - break; diff --git a/package/kernel/mac80211/patches/319-0027-brcmfmac-fix-out-of-bound-access-on-clearing-wowl-wa.patch b/package/kernel/mac80211/patches/319-0027-brcmfmac-fix-out-of-bound-access-on-clearing-wowl-wa.patch deleted file mode 100644 index 4a005d608a..0000000000 --- a/package/kernel/mac80211/patches/319-0027-brcmfmac-fix-out-of-bound-access-on-clearing-wowl-wa.patch +++ /dev/null @@ -1,44 +0,0 @@ -From a7ed7828ecda0c2b5e0d7f55dedd4230afd4b583 Mon Sep 17 00:00:00 2001 -From: Hante Meuleman -Date: Mon, 19 Sep 2016 12:09:58 +0100 -Subject: [PATCH] brcmfmac: fix out of bound access on clearing wowl wake - indicator - -Clearing the wowl wakeindicator happens with a rather odd -construction where the string "clear" is used to set the iovar -wowl_wakeind. This was implemented incorrectly as it caused an -out of bound access. Use an intermediate variable of correct -length and copy string in that. Problem was found using coverity. - -Reviewed-by: Arend Van Spriel -Reviewed-by: Franky Lin -Reviewed-by: Pieter-Paul Giesberts -Signed-off-by: Hante Meuleman -Signed-off-by: Arend van Spriel -Signed-off-by: Kalle Valo ---- - drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c | 6 ++++-- - 1 file changed, 4 insertions(+), 2 deletions(-) - ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c -@@ -3699,6 +3699,7 @@ static void brcmf_configure_wowl(struct - struct cfg80211_wowlan *wowl) - { - u32 wowl_config; -+ struct brcmf_wowl_wakeind_le wowl_wakeind; - u32 i; - - brcmf_dbg(TRACE, "Suspend, wowl config.\n"); -@@ -3740,8 +3741,9 @@ static void brcmf_configure_wowl(struct - if (!test_bit(BRCMF_VIF_STATUS_CONNECTED, &ifp->vif->sme_state)) - wowl_config |= BRCMF_WOWL_UNASSOC; - -- brcmf_fil_iovar_data_set(ifp, "wowl_wakeind", "clear", -- sizeof(struct brcmf_wowl_wakeind_le)); -+ memcpy(&wowl_wakeind, "clear", 6); -+ brcmf_fil_iovar_data_set(ifp, "wowl_wakeind", &wowl_wakeind, -+ sizeof(wowl_wakeind)); - brcmf_fil_iovar_int_set(ifp, "wowl", wowl_config); - brcmf_fil_iovar_int_set(ifp, "wowl_activate", 1); - brcmf_bus_wowl_config(cfg->pub->bus_if, true); diff --git a/package/kernel/mac80211/patches/319-0028-brcmfmac-simplify-mapping-of-auth-type.patch b/package/kernel/mac80211/patches/319-0028-brcmfmac-simplify-mapping-of-auth-type.patch deleted file mode 100644 index cbefa6e676..0000000000 --- a/package/kernel/mac80211/patches/319-0028-brcmfmac-simplify-mapping-of-auth-type.patch +++ /dev/null @@ -1,39 +0,0 @@ -From 92c313604711a0976def79dabb9e8da3cc2cc780 Mon Sep 17 00:00:00 2001 -From: Hante Meuleman -Date: Mon, 19 Sep 2016 12:09:59 +0100 -Subject: [PATCH] brcmfmac: simplify mapping of auth type - -The 802.11 standard only has four valid auth type configurations of which -our firmware only supports two, ie. Open System and Shared Key. Simplify -the mapping falling back to automatic for other types specified by -user-space. - -Reviewed-by: Arend Van Spriel -Reviewed-by: Franky Lin -Reviewed-by: Pieter-Paul Giesberts -Signed-off-by: Hante Meuleman -Signed-off-by: Arend van Spriel -Signed-off-by: Kalle Valo ---- - drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c | 8 +------- - 1 file changed, 1 insertion(+), 7 deletions(-) - ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c -@@ -1591,15 +1591,9 @@ static s32 brcmf_set_auth_type(struct ne - val = 1; - brcmf_dbg(CONN, "shared key\n"); - break; -- case NL80211_AUTHTYPE_AUTOMATIC: -- val = 2; -- brcmf_dbg(CONN, "automatic\n"); -- break; -- case NL80211_AUTHTYPE_NETWORK_EAP: -- brcmf_dbg(CONN, "network eap\n"); - default: - val = 2; -- brcmf_err("invalid auth type (%d)\n", sme->auth_type); -+ brcmf_dbg(CONN, "automatic, auth type (%d)\n", sme->auth_type); - break; - } - diff --git a/package/kernel/mac80211/patches/319-0029-brcmfmac-fix-memory-leak-in-brcmf_fill_bss_param.patch b/package/kernel/mac80211/patches/319-0029-brcmfmac-fix-memory-leak-in-brcmf_fill_bss_param.patch deleted file mode 100644 index fa7c27fdeb..0000000000 --- a/package/kernel/mac80211/patches/319-0029-brcmfmac-fix-memory-leak-in-brcmf_fill_bss_param.patch +++ /dev/null @@ -1,41 +0,0 @@ -From 23e9c128adb2038c27a424a5f91136e7fa3e0dc6 Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= -Date: Wed, 21 Sep 2016 08:23:24 +0200 -Subject: [PATCH] brcmfmac: fix memory leak in brcmf_fill_bss_param -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -This function is called from get_station callback which means that every -time user space was getting/dumping station(s) we were leaking 2 KiB. - -Signed-off-by: Rafał Miłecki -Fixes: 1f0dc59a6de ("brcmfmac: rework .get_station() callback") -Cc: stable@vger.kernel.org # 4.2+ -Acked-by: Arend van Spriel -Signed-off-by: Kalle Valo ---- - drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c | 5 ++++- - 1 file changed, 4 insertions(+), 1 deletion(-) - ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c -@@ -2523,7 +2523,7 @@ static void brcmf_fill_bss_param(struct - WL_BSS_INFO_MAX); - if (err) { - brcmf_err("Failed to get bss info (%d)\n", err); -- return; -+ goto out_kfree; - } - si->filled |= BIT(NL80211_STA_INFO_BSS_PARAM); - si->bss_param.beacon_interval = le16_to_cpu(buf->bss_le.beacon_period); -@@ -2535,6 +2535,9 @@ static void brcmf_fill_bss_param(struct - si->bss_param.flags |= BSS_PARAM_FLAGS_SHORT_PREAMBLE; - if (capability & WLAN_CAPABILITY_SHORT_SLOT_TIME) - si->bss_param.flags |= BSS_PARAM_FLAGS_SHORT_SLOT_TIME; -+ -+out_kfree: -+ kfree(buf); - } - - static s32 diff --git a/package/kernel/mac80211/patches/319-0030-brcmfmac-drop-unused-fields-from-struct-brcmf_pub.patch b/package/kernel/mac80211/patches/319-0030-brcmfmac-drop-unused-fields-from-struct-brcmf_pub.patch deleted file mode 100644 index 0dc2aa4114..0000000000 --- a/package/kernel/mac80211/patches/319-0030-brcmfmac-drop-unused-fields-from-struct-brcmf_pub.patch +++ /dev/null @@ -1,60 +0,0 @@ -From 2df86ad959c9d1cdbeb2f23a0801857731156692 Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= -Date: Fri, 23 Sep 2016 15:27:46 +0200 -Subject: [PATCH] brcmfmac: drop unused fields from struct brcmf_pub -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -They seem to be there from the first day. We calculate these values but -never use them. - -Signed-off-by: Rafał Miłecki -Signed-off-by: Kalle Valo ---- - drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c | 3 --- - drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.h | 4 ---- - drivers/net/wireless/broadcom/brcm80211/brcmfmac/fwsignal.c | 2 -- - 3 files changed, 9 deletions(-) - ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c -@@ -508,9 +508,6 @@ int brcmf_net_attach(struct brcmf_if *if - ndev->needed_headroom += drvr->hdrlen; - ndev->ethtool_ops = &brcmf_ethtool_ops; - -- drvr->rxsz = ndev->mtu + ndev->hard_header_len + -- drvr->hdrlen; -- - /* set the mac address */ - memcpy(ndev->dev_addr, ifp->mac_addr, ETH_ALEN); - ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.h -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.h -@@ -112,15 +112,11 @@ struct brcmf_pub { - - /* Internal brcmf items */ - uint hdrlen; /* Total BRCMF header length (proto + bus) */ -- uint rxsz; /* Rx buffer size bus module should use */ - - /* Dongle media info */ - char fwver[BRCMF_DRIVER_FIRMWARE_VERSION_LEN]; - u8 mac[ETH_ALEN]; /* MAC address obtained from dongle */ - -- /* Multicast data packets sent to dongle */ -- unsigned long tx_multicast; -- - struct mac_address addresses[BRCMF_MAX_IFS]; - - struct brcmf_if *iflist[BRCMF_MAX_IFS]; ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/fwsignal.c -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/fwsignal.c -@@ -2104,8 +2104,6 @@ int brcmf_fws_process_skb(struct brcmf_i - if ((skb->priority == 0) || (skb->priority > 7)) - skb->priority = cfg80211_classify8021d(skb, NULL); - -- drvr->tx_multicast += !!multicast; -- - if (fws->avoid_queueing) { - rc = brcmf_proto_txdata(drvr, ifp->ifidx, 0, skb); - if (rc < 0) diff --git a/package/kernel/mac80211/patches/319-0031-brcmfmac-replace-WARNING-on-timeout-with-a-simple-er.patch b/package/kernel/mac80211/patches/319-0031-brcmfmac-replace-WARNING-on-timeout-with-a-simple-er.patch deleted file mode 100644 index 1a48f1b304..0000000000 --- a/package/kernel/mac80211/patches/319-0031-brcmfmac-replace-WARNING-on-timeout-with-a-simple-er.patch +++ /dev/null @@ -1,38 +0,0 @@ -From 2f0e56fa37cce60a5ac5d451bcadec51cd711436 Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= -Date: Tue, 27 Sep 2016 12:12:24 +0200 -Subject: [PATCH] brcmfmac: replace WARNING on timeout with a simple error - message -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -Even with timeout increased to 950 ms we get WARNINGs from time to time. -It mostly happens on A-MPDU stalls (e.g. when station goes out of -range). It may take up to 5-10 secods for the firmware to recover and -for that time it doesn't process packets. - -It's still useful to have a message on time out as it may indicate some -firmware problem and incorrect key update. Raising a WARNING however -wasn't really that necessary, it doesn't point to any driver bug anymore -and backtrace wasn't much useful. - -Signed-off-by: Rafał Miłecki -Acked-by: Arend van Spriel -Signed-off-by: Kalle Valo ---- - drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c | 3 ++- - 1 file changed, 2 insertions(+), 1 deletion(-) - ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c -@@ -1155,7 +1155,8 @@ int brcmf_netdev_wait_pend8021x(struct b - !brcmf_get_pend_8021x_cnt(ifp), - MAX_WAIT_FOR_8021X_TX); - -- WARN_ON(!err); -+ if (!err) -+ brcmf_err("Timed out waiting for no pending 802.1x packets\n"); - - return !err; - } diff --git a/package/kernel/mac80211/patches/319-0032-brcmfmac-use-correct-skb-freeing-helper-when-deletin.patch b/package/kernel/mac80211/patches/319-0032-brcmfmac-use-correct-skb-freeing-helper-when-deletin.patch deleted file mode 100644 index 91c5dd5d4d..0000000000 --- a/package/kernel/mac80211/patches/319-0032-brcmfmac-use-correct-skb-freeing-helper-when-deletin.patch +++ /dev/null @@ -1,58 +0,0 @@ -From 7f00ee2bbc630900ba16fc2690473f3e2db0e264 Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= -Date: Tue, 27 Sep 2016 14:11:04 +0200 -Subject: [PATCH] brcmfmac: use correct skb freeing helper when deleting - flowring -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -Flowrings contain skbs waiting for transmission that were passed to us -by netif. It means we checked every one of them looking for 802.1x -Ethernet type. When deleting flowring we have to use freeing function -that will check for 802.1x type as well. - -Freeing skbs without a proper check was leading to counter not being -properly decreased. This was triggering a WARNING every time -brcmf_netdev_wait_pend8021x was called. - -Signed-off-by: Rafał Miłecki -Acked-by: Arend van Spriel -Cc: stable@vger.kernel.org # 4.5+ -Signed-off-by: Kalle Valo ---- - drivers/net/wireless/broadcom/brcm80211/brcmfmac/flowring.c | 9 ++++++++- - 1 file changed, 8 insertions(+), 1 deletion(-) - ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/flowring.c -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/flowring.c -@@ -234,13 +234,20 @@ static void brcmf_flowring_block(struct - - void brcmf_flowring_delete(struct brcmf_flowring *flow, u16 flowid) - { -+ struct brcmf_bus *bus_if = dev_get_drvdata(flow->dev); - struct brcmf_flowring_ring *ring; -+ struct brcmf_if *ifp; - u16 hash_idx; -+ u8 ifidx; - struct sk_buff *skb; - - ring = flow->rings[flowid]; - if (!ring) - return; -+ -+ ifidx = brcmf_flowring_ifidx_get(flow, flowid); -+ ifp = brcmf_get_ifp(bus_if->drvr, ifidx); -+ - brcmf_flowring_block(flow, flowid, false); - hash_idx = ring->hash_id; - flow->hash[hash_idx].ifidx = BRCMF_FLOWRING_INVALID_IFIDX; -@@ -249,7 +256,7 @@ void brcmf_flowring_delete(struct brcmf_ - - skb = skb_dequeue(&ring->skblist); - while (skb) { -- brcmu_pkt_buf_free_skb(skb); -+ brcmf_txfinalize(ifp, skb, false); - skb = skb_dequeue(&ring->skblist); - } - diff --git a/package/kernel/mac80211/patches/320-ath9k-fix-using-sta-drv_priv-before-initializing-it.patch b/package/kernel/mac80211/patches/320-ath9k-fix-using-sta-drv_priv-before-initializing-it.patch deleted file mode 100644 index aaa6706764..0000000000 --- a/package/kernel/mac80211/patches/320-ath9k-fix-using-sta-drv_priv-before-initializing-it.patch +++ /dev/null @@ -1,33 +0,0 @@ -From: Felix Fietkau -Date: Tue, 2 Aug 2016 13:00:01 +0200 -Subject: [PATCH] ath9k: fix using sta->drv_priv before initializing it - -A station pointer can be passed to the driver on tx, before it has been -marked as associated. Since ath9k_sta_state was initializing the entry -too late, it resulted in some spurious crashes. - -Fixes: df3c6eb34da5 ("ath9k: Use sta_state() callback") -Cc: stable@vger.kernel.org -Signed-off-by: Felix Fietkau ---- - ---- a/drivers/net/wireless/ath/ath9k/main.c -+++ b/drivers/net/wireless/ath/ath9k/main.c -@@ -1563,13 +1563,13 @@ static int ath9k_sta_state(struct ieee80 - struct ath_common *common = ath9k_hw_common(sc->sc_ah); - int ret = 0; - -- if (old_state == IEEE80211_STA_AUTH && -- new_state == IEEE80211_STA_ASSOC) { -+ if (old_state == IEEE80211_STA_NOTEXIST && -+ new_state == IEEE80211_STA_NONE) { - ret = ath9k_sta_add(hw, vif, sta); - ath_dbg(common, CONFIG, - "Add station: %pM\n", sta->addr); -- } else if (old_state == IEEE80211_STA_ASSOC && -- new_state == IEEE80211_STA_AUTH) { -+ } else if (old_state == IEEE80211_STA_NONE && -+ new_state == IEEE80211_STA_NOTEXIST) { - ret = ath9k_sta_remove(hw, vif, sta); - ath_dbg(common, CONFIG, - "Remove station: %pM\n", sta->addr); diff --git a/package/kernel/mac80211/patches/321-ath9k_hw-reset-AHB-WMAC-interface-on-AR91xx.patch b/package/kernel/mac80211/patches/321-ath9k_hw-reset-AHB-WMAC-interface-on-AR91xx.patch deleted file mode 100644 index 9caa76dc5d..0000000000 --- a/package/kernel/mac80211/patches/321-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 -@@ -1398,8 +1398,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/322-ath9k_hw-issue-external-reset-for-QCA9550.patch b/package/kernel/mac80211/patches/322-ath9k_hw-issue-external-reset-for-QCA9550.patch deleted file mode 100644 index 5d4e849b7f..0000000000 --- a/package/kernel/mac80211/patches/322-ath9k_hw-issue-external-reset-for-QCA9550.patch +++ /dev/null @@ -1,125 +0,0 @@ -From: Felix Fietkau -Date: Sat, 9 Jul 2016 15:26:44 +0200 -Subject: [PATCH] ath9k_hw: issue external reset for QCA9550 - -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 -@@ -1275,39 +1275,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; - } - -@@ -1360,24 +1377,23 @@ 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); - } - -+ 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/323-ath9k-Fix-programming-of-minCCA-power-threshold.patch b/package/kernel/mac80211/patches/323-ath9k-Fix-programming-of-minCCA-power-threshold.patch deleted file mode 100644 index 59ac29b1cf..0000000000 --- a/package/kernel/mac80211/patches/323-ath9k-Fix-programming-of-minCCA-power-threshold.patch +++ /dev/null @@ -1,26 +0,0 @@ -From: Sven Eckelmann -Date: Fri, 17 Jun 2016 11:58:20 +0200 -Subject: [PATCH] ath9k: Fix programming of minCCA power threshold - -The function ar9003_hw_apply_minccapwr_thresh takes as second parameter not -a pointer to the channel but a boolean value describing whether the channel -is 2.4GHz or not. This broke (according to the origin commit) the ETSI -regulatory compliance on 5GHz channels. - -Fixes: 3533bf6b15a0 ("ath9k: Fix regulatory compliance") -Signed-off-by: Sven Eckelmann -Cc: Simon Wunderlich -Cc: Sujith Manoharan ---- - ---- a/drivers/net/wireless/ath/ath9k/ar9003_eeprom.c -+++ b/drivers/net/wireless/ath/ath9k/ar9003_eeprom.c -@@ -4175,7 +4175,7 @@ static void ath9k_hw_ar9300_set_board_va - if (!AR_SREV_9330(ah) && !AR_SREV_9340(ah) && !AR_SREV_9531(ah)) - ar9003_hw_internal_regulator_apply(ah); - ar9003_hw_apply_tuning_caps(ah); -- ar9003_hw_apply_minccapwr_thresh(ah, chan); -+ ar9003_hw_apply_minccapwr_thresh(ah, is2ghz); - ar9003_hw_txend_to_xpa_off_apply(ah, is2ghz); - ar9003_hw_thermometer_apply(ah); - ar9003_hw_thermo_cal_apply(ah); diff --git a/package/kernel/mac80211/patches/324-ath9k_hw-fix-spectral-scan-on-AR9285-and-newer.patch b/package/kernel/mac80211/patches/324-ath9k_hw-fix-spectral-scan-on-AR9285-and-newer.patch deleted file mode 100644 index b6f48680b7..0000000000 --- a/package/kernel/mac80211/patches/324-ath9k_hw-fix-spectral-scan-on-AR9285-and-newer.patch +++ /dev/null @@ -1,86 +0,0 @@ -From: Felix Fietkau -Date: Mon, 11 Jul 2016 10:34:37 +0200 -Subject: [PATCH] ath9k_hw: fix spectral scan on AR9285 and newer - -The register layout of AR_PHY_SPECTRAL_SCAN has changed, only AR9280 -uses the old layout - -Signed-off-by: Felix Fietkau ---- - ---- a/drivers/net/wireless/ath/ath9k/ar9002_phy.c -+++ b/drivers/net/wireless/ath/ath9k/ar9002_phy.c -@@ -476,6 +476,7 @@ static void ar9002_hw_set_bt_ant_diversi - static void ar9002_hw_spectral_scan_config(struct ath_hw *ah, - struct ath_spec_scan *param) - { -+ u32 repeat_bit; - u8 count; - - if (!param->enabled) { -@@ -486,12 +487,15 @@ static void ar9002_hw_spectral_scan_conf - REG_SET_BIT(ah, AR_PHY_RADAR_0, AR_PHY_RADAR_0_FFT_ENA); - REG_SET_BIT(ah, AR_PHY_SPECTRAL_SCAN, AR_PHY_SPECTRAL_SCAN_ENABLE); - -+ if (AR_SREV_9280(ah)) -+ repeat_bit = AR_PHY_SPECTRAL_SCAN_SHORT_REPEAT; -+ else -+ repeat_bit = AR_PHY_SPECTRAL_SCAN_SHORT_REPEAT_KIWI; -+ - if (param->short_repeat) -- REG_SET_BIT(ah, AR_PHY_SPECTRAL_SCAN, -- AR_PHY_SPECTRAL_SCAN_SHORT_REPEAT); -+ REG_SET_BIT(ah, AR_PHY_SPECTRAL_SCAN, repeat_bit); - else -- REG_CLR_BIT(ah, AR_PHY_SPECTRAL_SCAN, -- AR_PHY_SPECTRAL_SCAN_SHORT_REPEAT); -+ REG_CLR_BIT(ah, AR_PHY_SPECTRAL_SCAN, repeat_bit); - - /* on AR92xx, the highest bit of count will make the the chip send - * spectral samples endlessly. Check if this really was intended, -@@ -499,15 +503,25 @@ static void ar9002_hw_spectral_scan_conf - */ - count = param->count; - if (param->endless) { -- if (AR_SREV_9271(ah)) -- count = 0; -- else -+ if (AR_SREV_9280(ah)) - count = 0x80; -+ else -+ count = 0; - } else if (count & 0x80) - count = 0x7f; -+ else if (!count) -+ count = 1; -+ -+ if (AR_SREV_9280(ah)) { -+ REG_RMW_FIELD(ah, AR_PHY_SPECTRAL_SCAN, -+ AR_PHY_SPECTRAL_SCAN_COUNT, count); -+ } else { -+ REG_RMW_FIELD(ah, AR_PHY_SPECTRAL_SCAN, -+ AR_PHY_SPECTRAL_SCAN_COUNT_KIWI, count); -+ REG_SET_BIT(ah, AR_PHY_SPECTRAL_SCAN, -+ AR_PHY_SPECTRAL_SCAN_PHYERR_MASK_SELECT); -+ } - -- REG_RMW_FIELD(ah, AR_PHY_SPECTRAL_SCAN, -- AR_PHY_SPECTRAL_SCAN_COUNT, count); - REG_RMW_FIELD(ah, AR_PHY_SPECTRAL_SCAN, - AR_PHY_SPECTRAL_SCAN_PERIOD, param->period); - REG_RMW_FIELD(ah, AR_PHY_SPECTRAL_SCAN, ---- a/drivers/net/wireless/ath/ath9k/ar9002_phy.h -+++ b/drivers/net/wireless/ath/ath9k/ar9002_phy.h -@@ -177,8 +177,11 @@ - #define AR_PHY_SPECTRAL_SCAN_PERIOD_S 8 - #define AR_PHY_SPECTRAL_SCAN_COUNT 0x00FF0000 /* Number of reports, reg 68, bits 16-23*/ - #define AR_PHY_SPECTRAL_SCAN_COUNT_S 16 -+#define AR_PHY_SPECTRAL_SCAN_COUNT_KIWI 0x0FFF0000 /* Number of reports, reg 68, bits 16-27*/ -+#define AR_PHY_SPECTRAL_SCAN_COUNT_KIWI_S 16 - #define AR_PHY_SPECTRAL_SCAN_SHORT_REPEAT 0x01000000 /* Short repeat, reg 68, bit 24*/ --#define AR_PHY_SPECTRAL_SCAN_SHORT_REPEAT_S 24 /* Short repeat, reg 68, bit 24*/ -+#define AR_PHY_SPECTRAL_SCAN_SHORT_REPEAT_KIWI 0x10000000 /* Short repeat, reg 68, bit 28*/ -+#define AR_PHY_SPECTRAL_SCAN_PHYERR_MASK_SELECT 0x40000000 - - #define AR_PHY_RX_DELAY 0x9914 - #define AR_PHY_SEARCH_START_DELAY 0x9918 diff --git a/package/kernel/mac80211/patches/325-ath9k_hw-fix-duplicate-and-partially-wrong-definitio.patch b/package/kernel/mac80211/patches/325-ath9k_hw-fix-duplicate-and-partially-wrong-definitio.patch deleted file mode 100644 index 6685f33989..0000000000 --- a/package/kernel/mac80211/patches/325-ath9k_hw-fix-duplicate-and-partially-wrong-definitio.patch +++ /dev/null @@ -1,57 +0,0 @@ -From: Felix Fietkau -Date: Mon, 11 Jul 2016 11:31:39 +0200 -Subject: [PATCH] ath9k_hw: fix duplicate (and partially wrong) definition - of AR_CH0_THERM - -AR_PHY_65NM_CH0_THERM and AR_CH0_THERM were supposed to refer to the -same register, however they had different SREV checks. - -Remove the duplicate and use the checks. Since there were other SREV -checks present in the only place that uses this, this will probaby not -affect runtime behavior. - -Signed-off-by: Felix Fietkau ---- - ---- a/drivers/net/wireless/ath/ath9k/ar9003_phy.h -+++ b/drivers/net/wireless/ath/ath9k/ar9003_phy.h -@@ -689,13 +689,6 @@ - #define AR_CH0_TOP_XPABIASLVL (AR_SREV_9550(ah) ? 0x3c0 : 0x300) - #define AR_CH0_TOP_XPABIASLVL_S (AR_SREV_9550(ah) ? 6 : 8) - --#define AR_CH0_THERM (AR_SREV_9300(ah) ? 0x16290 : \ -- ((AR_SREV_9485(ah) ? 0x1628c : 0x16294))) --#define AR_CH0_THERM_XPABIASLVL_MSB 0x3 --#define AR_CH0_THERM_XPABIASLVL_MSB_S 0 --#define AR_CH0_THERM_XPASHORT2GND 0x4 --#define AR_CH0_THERM_XPASHORT2GND_S 2 -- - #define AR_SWITCH_TABLE_COM_ALL (0xffff) - #define AR_SWITCH_TABLE_COM_ALL_S (0) - #define AR_SWITCH_TABLE_COM_AR9462_ALL (0xffffff) -@@ -712,15 +705,17 @@ - #define AR_SWITCH_TABLE_ALL (0xfff) - #define AR_SWITCH_TABLE_ALL_S (0) - --#define AR_PHY_65NM_CH0_THERM (AR_SREV_9300(ah) ? 0x16290 :\ -- ((AR_SREV_9462(ah) || AR_SREV_9565(ah)) ? 0x16294 : 0x1628c)) -+#define AR_CH0_THERM (AR_SREV_9300(ah) ? 0x16290 :\ -+ ((AR_SREV_9462(ah) || AR_SREV_9565(ah)) ? 0x16294 : 0x1628c)) -+#define AR_CH0_THERM_XPABIASLVL_MSB 0x3 -+#define AR_CH0_THERM_XPABIASLVL_MSB_S 0 -+#define AR_CH0_THERM_XPASHORT2GND 0x4 -+#define AR_CH0_THERM_XPASHORT2GND_S 2 - --#define AR_PHY_65NM_CH0_THERM_LOCAL 0x80000000 --#define AR_PHY_65NM_CH0_THERM_LOCAL_S 31 --#define AR_PHY_65NM_CH0_THERM_START 0x20000000 --#define AR_PHY_65NM_CH0_THERM_START_S 29 --#define AR_PHY_65NM_CH0_THERM_SAR_ADC_OUT 0x0000ff00 --#define AR_PHY_65NM_CH0_THERM_SAR_ADC_OUT_S 8 -+#define AR_CH0_THERM_LOCAL 0x80000000 -+#define AR_CH0_THERM_START 0x20000000 -+#define AR_CH0_THERM_SAR_ADC_OUT 0x0000ff00 -+#define AR_CH0_THERM_SAR_ADC_OUT_S 8 - - #define AR_CH0_TOP2 (AR_SREV_9300(ah) ? 0x1628c : \ - (AR_SREV_9462(ah) ? 0x16290 : 0x16284)) diff --git a/package/kernel/mac80211/patches/326-ath9k_hw-simplify-ar9003_hw_per_calibration.patch b/package/kernel/mac80211/patches/326-ath9k_hw-simplify-ar9003_hw_per_calibration.patch deleted file mode 100644 index 999d9934cd..0000000000 --- a/package/kernel/mac80211/patches/326-ath9k_hw-simplify-ar9003_hw_per_calibration.patch +++ /dev/null @@ -1,88 +0,0 @@ -From: Felix Fietkau -Date: Mon, 11 Jul 2016 11:34:47 +0200 -Subject: [PATCH] ath9k_hw: simplify ar9003_hw_per_calibration - -Reduce indentation, use a variable to save a few pointer dereferences - -Signed-off-by: Felix Fietkau ---- - ---- a/drivers/net/wireless/ath/ath9k/ar9003_calib.c -+++ b/drivers/net/wireless/ath/ath9k/ar9003_calib.c -@@ -75,50 +75,49 @@ static bool ar9003_hw_per_calibration(st - struct ath9k_cal_list *currCal) - { - struct ath9k_hw_cal_data *caldata = ah->caldata; -- /* Cal is assumed not done until explicitly set below */ -- bool iscaldone = false; -+ const struct ath9k_percal_data *cur_caldata = currCal->calData; - - /* Calibration in progress. */ - if (currCal->calState == CAL_RUNNING) { - /* Check to see if it has finished. */ -- if (!(REG_READ(ah, AR_PHY_TIMING4) & AR_PHY_TIMING4_DO_CAL)) { -- /* -- * Accumulate cal measures for active chains -- */ -- currCal->calData->calCollect(ah); -- ah->cal_samples++; -+ if (REG_READ(ah, AR_PHY_TIMING4) & AR_PHY_TIMING4_DO_CAL) -+ return false; - -- if (ah->cal_samples >= -- currCal->calData->calNumSamples) { -- unsigned int i, numChains = 0; -- for (i = 0; i < AR9300_MAX_CHAINS; i++) { -- if (rxchainmask & (1 << i)) -- numChains++; -- } -+ /* -+ * Accumulate cal measures for active chains -+ */ -+ cur_caldata->calCollect(ah); -+ ah->cal_samples++; - -- /* -- * Process accumulated data -- */ -- currCal->calData->calPostProc(ah, numChains); -+ if (ah->cal_samples >= cur_caldata->calNumSamples) { -+ unsigned int i, numChains = 0; -+ for (i = 0; i < AR9300_MAX_CHAINS; i++) { -+ if (rxchainmask & (1 << i)) -+ numChains++; -+ } - -- /* Calibration has finished. */ -- caldata->CalValid |= currCal->calData->calType; -- currCal->calState = CAL_DONE; -- iscaldone = true; -- } else { -+ /* -+ * Process accumulated data -+ */ -+ cur_caldata->calPostProc(ah, numChains); -+ -+ /* Calibration has finished. */ -+ caldata->CalValid |= cur_caldata->calType; -+ currCal->calState = CAL_DONE; -+ return true; -+ } else { - /* - * Set-up collection of another sub-sample until we - * get desired number - */ - ar9003_hw_setup_calibration(ah, currCal); -- } - } -- } else if (!(caldata->CalValid & currCal->calData->calType)) { -+ } else if (!(caldata->CalValid & cur_caldata->calType)) { - /* If current cal is marked invalid in channel, kick it off */ - ath9k_hw_reset_calibration(ah, currCal); - } - -- return iscaldone; -+ return false; - } - - static int ar9003_hw_calibrate(struct ath_hw *ah, struct ath9k_channel *chan, diff --git a/package/kernel/mac80211/patches/327-ath9k_hw-get-rid-of-some-duplicate-code-in-calibrati.patch b/package/kernel/mac80211/patches/327-ath9k_hw-get-rid-of-some-duplicate-code-in-calibrati.patch deleted file mode 100644 index b7f3823ee6..0000000000 --- a/package/kernel/mac80211/patches/327-ath9k_hw-get-rid-of-some-duplicate-code-in-calibrati.patch +++ /dev/null @@ -1,94 +0,0 @@ -From: Felix Fietkau -Date: Mon, 11 Jul 2016 11:35:20 +0200 -Subject: [PATCH] ath9k_hw: get rid of some duplicate code in calibration - init - -Remove a misleading debug message as well - -Signed-off-by: Felix Fietkau ---- - ---- a/drivers/net/wireless/ath/ath9k/ar9003_calib.c -+++ b/drivers/net/wireless/ath/ath9k/ar9003_calib.c -@@ -1373,6 +1373,26 @@ static void ar9003_hw_cl_cal_post_proc(s - } - } - -+static void ar9003_hw_init_cal_common(struct ath_hw *ah) -+{ -+ struct ath9k_hw_cal_data *caldata = ah->caldata; -+ -+ /* Initialize list pointers */ -+ ah->cal_list = ah->cal_list_last = ah->cal_list_curr = NULL; -+ -+ INIT_CAL(&ah->iq_caldata); -+ INSERT_CAL(ah, &ah->iq_caldata); -+ -+ /* Initialize current pointer to first element in list */ -+ ah->cal_list_curr = ah->cal_list; -+ -+ if (ah->cal_list_curr) -+ ath9k_hw_reset_calibration(ah, ah->cal_list_curr); -+ -+ if (caldata) -+ caldata->CalValid = 0; -+} -+ - static bool ar9003_hw_init_cal_pcoem(struct ath_hw *ah, - struct ath9k_channel *chan) - { -@@ -1532,21 +1552,7 @@ skip_tx_iqcal: - /* Revert chainmask to runtime parameters */ - ar9003_hw_set_chain_masks(ah, ah->rxchainmask, ah->txchainmask); - -- /* Initialize list pointers */ -- ah->cal_list = ah->cal_list_last = ah->cal_list_curr = NULL; -- -- INIT_CAL(&ah->iq_caldata); -- INSERT_CAL(ah, &ah->iq_caldata); -- ath_dbg(common, CALIBRATE, "enabling IQ Calibration\n"); -- -- /* Initialize current pointer to first element in list */ -- ah->cal_list_curr = ah->cal_list; -- -- if (ah->cal_list_curr) -- ath9k_hw_reset_calibration(ah, ah->cal_list_curr); -- -- if (caldata) -- caldata->CalValid = 0; -+ ar9003_hw_init_cal_common(ah); - - return true; - } -@@ -1577,8 +1583,6 @@ static bool do_ar9003_agc_cal(struct ath - static bool ar9003_hw_init_cal_soc(struct ath_hw *ah, - struct ath9k_channel *chan) - { -- struct ath_common *common = ath9k_hw_common(ah); -- struct ath9k_hw_cal_data *caldata = ah->caldata; - bool txiqcal_done = false; - bool status = true; - bool run_agc_cal = false, sep_iq_cal = false; -@@ -1676,21 +1680,7 @@ skip_tx_iqcal: - /* Revert chainmask to runtime parameters */ - ar9003_hw_set_chain_masks(ah, ah->rxchainmask, ah->txchainmask); - -- /* Initialize list pointers */ -- ah->cal_list = ah->cal_list_last = ah->cal_list_curr = NULL; -- -- INIT_CAL(&ah->iq_caldata); -- INSERT_CAL(ah, &ah->iq_caldata); -- ath_dbg(common, CALIBRATE, "enabling IQ Calibration\n"); -- -- /* Initialize current pointer to first element in list */ -- ah->cal_list_curr = ah->cal_list; -- -- if (ah->cal_list_curr) -- ath9k_hw_reset_calibration(ah, ah->cal_list_curr); -- -- if (caldata) -- caldata->CalValid = 0; -+ ar9003_hw_init_cal_common(ah); - - return true; - } diff --git a/package/kernel/mac80211/patches/329-mac80211-fix-check-for-buffered-powersave-frames-wit.patch b/package/kernel/mac80211/patches/329-mac80211-fix-check-for-buffered-powersave-frames-wit.patch deleted file mode 100644 index 38e541c715..0000000000 --- a/package/kernel/mac80211/patches/329-mac80211-fix-check-for-buffered-powersave-frames-wit.patch +++ /dev/null @@ -1,21 +0,0 @@ -From: Felix Fietkau -Date: Mon, 11 Jul 2016 15:07:06 +0200 -Subject: [PATCH] mac80211: fix check for buffered powersave frames with txq - -The logic was inverted here, set the bit if frames are pending. - -Fixes: ba8c3d6f16a1 ("mac80211: add an intermediate software queue implementation") -Signed-off-by: Felix Fietkau ---- - ---- a/net/mac80211/rx.c -+++ b/net/mac80211/rx.c -@@ -1268,7 +1268,7 @@ static void sta_ps_start(struct sta_info - for (tid = 0; tid < ARRAY_SIZE(sta->sta.txq); tid++) { - struct txq_info *txqi = to_txq_info(sta->sta.txq[tid]); - -- if (!txqi->tin.backlog_packets) -+ if (txqi->tin.backlog_packets) - set_bit(tid, &sta->txq_buffered_tids); - else - clear_bit(tid, &sta->txq_buffered_tids); diff --git a/package/kernel/mac80211/patches/330-ath10k-fix-rx-status-reporting-for-A-MSDU-subframes.patch b/package/kernel/mac80211/patches/330-ath10k-fix-rx-status-reporting-for-A-MSDU-subframes.patch deleted file mode 100644 index a6031b9c26..0000000000 --- a/package/kernel/mac80211/patches/330-ath10k-fix-rx-status-reporting-for-A-MSDU-subframes.patch +++ /dev/null @@ -1,36 +0,0 @@ -From: Felix Fietkau -Date: Sun, 17 Jul 2016 12:49:59 +0200 -Subject: [PATCH] ath10k: fix rx status reporting for A-MSDU subframes - -Patch by Nagarajan, Ashok Raj - -Signed-off-by: Felix Fietkau ---- - ---- a/drivers/net/wireless/ath/ath10k/htt_rx.c -+++ b/drivers/net/wireless/ath/ath10k/htt_rx.c -@@ -1525,7 +1525,7 @@ static void ath10k_htt_rx_h_filter(struc - static int ath10k_htt_rx_handle_amsdu(struct ath10k_htt *htt) - { - struct ath10k *ar = htt->ar; -- static struct ieee80211_rx_status rx_status; -+ struct ieee80211_rx_status *rx_status = &htt->rx_status; - struct sk_buff_head amsdu; - int ret; - -@@ -1549,11 +1549,11 @@ static int ath10k_htt_rx_handle_amsdu(st - return ret; - } - -- ath10k_htt_rx_h_ppdu(ar, &amsdu, &rx_status, 0xffff); -+ ath10k_htt_rx_h_ppdu(ar, &amsdu, rx_status, 0xffff); - ath10k_htt_rx_h_unchain(ar, &amsdu, ret > 0); -- ath10k_htt_rx_h_filter(ar, &amsdu, &rx_status); -- ath10k_htt_rx_h_mpdu(ar, &amsdu, &rx_status); -- ath10k_htt_rx_h_deliver(ar, &amsdu, &rx_status); -+ ath10k_htt_rx_h_filter(ar, &amsdu, rx_status); -+ ath10k_htt_rx_h_mpdu(ar, &amsdu, rx_status); -+ ath10k_htt_rx_h_deliver(ar, &amsdu, rx_status); - - return 0; - } diff --git a/package/kernel/mac80211/patches/331-mac80211-End-the-MPSP-even-if-EOSP-frame-was-not-rec.patch b/package/kernel/mac80211/patches/331-mac80211-End-the-MPSP-even-if-EOSP-frame-was-not-rec.patch deleted file mode 100644 index 5d8a8fb4e3..0000000000 --- a/package/kernel/mac80211/patches/331-mac80211-End-the-MPSP-even-if-EOSP-frame-was-not-rec.patch +++ /dev/null @@ -1,42 +0,0 @@ -From: Masashi Honma -Date: Wed, 13 Jul 2016 16:04:35 +0900 -Subject: [PATCH] mac80211: End the MPSP even if EOSP frame was not received - -The mesh STA sends QoS frame with EOSP (end of service period) -subfiled=1 to end the MPSP(mesh peer service period). Previously, if -the frame was not acked by peer, the mesh STA did not end the MPSP. -This patch ends the MPSP even if the QoS frame was no acked. - -Signed-off-by: Masashi Honma ---- - ---- a/net/mac80211/status.c -+++ b/net/mac80211/status.c -@@ -784,6 +784,13 @@ void ieee80211_tx_status(struct ieee8021 - clear_sta_flag(sta, WLAN_STA_SP); - - acked = !!(info->flags & IEEE80211_TX_STAT_ACK); -+ -+ /* mesh Peer Service Period support */ -+ if (ieee80211_vif_is_mesh(&sta->sdata->vif) && -+ ieee80211_is_data_qos(fc)) -+ ieee80211_mpsp_trigger_process( -+ ieee80211_get_qos_ctl(hdr), sta, true, acked); -+ - if (!acked && test_sta_flag(sta, WLAN_STA_PS_STA)) { - /* - * The STA is in power save mode, so assume -@@ -794,13 +801,6 @@ void ieee80211_tx_status(struct ieee8021 - return; - } - -- /* mesh Peer Service Period support */ -- if (ieee80211_vif_is_mesh(&sta->sdata->vif) && -- ieee80211_is_data_qos(fc)) -- ieee80211_mpsp_trigger_process( -- ieee80211_get_qos_ctl(hdr), -- sta, true, acked); -- - if (ieee80211_hw_check(&local->hw, HAS_RATE_CONTROL) && - (ieee80211_is_data(hdr->frame_control)) && - (rates_idx != -1)) diff --git a/package/kernel/mac80211/patches/332-ath10k-implement-NAPI-support.patch b/package/kernel/mac80211/patches/332-ath10k-implement-NAPI-support.patch deleted file mode 100644 index c6cc145957..0000000000 --- a/package/kernel/mac80211/patches/332-ath10k-implement-NAPI-support.patch +++ /dev/null @@ -1,642 +0,0 @@ -From: Rajkumar Manoharan -Date: Thu, 21 Jul 2016 11:50:00 +0530 -Subject: [PATCH] ath10k: implement NAPI support - -Add NAPI support for rx and tx completion. NAPI poll is scheduled -from interrupt handler. The design is as below - - - on interrupt - - schedule napi and mask interrupts - - on poll - - process all pipes (no actual Tx/Rx) - - process Rx within budget - - if quota exceeds budget reschedule napi poll by returning budget - - process Tx completions and update budget if necessary - - process Tx fetch indications (pull-push) - - push any other pending Tx (if possible) - - before resched or napi completion replenish htt rx ring buffer - - if work done < budget, complete napi poll and unmask interrupts - -This change also get rid of two tasklets (intr_tq and txrx_compl_task). - -Measured peak throughput with NAPI on IPQ4019 platform in controlled -environment. No noticeable reduction in throughput is seen and also -observed improvements in CPU usage. Approx. 15% CPU usage got reduced -in UDP uplink case. - -DL: AP DUT Tx -UL: AP DUT Rx - -IPQ4019 (avg. cpu usage %) -======== - TOT +NAPI - =========== ============= -TCP DL 644 Mbps (42%) 645 Mbps (36%) -TCP UL 673 Mbps (30%) 675 Mbps (26%) -UDP DL 682 Mbps (49%) 680 Mbps (49%) -UDP UL 720 Mbps (28%) 717 Mbps (11%) - -Signed-off-by: Rajkumar Manoharan ---- - ---- a/drivers/net/wireless/ath/ath10k/ahb.c -+++ b/drivers/net/wireless/ath/ath10k/ahb.c -@@ -462,13 +462,13 @@ static void ath10k_ahb_halt_chip(struct - static irqreturn_t ath10k_ahb_interrupt_handler(int irq, void *arg) - { - struct ath10k *ar = arg; -- struct ath10k_pci *ar_pci = ath10k_pci_priv(ar); - - if (!ath10k_pci_irq_pending(ar)) - return IRQ_NONE; - - ath10k_pci_disable_and_clear_legacy_irq(ar); -- tasklet_schedule(&ar_pci->intr_tq); -+ ath10k_pci_irq_msi_fw_mask(ar); -+ napi_schedule(&ar->napi); - - return IRQ_HANDLED; - } -@@ -831,7 +831,7 @@ static int ath10k_ahb_probe(struct platf - goto err_resource_deinit; - } - -- ath10k_pci_init_irq_tasklets(ar); -+ ath10k_pci_init_napi(ar); - - ret = ath10k_ahb_request_irq_legacy(ar); - if (ret) ---- a/drivers/net/wireless/ath/ath10k/core.c -+++ b/drivers/net/wireless/ath/ath10k/core.c -@@ -2226,6 +2226,8 @@ struct ath10k *ath10k_core_create(size_t - INIT_WORK(&ar->register_work, ath10k_core_register_work); - INIT_WORK(&ar->restart_work, ath10k_core_restart); - -+ init_dummy_netdev(&ar->napi_dev); -+ - ret = ath10k_debug_create(ar); - if (ret) - goto err_free_aux_wq; ---- a/drivers/net/wireless/ath/ath10k/core.h -+++ b/drivers/net/wireless/ath/ath10k/core.h -@@ -65,6 +65,10 @@ - #define ATH10K_KEEPALIVE_MAX_IDLE 3895 - #define ATH10K_KEEPALIVE_MAX_UNRESPONSIVE 3900 - -+/* NAPI poll budget */ -+#define ATH10K_NAPI_BUDGET 64 -+#define ATH10K_NAPI_QUOTA_LIMIT 60 -+ - struct ath10k; - - enum ath10k_bus { -@@ -933,6 +937,10 @@ struct ath10k { - struct ath10k_thermal thermal; - struct ath10k_wow wow; - -+ /* NAPI */ -+ struct net_device napi_dev; -+ struct napi_struct napi; -+ - /* must be last */ - u8 drv_priv[0] __aligned(sizeof(void *)); - }; ---- a/drivers/net/wireless/ath/ath10k/htt.h -+++ b/drivers/net/wireless/ath/ath10k/htt.h -@@ -1666,7 +1666,6 @@ struct ath10k_htt { - - /* This is used to group tx/rx completions separately and process them - * in batches to reduce cache stalls */ -- struct tasklet_struct txrx_compl_task; - struct sk_buff_head rx_compl_q; - struct sk_buff_head rx_in_ord_compl_q; - struct sk_buff_head tx_fetch_ind_q; -@@ -1799,5 +1798,6 @@ int ath10k_htt_tx(struct ath10k_htt *htt - struct sk_buff *msdu); - void ath10k_htt_rx_pktlog_completion_handler(struct ath10k *ar, - struct sk_buff *skb); -+int ath10k_htt_txrx_compl_task(struct ath10k *ar, int budget); - - #endif ---- a/drivers/net/wireless/ath/ath10k/htt_rx.c -+++ b/drivers/net/wireless/ath/ath10k/htt_rx.c -@@ -34,7 +34,6 @@ - #define HTT_RX_RING_REFILL_RESCHED_MS 5 - - static int ath10k_htt_rx_get_csum_state(struct sk_buff *skb); --static void ath10k_htt_txrx_compl_task(unsigned long ptr); - - static struct sk_buff * - ath10k_htt_rx_find_skb_paddr(struct ath10k *ar, u32 paddr) -@@ -226,7 +225,6 @@ int ath10k_htt_rx_ring_refill(struct ath - void ath10k_htt_rx_free(struct ath10k_htt *htt) - { - del_timer_sync(&htt->rx_ring.refill_retry_timer); -- tasklet_kill(&htt->txrx_compl_task); - - skb_queue_purge(&htt->rx_compl_q); - skb_queue_purge(&htt->rx_in_ord_compl_q); -@@ -520,9 +518,6 @@ int ath10k_htt_rx_alloc(struct ath10k_ht - skb_queue_head_init(&htt->tx_fetch_ind_q); - atomic_set(&htt->num_mpdus_ready, 0); - -- tasklet_init(&htt->txrx_compl_task, ath10k_htt_txrx_compl_task, -- (unsigned long)htt); -- - ath10k_dbg(ar, ATH10K_DBG_BOOT, "htt rx ring size %d fill_level %d\n", - htt->rx_ring.size, htt->rx_ring.fill_level); - return 0; -@@ -958,7 +953,7 @@ static void ath10k_process_rx(struct ath - trace_ath10k_rx_hdr(ar, skb->data, skb->len); - trace_ath10k_rx_payload(ar, skb->data, skb->len); - -- ieee80211_rx(ar->hw, skb); -+ ieee80211_rx_napi(ar->hw, NULL, skb, &ar->napi); - } - - static int ath10k_htt_rx_nwifi_hdrlen(struct ath10k *ar, -@@ -1527,7 +1522,7 @@ static int ath10k_htt_rx_handle_amsdu(st - struct ath10k *ar = htt->ar; - struct ieee80211_rx_status *rx_status = &htt->rx_status; - struct sk_buff_head amsdu; -- int ret; -+ int ret, num_msdus; - - __skb_queue_head_init(&amsdu); - -@@ -1549,13 +1544,14 @@ static int ath10k_htt_rx_handle_amsdu(st - return ret; - } - -+ num_msdus = skb_queue_len(&amsdu); - ath10k_htt_rx_h_ppdu(ar, &amsdu, rx_status, 0xffff); - ath10k_htt_rx_h_unchain(ar, &amsdu, ret > 0); - ath10k_htt_rx_h_filter(ar, &amsdu, rx_status); - ath10k_htt_rx_h_mpdu(ar, &amsdu, rx_status); - ath10k_htt_rx_h_deliver(ar, &amsdu, rx_status); - -- return 0; -+ return num_msdus; - } - - static void ath10k_htt_rx_proc_rx_ind(struct ath10k_htt *htt, -@@ -1579,15 +1575,6 @@ static void ath10k_htt_rx_proc_rx_ind(st - mpdu_count += mpdu_ranges[i].mpdu_count; - - atomic_add(mpdu_count, &htt->num_mpdus_ready); -- -- tasklet_schedule(&htt->txrx_compl_task); --} -- --static void ath10k_htt_rx_frag_handler(struct ath10k_htt *htt) --{ -- atomic_inc(&htt->num_mpdus_ready); -- -- tasklet_schedule(&htt->txrx_compl_task); - } - - static void ath10k_htt_rx_tx_compl_ind(struct ath10k *ar, -@@ -1772,14 +1759,15 @@ static void ath10k_htt_rx_h_rx_offload_p - RX_FLAG_MMIC_STRIPPED; - } - --static void ath10k_htt_rx_h_rx_offload(struct ath10k *ar, -- struct sk_buff_head *list) -+static int ath10k_htt_rx_h_rx_offload(struct ath10k *ar, -+ struct sk_buff_head *list) - { - struct ath10k_htt *htt = &ar->htt; - struct ieee80211_rx_status *status = &htt->rx_status; - struct htt_rx_offload_msdu *rx; - struct sk_buff *msdu; - size_t offset; -+ int num_msdu = 0; - - while ((msdu = __skb_dequeue(list))) { - /* Offloaded frames don't have Rx descriptor. Instead they have -@@ -1819,10 +1807,12 @@ static void ath10k_htt_rx_h_rx_offload(s - ath10k_htt_rx_h_rx_offload_prot(status, msdu); - ath10k_htt_rx_h_channel(ar, status, NULL, rx->vdev_id); - ath10k_process_rx(ar, status, msdu); -+ num_msdu++; - } -+ return num_msdu; - } - --static void ath10k_htt_rx_in_ord_ind(struct ath10k *ar, struct sk_buff *skb) -+static int ath10k_htt_rx_in_ord_ind(struct ath10k *ar, struct sk_buff *skb) - { - struct ath10k_htt *htt = &ar->htt; - struct htt_resp *resp = (void *)skb->data; -@@ -1835,12 +1825,12 @@ static void ath10k_htt_rx_in_ord_ind(str - u8 tid; - bool offload; - bool frag; -- int ret; -+ int ret, num_msdus = 0; - - lockdep_assert_held(&htt->rx_ring.lock); - - if (htt->rx_confused) -- return; -+ return -EIO; - - skb_pull(skb, sizeof(resp->hdr)); - skb_pull(skb, sizeof(resp->rx_in_ord_ind)); -@@ -1859,7 +1849,7 @@ static void ath10k_htt_rx_in_ord_ind(str - - if (skb->len < msdu_count * sizeof(*resp->rx_in_ord_ind.msdu_descs)) { - ath10k_warn(ar, "dropping invalid in order rx indication\n"); -- return; -+ return -EINVAL; - } - - /* The event can deliver more than 1 A-MSDU. Each A-MSDU is later -@@ -1870,14 +1860,14 @@ static void ath10k_htt_rx_in_ord_ind(str - if (ret < 0) { - ath10k_warn(ar, "failed to pop paddr list: %d\n", ret); - htt->rx_confused = true; -- return; -+ return -EIO; - } - - /* Offloaded frames are very different and need to be handled - * separately. - */ - if (offload) -- ath10k_htt_rx_h_rx_offload(ar, &list); -+ num_msdus = ath10k_htt_rx_h_rx_offload(ar, &list); - - while (!skb_queue_empty(&list)) { - __skb_queue_head_init(&amsdu); -@@ -1890,6 +1880,7 @@ static void ath10k_htt_rx_in_ord_ind(str - * better to report something than nothing though. This - * should still give an idea about rx rate to the user. - */ -+ num_msdus += skb_queue_len(&amsdu); - ath10k_htt_rx_h_ppdu(ar, &amsdu, status, vdev_id); - ath10k_htt_rx_h_filter(ar, &amsdu, status); - ath10k_htt_rx_h_mpdu(ar, &amsdu, status); -@@ -1902,9 +1893,10 @@ static void ath10k_htt_rx_in_ord_ind(str - ath10k_warn(ar, "failed to extract amsdu: %d\n", ret); - htt->rx_confused = true; - __skb_queue_purge(&list); -- return; -+ return -EIO; - } - } -+ return num_msdus; - } - - static void ath10k_htt_rx_tx_fetch_resp_id_confirm(struct ath10k *ar, -@@ -2267,7 +2259,6 @@ bool ath10k_htt_t2h_msg_handler(struct a - } - case HTT_T2H_MSG_TYPE_TX_COMPL_IND: - ath10k_htt_rx_tx_compl_ind(htt->ar, skb); -- tasklet_schedule(&htt->txrx_compl_task); - break; - case HTT_T2H_MSG_TYPE_SEC_IND: { - struct ath10k *ar = htt->ar; -@@ -2284,7 +2275,7 @@ bool ath10k_htt_t2h_msg_handler(struct a - case HTT_T2H_MSG_TYPE_RX_FRAG_IND: { - ath10k_dbg_dump(ar, ATH10K_DBG_HTT_DUMP, NULL, "htt event: ", - skb->data, skb->len); -- ath10k_htt_rx_frag_handler(htt); -+ atomic_inc(&htt->num_mpdus_ready); - break; - } - case HTT_T2H_MSG_TYPE_TEST: -@@ -2322,8 +2313,7 @@ bool ath10k_htt_t2h_msg_handler(struct a - break; - } - case HTT_T2H_MSG_TYPE_RX_IN_ORD_PADDR_IND: { -- skb_queue_tail(&htt->rx_in_ord_compl_q, skb); -- tasklet_schedule(&htt->txrx_compl_task); -+ __skb_queue_tail(&htt->rx_in_ord_compl_q, skb); - return false; - } - case HTT_T2H_MSG_TYPE_TX_CREDIT_UPDATE_IND: -@@ -2349,7 +2339,6 @@ bool ath10k_htt_t2h_msg_handler(struct a - break; - } - skb_queue_tail(&htt->tx_fetch_ind_q, tx_fetch_ind); -- tasklet_schedule(&htt->txrx_compl_task); - break; - } - case HTT_T2H_MSG_TYPE_TX_FETCH_CONFIRM: -@@ -2378,27 +2367,77 @@ void ath10k_htt_rx_pktlog_completion_han - } - EXPORT_SYMBOL(ath10k_htt_rx_pktlog_completion_handler); - --static void ath10k_htt_txrx_compl_task(unsigned long ptr) -+int ath10k_htt_txrx_compl_task(struct ath10k *ar, int budget) - { -- struct ath10k_htt *htt = (struct ath10k_htt *)ptr; -- struct ath10k *ar = htt->ar; -+ struct ath10k_htt *htt = &ar->htt; - struct htt_tx_done tx_done = {}; -- struct sk_buff_head rx_ind_q; - struct sk_buff_head tx_ind_q; - struct sk_buff *skb; - unsigned long flags; -- int num_mpdus; -+ int quota = 0, done, num_rx_msdus; -+ bool resched_napi = false; - -- __skb_queue_head_init(&rx_ind_q); - __skb_queue_head_init(&tx_ind_q); - -- spin_lock_irqsave(&htt->rx_in_ord_compl_q.lock, flags); -- skb_queue_splice_init(&htt->rx_in_ord_compl_q, &rx_ind_q); -- spin_unlock_irqrestore(&htt->rx_in_ord_compl_q.lock, flags); -+ /* Since in-ord-ind can deliver more than 1 A-MSDU in single event, -+ * process it first to utilize full available quota. -+ */ -+ while (quota < budget) { -+ if (skb_queue_empty(&htt->rx_in_ord_compl_q)) -+ break; - -- spin_lock_irqsave(&htt->tx_fetch_ind_q.lock, flags); -- skb_queue_splice_init(&htt->tx_fetch_ind_q, &tx_ind_q); -- spin_unlock_irqrestore(&htt->tx_fetch_ind_q.lock, flags); -+ skb = __skb_dequeue(&htt->rx_in_ord_compl_q); -+ if (!skb) { -+ resched_napi = true; -+ goto exit; -+ } -+ -+ spin_lock_bh(&htt->rx_ring.lock); -+ num_rx_msdus = ath10k_htt_rx_in_ord_ind(ar, skb); -+ spin_unlock_bh(&htt->rx_ring.lock); -+ if (num_rx_msdus < 0) { -+ resched_napi = true; -+ goto exit; -+ } -+ -+ dev_kfree_skb_any(skb); -+ if (num_rx_msdus > 0) -+ quota += num_rx_msdus; -+ -+ if ((quota > ATH10K_NAPI_QUOTA_LIMIT) && -+ !skb_queue_empty(&htt->rx_in_ord_compl_q)) { -+ resched_napi = true; -+ goto exit; -+ } -+ } -+ -+ while (quota < budget) { -+ /* no more data to receive */ -+ if (!atomic_read(&htt->num_mpdus_ready)) -+ break; -+ -+ num_rx_msdus = ath10k_htt_rx_handle_amsdu(htt); -+ if (num_rx_msdus < 0) { -+ resched_napi = true; -+ goto exit; -+ } -+ -+ quota += num_rx_msdus; -+ atomic_dec(&htt->num_mpdus_ready); -+ if ((quota > ATH10K_NAPI_QUOTA_LIMIT) && -+ atomic_read(&htt->num_mpdus_ready)) { -+ resched_napi = true; -+ goto exit; -+ } -+ } -+ -+ /* From NAPI documentation: -+ * The napi poll() function may also process TX completions, in which -+ * case if it processes the entire TX ring then it should count that -+ * work as the rest of the budget. -+ */ -+ if ((quota < budget) && !kfifo_is_empty(&htt->txdone_fifo)) -+ quota = budget; - - /* kfifo_get: called only within txrx_tasklet so it's neatly serialized. - * From kfifo_get() documentation: -@@ -2408,27 +2447,22 @@ static void ath10k_htt_txrx_compl_task(u - while (kfifo_get(&htt->txdone_fifo, &tx_done)) - ath10k_txrx_tx_unref(htt, &tx_done); - -+ spin_lock_irqsave(&htt->tx_fetch_ind_q.lock, flags); -+ skb_queue_splice_init(&htt->tx_fetch_ind_q, &tx_ind_q); -+ spin_unlock_irqrestore(&htt->tx_fetch_ind_q.lock, flags); -+ - while ((skb = __skb_dequeue(&tx_ind_q))) { - ath10k_htt_rx_tx_fetch_ind(ar, skb); - dev_kfree_skb_any(skb); - } - -- num_mpdus = atomic_read(&htt->num_mpdus_ready); -- -- while (num_mpdus) { -- if (ath10k_htt_rx_handle_amsdu(htt)) -- break; -- -- num_mpdus--; -- atomic_dec(&htt->num_mpdus_ready); -- } -- -- while ((skb = __skb_dequeue(&rx_ind_q))) { -- spin_lock_bh(&htt->rx_ring.lock); -- ath10k_htt_rx_in_ord_ind(ar, skb); -- spin_unlock_bh(&htt->rx_ring.lock); -- dev_kfree_skb_any(skb); -- } -- -+exit: - ath10k_htt_rx_msdu_buff_replenish(htt); -+ /* In case of rx failure or more data to read, report budget -+ * to reschedule NAPI poll -+ */ -+ done = resched_napi ? budget : quota; -+ -+ return done; - } -+EXPORT_SYMBOL(ath10k_htt_txrx_compl_task); ---- a/drivers/net/wireless/ath/ath10k/htt_tx.c -+++ b/drivers/net/wireless/ath/ath10k/htt_tx.c -@@ -388,8 +388,6 @@ void ath10k_htt_tx_free(struct ath10k_ht - { - int size; - -- tasklet_kill(&htt->txrx_compl_task); -- - idr_for_each(&htt->pending_tx, ath10k_htt_tx_clean_up_pending, htt->ar); - idr_destroy(&htt->pending_tx); - ---- a/drivers/net/wireless/ath/ath10k/pci.c -+++ b/drivers/net/wireless/ath/ath10k/pci.c -@@ -1502,12 +1502,10 @@ void ath10k_pci_hif_send_complete_check( - ath10k_ce_per_engine_service(ar, pipe); - } - --void ath10k_pci_kill_tasklet(struct ath10k *ar) -+static void ath10k_pci_rx_retry_sync(struct ath10k *ar) - { - struct ath10k_pci *ar_pci = ath10k_pci_priv(ar); - -- tasklet_kill(&ar_pci->intr_tq); -- - del_timer_sync(&ar_pci->rx_post_retry); - } - -@@ -1566,7 +1564,7 @@ void ath10k_pci_hif_get_default_pipe(str - ul_pipe, dl_pipe); - } - --static void ath10k_pci_irq_msi_fw_mask(struct ath10k *ar) -+void ath10k_pci_irq_msi_fw_mask(struct ath10k *ar) - { - u32 val; - -@@ -1747,7 +1745,7 @@ void ath10k_pci_ce_deinit(struct ath10k - - void ath10k_pci_flush(struct ath10k *ar) - { -- ath10k_pci_kill_tasklet(ar); -+ ath10k_pci_rx_retry_sync(ar); - ath10k_pci_buffer_cleanup(ar); - } - -@@ -2754,35 +2752,53 @@ static irqreturn_t ath10k_pci_interrupt_ - return IRQ_NONE; - } - -- if (ar_pci->oper_irq_mode == ATH10K_PCI_IRQ_LEGACY) { -- if (!ath10k_pci_irq_pending(ar)) -- return IRQ_NONE; -- -- ath10k_pci_disable_and_clear_legacy_irq(ar); -- } -+ if ((ar_pci->oper_irq_mode == ATH10K_PCI_IRQ_LEGACY) && -+ !ath10k_pci_irq_pending(ar)) -+ return IRQ_NONE; - -- tasklet_schedule(&ar_pci->intr_tq); -+ ath10k_pci_disable_and_clear_legacy_irq(ar); -+ ath10k_pci_irq_msi_fw_mask(ar); -+ napi_schedule(&ar->napi); - - return IRQ_HANDLED; - } - --static void ath10k_pci_tasklet(unsigned long data) -+static int ath10k_pci_napi_poll(struct napi_struct *ctx, int budget) - { -- struct ath10k *ar = (struct ath10k *)data; -- struct ath10k_pci *ar_pci = ath10k_pci_priv(ar); -+ struct ath10k *ar = container_of(ctx, struct ath10k, napi); -+ int done = 0; - - if (ath10k_pci_has_fw_crashed(ar)) { -- ath10k_pci_irq_disable(ar); - ath10k_pci_fw_crashed_clear(ar); - ath10k_pci_fw_crashed_dump(ar); -- return; -+ napi_complete(ctx); -+ return done; - } - - ath10k_ce_per_engine_service_any(ar); - -- /* Re-enable legacy irq that was disabled in the irq handler */ -- if (ar_pci->oper_irq_mode == ATH10K_PCI_IRQ_LEGACY) -+ done = ath10k_htt_txrx_compl_task(ar, budget); -+ -+ if (done < budget) { -+ napi_complete(ctx); -+ /* In case of MSI, it is possible that interrupts are received -+ * while NAPI poll is inprogress. So pending interrupts that are -+ * received after processing all copy engine pipes by NAPI poll -+ * will not be handled again. This is causing failure to -+ * complete boot sequence in x86 platform. So before enabling -+ * interrupts safer to check for pending interrupts for -+ * immediate servicing. -+ */ -+ if (CE_INTERRUPT_SUMMARY(ar)) { -+ napi_reschedule(&ar->napi); -+ goto out; -+ } - ath10k_pci_enable_legacy_irq(ar); -+ ath10k_pci_irq_msi_fw_unmask(ar); -+ } -+ -+out: -+ return done; - } - - static int ath10k_pci_request_irq_msi(struct ath10k *ar) -@@ -2840,11 +2856,11 @@ static void ath10k_pci_free_irq(struct a - free_irq(ar_pci->pdev->irq, ar); - } - --void ath10k_pci_init_irq_tasklets(struct ath10k *ar) -+void ath10k_pci_init_napi(struct ath10k *ar) - { -- struct ath10k_pci *ar_pci = ath10k_pci_priv(ar); -- -- tasklet_init(&ar_pci->intr_tq, ath10k_pci_tasklet, (unsigned long)ar); -+ netif_napi_add(&ar->napi_dev, &ar->napi, ath10k_pci_napi_poll, -+ ATH10K_NAPI_BUDGET); -+ napi_enable(&ar->napi); - } - - static int ath10k_pci_init_irq(struct ath10k *ar) -@@ -2852,7 +2868,7 @@ static int ath10k_pci_init_irq(struct at - struct ath10k_pci *ar_pci = ath10k_pci_priv(ar); - int ret; - -- ath10k_pci_init_irq_tasklets(ar); -+ ath10k_pci_init_napi(ar); - - if (ath10k_pci_irq_mode != ATH10K_PCI_IRQ_AUTO) - ath10k_info(ar, "limiting irq mode to: %d\n", -@@ -3113,7 +3129,8 @@ int ath10k_pci_setup_resource(struct ath - - void ath10k_pci_release_resource(struct ath10k *ar) - { -- ath10k_pci_kill_tasklet(ar); -+ ath10k_pci_rx_retry_sync(ar); -+ netif_napi_del(&ar->napi); - ath10k_pci_ce_deinit(ar); - ath10k_pci_free_pipes(ar); - } -@@ -3274,7 +3291,7 @@ static int ath10k_pci_probe(struct pci_d - - err_free_irq: - ath10k_pci_free_irq(ar); -- ath10k_pci_kill_tasklet(ar); -+ ath10k_pci_rx_retry_sync(ar); - - err_deinit_irq: - ath10k_pci_deinit_irq(ar); ---- a/drivers/net/wireless/ath/ath10k/pci.h -+++ b/drivers/net/wireless/ath/ath10k/pci.h -@@ -177,8 +177,6 @@ struct ath10k_pci { - /* Operating interrupt mode */ - enum ath10k_pci_irq_mode oper_irq_mode; - -- struct tasklet_struct intr_tq; -- - struct ath10k_pci_pipe pipe_info[CE_COUNT_MAX]; - - /* Copy Engine used for Diagnostic Accesses */ -@@ -294,8 +292,7 @@ void ath10k_pci_free_pipes(struct ath10k - void ath10k_pci_free_pipes(struct ath10k *ar); - void ath10k_pci_rx_replenish_retry(unsigned long ptr); - void ath10k_pci_ce_deinit(struct ath10k *ar); --void ath10k_pci_init_irq_tasklets(struct ath10k *ar); --void ath10k_pci_kill_tasklet(struct ath10k *ar); -+void ath10k_pci_init_napi(struct ath10k *ar); - int ath10k_pci_init_pipes(struct ath10k *ar); - int ath10k_pci_init_config(struct ath10k *ar); - void ath10k_pci_rx_post(struct ath10k *ar); -@@ -303,6 +300,7 @@ void ath10k_pci_flush(struct ath10k *ar) - void ath10k_pci_enable_legacy_irq(struct ath10k *ar); - bool ath10k_pci_irq_pending(struct ath10k *ar); - void ath10k_pci_disable_and_clear_legacy_irq(struct ath10k *ar); -+void ath10k_pci_irq_msi_fw_mask(struct ath10k *ar); - int ath10k_pci_wait_for_target_init(struct ath10k *ar); - int ath10k_pci_setup_resource(struct ath10k *ar); - void ath10k_pci_release_resource(struct ath10k *ar); diff --git a/package/kernel/mac80211/patches/333-ath9k-fix-client-mode-beacon-configuration.patch b/package/kernel/mac80211/patches/333-ath9k-fix-client-mode-beacon-configuration.patch deleted file mode 100644 index d008ceb706..0000000000 --- a/package/kernel/mac80211/patches/333-ath9k-fix-client-mode-beacon-configuration.patch +++ /dev/null @@ -1,69 +0,0 @@ -From: Felix Fietkau -Date: Tue, 26 Jul 2016 08:05:10 +0200 -Subject: [PATCH] ath9k: fix client mode beacon configuration - -For pure station mode, iter_data.primary_beacon_vif was used and passed -to ath_beacon_config, but not set to the station vif. -This was causing the following warning: - -[ 100.310919] ------------[ cut here ]------------ -[ 100.315683] WARNING: CPU: 0 PID: 7 at compat-wireless-2016-06-20/drivers/net/wireless/ath/ath9k/beacon.c:642 ath9k_calculate_summary_state+0x250/0x60c [ath9k]() -[ 100.402028] CPU: 0 PID: 7 Comm: kworker/u2:1 Tainted: G W 4.4.15 #5 -[ 100.409676] Workqueue: phy0 ieee80211_ibss_leave [mac80211] -[ 100.415351] Stack : 8736e98c 870b4b20 87a25b54 800a6800 8782a080 80400d63 8039b96c 00000007 -[ 100.415351] 803c5edc 87875914 80400000 800a47cc 87a25b54 800a6800 803a0fd8 80400000 -[ 100.415351] 00000003 87875914 80400000 80094ae0 87a25b54 8787594c 00000000 801ef308 -[ 100.415351] 803ffe70 801ef300 87193d58 87b3a400 87b3ad00 70687930 00000000 00000000 -[ 100.415351] 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 -[ 100.415351] ... -[ 100.451703] Call Trace: -[ 100.454235] [<800a6800>] vprintk_default+0x24/0x30 -[ 100.459110] [<800a47cc>] printk+0x2c/0x38 -[ 100.463190] [<800a6800>] vprintk_default+0x24/0x30 -[ 100.468072] [<80094ae0>] print_worker_info+0x148/0x174 -[ 100.473378] [<801ef308>] serial8250_console_putchar+0x0/0x44 -[ 100.479122] [<801ef300>] wait_for_xmitr+0xc4/0xcc -[ 100.484014] [<87193d58>] ieee80211_ibss_leave+0xb90/0x1900 [mac80211] -[ 100.490590] [<80081604>] warn_slowpath_common+0xa0/0xd0 -[ 100.495922] [<801a359c>] dump_stack+0x14/0x28 -[ 100.500350] [<80071a00>] show_stack+0x50/0x84 -[ 100.504784] [<80081604>] warn_slowpath_common+0xa0/0xd0 -[ 100.510106] [<87024c60>] ath9k_calculate_summary_state+0x250/0x60c [ath9k] -[ 100.517105] [<800816b8>] warn_slowpath_null+0x18/0x24 -[ 100.522256] [<87024c60>] ath9k_calculate_summary_state+0x250/0x60c [ath9k] -[ 100.529273] [<87025418>] ath9k_set_txpower+0x148/0x498 [ath9k] -[ 100.535302] [<871d2c64>] cleanup_module+0xa74/0xd4c [mac80211] -[ 100.541237] [<801ef308>] serial8250_console_putchar+0x0/0x44 -[ 100.547042] [<800a5d18>] wake_up_klogd+0x54/0x68 -[ 100.551730] [<800a6650>] vprintk_emit+0x404/0x43c -[ 100.556623] [<871b9db8>] ieee80211_sta_rx_notify+0x258/0x32c [mac80211] -[ 100.563475] [<871ba6a4>] ieee80211_sta_rx_queued_mgmt+0x63c/0x734 [mac80211] -[ 100.570693] [<871aa49c>] ieee80211_tx_prepare_skb+0x210/0x230 [mac80211] -[ 100.577609] [<800af5d4>] mod_timer+0x15c/0x190 -[ 100.582220] [<871ba8b8>] ieee80211_sta_work+0xfc/0xe1c [mac80211] -[ 100.588539] [<871940b4>] ieee80211_ibss_leave+0xeec/0x1900 [mac80211] -[ 100.595122] [<8009ec84>] dequeue_task_fair+0x44/0x130 -[ 100.600281] [<80092a34>] process_one_work+0x1f8/0x334 -[ 100.605454] [<80093830>] worker_thread+0x2b4/0x408 -[ 100.610317] [<8009357c>] worker_thread+0x0/0x408 -[ 100.615019] [<8009357c>] worker_thread+0x0/0x408 -[ 100.619705] [<80097b68>] kthread+0xdc/0xe8 -[ 100.623886] [<80097a8c>] kthread+0x0/0xe8 -[ 100.627961] [<80060878>] ret_from_kernel_thread+0x14/0x1c -[ 100.633448] -[ 100.634956] ---[ end trace aafbe57e9ae6862f ]--- - -Fixes: cfda2d8e2314 ("ath9k: Fix beacon configuration for addition/removal of interfaces") -Signed-off-by: Felix Fietkau ---- - ---- a/drivers/net/wireless/ath/ath9k/main.c -+++ b/drivers/net/wireless/ath/ath9k/main.c -@@ -1154,6 +1154,7 @@ void ath9k_calculate_summary_state(struc - bool changed = (iter_data.primary_sta != ctx->primary_sta); - - if (iter_data.primary_sta) { -+ iter_data.primary_beacon_vif = iter_data.primary_sta; - iter_data.beacons = true; - ath9k_set_assoc_state(sc, iter_data.primary_sta, - changed); diff --git a/package/kernel/mac80211/patches/334-mac80211-fix-purging-multicast-PS-buffer-queue.patch b/package/kernel/mac80211/patches/334-mac80211-fix-purging-multicast-PS-buffer-queue.patch deleted file mode 100644 index dfcc6e4565..0000000000 --- a/package/kernel/mac80211/patches/334-mac80211-fix-purging-multicast-PS-buffer-queue.patch +++ /dev/null @@ -1,54 +0,0 @@ -From: Felix Fietkau -Date: Tue, 2 Aug 2016 11:11:13 +0200 -Subject: [PATCH] mac80211: fix purging multicast PS buffer queue - -The code currently assumes that buffered multicast PS frames don't have -a pending ACK frame for tx status reporting. -However, hostapd sends a broadcast deauth frame on teardown for which tx -status is requested. This can lead to the "Have pending ack frames" -warning on module reload. -Fix this by using ieee80211_free_txskb/ieee80211_purge_tx_queue. - -Signed-off-by: Felix Fietkau ---- - ---- a/net/mac80211/cfg.c -+++ b/net/mac80211/cfg.c -@@ -868,7 +868,7 @@ static int ieee80211_stop_ap(struct wiph - - /* free all potentially still buffered bcast frames */ - local->total_ps_buffered -= skb_queue_len(&sdata->u.ap.ps.bc_buf); -- skb_queue_purge(&sdata->u.ap.ps.bc_buf); -+ ieee80211_purge_tx_queue(&local->hw, &sdata->u.ap.ps.bc_buf); - - mutex_lock(&local->mtx); - ieee80211_vif_copy_chanctx_to_vlans(sdata, true); ---- a/net/mac80211/tx.c -+++ b/net/mac80211/tx.c -@@ -368,7 +368,7 @@ static void purge_old_ps_buffers(struct - skb = skb_dequeue(&ps->bc_buf); - if (skb) { - purged++; -- dev_kfree_skb(skb); -+ ieee80211_free_txskb(&local->hw, skb); - } - total += skb_queue_len(&ps->bc_buf); - } -@@ -451,7 +451,7 @@ ieee80211_tx_h_multicast_ps_buf(struct i - if (skb_queue_len(&ps->bc_buf) >= AP_MAX_BC_BUFFER) { - ps_dbg(tx->sdata, - "BC TX buffer full - dropping the oldest frame\n"); -- dev_kfree_skb(skb_dequeue(&ps->bc_buf)); -+ ieee80211_free_txskb(&tx->local->hw, skb_dequeue(&ps->bc_buf)); - } else - tx->local->total_ps_buffered++; - -@@ -4276,7 +4276,7 @@ ieee80211_get_buffered_bc(struct ieee802 - sdata = IEEE80211_DEV_TO_SUB_IF(skb->dev); - if (!ieee80211_tx_prepare(sdata, &tx, NULL, skb)) - break; -- dev_kfree_skb_any(skb); -+ ieee80211_free_txskb(hw, skb); - } - - info = IEEE80211_SKB_CB(skb); diff --git a/package/kernel/mac80211/patches/335-ath9k-use-ieee80211_tx_status_noskb-where-possible.patch b/package/kernel/mac80211/patches/335-ath9k-use-ieee80211_tx_status_noskb-where-possible.patch deleted file mode 100644 index dbb5b90fe6..0000000000 --- a/package/kernel/mac80211/patches/335-ath9k-use-ieee80211_tx_status_noskb-where-possible.patch +++ /dev/null @@ -1,305 +0,0 @@ -From: Felix Fietkau -Date: Tue, 2 Aug 2016 12:12:18 +0200 -Subject: [PATCH] ath9k: use ieee80211_tx_status_noskb where possible - -It removes the need for undoing the padding changes to skb->data and it -improves performance by eliminating one tx status lookup per MPDU in the -status path. It is also useful for preparing a follow-up fix to better -handle powersave filtering. - -Signed-off-by: Felix Fietkau ---- - ---- a/drivers/net/wireless/ath/ath9k/xmit.c -+++ b/drivers/net/wireless/ath/ath9k/xmit.c -@@ -50,9 +50,11 @@ static u16 bits_per_symbol[][2] = { - static void ath_tx_send_normal(struct ath_softc *sc, struct ath_txq *txq, - struct ath_atx_tid *tid, struct sk_buff *skb); - static void ath_tx_complete(struct ath_softc *sc, struct sk_buff *skb, -- int tx_flags, struct ath_txq *txq); -+ int tx_flags, struct ath_txq *txq, -+ struct ieee80211_sta *sta); - static void ath_tx_complete_buf(struct ath_softc *sc, struct ath_buf *bf, - struct ath_txq *txq, struct list_head *bf_q, -+ struct ieee80211_sta *sta, - struct ath_tx_status *ts, int txok); - static void ath_tx_txqaddbuf(struct ath_softc *sc, struct ath_txq *txq, - struct list_head *head, bool internal); -@@ -77,6 +79,22 @@ enum { - /* Aggregation logic */ - /*********************/ - -+static void ath_tx_status(struct ieee80211_hw *hw, struct sk_buff *skb) -+{ -+ 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) { -+ ieee80211_tx_status(hw, skb); -+ return; -+ } -+ -+ if (sta) -+ ieee80211_tx_status_noskb(hw, sta, info); -+ -+ dev_kfree_skb(skb); -+} -+ - void ath_txq_lock(struct ath_softc *sc, struct ath_txq *txq) - __acquires(&txq->axq_lock) - { -@@ -92,6 +110,7 @@ void ath_txq_unlock(struct ath_softc *sc - void ath_txq_unlock_complete(struct ath_softc *sc, struct ath_txq *txq) - __releases(&txq->axq_lock) - { -+ struct ieee80211_hw *hw = sc->hw; - struct sk_buff_head q; - struct sk_buff *skb; - -@@ -100,7 +119,7 @@ void ath_txq_unlock_complete(struct ath_ - spin_unlock_bh(&txq->axq_lock); - - while ((skb = __skb_dequeue(&q))) -- ieee80211_tx_status(sc->hw, skb); -+ ath_tx_status(hw, skb); - } - - static void ath_tx_queue_tid(struct ath_softc *sc, struct ath_txq *txq, -@@ -268,7 +287,7 @@ static void ath_tx_flush_tid(struct ath_ - } - - list_add_tail(&bf->list, &bf_head); -- ath_tx_complete_buf(sc, bf, txq, &bf_head, &ts, 0); -+ ath_tx_complete_buf(sc, bf, txq, &bf_head, NULL, &ts, 0); - } - - if (sendbar) { -@@ -333,12 +352,12 @@ static void ath_tid_drain(struct ath_sof - bf = fi->bf; - - if (!bf) { -- ath_tx_complete(sc, skb, ATH_TX_ERROR, txq); -+ ath_tx_complete(sc, skb, ATH_TX_ERROR, txq, NULL); - continue; - } - - list_add_tail(&bf->list, &bf_head); -- ath_tx_complete_buf(sc, bf, txq, &bf_head, &ts, 0); -+ ath_tx_complete_buf(sc, bf, txq, &bf_head, NULL, &ts, 0); - } - } - -@@ -441,12 +460,11 @@ static void ath_tx_count_frames(struct a - - static void ath_tx_complete_aggr(struct ath_softc *sc, struct ath_txq *txq, - struct ath_buf *bf, struct list_head *bf_q, -+ struct ieee80211_sta *sta, - struct ath_tx_status *ts, int txok) - { - struct ath_node *an = NULL; - struct sk_buff *skb; -- struct ieee80211_sta *sta; -- struct ieee80211_hw *hw = sc->hw; - struct ieee80211_hdr *hdr; - struct ieee80211_tx_info *tx_info; - struct ath_atx_tid *tid = NULL; -@@ -475,12 +493,7 @@ static void ath_tx_complete_aggr(struct - for (i = 0; i < ts->ts_rateindex; i++) - retries += rates[i].count; - -- rcu_read_lock(); -- -- sta = ieee80211_find_sta_by_ifaddr(hw, hdr->addr1, hdr->addr2); - if (!sta) { -- rcu_read_unlock(); -- - INIT_LIST_HEAD(&bf_head); - while (bf) { - bf_next = bf->bf_next; -@@ -488,7 +501,7 @@ static void ath_tx_complete_aggr(struct - if (!bf->bf_state.stale || bf_next != NULL) - list_move_tail(&bf->list, &bf_head); - -- ath_tx_complete_buf(sc, bf, txq, &bf_head, ts, 0); -+ ath_tx_complete_buf(sc, bf, txq, &bf_head, NULL, ts, 0); - - bf = bf_next; - } -@@ -598,7 +611,7 @@ static void ath_tx_complete_aggr(struct - ts); - } - -- ath_tx_complete_buf(sc, bf, txq, &bf_head, ts, -+ ath_tx_complete_buf(sc, bf, txq, &bf_head, sta, ts, - !txfail); - } else { - if (tx_info->flags & IEEE80211_TX_STATUS_EOSP) { -@@ -619,7 +632,8 @@ static void ath_tx_complete_aggr(struct - ath_tx_update_baw(sc, tid, seqno); - - ath_tx_complete_buf(sc, bf, txq, -- &bf_head, ts, 0); -+ &bf_head, NULL, ts, -+ 0); - bar_index = max_t(int, bar_index, - ATH_BA_INDEX(seq_first, seqno)); - break; -@@ -663,8 +677,6 @@ static void ath_tx_complete_aggr(struct - ath_txq_lock(sc, txq); - } - -- rcu_read_unlock(); -- - if (needreset) - ath9k_queue_reset(sc, RESET_TYPE_TX_ERROR); - } -@@ -679,7 +691,10 @@ static void ath_tx_process_buffer(struct - struct ath_tx_status *ts, struct ath_buf *bf, - struct list_head *bf_head) - { -+ struct ieee80211_hw *hw = sc->hw; - struct ieee80211_tx_info *info; -+ struct ieee80211_sta *sta; -+ struct ieee80211_hdr *hdr; - bool txok, flush; - - txok = !(ts->ts_status & ATH9K_TXERR_MASK); -@@ -692,6 +707,10 @@ static void ath_tx_process_buffer(struct - - ts->duration = ath9k_hw_get_duration(sc->sc_ah, bf->bf_desc, - ts->ts_rateindex); -+ -+ hdr = (struct ieee80211_hdr *) bf->bf_mpdu->data; -+ sta = ieee80211_find_sta_by_ifaddr(hw, hdr->addr1, hdr->addr2); -+ - if (!bf_isampdu(bf)) { - if (!flush) { - info = IEEE80211_SKB_CB(bf->bf_mpdu); -@@ -700,9 +719,9 @@ static void ath_tx_process_buffer(struct - ath_tx_rc_status(sc, bf, ts, 1, txok ? 0 : 1, txok); - ath_dynack_sample_tx_ts(sc->sc_ah, bf->bf_mpdu, ts); - } -- ath_tx_complete_buf(sc, bf, txq, bf_head, ts, txok); -+ ath_tx_complete_buf(sc, bf, txq, bf_head, sta, ts, txok); - } else -- ath_tx_complete_aggr(sc, txq, bf, bf_head, ts, txok); -+ ath_tx_complete_aggr(sc, txq, bf, bf_head, sta, ts, txok); - - if (!flush) - ath_txq_schedule(sc, txq); -@@ -938,7 +957,7 @@ ath_tx_get_tid_subframe(struct ath_softc - list_add(&bf->list, &bf_head); - __skb_unlink(skb, *q); - ath_tx_update_baw(sc, tid, seqno); -- ath_tx_complete_buf(sc, bf, txq, &bf_head, &ts, 0); -+ ath_tx_complete_buf(sc, bf, txq, &bf_head, NULL, &ts, 0); - continue; - } - -@@ -1847,6 +1866,7 @@ static void ath_drain_txq_list(struct at - */ - void ath_draintxq(struct ath_softc *sc, struct ath_txq *txq) - { -+ rcu_read_lock(); - ath_txq_lock(sc, txq); - - if (sc->sc_ah->caps.hw_caps & ATH9K_HW_CAP_EDMA) { -@@ -1865,6 +1885,7 @@ void ath_draintxq(struct ath_softc *sc, - ath_drain_txq_list(sc, txq, &txq->axq_q); - - ath_txq_unlock_complete(sc, txq); -+ rcu_read_unlock(); - } - - bool ath_drain_all_txq(struct ath_softc *sc) -@@ -2487,7 +2508,8 @@ void ath_tx_cabq(struct ieee80211_hw *hw - /*****************/ - - static void ath_tx_complete(struct ath_softc *sc, struct sk_buff *skb, -- int tx_flags, struct ath_txq *txq) -+ int tx_flags, struct ath_txq *txq, -+ struct ieee80211_sta *sta) - { - struct ieee80211_tx_info *tx_info = IEEE80211_SKB_CB(skb); - struct ath_common *common = ath9k_hw_common(sc->sc_ah); -@@ -2507,15 +2529,17 @@ static void ath_tx_complete(struct ath_s - tx_info->flags |= IEEE80211_TX_STAT_ACK; - } - -- padpos = ieee80211_hdrlen(hdr->frame_control); -- padsize = padpos & 3; -- if (padsize && skb->len>padpos+padsize) { -- /* -- * Remove MAC header padding before giving the frame back to -- * mac80211. -- */ -- memmove(skb->data + padsize, skb->data, padpos); -- skb_pull(skb, padsize); -+ if (tx_info->flags & IEEE80211_TX_CTL_REQ_TX_STATUS) { -+ padpos = ieee80211_hdrlen(hdr->frame_control); -+ padsize = padpos & 3; -+ if (padsize && skb->len>padpos+padsize) { -+ /* -+ * Remove MAC header padding before giving the frame back to -+ * mac80211. -+ */ -+ memmove(skb->data + padsize, skb->data, padpos); -+ skb_pull(skb, padsize); -+ } - } - - spin_lock_irqsave(&sc->sc_pm_lock, flags); -@@ -2530,12 +2554,14 @@ static void ath_tx_complete(struct ath_s - } - spin_unlock_irqrestore(&sc->sc_pm_lock, flags); - -- __skb_queue_tail(&txq->complete_q, skb); - ath_txq_skb_done(sc, txq, skb); -+ tx_info->status.status_driver_data[0] = sta; -+ __skb_queue_tail(&txq->complete_q, skb); - } - - static void ath_tx_complete_buf(struct ath_softc *sc, struct ath_buf *bf, - struct ath_txq *txq, struct list_head *bf_q, -+ struct ieee80211_sta *sta, - struct ath_tx_status *ts, int txok) - { - struct sk_buff *skb = bf->bf_mpdu; -@@ -2563,7 +2589,7 @@ static void ath_tx_complete_buf(struct a - complete(&sc->paprd_complete); - } else { - ath_debug_stat_tx(sc, bf, ts, txq, tx_flags); -- ath_tx_complete(sc, skb, tx_flags, txq); -+ ath_tx_complete(sc, skb, tx_flags, txq, sta); - } - skip_tx_complete: - /* At this point, skb (bf->bf_mpdu) is consumed...make sure we don't -@@ -2715,10 +2741,12 @@ void ath_tx_tasklet(struct ath_softc *sc - u32 qcumask = ((1 << ATH9K_NUM_TX_QUEUES) - 1) & ah->intr_txqs; - int i; - -+ rcu_read_lock(); - for (i = 0; i < ATH9K_NUM_TX_QUEUES; i++) { - if (ATH_TXQ_SETUP(sc, i) && (qcumask & (1 << i))) - ath_tx_processq(sc, &sc->tx.txq[i]); - } -+ rcu_read_unlock(); - } - - void ath_tx_edma_tasklet(struct ath_softc *sc) -@@ -2732,6 +2760,7 @@ void ath_tx_edma_tasklet(struct ath_soft - struct list_head *fifo_list; - int status; - -+ rcu_read_lock(); - for (;;) { - if (test_bit(ATH_OP_HW_RESET, &common->op_flags)) - break; -@@ -2802,6 +2831,7 @@ void ath_tx_edma_tasklet(struct ath_soft - ath_tx_process_buffer(sc, txq, &ts, bf, &bf_head); - ath_txq_unlock_complete(sc, txq); - } -+ rcu_read_unlock(); - } - - /*****************/ diff --git a/package/kernel/mac80211/patches/336-ath9k-improve-powersave-filter-handling.patch b/package/kernel/mac80211/patches/336-ath9k-improve-powersave-filter-handling.patch deleted file mode 100644 index 67a6c631ee..0000000000 --- a/package/kernel/mac80211/patches/336-ath9k-improve-powersave-filter-handling.patch +++ /dev/null @@ -1,70 +0,0 @@ -From: Felix Fietkau -Date: Tue, 2 Aug 2016 12:13:35 +0200 -Subject: [PATCH] ath9k: improve powersave filter handling - -For non-aggregated frames, ath9k was leaving handling of powersave -filtered packets to mac80211. This can be too slow if the intermediate -queue is already filled with packets and mac80211 does not immediately -send a new packet via drv_tx(). - -Improve response time with filtered frames by triggering clearing the -powersave filter internally. - -Signed-off-by: Felix Fietkau ---- - ---- a/drivers/net/wireless/ath/ath9k/xmit.c -+++ b/drivers/net/wireless/ath/ath9k/xmit.c -@@ -461,13 +461,13 @@ static void ath_tx_count_frames(struct a - static void ath_tx_complete_aggr(struct ath_softc *sc, struct ath_txq *txq, - struct ath_buf *bf, struct list_head *bf_q, - struct ieee80211_sta *sta, -+ struct ath_atx_tid *tid, - struct ath_tx_status *ts, int txok) - { - struct ath_node *an = NULL; - struct sk_buff *skb; - struct ieee80211_hdr *hdr; - struct ieee80211_tx_info *tx_info; -- struct ath_atx_tid *tid = NULL; - struct ath_buf *bf_next, *bf_last = bf->bf_lastbf; - struct list_head bf_head; - struct sk_buff_head bf_pending; -@@ -509,7 +509,6 @@ static void ath_tx_complete_aggr(struct - } - - an = (struct ath_node *)sta->drv_priv; -- tid = ath_get_skb_tid(sc, an, skb); - seq_first = tid->seq_start; - isba = ts->ts_flags & ATH9K_TX_BA; - -@@ -695,6 +694,7 @@ static void ath_tx_process_buffer(struct - struct ieee80211_tx_info *info; - struct ieee80211_sta *sta; - struct ieee80211_hdr *hdr; -+ struct ath_atx_tid *tid = NULL; - bool txok, flush; - - txok = !(ts->ts_status & ATH9K_TXERR_MASK); -@@ -710,6 +710,12 @@ static void ath_tx_process_buffer(struct - - hdr = (struct ieee80211_hdr *) bf->bf_mpdu->data; - sta = ieee80211_find_sta_by_ifaddr(hw, hdr->addr1, hdr->addr2); -+ if (sta) { -+ struct ath_node *an = (struct ath_node *)sta->drv_priv; -+ tid = ath_get_skb_tid(sc, an, bf->bf_mpdu); -+ if (ts->ts_status & (ATH9K_TXERR_FILT | ATH9K_TXERR_XRETRY)) -+ tid->clear_ps_filter = true; -+ } - - if (!bf_isampdu(bf)) { - if (!flush) { -@@ -721,7 +727,7 @@ static void ath_tx_process_buffer(struct - } - ath_tx_complete_buf(sc, bf, txq, bf_head, sta, ts, txok); - } else -- ath_tx_complete_aggr(sc, txq, bf, bf_head, sta, ts, txok); -+ ath_tx_complete_aggr(sc, txq, bf, bf_head, sta, tid, ts, txok); - - if (!flush) - ath_txq_schedule(sc, txq); diff --git a/package/kernel/mac80211/patches/337-ath9k-Switch-to-using-mac80211-intermediate-software.patch b/package/kernel/mac80211/patches/337-ath9k-Switch-to-using-mac80211-intermediate-software.patch deleted file mode 100644 index adfd6dfe01..0000000000 --- a/package/kernel/mac80211/patches/337-ath9k-Switch-to-using-mac80211-intermediate-software.patch +++ /dev/null @@ -1,951 +0,0 @@ -From: =?UTF-8?q?Toke=20H=C3=B8iland-J=C3=B8rgensen?= -Date: Wed, 6 Jul 2016 21:34:17 +0200 -Subject: [PATCH] ath9k: Switch to using mac80211 intermediate software queues. -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -This switches ath9k over to using the mac80211 intermediate software -queueing mechanism for data packets. It removes the queueing inside the -driver, except for the retry queue, and instead pulls from mac80211 when -a packet is needed. The retry queue is used to store a packet that was -pulled but can't be sent immediately. - -The old code path in ath_tx_start that would queue packets has been -removed completely, as has the qlen limit tunables (since there's no -longer a queue in the driver to limit). - -Based on Tim's original patch set, but reworked quite thoroughly. - -Cc: Tim Shepard -Cc: Felix Fietkau -Signed-off-by: Toke Høiland-Jørgensen ---- - ---- a/drivers/net/wireless/ath/ath9k/ath9k.h -+++ b/drivers/net/wireless/ath/ath9k/ath9k.h -@@ -91,7 +91,6 @@ int ath_descdma_setup(struct ath_softc * - #define ATH_RXBUF 512 - #define ATH_TXBUF 512 - #define ATH_TXBUF_RESERVE 5 --#define ATH_MAX_QDEPTH (ATH_TXBUF / 4 - ATH_TXBUF_RESERVE) - #define ATH_TXMAXTRY 13 - #define ATH_MAX_SW_RETRIES 30 - -@@ -145,7 +144,7 @@ int ath_descdma_setup(struct ath_softc * - #define BAW_WITHIN(_start, _bawsz, _seqno) \ - ((((_seqno) - (_start)) & 4095) < (_bawsz)) - --#define ATH_AN_2_TID(_an, _tidno) (&(_an)->tid[(_tidno)]) -+#define ATH_AN_2_TID(_an, _tidno) ath_node_to_tid(_an, _tidno) - - #define IS_HT_RATE(rate) (rate & 0x80) - #define IS_CCK_RATE(rate) ((rate >= 0x18) && (rate <= 0x1e)) -@@ -164,7 +163,6 @@ struct ath_txq { - spinlock_t axq_lock; - u32 axq_depth; - u32 axq_ampdu_depth; -- bool stopped; - bool axq_tx_inprogress; - struct list_head txq_fifo[ATH_TXFIFO_DEPTH]; - u8 txq_headidx; -@@ -232,7 +230,6 @@ struct ath_buf { - - struct ath_atx_tid { - struct list_head list; -- struct sk_buff_head buf_q; - struct sk_buff_head retry_q; - struct ath_node *an; - struct ath_txq *txq; -@@ -247,13 +244,13 @@ struct ath_atx_tid { - s8 bar_index; - bool active; - bool clear_ps_filter; -+ bool has_queued; - }; - - struct ath_node { - struct ath_softc *sc; - struct ieee80211_sta *sta; /* station struct we're part of */ - struct ieee80211_vif *vif; /* interface with which we're associated */ -- struct ath_atx_tid tid[IEEE80211_NUM_TIDS]; - - u16 maxampdu; - u8 mpdudensity; -@@ -276,7 +273,6 @@ struct ath_tx_control { - struct ath_node *an; - struct ieee80211_sta *sta; - u8 paprd; -- bool force_channel; - }; - - -@@ -293,7 +289,6 @@ struct ath_tx { - struct ath_descdma txdma; - struct ath_txq *txq_map[IEEE80211_NUM_ACS]; - struct ath_txq *uapsdq; -- u32 txq_max_pending[IEEE80211_NUM_ACS]; - u16 max_aggr_framelen[IEEE80211_NUM_ACS][4][32]; - }; - -@@ -421,6 +416,22 @@ struct ath_offchannel { - int duration; - }; - -+static inline struct ath_atx_tid * -+ath_node_to_tid(struct ath_node *an, u8 tidno) -+{ -+ struct ieee80211_sta *sta = an->sta; -+ struct ieee80211_vif *vif = an->vif; -+ struct ieee80211_txq *txq; -+ -+ BUG_ON(!vif); -+ if (sta) -+ txq = sta->txq[tidno % ARRAY_SIZE(sta->txq)]; -+ else -+ txq = vif->txq; -+ -+ return (struct ath_atx_tid *) txq->drv_priv; -+} -+ - #define case_rtn_string(val) case val: return #val - - #define ath_for_each_chanctx(_sc, _ctx) \ -@@ -575,7 +586,6 @@ void ath_tx_edma_tasklet(struct ath_soft - int ath_tx_aggr_start(struct ath_softc *sc, struct ieee80211_sta *sta, - u16 tid, u16 *ssn); - void ath_tx_aggr_stop(struct ath_softc *sc, struct ieee80211_sta *sta, u16 tid); --void ath_tx_aggr_resume(struct ath_softc *sc, struct ieee80211_sta *sta, u16 tid); - - void ath_tx_aggr_wakeup(struct ath_softc *sc, struct ath_node *an); - void ath_tx_aggr_sleep(struct ieee80211_sta *sta, struct ath_softc *sc, -@@ -585,6 +595,7 @@ void ath9k_release_buffered_frames(struc - u16 tids, int nframes, - enum ieee80211_frame_release_type reason, - bool more_data); -+void ath9k_wake_tx_queue(struct ieee80211_hw *hw, struct ieee80211_txq *queue); - - /********/ - /* VIFs */ ---- a/drivers/net/wireless/ath/ath9k/channel.c -+++ b/drivers/net/wireless/ath/ath9k/channel.c -@@ -1007,7 +1007,6 @@ static void ath_scan_send_probe(struct a - goto error; - - txctl.txq = sc->tx.txq_map[IEEE80211_AC_VO]; -- txctl.force_channel = true; - if (ath_tx_start(sc->hw, skb, &txctl)) - goto error; - -@@ -1130,7 +1129,6 @@ ath_chanctx_send_vif_ps_frame(struct ath - memset(&txctl, 0, sizeof(txctl)); - txctl.txq = sc->tx.txq_map[IEEE80211_AC_VO]; - txctl.sta = sta; -- txctl.force_channel = true; - if (ath_tx_start(sc->hw, skb, &txctl)) { - ieee80211_free_txskb(sc->hw, skb); - return false; ---- a/drivers/net/wireless/ath/ath9k/debug.c -+++ b/drivers/net/wireless/ath/ath9k/debug.c -@@ -600,7 +600,6 @@ static int read_file_xmit(struct seq_fil - PR("MPDUs XRetried: ", xretries); - PR("Aggregates: ", a_aggr); - PR("AMPDUs Queued HW:", a_queued_hw); -- PR("AMPDUs Queued SW:", a_queued_sw); - PR("AMPDUs Completed:", a_completed); - PR("AMPDUs Retried: ", a_retries); - PR("AMPDUs XRetried: ", a_xretries); -@@ -629,8 +628,7 @@ static void print_queue(struct ath_softc - seq_printf(file, "%s: %d ", "qnum", txq->axq_qnum); - seq_printf(file, "%s: %2d ", "qdepth", txq->axq_depth); - seq_printf(file, "%s: %2d ", "ampdu-depth", txq->axq_ampdu_depth); -- seq_printf(file, "%s: %3d ", "pending", txq->pending_frames); -- seq_printf(file, "%s: %d\n", "stopped", txq->stopped); -+ seq_printf(file, "%s: %3d\n", "pending", txq->pending_frames); - - ath_txq_unlock(sc, txq); - } -@@ -1208,7 +1206,6 @@ static const char ath9k_gstrings_stats[] - AMKSTR(d_tx_mpdu_xretries), - AMKSTR(d_tx_aggregates), - AMKSTR(d_tx_ampdus_queued_hw), -- AMKSTR(d_tx_ampdus_queued_sw), - AMKSTR(d_tx_ampdus_completed), - AMKSTR(d_tx_ampdu_retries), - AMKSTR(d_tx_ampdu_xretries), -@@ -1288,7 +1285,6 @@ void ath9k_get_et_stats(struct ieee80211 - AWDATA(xretries); - AWDATA(a_aggr); - AWDATA(a_queued_hw); -- AWDATA(a_queued_sw); - AWDATA(a_completed); - AWDATA(a_retries); - AWDATA(a_xretries); -@@ -1346,14 +1342,6 @@ int ath9k_init_debug(struct ath_hw *ah) - read_file_xmit); - debugfs_create_devm_seqfile(sc->dev, "queues", sc->debug.debugfs_phy, - read_file_queues); -- debugfs_create_u32("qlen_bk", S_IRUSR | S_IWUSR, sc->debug.debugfs_phy, -- &sc->tx.txq_max_pending[IEEE80211_AC_BK]); -- debugfs_create_u32("qlen_be", S_IRUSR | S_IWUSR, sc->debug.debugfs_phy, -- &sc->tx.txq_max_pending[IEEE80211_AC_BE]); -- debugfs_create_u32("qlen_vi", S_IRUSR | S_IWUSR, sc->debug.debugfs_phy, -- &sc->tx.txq_max_pending[IEEE80211_AC_VI]); -- debugfs_create_u32("qlen_vo", S_IRUSR | S_IWUSR, sc->debug.debugfs_phy, -- &sc->tx.txq_max_pending[IEEE80211_AC_VO]); - debugfs_create_devm_seqfile(sc->dev, "misc", sc->debug.debugfs_phy, - read_file_misc); - debugfs_create_devm_seqfile(sc->dev, "reset", sc->debug.debugfs_phy, ---- a/drivers/net/wireless/ath/ath9k/debug.h -+++ b/drivers/net/wireless/ath/ath9k/debug.h -@@ -147,7 +147,6 @@ struct ath_interrupt_stats { - * @completed: Total MPDUs (non-aggr) completed - * @a_aggr: Total no. of aggregates queued - * @a_queued_hw: Total AMPDUs queued to hardware -- * @a_queued_sw: Total AMPDUs queued to software queues - * @a_completed: Total AMPDUs completed - * @a_retries: No. of AMPDUs retried (SW) - * @a_xretries: No. of AMPDUs dropped due to xretries -@@ -174,7 +173,6 @@ struct ath_tx_stats { - u32 xretries; - u32 a_aggr; - u32 a_queued_hw; -- u32 a_queued_sw; - u32 a_completed; - u32 a_retries; - u32 a_xretries; ---- a/drivers/net/wireless/ath/ath9k/debug_sta.c -+++ b/drivers/net/wireless/ath/ath9k/debug_sta.c -@@ -52,8 +52,8 @@ static ssize_t read_file_node_aggr(struc - "TID", "SEQ_START", "SEQ_NEXT", "BAW_SIZE", - "BAW_HEAD", "BAW_TAIL", "BAR_IDX", "SCHED", "PAUSED"); - -- for (tidno = 0, tid = &an->tid[tidno]; -- tidno < IEEE80211_NUM_TIDS; tidno++, tid++) { -+ for (tidno = 0; tidno < IEEE80211_NUM_TIDS; tidno++) { -+ tid = ath_node_to_tid(an, tidno); - txq = tid->txq; - ath_txq_lock(sc, txq); - if (tid->active) { ---- a/drivers/net/wireless/ath/ath9k/init.c -+++ b/drivers/net/wireless/ath/ath9k/init.c -@@ -358,7 +358,6 @@ static int ath9k_init_queues(struct ath_ - for (i = 0; i < IEEE80211_NUM_ACS; i++) { - sc->tx.txq_map[i] = ath_txq_setup(sc, ATH9K_TX_QUEUE_DATA, i); - sc->tx.txq_map[i]->mac80211_qnum = i; -- sc->tx.txq_max_pending[i] = ATH_MAX_QDEPTH; - } - return 0; - } -@@ -873,6 +872,7 @@ static void ath9k_set_hw_capab(struct at - hw->max_rate_tries = 10; - hw->sta_data_size = sizeof(struct ath_node); - hw->vif_data_size = sizeof(struct ath_vif); -+ hw->txq_data_size = sizeof(struct ath_atx_tid); - hw->extra_tx_headroom = 4; - - hw->wiphy->available_antennas_rx = BIT(ah->caps.max_rxchains) - 1; ---- a/drivers/net/wireless/ath/ath9k/main.c -+++ b/drivers/net/wireless/ath/ath9k/main.c -@@ -1897,9 +1897,11 @@ static int ath9k_ampdu_action(struct iee - bool flush = false; - int ret = 0; - struct ieee80211_sta *sta = params->sta; -+ struct ath_node *an = (struct ath_node *)sta->drv_priv; - enum ieee80211_ampdu_mlme_action action = params->action; - u16 tid = params->tid; - u16 *ssn = ¶ms->ssn; -+ struct ath_atx_tid *atid; - - mutex_lock(&sc->mutex); - -@@ -1932,9 +1934,9 @@ static int ath9k_ampdu_action(struct iee - ath9k_ps_restore(sc); - break; - case IEEE80211_AMPDU_TX_OPERATIONAL: -- ath9k_ps_wakeup(sc); -- ath_tx_aggr_resume(sc, sta, tid); -- ath9k_ps_restore(sc); -+ atid = ath_node_to_tid(an, tid); -+ atid->baw_size = IEEE80211_MIN_AMPDU_BUF << -+ sta->ht_cap.ampdu_factor; - break; - default: - ath_err(ath9k_hw_common(sc->sc_ah), "Unknown AMPDU action\n"); -@@ -2696,4 +2698,5 @@ struct ieee80211_ops ath9k_ops = { - .sw_scan_start = ath9k_sw_scan_start, - .sw_scan_complete = ath9k_sw_scan_complete, - .get_txpower = ath9k_get_txpower, -+ .wake_tx_queue = ath9k_wake_tx_queue, - }; ---- a/drivers/net/wireless/ath/ath9k/xmit.c -+++ b/drivers/net/wireless/ath/ath9k/xmit.c -@@ -67,6 +67,8 @@ static struct ath_buf *ath_tx_setup_buff - struct ath_txq *txq, - struct ath_atx_tid *tid, - struct sk_buff *skb); -+static int ath_tx_prepare(struct ieee80211_hw *hw, struct sk_buff *skb, -+ struct ath_tx_control *txctl); - - enum { - MCS_HT20, -@@ -137,6 +139,26 @@ static void ath_tx_queue_tid(struct ath_ - list_add_tail(&tid->list, list); - } - -+void ath9k_wake_tx_queue(struct ieee80211_hw *hw, struct ieee80211_txq *queue) -+{ -+ struct ath_softc *sc = hw->priv; -+ struct ath_common *common = ath9k_hw_common(sc->sc_ah); -+ struct ath_atx_tid *tid = (struct ath_atx_tid *) queue->drv_priv; -+ struct ath_txq *txq = tid->txq; -+ -+ ath_dbg(common, QUEUE, "Waking TX queue: %pM (%d)\n", -+ queue->sta ? queue->sta->addr : queue->vif->addr, -+ tid->tidno); -+ -+ ath_txq_lock(sc, txq); -+ -+ tid->has_queued = true; -+ ath_tx_queue_tid(sc, txq, tid); -+ ath_txq_schedule(sc, txq); -+ -+ ath_txq_unlock(sc, txq); -+} -+ - static struct ath_frame_info *get_frame_info(struct sk_buff *skb) - { - struct ieee80211_tx_info *tx_info = IEEE80211_SKB_CB(skb); -@@ -179,7 +201,6 @@ static void ath_set_rates(struct ieee802 - static void ath_txq_skb_done(struct ath_softc *sc, struct ath_txq *txq, - struct sk_buff *skb) - { -- struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb); - struct ath_frame_info *fi = get_frame_info(skb); - int q = fi->txq; - -@@ -190,14 +211,6 @@ static void ath_txq_skb_done(struct ath_ - if (WARN_ON(--txq->pending_frames < 0)) - txq->pending_frames = 0; - -- if (txq->stopped && -- txq->pending_frames < sc->tx.txq_max_pending[q]) { -- if (ath9k_is_chanctx_enabled()) -- ieee80211_wake_queue(sc->hw, info->hw_queue); -- else -- ieee80211_wake_queue(sc->hw, q); -- txq->stopped = false; -- } - } - - static struct ath_atx_tid * -@@ -207,9 +220,48 @@ ath_get_skb_tid(struct ath_softc *sc, st - return ATH_AN_2_TID(an, tidno); - } - -+static struct sk_buff * -+ath_tid_pull(struct ath_atx_tid *tid) -+{ -+ struct ieee80211_txq *txq = container_of((void*)tid, struct ieee80211_txq, drv_priv); -+ struct ath_softc *sc = tid->an->sc; -+ struct ieee80211_hw *hw = sc->hw; -+ struct ath_tx_control txctl = { -+ .txq = tid->txq, -+ .sta = tid->an->sta, -+ }; -+ struct sk_buff *skb; -+ struct ath_frame_info *fi; -+ int q; -+ -+ if (!tid->has_queued) -+ return NULL; -+ -+ skb = ieee80211_tx_dequeue(hw, txq); -+ if (!skb) { -+ tid->has_queued = false; -+ return NULL; -+ } -+ -+ if (ath_tx_prepare(hw, skb, &txctl)) { -+ ieee80211_free_txskb(hw, skb); -+ return NULL; -+ } -+ -+ q = skb_get_queue_mapping(skb); -+ if (tid->txq == sc->tx.txq_map[q]) { -+ fi = get_frame_info(skb); -+ fi->txq = q; -+ ++tid->txq->pending_frames; -+ } -+ -+ return skb; -+ } -+ -+ - static bool ath_tid_has_buffered(struct ath_atx_tid *tid) - { -- return !skb_queue_empty(&tid->buf_q) || !skb_queue_empty(&tid->retry_q); -+ return !skb_queue_empty(&tid->retry_q) || tid->has_queued; - } - - static struct sk_buff *ath_tid_dequeue(struct ath_atx_tid *tid) -@@ -218,46 +270,11 @@ static struct sk_buff *ath_tid_dequeue(s - - skb = __skb_dequeue(&tid->retry_q); - if (!skb) -- skb = __skb_dequeue(&tid->buf_q); -+ skb = ath_tid_pull(tid); - - return skb; - } - --/* -- * ath_tx_tid_change_state: -- * - clears a-mpdu flag of previous session -- * - force sequence number allocation to fix next BlockAck Window -- */ --static void --ath_tx_tid_change_state(struct ath_softc *sc, struct ath_atx_tid *tid) --{ -- struct ath_txq *txq = tid->txq; -- struct ieee80211_tx_info *tx_info; -- struct sk_buff *skb, *tskb; -- struct ath_buf *bf; -- struct ath_frame_info *fi; -- -- skb_queue_walk_safe(&tid->buf_q, skb, tskb) { -- fi = get_frame_info(skb); -- bf = fi->bf; -- -- tx_info = IEEE80211_SKB_CB(skb); -- tx_info->flags &= ~IEEE80211_TX_CTL_AMPDU; -- -- if (bf) -- continue; -- -- bf = ath_tx_setup_buffer(sc, txq, tid, skb); -- if (!bf) { -- __skb_unlink(skb, &tid->buf_q); -- ath_txq_skb_done(sc, txq, skb); -- ieee80211_free_txskb(sc->hw, skb); -- continue; -- } -- } -- --} -- - static void ath_tx_flush_tid(struct ath_softc *sc, struct ath_atx_tid *tid) - { - struct ath_txq *txq = tid->txq; -@@ -898,20 +915,16 @@ static int ath_compute_num_delims(struct - - static struct ath_buf * - ath_tx_get_tid_subframe(struct ath_softc *sc, struct ath_txq *txq, -- struct ath_atx_tid *tid, struct sk_buff_head **q) -+ struct ath_atx_tid *tid) - { - struct ieee80211_tx_info *tx_info; - struct ath_frame_info *fi; -- struct sk_buff *skb; -+ struct sk_buff *skb, *first_skb = NULL; - struct ath_buf *bf; - u16 seqno; - - while (1) { -- *q = &tid->retry_q; -- if (skb_queue_empty(*q)) -- *q = &tid->buf_q; -- -- skb = skb_peek(*q); -+ skb = ath_tid_dequeue(tid); - if (!skb) - break; - -@@ -923,7 +936,6 @@ ath_tx_get_tid_subframe(struct ath_softc - bf->bf_state.stale = false; - - if (!bf) { -- __skb_unlink(skb, *q); - ath_txq_skb_done(sc, txq, skb); - ieee80211_free_txskb(sc->hw, skb); - continue; -@@ -952,8 +964,19 @@ ath_tx_get_tid_subframe(struct ath_softc - seqno = bf->bf_state.seqno; - - /* do not step over block-ack window */ -- if (!BAW_WITHIN(tid->seq_start, tid->baw_size, seqno)) -+ if (!BAW_WITHIN(tid->seq_start, tid->baw_size, seqno)) { -+ __skb_queue_tail(&tid->retry_q, skb); -+ -+ /* If there are other skbs in the retry q, they are -+ * probably within the BAW, so loop immediately to get -+ * one of them. Otherwise the queue can get stuck. */ -+ if (!skb_queue_is_first(&tid->retry_q, skb) && skb != first_skb) { -+ if(!first_skb) /* infinite loop prevention */ -+ first_skb = skb; -+ continue; -+ } - break; -+ } - - if (tid->bar_index > ATH_BA_INDEX(tid->seq_start, seqno)) { - struct ath_tx_status ts = {}; -@@ -961,7 +984,6 @@ ath_tx_get_tid_subframe(struct ath_softc - - INIT_LIST_HEAD(&bf_head); - list_add(&bf->list, &bf_head); -- __skb_unlink(skb, *q); - ath_tx_update_baw(sc, tid, seqno); - ath_tx_complete_buf(sc, bf, txq, &bf_head, NULL, &ts, 0); - continue; -@@ -973,11 +995,10 @@ ath_tx_get_tid_subframe(struct ath_softc - return NULL; - } - --static bool -+static int - ath_tx_form_aggr(struct ath_softc *sc, struct ath_txq *txq, - struct ath_atx_tid *tid, struct list_head *bf_q, -- struct ath_buf *bf_first, struct sk_buff_head *tid_q, -- int *aggr_len) -+ struct ath_buf *bf_first) - { - #define PADBYTES(_len) ((4 - ((_len) % 4)) % 4) - struct ath_buf *bf = bf_first, *bf_prev = NULL; -@@ -987,12 +1008,13 @@ ath_tx_form_aggr(struct ath_softc *sc, s - struct ieee80211_tx_info *tx_info; - struct ath_frame_info *fi; - struct sk_buff *skb; -- bool closed = false; -+ - - bf = bf_first; - aggr_limit = ath_lookup_rate(sc, bf, tid); - -- do { -+ while (bf) -+ { - skb = bf->bf_mpdu; - fi = get_frame_info(skb); - -@@ -1001,12 +1023,12 @@ ath_tx_form_aggr(struct ath_softc *sc, s - if (nframes) { - if (aggr_limit < al + bpad + al_delta || - ath_lookup_legacy(bf) || nframes >= h_baw) -- break; -+ goto stop; - - tx_info = IEEE80211_SKB_CB(bf->bf_mpdu); - if ((tx_info->flags & IEEE80211_TX_CTL_RATE_CTRL_PROBE) || - !(tx_info->flags & IEEE80211_TX_CTL_AMPDU)) -- break; -+ goto stop; - } - - /* add padding for previous frame to aggregation length */ -@@ -1028,20 +1050,18 @@ ath_tx_form_aggr(struct ath_softc *sc, s - ath_tx_addto_baw(sc, tid, bf); - bf->bf_state.ndelim = ndelim; - -- __skb_unlink(skb, tid_q); - list_add_tail(&bf->list, bf_q); - if (bf_prev) - bf_prev->bf_next = bf; - - bf_prev = bf; - -- bf = ath_tx_get_tid_subframe(sc, txq, tid, &tid_q); -- if (!bf) { -- closed = true; -- break; -- } -- } while (ath_tid_has_buffered(tid)); -- -+ bf = ath_tx_get_tid_subframe(sc, txq, tid); -+ } -+ goto finish; -+stop: -+ __skb_queue_tail(&tid->retry_q, bf->bf_mpdu); -+finish: - bf = bf_first; - bf->bf_lastbf = bf_prev; - -@@ -1052,9 +1072,7 @@ ath_tx_form_aggr(struct ath_softc *sc, s - TX_STAT_INC(txq->axq_qnum, a_aggr); - } - -- *aggr_len = al; -- -- return closed; -+ return al; - #undef PADBYTES - } - -@@ -1431,18 +1449,15 @@ static void ath_tx_fill_desc(struct ath_ - static void - ath_tx_form_burst(struct ath_softc *sc, struct ath_txq *txq, - struct ath_atx_tid *tid, struct list_head *bf_q, -- struct ath_buf *bf_first, struct sk_buff_head *tid_q) -+ struct ath_buf *bf_first) - { - struct ath_buf *bf = bf_first, *bf_prev = NULL; -- struct sk_buff *skb; - int nframes = 0; - - do { - struct ieee80211_tx_info *tx_info; -- skb = bf->bf_mpdu; - - nframes++; -- __skb_unlink(skb, tid_q); - list_add_tail(&bf->list, bf_q); - if (bf_prev) - bf_prev->bf_next = bf; -@@ -1451,13 +1466,15 @@ ath_tx_form_burst(struct ath_softc *sc, - if (nframes >= 2) - break; - -- bf = ath_tx_get_tid_subframe(sc, txq, tid, &tid_q); -+ bf = ath_tx_get_tid_subframe(sc, txq, tid); - if (!bf) - break; - - tx_info = IEEE80211_SKB_CB(bf->bf_mpdu); -- if (tx_info->flags & IEEE80211_TX_CTL_AMPDU) -+ if (tx_info->flags & IEEE80211_TX_CTL_AMPDU) { -+ __skb_queue_tail(&tid->retry_q, bf->bf_mpdu); - break; -+ } - - ath_set_rates(tid->an->vif, tid->an->sta, bf, false); - } while (1); -@@ -1468,34 +1485,33 @@ static bool ath_tx_sched_aggr(struct ath - { - struct ath_buf *bf; - struct ieee80211_tx_info *tx_info; -- struct sk_buff_head *tid_q; - struct list_head bf_q; - int aggr_len = 0; -- bool aggr, last = true; -+ bool aggr; - - if (!ath_tid_has_buffered(tid)) - return false; - - INIT_LIST_HEAD(&bf_q); - -- bf = ath_tx_get_tid_subframe(sc, txq, tid, &tid_q); -+ bf = ath_tx_get_tid_subframe(sc, txq, tid); - if (!bf) - return false; - - tx_info = IEEE80211_SKB_CB(bf->bf_mpdu); - aggr = !!(tx_info->flags & IEEE80211_TX_CTL_AMPDU); - if ((aggr && txq->axq_ampdu_depth >= ATH_AGGR_MIN_QDEPTH) || -- (!aggr && txq->axq_depth >= ATH_NON_AGGR_MIN_QDEPTH)) { -+ (!aggr && txq->axq_depth >= ATH_NON_AGGR_MIN_QDEPTH)) { -+ __skb_queue_tail(&tid->retry_q, bf->bf_mpdu); - *stop = true; - return false; - } - - ath_set_rates(tid->an->vif, tid->an->sta, bf, false); - if (aggr) -- last = ath_tx_form_aggr(sc, txq, tid, &bf_q, bf, -- tid_q, &aggr_len); -+ aggr_len = ath_tx_form_aggr(sc, txq, tid, &bf_q, bf); - else -- ath_tx_form_burst(sc, txq, tid, &bf_q, bf, tid_q); -+ ath_tx_form_burst(sc, txq, tid, &bf_q, bf); - - if (list_empty(&bf_q)) - return false; -@@ -1538,9 +1554,6 @@ int ath_tx_aggr_start(struct ath_softc * - an->mpdudensity = density; - } - -- /* force sequence number allocation for pending frames */ -- ath_tx_tid_change_state(sc, txtid); -- - txtid->active = true; - *ssn = txtid->seq_start = txtid->seq_next; - txtid->bar_index = -1; -@@ -1565,7 +1578,6 @@ void ath_tx_aggr_stop(struct ath_softc * - ath_txq_lock(sc, txq); - txtid->active = false; - ath_tx_flush_tid(sc, txtid); -- ath_tx_tid_change_state(sc, txtid); - ath_txq_unlock_complete(sc, txq); - } - -@@ -1575,14 +1587,12 @@ void ath_tx_aggr_sleep(struct ieee80211_ - struct ath_common *common = ath9k_hw_common(sc->sc_ah); - struct ath_atx_tid *tid; - struct ath_txq *txq; -- bool buffered; - int tidno; - - ath_dbg(common, XMIT, "%s called\n", __func__); - -- for (tidno = 0, tid = &an->tid[tidno]; -- tidno < IEEE80211_NUM_TIDS; tidno++, tid++) { -- -+ for (tidno = 0; tidno < IEEE80211_NUM_TIDS; tidno++) { -+ tid = ath_node_to_tid(an, tidno); - txq = tid->txq; - - ath_txq_lock(sc, txq); -@@ -1592,13 +1602,12 @@ void ath_tx_aggr_sleep(struct ieee80211_ - continue; - } - -- buffered = ath_tid_has_buffered(tid); -+ if (!skb_queue_empty(&tid->retry_q)) -+ ieee80211_sta_set_buffered(sta, tid->tidno, true); - - list_del_init(&tid->list); - - ath_txq_unlock(sc, txq); -- -- ieee80211_sta_set_buffered(sta, tidno, buffered); - } - } - -@@ -1611,49 +1620,20 @@ void ath_tx_aggr_wakeup(struct ath_softc - - ath_dbg(common, XMIT, "%s called\n", __func__); - -- for (tidno = 0, tid = &an->tid[tidno]; -- tidno < IEEE80211_NUM_TIDS; tidno++, tid++) { -- -+ for (tidno = 0; tidno < IEEE80211_NUM_TIDS; tidno++) { -+ tid = ath_node_to_tid(an, tidno); - txq = tid->txq; - - ath_txq_lock(sc, txq); - tid->clear_ps_filter = true; -- - if (ath_tid_has_buffered(tid)) { - ath_tx_queue_tid(sc, txq, tid); - ath_txq_schedule(sc, txq); - } -- - ath_txq_unlock_complete(sc, txq); - } - } - --void ath_tx_aggr_resume(struct ath_softc *sc, struct ieee80211_sta *sta, -- u16 tidno) --{ -- struct ath_common *common = ath9k_hw_common(sc->sc_ah); -- struct ath_atx_tid *tid; -- struct ath_node *an; -- struct ath_txq *txq; -- -- ath_dbg(common, XMIT, "%s called\n", __func__); -- -- an = (struct ath_node *)sta->drv_priv; -- tid = ATH_AN_2_TID(an, tidno); -- txq = tid->txq; -- -- ath_txq_lock(sc, txq); -- -- tid->baw_size = IEEE80211_MIN_AMPDU_BUF << sta->ht_cap.ampdu_factor; -- -- if (ath_tid_has_buffered(tid)) { -- ath_tx_queue_tid(sc, txq, tid); -- ath_txq_schedule(sc, txq); -- } -- -- ath_txq_unlock_complete(sc, txq); --} -- - void ath9k_release_buffered_frames(struct ieee80211_hw *hw, - struct ieee80211_sta *sta, - u16 tids, int nframes, -@@ -1666,7 +1646,6 @@ void ath9k_release_buffered_frames(struc - struct ieee80211_tx_info *info; - struct list_head bf_q; - struct ath_buf *bf_tail = NULL, *bf; -- struct sk_buff_head *tid_q; - int sent = 0; - int i; - -@@ -1681,11 +1660,10 @@ void ath9k_release_buffered_frames(struc - - ath_txq_lock(sc, tid->txq); - while (nframes > 0) { -- bf = ath_tx_get_tid_subframe(sc, sc->tx.uapsdq, tid, &tid_q); -+ bf = ath_tx_get_tid_subframe(sc, sc->tx.uapsdq, tid); - if (!bf) - break; - -- __skb_unlink(bf->bf_mpdu, tid_q); - list_add_tail(&bf->list, &bf_q); - ath_set_rates(tid->an->vif, tid->an->sta, bf, true); - if (bf_isampdu(bf)) { -@@ -1700,7 +1678,7 @@ void ath9k_release_buffered_frames(struc - sent++; - TX_STAT_INC(txq->axq_qnum, a_queued_hw); - -- if (an->sta && !ath_tid_has_buffered(tid)) -+ if (an->sta && skb_queue_empty(&tid->retry_q)) - ieee80211_sta_set_buffered(an->sta, i, false); - } - ath_txq_unlock_complete(sc, tid->txq); -@@ -1929,13 +1907,7 @@ bool ath_drain_all_txq(struct ath_softc - if (!ATH_TXQ_SETUP(sc, i)) - continue; - -- /* -- * The caller will resume queues with ieee80211_wake_queues. -- * Mark the queue as not stopped to prevent ath_tx_complete -- * from waking the queue too early. -- */ - txq = &sc->tx.txq[i]; -- txq->stopped = false; - ath_draintxq(sc, txq); - } - -@@ -2334,16 +2306,14 @@ int ath_tx_start(struct ieee80211_hw *hw - struct ath_softc *sc = hw->priv; - struct ath_txq *txq = txctl->txq; - struct ath_atx_tid *tid = NULL; -+ struct ath_node *an = NULL; - struct ath_buf *bf; -- bool queue, ps_resp; -+ bool ps_resp; - int q, ret; - - if (vif) - avp = (void *)vif->drv_priv; - -- if (info->flags & IEEE80211_TX_CTL_TX_OFFCHAN) -- txctl->force_channel = true; -- - ps_resp = !!(info->control.flags & IEEE80211_TX_CTRL_PS_RESPONSE); - - ret = ath_tx_prepare(hw, skb, txctl); -@@ -2358,63 +2328,18 @@ int ath_tx_start(struct ieee80211_hw *hw - - q = skb_get_queue_mapping(skb); - -- ath_txq_lock(sc, txq); -- if (txq == sc->tx.txq_map[q]) { -- fi->txq = q; -- if (++txq->pending_frames > sc->tx.txq_max_pending[q] && -- !txq->stopped) { -- if (ath9k_is_chanctx_enabled()) -- ieee80211_stop_queue(sc->hw, info->hw_queue); -- else -- ieee80211_stop_queue(sc->hw, q); -- txq->stopped = true; -- } -- } -- -- queue = ieee80211_is_data_present(hdr->frame_control); -- -- /* If chanctx, queue all null frames while NOA could be there */ -- if (ath9k_is_chanctx_enabled() && -- ieee80211_is_nullfunc(hdr->frame_control) && -- !txctl->force_channel) -- queue = true; -- -- /* Force queueing of all frames that belong to a virtual interface on -- * a different channel context, to ensure that they are sent on the -- * correct channel. -- */ -- if (((avp && avp->chanctx != sc->cur_chan) || -- sc->cur_chan->stopped) && !txctl->force_channel) { -- if (!txctl->an) -- txctl->an = &avp->mcast_node; -- queue = true; -- ps_resp = false; -- } -- -- if (txctl->an && queue) -- tid = ath_get_skb_tid(sc, txctl->an, skb); -- -- if (ps_resp) { -- ath_txq_unlock(sc, txq); -+ if (ps_resp) - txq = sc->tx.uapsdq; -- ath_txq_lock(sc, txq); -- } else if (txctl->an && queue) { -- WARN_ON(tid->txq != txctl->txq); -- -- if (info->flags & IEEE80211_TX_CTL_CLEAR_PS_FILT) -- tid->clear_ps_filter = true; - -- /* -- * Add this frame to software queue for scheduling later -- * for aggregation. -- */ -- TX_STAT_INC(txq->axq_qnum, a_queued_sw); -- __skb_queue_tail(&tid->buf_q, skb); -- if (!txctl->an->sleeping) -- ath_tx_queue_tid(sc, txq, tid); -+ if (txctl->sta) { -+ an = (struct ath_node *) sta->drv_priv; -+ tid = ath_get_skb_tid(sc, an, skb); -+ } - -- ath_txq_schedule(sc, txq); -- goto out; -+ ath_txq_lock(sc, txq); -+ if (txq == sc->tx.txq_map[q]) { -+ fi->txq = q; -+ ++txq->pending_frames; - } - - bf = ath_tx_setup_buffer(sc, txq, tid, skb); -@@ -2907,9 +2832,8 @@ void ath_tx_node_init(struct ath_softc * - struct ath_atx_tid *tid; - int tidno, acno; - -- for (tidno = 0, tid = &an->tid[tidno]; -- tidno < IEEE80211_NUM_TIDS; -- tidno++, tid++) { -+ for (tidno = 0; tidno < IEEE80211_NUM_TIDS; tidno++) { -+ tid = ath_node_to_tid(an, tidno); - tid->an = an; - tid->tidno = tidno; - tid->seq_start = tid->seq_next = 0; -@@ -2917,11 +2841,14 @@ void ath_tx_node_init(struct ath_softc * - tid->baw_head = tid->baw_tail = 0; - tid->active = false; - tid->clear_ps_filter = true; -- __skb_queue_head_init(&tid->buf_q); -+ tid->has_queued = false; - __skb_queue_head_init(&tid->retry_q); - INIT_LIST_HEAD(&tid->list); - acno = TID_TO_WME_AC(tidno); - tid->txq = sc->tx.txq_map[acno]; -+ -+ if (!an->sta) -+ break; /* just one multicast ath_atx_tid */ - } - } - -@@ -2931,9 +2858,8 @@ void ath_tx_node_cleanup(struct ath_soft - struct ath_txq *txq; - int tidno; - -- for (tidno = 0, tid = &an->tid[tidno]; -- tidno < IEEE80211_NUM_TIDS; tidno++, tid++) { -- -+ for (tidno = 0; tidno < IEEE80211_NUM_TIDS; tidno++) { -+ tid = ath_node_to_tid(an, tidno); - txq = tid->txq; - - ath_txq_lock(sc, txq); -@@ -2945,6 +2871,9 @@ void ath_tx_node_cleanup(struct ath_soft - tid->active = false; - - ath_txq_unlock(sc, txq); -+ -+ if (!an->sta) -+ break; /* just one multicast ath_atx_tid */ - } - } - diff --git a/package/kernel/mac80211/patches/338-mac80211-fix-tim-recalculation-after-PS-response.patch b/package/kernel/mac80211/patches/338-mac80211-fix-tim-recalculation-after-PS-response.patch deleted file mode 100644 index 6c0852e826..0000000000 --- a/package/kernel/mac80211/patches/338-mac80211-fix-tim-recalculation-after-PS-response.patch +++ /dev/null @@ -1,31 +0,0 @@ -From: Felix Fietkau -Date: Fri, 26 Aug 2016 21:57:16 +0200 -Subject: [PATCH] mac80211: fix tim recalculation after PS response - -Handle the case where the mac80211 intermediate queues are empty and the -driver has buffered frames - -Fixes: ba8c3d6f16a1 ("mac80211: add an intermediate software queue implementation") -Signed-off-by: Felix Fietkau ---- - ---- a/net/mac80211/sta_info.c -+++ b/net/mac80211/sta_info.c -@@ -1616,7 +1616,6 @@ ieee80211_sta_ps_deliver_response(struct - - sta_info_recalc_tim(sta); - } else { -- unsigned long tids = sta->txq_buffered_tids & driver_release_tids; - int tid; - - /* -@@ -1648,7 +1647,8 @@ ieee80211_sta_ps_deliver_response(struct - for (tid = 0; tid < ARRAY_SIZE(sta->sta.txq); tid++) { - struct txq_info *txqi = to_txq_info(sta->sta.txq[tid]); - -- if (!(tids & BIT(tid)) || txqi->tin.backlog_packets) -+ if (!(driver_release_tids & BIT(tid)) || -+ txqi->tin.backlog_packets) - continue; - - sta_info_recalc_tim(sta); diff --git a/package/kernel/mac80211/patches/339-ath9k-fix-moredata-bit-in-PS-buffered-frame-release.patch b/package/kernel/mac80211/patches/339-ath9k-fix-moredata-bit-in-PS-buffered-frame-release.patch deleted file mode 100644 index 49b37e407b..0000000000 --- a/package/kernel/mac80211/patches/339-ath9k-fix-moredata-bit-in-PS-buffered-frame-release.patch +++ /dev/null @@ -1,49 +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 -@@ -1634,6 +1634,21 @@ 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, -@@ -1664,6 +1679,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)) { -@@ -1687,6 +1703,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/340-ath9k-clear-potentially-stale-EOSP-status-bit-in-int.patch b/package/kernel/mac80211/patches/340-ath9k-clear-potentially-stale-EOSP-status-bit-in-int.patch deleted file mode 100644 index 929da25d75..0000000000 --- a/package/kernel/mac80211/patches/340-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 -@@ -945,7 +945,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/341-ath9k-report-tx-status-on-EOSP.patch b/package/kernel/mac80211/patches/341-ath9k-report-tx-status-on-EOSP.patch deleted file mode 100644 index 80a3074a4d..0000000000 --- a/package/kernel/mac80211/patches/341-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/342-ath9k-fix-block-ack-window-tracking-issues.patch b/package/kernel/mac80211/patches/342-ath9k-fix-block-ack-window-tracking-issues.patch deleted file mode 100644 index fea147b182..0000000000 --- a/package/kernel/mac80211/patches/342-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, -@@ -300,7 +300,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; - } - -@@ -316,10 +316,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); - -@@ -340,6 +345,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); -@@ -616,7 +624,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)); -@@ -646,7 +654,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, -@@ -986,11 +994,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; - } - -@@ -1048,8 +1059,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); -@@ -1684,10 +1693,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/343-mac80211-send-delBA-on-unexpected-BlockAck-data-fram.patch b/package/kernel/mac80211/patches/343-mac80211-send-delBA-on-unexpected-BlockAck-data-fram.patch deleted file mode 100644 index 3bbca22b46..0000000000 --- a/package/kernel/mac80211/patches/343-mac80211-send-delBA-on-unexpected-BlockAck-data-fram.patch +++ /dev/null @@ -1,64 +0,0 @@ -From: Johannes Berg -Date: Mon, 29 Aug 2016 23:25:18 +0300 -Subject: [PATCH] mac80211: send delBA on unexpected BlockAck data frames - -When we receive data frames with ACK policy BlockAck, send -delBA as requested by the 802.11 spec. Since this would be -happening for every frame inside an A-MPDU if it's really -received outside a session, limit it to a single attempt. - -Signed-off-by: Johannes Berg ---- - ---- a/net/mac80211/agg-rx.c -+++ b/net/mac80211/agg-rx.c -@@ -388,8 +388,10 @@ void __ieee80211_start_rx_ba_session(str - } - - end: -- if (status == WLAN_STATUS_SUCCESS) -+ if (status == WLAN_STATUS_SUCCESS) { - __set_bit(tid, sta->ampdu_mlme.agg_session_valid); -+ __clear_bit(tid, sta->ampdu_mlme.unexpected_agg); -+ } - mutex_unlock(&sta->ampdu_mlme.mtx); - - end_no_lock: ---- a/net/mac80211/rx.c -+++ b/net/mac80211/rx.c -@@ -1072,8 +1072,15 @@ static void ieee80211_rx_reorder_ampdu(s - tid = *ieee80211_get_qos_ctl(hdr) & IEEE80211_QOS_CTL_TID_MASK; - - tid_agg_rx = rcu_dereference(sta->ampdu_mlme.tid_rx[tid]); -- if (!tid_agg_rx) -+ if (!tid_agg_rx) { -+ if (ack_policy == IEEE80211_QOS_CTL_ACK_POLICY_BLOCKACK && -+ !test_bit(tid, rx->sta->ampdu_mlme.agg_session_valid) && -+ !test_and_set_bit(tid, rx->sta->ampdu_mlme.unexpected_agg)) -+ ieee80211_send_delba(rx->sdata, rx->sta->sta.addr, tid, -+ WLAN_BACK_RECIPIENT, -+ WLAN_REASON_QSTA_REQUIRE_SETUP); - goto dont_reorder; -+ } - - /* qos null data frames are excluded */ - if (unlikely(hdr->frame_control & cpu_to_le16(IEEE80211_STYPE_NULLFUNC))) ---- a/net/mac80211/sta_info.h -+++ b/net/mac80211/sta_info.h -@@ -230,6 +230,8 @@ struct tid_ampdu_rx { - * @tid_rx_stop_requested: bitmap indicating which BA sessions per TID the - * driver requested to close until the work for it runs - * @agg_session_valid: bitmap indicating which TID has a rx BA session open on -+ * @unexpected_agg: bitmap indicating which TID already sent a delBA due to -+ * unexpected aggregation related frames outside a session - * @work: work struct for starting/stopping aggregation - * @tid_tx: aggregation info for Tx per TID - * @tid_start_tx: sessions where start was requested -@@ -244,6 +246,7 @@ struct sta_ampdu_mlme { - unsigned long tid_rx_timer_expired[BITS_TO_LONGS(IEEE80211_NUM_TIDS)]; - unsigned long tid_rx_stop_requested[BITS_TO_LONGS(IEEE80211_NUM_TIDS)]; - unsigned long agg_session_valid[BITS_TO_LONGS(IEEE80211_NUM_TIDS)]; -+ unsigned long unexpected_agg[BITS_TO_LONGS(IEEE80211_NUM_TIDS)]; - /* tx */ - struct work_struct work; - struct tid_ampdu_tx __rcu *tid_tx[IEEE80211_NUM_TIDS]; diff --git a/package/kernel/mac80211/patches/344-mac80211-send-delBA-on-unexpected-BlockAck-Request.patch b/package/kernel/mac80211/patches/344-mac80211-send-delBA-on-unexpected-BlockAck-Request.patch deleted file mode 100644 index c3d3118894..0000000000 --- a/package/kernel/mac80211/patches/344-mac80211-send-delBA-on-unexpected-BlockAck-Request.patch +++ /dev/null @@ -1,26 +0,0 @@ -From: Johannes Berg -Date: Mon, 29 Aug 2016 23:25:19 +0300 -Subject: [PATCH] mac80211: send delBA on unexpected BlockAck Request - -If we don't have a BA session, send delBA, as requested by the -IEEE 802.11 spec. Apply the same limit of sending such a delBA -only once as in the previous patch. - -Signed-off-by: Johannes Berg ---- - ---- a/net/mac80211/rx.c -+++ b/net/mac80211/rx.c -@@ -2537,6 +2537,12 @@ ieee80211_rx_h_ctrl(struct ieee80211_rx_ - - tid = le16_to_cpu(bar_data.control) >> 12; - -+ if (!test_bit(tid, rx->sta->ampdu_mlme.agg_session_valid) && -+ !test_and_set_bit(tid, rx->sta->ampdu_mlme.unexpected_agg)) -+ ieee80211_send_delba(rx->sdata, rx->sta->sta.addr, tid, -+ WLAN_BACK_RECIPIENT, -+ WLAN_REASON_QSTA_REQUIRE_SETUP); -+ - tid_agg_rx = rcu_dereference(rx->sta->ampdu_mlme.tid_rx[tid]); - if (!tid_agg_rx) - return RX_DROP_MONITOR; diff --git a/package/kernel/mac80211/patches/345-mac80211-Move-reorder-sensitive-TX-handlers-to-after.patch b/package/kernel/mac80211/patches/345-mac80211-Move-reorder-sensitive-TX-handlers-to-after.patch deleted file mode 100644 index aba1ff4532..0000000000 --- a/package/kernel/mac80211/patches/345-mac80211-Move-reorder-sensitive-TX-handlers-to-after.patch +++ /dev/null @@ -1,478 +0,0 @@ -From: Felix Fietkau -Date: Sun, 4 Sep 2016 17:46:24 +0200 -Subject: [PATCH] mac80211: fix sequence number assignment for PS response - frames - -When using intermediate queues, sequence number allocation is deferred -until dequeue. This doesn't work for PS response frames, which bypass -those queues. - -Signed-off-by: Felix Fietkau ---- - ---- a/net/mac80211/tx.c -+++ b/net/mac80211/tx.c -@@ -38,6 +38,12 @@ - #include "wme.h" - #include "rate.h" - -+static int invoke_tx_handlers_late(struct ieee80211_tx_data *tx); -+static bool ieee80211_xmit_fast_finish(struct ieee80211_sub_if_data *sdata, -+ struct sta_info *sta, u8 pn_offs, -+ struct ieee80211_key_conf *key_conf, -+ struct sk_buff *skb); -+ - /* misc utils */ - - static inline void ieee80211_tx_stats(struct net_device *dev, u32 len) -@@ -849,8 +855,7 @@ ieee80211_tx_h_sequence(struct ieee80211 - tid = *qc & IEEE80211_QOS_CTL_TID_MASK; - tx->sta->tx_stats.msdu[tid]++; - -- if (!tx->sta->sta.txq[0]) -- hdr->seq_ctrl = ieee80211_tx_next_seq(tx->sta, tid); -+ hdr->seq_ctrl = ieee80211_tx_next_seq(tx->sta, tid); - - return TX_CONTINUE; - } -@@ -1398,6 +1403,7 @@ void ieee80211_txq_init(struct ieee80211 - fq_tin_init(&txqi->tin); - fq_flow_init(&txqi->def_flow); - codel_vars_init(&txqi->def_cvars); -+ __skb_queue_head_init(&txqi->frags); - - txqi->txq.vif = &sdata->vif; - -@@ -1420,6 +1426,7 @@ void ieee80211_txq_purge(struct ieee8021 - struct fq_tin *tin = &txqi->tin; - - fq_tin_reset(fq, tin, fq_skb_free_func); -+ ieee80211_purge_tx_queue(&local->hw, &txqi->frags); - } - - int ieee80211_txq_setup_flows(struct ieee80211_local *local) -@@ -1476,12 +1483,19 @@ struct sk_buff *ieee80211_tx_dequeue(str - struct sk_buff *skb = NULL; - struct fq *fq = &local->fq; - struct fq_tin *tin = &txqi->tin; -+ struct ieee80211_tx_info *info; - - spin_lock_bh(&fq->lock); - - if (test_bit(IEEE80211_TXQ_STOP, &txqi->flags)) - goto out; - -+ /* Make sure fragments stay together. */ -+ skb = __skb_dequeue(&txqi->frags); -+ if (skb) -+ goto out; -+ -+begin: - skb = fq_tin_dequeue(fq, tin, fq_tin_dequeue_func); - if (!skb) - goto out; -@@ -1489,16 +1503,38 @@ struct sk_buff *ieee80211_tx_dequeue(str - ieee80211_set_skb_vif(skb, txqi); - - hdr = (struct ieee80211_hdr *)skb->data; -- if (txq->sta && ieee80211_is_data_qos(hdr->frame_control)) { -+ info = IEEE80211_SKB_CB(skb); -+ if (txq->sta && info->control.flags & IEEE80211_TX_CTRL_FAST_XMIT) { - struct sta_info *sta = container_of(txq->sta, struct sta_info, - sta); -- struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb); -+ u8 pn_offs = 0; - -- hdr->seq_ctrl = ieee80211_tx_next_seq(sta, txq->tid); -- if (test_bit(IEEE80211_TXQ_AMPDU, &txqi->flags)) -- info->flags |= IEEE80211_TX_CTL_AMPDU; -- else -- info->flags &= ~IEEE80211_TX_CTL_AMPDU; -+ if (info->control.hw_key) -+ pn_offs = ieee80211_padded_hdrlen(hw, hdr->frame_control); -+ -+ ieee80211_xmit_fast_finish(sta->sdata, sta, pn_offs, -+ info->control.hw_key, skb); -+ } else { -+ struct ieee80211_tx_data tx = { }; -+ -+ __skb_queue_head_init(&tx.skbs); -+ tx.local = local; -+ tx.skb = skb; -+ tx.hdrlen = ieee80211_padded_hdrlen(hw, hdr->frame_control); -+ if (txq->sta) { -+ tx.sta = container_of(txq->sta, struct sta_info, sta); -+ tx.sdata = tx.sta->sdata; -+ } else { -+ tx.sdata = vif_to_sdata(info->control.vif); -+ } -+ -+ if (invoke_tx_handlers_late(&tx)) -+ goto begin; -+ -+ skb = __skb_dequeue(&tx.skbs); -+ -+ if (!skb_queue_empty(&tx.skbs)) -+ skb_queue_splice_tail(&tx.skbs, &txqi->frags); - } - - out: -@@ -1512,6 +1548,47 @@ out: - } - EXPORT_SYMBOL(ieee80211_tx_dequeue); - -+static bool ieee80211_queue_skb(struct ieee80211_local *local, -+ struct ieee80211_sub_if_data *sdata, -+ struct sta_info *sta, -+ struct sk_buff *skb) -+{ -+ struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb); -+ struct fq *fq = &local->fq; -+ struct ieee80211_vif *vif; -+ struct txq_info *txqi; -+ struct ieee80211_sta *pubsta; -+ -+ if (!local->ops->wake_tx_queue || -+ sdata->vif.type == NL80211_IFTYPE_MONITOR) -+ return false; -+ -+ if (sta && sta->uploaded) -+ pubsta = &sta->sta; -+ else -+ pubsta = NULL; -+ -+ if (sdata->vif.type == NL80211_IFTYPE_AP_VLAN) -+ sdata = container_of(sdata->bss, -+ struct ieee80211_sub_if_data, u.ap); -+ -+ vif = &sdata->vif; -+ txqi = ieee80211_get_txq(local, vif, pubsta, skb); -+ -+ if (!txqi) -+ return false; -+ -+ info->control.vif = vif; -+ -+ spin_lock_bh(&fq->lock); -+ ieee80211_txq_enqueue(local, txqi, skb); -+ spin_unlock_bh(&fq->lock); -+ -+ drv_wake_tx_queue(local, txqi); -+ -+ return true; -+} -+ - static bool ieee80211_tx_frags(struct ieee80211_local *local, - struct ieee80211_vif *vif, - struct ieee80211_sta *sta, -@@ -1519,9 +1596,7 @@ static bool ieee80211_tx_frags(struct ie - bool txpending) - { - struct ieee80211_tx_control control = {}; -- struct fq *fq = &local->fq; - struct sk_buff *skb, *tmp; -- struct txq_info *txqi; - unsigned long flags; - - skb_queue_walk_safe(skbs, skb, tmp) { -@@ -1536,21 +1611,6 @@ static bool ieee80211_tx_frags(struct ie - } - #endif - -- txqi = ieee80211_get_txq(local, vif, sta, skb); -- if (txqi) { -- info->control.vif = vif; -- -- __skb_unlink(skb, skbs); -- -- spin_lock_bh(&fq->lock); -- ieee80211_txq_enqueue(local, txqi, skb); -- spin_unlock_bh(&fq->lock); -- -- drv_wake_tx_queue(local, txqi); -- -- continue; -- } -- - spin_lock_irqsave(&local->queue_stop_reason_lock, flags); - if (local->queue_stop_reasons[q] || - (!txpending && !skb_queue_empty(&local->pending[q]))) { -@@ -1671,10 +1731,13 @@ static bool __ieee80211_tx(struct ieee80 - /* - * Invoke TX handlers, return 0 on success and non-zero if the - * frame was dropped or queued. -+ * -+ * The handlers are split into an early and late part. The latter is everything -+ * that can be sensitive to reordering, and will be deferred to after packets -+ * are dequeued from the intermediate queues (when they are enabled). - */ --static int invoke_tx_handlers(struct ieee80211_tx_data *tx) -+static int invoke_tx_handlers_early(struct ieee80211_tx_data *tx) - { -- struct ieee80211_tx_info *info = IEEE80211_SKB_CB(tx->skb); - ieee80211_tx_result res = TX_DROP; - - #define CALL_TXH(txh) \ -@@ -1688,16 +1751,42 @@ static int invoke_tx_handlers(struct iee - CALL_TXH(ieee80211_tx_h_check_assoc); - CALL_TXH(ieee80211_tx_h_ps_buf); - CALL_TXH(ieee80211_tx_h_check_control_port_protocol); -- CALL_TXH(ieee80211_tx_h_select_key); -+ - if (!ieee80211_hw_check(&tx->local->hw, HAS_RATE_CONTROL)) - CALL_TXH(ieee80211_tx_h_rate_ctrl); - -+ txh_done: -+ if (unlikely(res == TX_DROP)) { -+ I802_DEBUG_INC(tx->local->tx_handlers_drop); -+ if (tx->skb) -+ ieee80211_free_txskb(&tx->local->hw, tx->skb); -+ else -+ ieee80211_purge_tx_queue(&tx->local->hw, &tx->skbs); -+ return -1; -+ } else if (unlikely(res == TX_QUEUED)) { -+ I802_DEBUG_INC(tx->local->tx_handlers_queued); -+ return -1; -+ } -+ -+ return 0; -+} -+ -+/* -+ * Late handlers can be called while the sta lock is held. Handlers that can -+ * cause packets to be generated will cause deadlock! -+ */ -+static int invoke_tx_handlers_late(struct ieee80211_tx_data *tx) -+{ -+ struct ieee80211_tx_info *info = IEEE80211_SKB_CB(tx->skb); -+ ieee80211_tx_result res = TX_CONTINUE; -+ - if (unlikely(info->flags & IEEE80211_TX_INTFL_RETRANSMISSION)) { - __skb_queue_tail(&tx->skbs, tx->skb); - tx->skb = NULL; - goto txh_done; - } - -+ CALL_TXH(ieee80211_tx_h_select_key); - CALL_TXH(ieee80211_tx_h_michael_mic_add); - CALL_TXH(ieee80211_tx_h_sequence); - CALL_TXH(ieee80211_tx_h_fragment); -@@ -1724,6 +1813,15 @@ static int invoke_tx_handlers(struct iee - return 0; - } - -+static int invoke_tx_handlers(struct ieee80211_tx_data *tx) -+{ -+ int r = invoke_tx_handlers_early(tx); -+ if (r) -+ return r; -+ -+ return invoke_tx_handlers_late(tx); -+} -+ - bool ieee80211_tx_prepare_skb(struct ieee80211_hw *hw, - struct ieee80211_vif *vif, struct sk_buff *skb, - int band, struct ieee80211_sta **sta) -@@ -1798,7 +1896,13 @@ static bool ieee80211_tx(struct ieee8021 - info->hw_queue = - sdata->vif.hw_queue[skb_get_queue_mapping(skb)]; - -- if (!invoke_tx_handlers(&tx)) -+ if (invoke_tx_handlers_early(&tx)) -+ return false; -+ -+ if (ieee80211_queue_skb(local, sdata, tx.sta, tx.skb)) -+ return true; -+ -+ if (!invoke_tx_handlers_late(&tx)) - result = __ieee80211_tx(local, &tx.skbs, led_len, - tx.sta, txpending); - -@@ -3181,7 +3285,7 @@ out: - } - - static bool ieee80211_xmit_fast(struct ieee80211_sub_if_data *sdata, -- struct net_device *dev, struct sta_info *sta, -+ struct sta_info *sta, - struct ieee80211_fast_tx *fast_tx, - struct sk_buff *skb) - { -@@ -3192,9 +3296,9 @@ static bool ieee80211_xmit_fast(struct i - struct ethhdr eth; - struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb); - struct ieee80211_hdr *hdr = (void *)fast_tx->hdr; -- struct ieee80211_tx_data tx; -- ieee80211_tx_result r; - struct tid_ampdu_tx *tid_tx = NULL; -+ ieee80211_tx_result r; -+ struct ieee80211_tx_data tx; - u8 tid = IEEE80211_NUM_TIDS; - - /* control port protocol needs a lot of special handling */ -@@ -3232,8 +3336,6 @@ static bool ieee80211_xmit_fast(struct i - return true; - } - -- ieee80211_tx_stats(dev, skb->len + extra_head); -- - if ((hdr->frame_control & cpu_to_le16(IEEE80211_STYPE_QOS_DATA)) && - ieee80211_amsdu_aggregate(sdata, sta, fast_tx, skb)) - return true; -@@ -3262,24 +3364,7 @@ static bool ieee80211_xmit_fast(struct i - info->flags = IEEE80211_TX_CTL_FIRST_FRAGMENT | - IEEE80211_TX_CTL_DONTFRAG | - (tid_tx ? IEEE80211_TX_CTL_AMPDU : 0); -- -- if (hdr->frame_control & cpu_to_le16(IEEE80211_STYPE_QOS_DATA)) { -- *ieee80211_get_qos_ctl(hdr) = tid; -- if (!sta->sta.txq[0]) -- hdr->seq_ctrl = ieee80211_tx_next_seq(sta, tid); -- } else { -- info->flags |= IEEE80211_TX_CTL_ASSIGN_SEQ; -- hdr->seq_ctrl = cpu_to_le16(sdata->sequence_number); -- sdata->sequence_number += 0x10; -- } -- -- if (skb_shinfo(skb)->gso_size) -- sta->tx_stats.msdu[tid] += -- DIV_ROUND_UP(skb->len, skb_shinfo(skb)->gso_size); -- else -- sta->tx_stats.msdu[tid]++; -- -- info->hw_queue = sdata->vif.hw_queue[skb_get_queue_mapping(skb)]; -+ info->control.flags = IEEE80211_TX_CTRL_FAST_XMIT; - - __skb_queue_head_init(&tx.skbs); - -@@ -3305,22 +3390,71 @@ static bool ieee80211_xmit_fast(struct i - } - } - -+ if (ieee80211_queue_skb(local, sdata, sta, skb)) -+ return true; -+ -+ ieee80211_xmit_fast_finish(sdata, sta, fast_tx->pn_offs, -+ &fast_tx->key->conf, skb); -+ -+ if (sdata->vif.type == NL80211_IFTYPE_AP_VLAN) -+ sdata = container_of(sdata->bss, -+ struct ieee80211_sub_if_data, u.ap); -+ -+ __skb_queue_tail(&tx.skbs, skb); -+ ieee80211_tx_frags(local, &sdata->vif, &sta->sta, &tx.skbs, false); -+ -+ return true; -+} -+ -+/* -+ * Can be called while the sta lock is held. Anything that can cause packets to -+ * be generated will cause deadlock! -+ */ -+static bool ieee80211_xmit_fast_finish(struct ieee80211_sub_if_data *sdata, -+ struct sta_info *sta, u8 pn_offs, -+ struct ieee80211_key_conf *key_conf, -+ struct sk_buff *skb) -+{ -+ struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb); -+ struct ieee80211_hdr *hdr = (void *)skb->data; -+ u8 tid = IEEE80211_NUM_TIDS; -+ -+ ieee80211_tx_stats(skb->dev, skb->len); -+ -+ if (hdr->frame_control & cpu_to_le16(IEEE80211_STYPE_QOS_DATA)) { -+ tid = skb->priority & IEEE80211_QOS_CTL_TAG1D_MASK; -+ *ieee80211_get_qos_ctl(hdr) = tid; -+ hdr->seq_ctrl = ieee80211_tx_next_seq(sta, tid); -+ } else { -+ info->flags |= IEEE80211_TX_CTL_ASSIGN_SEQ; -+ hdr->seq_ctrl = cpu_to_le16(sdata->sequence_number); -+ sdata->sequence_number += 0x10; -+ } -+ -+ if (skb_shinfo(skb)->gso_size) -+ sta->tx_stats.msdu[tid] += -+ DIV_ROUND_UP(skb->len, skb_shinfo(skb)->gso_size); -+ else -+ sta->tx_stats.msdu[tid]++; -+ -+ info->hw_queue = sdata->vif.hw_queue[skb_get_queue_mapping(skb)]; -+ - /* statistics normally done by ieee80211_tx_h_stats (but that - * has to consider fragmentation, so is more complex) - */ - sta->tx_stats.bytes[skb_get_queue_mapping(skb)] += skb->len; - sta->tx_stats.packets[skb_get_queue_mapping(skb)]++; - -- if (fast_tx->pn_offs) { -+ if (pn_offs && (key_conf->flags & IEEE80211_KEY_FLAG_GENERATE_IV)) { - u64 pn; -- u8 *crypto_hdr = skb->data + fast_tx->pn_offs; -+ u8 *crypto_hdr = skb->data + pn_offs; - -- switch (fast_tx->key->conf.cipher) { -+ switch (key_conf->cipher) { - case WLAN_CIPHER_SUITE_CCMP: - case WLAN_CIPHER_SUITE_CCMP_256: - case WLAN_CIPHER_SUITE_GCMP: - case WLAN_CIPHER_SUITE_GCMP_256: -- pn = atomic64_inc_return(&fast_tx->key->conf.tx_pn); -+ pn = atomic64_inc_return(&key_conf->tx_pn); - crypto_hdr[0] = pn; - crypto_hdr[1] = pn >> 8; - crypto_hdr[4] = pn >> 16; -@@ -3331,12 +3465,6 @@ static bool ieee80211_xmit_fast(struct i - } - } - -- if (sdata->vif.type == NL80211_IFTYPE_AP_VLAN) -- sdata = container_of(sdata->bss, -- struct ieee80211_sub_if_data, u.ap); -- -- __skb_queue_tail(&tx.skbs, skb); -- ieee80211_tx_frags(local, &sdata->vif, &sta->sta, &tx.skbs, false); - return true; - } - -@@ -3364,7 +3492,7 @@ void __ieee80211_subif_start_xmit(struct - fast_tx = rcu_dereference(sta->fast_tx); - - if (fast_tx && -- ieee80211_xmit_fast(sdata, dev, sta, fast_tx, skb)) -+ ieee80211_xmit_fast(sdata, sta, fast_tx, skb)) - goto out; - } - ---- a/include/net/mac80211.h -+++ b/include/net/mac80211.h -@@ -715,6 +715,7 @@ enum mac80211_tx_info_flags { - * frame (PS-Poll or uAPSD). - * @IEEE80211_TX_CTRL_RATE_INJECT: This frame is injected with rate information - * @IEEE80211_TX_CTRL_AMSDU: This frame is an A-MSDU frame -+ * @IEEE80211_TX_CTRL_FAST_XMIT: This frame is going through the fast_xmit path - * - * These flags are used in tx_info->control.flags. - */ -@@ -723,6 +724,7 @@ enum mac80211_tx_control_flags { - IEEE80211_TX_CTRL_PS_RESPONSE = BIT(1), - IEEE80211_TX_CTRL_RATE_INJECT = BIT(2), - IEEE80211_TX_CTRL_AMSDU = BIT(3), -+ IEEE80211_TX_CTRL_FAST_XMIT = BIT(4), - }; - - /* ---- a/net/mac80211/ieee80211_i.h -+++ b/net/mac80211/ieee80211_i.h -@@ -814,11 +814,13 @@ enum txq_info_flags { - * @def_flow: used as a fallback flow when a packet destined to @tin hashes to - * a fq_flow which is already owned by a different tin - * @def_cvars: codel vars for @def_flow -+ * @frags: used to keep fragments created after dequeue - */ - struct txq_info { - struct fq_tin tin; - struct fq_flow def_flow; - struct codel_vars def_cvars; -+ struct sk_buff_head frags; - unsigned long flags; - - /* keep last! */ diff --git a/package/kernel/mac80211/patches/406-ath_relax_default_regd.patch b/package/kernel/mac80211/patches/406-ath_relax_default_regd.patch index 6336f1f375..0598fa34f1 100644 --- a/package/kernel/mac80211/patches/406-ath_relax_default_regd.patch +++ b/package/kernel/mac80211/patches/406-ath_relax_default_regd.patch @@ -1,6 +1,6 @@ --- a/drivers/net/wireless/ath/regd.c +++ b/drivers/net/wireless/ath/regd.c -@@ -114,10 +114,22 @@ static const struct ieee80211_regdomain +@@ -114,11 +114,24 @@ static const struct ieee80211_regdomain ) }; @@ -16,14 +16,16 @@ + static bool dynamic_country_user_possible(struct ath_regulatory *reg) { - if (config_enabled(CPTCFG_ATH_REG_DYNAMIC_USER_CERT_TESTING)) + if (IS_ENABLED(CPTCFG_ATH_REG_DYNAMIC_USER_CERT_TESTING)) return true; + + if (is_default_regd(reg)) + return true; - ++ switch (reg->country_code) { case CTRY_UNITED_STATES: -@@ -202,11 +214,6 @@ static inline bool is_wwr_sku(u16 regd) + case CTRY_JAPAN1: +@@ -202,11 +215,6 @@ static inline bool is_wwr_sku(u16 regd) (regd == WORLD)); } @@ -35,7 +37,7 @@ bool ath_is_world_regd(struct ath_regulatory *reg) { return is_wwr_sku(ath_regd_get_eepromRD(reg)); -@@ -650,6 +657,9 @@ ath_regd_init_wiphy(struct ath_regulator +@@ -650,6 +658,9 @@ ath_regd_init_wiphy(struct ath_regulator return 0; #endif diff --git a/package/kernel/mac80211/patches/410-ath9k_allow_adhoc_and_ap.patch b/package/kernel/mac80211/patches/410-ath9k_allow_adhoc_and_ap.patch index f2f52f93af..f3f5e1d779 100644 --- a/package/kernel/mac80211/patches/410-ath9k_allow_adhoc_and_ap.patch +++ b/package/kernel/mac80211/patches/410-ath9k_allow_adhoc_and_ap.patch @@ -1,6 +1,6 @@ --- a/drivers/net/wireless/ath/ath9k/init.c +++ b/drivers/net/wireless/ath/ath9k/init.c -@@ -727,6 +727,7 @@ static const struct ieee80211_iface_limi +@@ -731,6 +731,7 @@ static const struct ieee80211_iface_limi BIT(NL80211_IFTYPE_AP) }, { .max = 1, .types = BIT(NL80211_IFTYPE_P2P_CLIENT) | BIT(NL80211_IFTYPE_P2P_GO) }, diff --git a/package/kernel/mac80211/patches/501-ath9k_ahb_init.patch b/package/kernel/mac80211/patches/501-ath9k_ahb_init.patch index 1825d77b7f..c42bba6b0d 100644 --- a/package/kernel/mac80211/patches/501-ath9k_ahb_init.patch +++ b/package/kernel/mac80211/patches/501-ath9k_ahb_init.patch @@ -1,6 +1,6 @@ --- a/drivers/net/wireless/ath/ath9k/init.c +++ b/drivers/net/wireless/ath/ath9k/init.c -@@ -1030,23 +1030,23 @@ static int __init ath9k_init(void) +@@ -1034,23 +1034,23 @@ static int __init ath9k_init(void) { int error; diff --git a/package/kernel/mac80211/patches/513-ath9k_add_pci_ids.patch b/package/kernel/mac80211/patches/513-ath9k_add_pci_ids.patch index 167eeff2d2..78b22e71a9 100644 --- a/package/kernel/mac80211/patches/513-ath9k_add_pci_ids.patch +++ b/package/kernel/mac80211/patches/513-ath9k_add_pci_ids.patch @@ -1,6 +1,6 @@ --- a/drivers/net/wireless/ath/ath9k/hw.c +++ b/drivers/net/wireless/ath/ath9k/hw.c -@@ -651,6 +651,7 @@ int ath9k_hw_init(struct ath_hw *ah) +@@ -647,6 +647,7 @@ int ath9k_hw_init(struct ath_hw *ah) /* These are all the AR5008/AR9001/AR9002/AR9003 hardware family of chipsets */ switch (ah->hw_version.devid) { @@ -20,7 +20,7 @@ #define AR9160_DEVID_PCI 0x0027 --- a/drivers/net/wireless/ath/ath9k/pci.c +++ b/drivers/net/wireless/ath/ath9k/pci.c -@@ -761,6 +761,7 @@ static const struct pci_device_id ath_pc +@@ -760,6 +760,7 @@ static const struct pci_device_id ath_pc .driver_data = ATH9K_PCI_BT_ANT_DIV }, #endif diff --git a/package/kernel/mac80211/patches/522-mac80211_configure_antenna_gain.patch b/package/kernel/mac80211/patches/522-mac80211_configure_antenna_gain.patch index aba065ee8e..6e4962b09d 100644 --- a/package/kernel/mac80211/patches/522-mac80211_configure_antenna_gain.patch +++ b/package/kernel/mac80211/patches/522-mac80211_configure_antenna_gain.patch @@ -1,6 +1,6 @@ --- a/include/net/cfg80211.h +++ b/include/net/cfg80211.h -@@ -2410,6 +2410,7 @@ struct cfg80211_qos_map { +@@ -2562,6 +2562,7 @@ struct cfg80211_nan_func { * (as advertised by the nl80211 feature flag.) * @get_tx_power: store the current TX power into the dbm variable; * return 0 if successful @@ -8,7 +8,7 @@ * * @set_wds_peer: set the WDS peer for a WDS interface * -@@ -2671,6 +2672,7 @@ struct cfg80211_ops { +@@ -2836,6 +2837,7 @@ struct cfg80211_ops { enum nl80211_tx_power_setting type, int mbm); int (*get_tx_power)(struct wiphy *wiphy, struct wireless_dev *wdev, int *dbm); @@ -36,9 +36,9 @@ u8 ps_dtim_period; --- a/include/uapi/linux/nl80211.h +++ b/include/uapi/linux/nl80211.h -@@ -1829,6 +1829,9 @@ enum nl80211_commands { - * %NL80211_ATTR_EXT_CAPA_MASK, to specify the extended capabilities per - * interface type. +@@ -1937,6 +1937,9 @@ enum nl80211_commands { + * @NL80211_ATTR_NAN_MATCH: used to report a match. This is a nested attribute. + * See &enum nl80211_nan_match_attributes. * + * @NL80211_ATTR_WIPHY_ANTENNA_GAIN: Configured antenna gain. Used to reduce + * transmit power to stay within regulatory limits. u32, dBi. @@ -46,9 +46,9 @@ * @NUM_NL80211_ATTR: total number of nl80211_attrs available * @NL80211_ATTR_MAX: highest attribute number currently defined * @__NL80211_ATTR_AFTER_LAST: internal use -@@ -2213,6 +2216,8 @@ enum nl80211_attrs { - - NL80211_ATTR_IFTYPE_EXT_CAPA, +@@ -2336,6 +2339,8 @@ enum nl80211_attrs { + NL80211_ATTR_NAN_FUNC, + NL80211_ATTR_NAN_MATCH, + NL80211_ATTR_WIPHY_ANTENNA_GAIN, + @@ -57,7 +57,7 @@ __NL80211_ATTR_AFTER_LAST, --- a/net/mac80211/cfg.c +++ b/net/mac80211/cfg.c -@@ -2238,6 +2238,19 @@ static int ieee80211_get_tx_power(struct +@@ -2406,6 +2406,19 @@ static int ieee80211_get_tx_power(struct return 0; } @@ -77,7 +77,7 @@ static int ieee80211_set_wds_peer(struct wiphy *wiphy, struct net_device *dev, const u8 *addr) { -@@ -3412,6 +3425,7 @@ const struct cfg80211_ops mac80211_confi +@@ -3633,6 +3646,7 @@ const struct cfg80211_ops mac80211_confi .set_wiphy_params = ieee80211_set_wiphy_params, .set_tx_power = ieee80211_set_tx_power, .get_tx_power = ieee80211_get_tx_power, @@ -87,7 +87,7 @@ CFG80211_TESTMODE_CMD(ieee80211_testmode_cmd) --- a/net/mac80211/ieee80211_i.h +++ b/net/mac80211/ieee80211_i.h -@@ -1340,6 +1340,7 @@ struct ieee80211_local { +@@ -1363,6 +1363,7 @@ struct ieee80211_local { int dynamic_ps_forced_timeout; int user_power_level; /* in dBm, for all interfaces */ @@ -129,15 +129,15 @@ local->user_power_level = IEEE80211_UNSET_POWER_LEVEL; --- a/net/wireless/nl80211.c +++ b/net/wireless/nl80211.c -@@ -407,6 +407,7 @@ static const struct nla_policy nl80211_p - [NL80211_ATTR_PBSS] = { .type = NLA_FLAG }, - [NL80211_ATTR_BSS_SELECT] = { .type = NLA_NESTED }, - [NL80211_ATTR_STA_SUPPORT_P2P_PS] = { .type = NLA_U8 }, +@@ -416,6 +416,7 @@ static const struct nla_policy nl80211_p + [NL80211_ATTR_NAN_MASTER_PREF] = { .type = NLA_U8 }, + [NL80211_ATTR_NAN_DUAL] = { .type = NLA_U8 }, + [NL80211_ATTR_NAN_FUNC] = { .type = NLA_NESTED }, + [NL80211_ATTR_WIPHY_ANTENNA_GAIN] = { .type = NLA_U32 }, }; /* policy for the key attributes */ -@@ -2294,6 +2295,20 @@ static int nl80211_set_wiphy(struct sk_b +@@ -2353,6 +2354,20 @@ static int nl80211_set_wiphy(struct sk_b if (result) return result; } diff --git a/package/kernel/mac80211/patches/530-ath9k_extra_leds.patch b/package/kernel/mac80211/patches/530-ath9k_extra_leds.patch index 69147f6bba..46f1dea15b 100644 --- a/package/kernel/mac80211/patches/530-ath9k_extra_leds.patch +++ b/package/kernel/mac80211/patches/530-ath9k_extra_leds.patch @@ -38,16 +38,7 @@ #ifdef CPTCFG_ATH9K_DEBUGFS --- a/drivers/net/wireless/ath/ath9k/gpio.c +++ b/drivers/net/wireless/ath/ath9k/gpio.c -@@ -22,7 +22,7 @@ - - #ifdef CPTCFG_MAC80211_LEDS - --void ath_fill_led_pin(struct ath_softc *sc) -+static void ath_fill_led_pin(struct ath_softc *sc) - { - struct ath_hw *ah = sc->sc_ah; - -@@ -39,61 +39,111 @@ void ath_fill_led_pin(struct ath_softc * +@@ -39,61 +39,111 @@ static void ath_fill_led_pin(struct ath_ else ah->led_pin = ATH_LED_PIN_DEF; } @@ -190,7 +181,7 @@ --- a/drivers/net/wireless/ath/ath9k/init.c +++ b/drivers/net/wireless/ath/ath9k/init.c -@@ -942,7 +942,7 @@ int ath9k_init_device(u16 devid, struct +@@ -946,7 +946,7 @@ int ath9k_init_device(u16 devid, struct #ifdef CPTCFG_MAC80211_LEDS /* must be initialized before ieee80211_register_hw */ diff --git a/package/kernel/mac80211/patches/531-ath9k_extra_platform_leds.patch b/package/kernel/mac80211/patches/531-ath9k_extra_platform_leds.patch index f656697a07..35d8e8bd42 100644 --- a/package/kernel/mac80211/patches/531-ath9k_extra_platform_leds.patch +++ b/package/kernel/mac80211/patches/531-ath9k_extra_platform_leds.patch @@ -1,6 +1,6 @@ --- a/include/linux/ath9k_platform.h +++ b/include/linux/ath9k_platform.h -@@ -45,6 +45,9 @@ struct ath9k_platform_data { +@@ -46,6 +46,9 @@ struct ath9k_platform_data { int (*external_reset)(void); bool use_eeprom; diff --git a/package/kernel/mac80211/patches/532-ath9k_get_led_polarity_from_platform_data.patch b/package/kernel/mac80211/patches/532-ath9k_get_led_polarity_from_platform_data.patch deleted file mode 100644 index 50d8a7abae..0000000000 --- a/package/kernel/mac80211/patches/532-ath9k_get_led_polarity_from_platform_data.patch +++ /dev/null @@ -1,20 +0,0 @@ ---- a/include/linux/ath9k_platform.h -+++ b/include/linux/ath9k_platform.h -@@ -40,6 +40,7 @@ struct ath9k_platform_data { - bool tx_gain_buffalo; - bool disable_2ghz; - bool disable_5ghz; -+ bool led_active_high; - - int (*get_mac_revision)(void); - int (*external_reset)(void); ---- a/drivers/net/wireless/ath/ath9k/init.c -+++ b/drivers/net/wireless/ath/ath9k/init.c -@@ -580,6 +580,7 @@ static int ath9k_init_softc(u16 devid, s - ah->external_reset = pdata->external_reset; - ah->disable_2ghz = pdata->disable_2ghz; - ah->disable_5ghz = pdata->disable_5ghz; -+ ah->config.led_active_high = pdata->led_active_high; - if (!pdata->endian_check) - ah->ah_flags |= AH_NO_EEP_SWAP; - } diff --git a/package/kernel/mac80211/patches/542-ath9k_debugfs_diag.patch b/package/kernel/mac80211/patches/542-ath9k_debugfs_diag.patch index 6edef09754..a820e16c88 100644 --- a/package/kernel/mac80211/patches/542-ath9k_debugfs_diag.patch +++ b/package/kernel/mac80211/patches/542-ath9k_debugfs_diag.patch @@ -94,7 +94,7 @@ struct ath_gen_timer *ath_gen_timer_alloc(struct ath_hw *ah, --- a/drivers/net/wireless/ath/ath9k/hw.c +++ b/drivers/net/wireless/ath/ath9k/hw.c -@@ -1841,6 +1841,20 @@ u32 ath9k_hw_get_tsf_offset(struct times +@@ -1837,6 +1837,20 @@ u32 ath9k_hw_get_tsf_offset(struct times } EXPORT_SYMBOL(ath9k_hw_get_tsf_offset); @@ -115,7 +115,7 @@ int ath9k_hw_reset(struct ath_hw *ah, struct ath9k_channel *chan, struct ath9k_hw_cal_data *caldata, bool fastcc) { -@@ -2049,6 +2063,7 @@ int ath9k_hw_reset(struct ath_hw *ah, st +@@ -2045,6 +2059,7 @@ int ath9k_hw_reset(struct ath_hw *ah, st ar9003_hw_disable_phy_restart(ah); ath9k_hw_apply_gpio_override(ah); diff --git a/package/kernel/mac80211/patches/543-ath9k_entropy_from_adc.patch b/package/kernel/mac80211/patches/543-ath9k_entropy_from_adc.patch index 656ed439b9..a5977b7413 100644 --- a/package/kernel/mac80211/patches/543-ath9k_entropy_from_adc.patch +++ b/package/kernel/mac80211/patches/543-ath9k_entropy_from_adc.patch @@ -18,7 +18,7 @@ void (*spectral_scan_trigger)(struct ath_hw *ah); --- a/drivers/net/wireless/ath/ath9k/ar9003_phy.c +++ b/drivers/net/wireless/ath/ath9k/ar9003_phy.c -@@ -1945,6 +1945,26 @@ void ar9003_hw_init_rate_txpower(struct +@@ -1947,6 +1947,26 @@ void ar9003_hw_init_rate_txpower(struct } } @@ -45,7 +45,7 @@ void ar9003_hw_attach_phy_ops(struct ath_hw *ah) { struct ath_hw_private_ops *priv_ops = ath9k_hw_private_ops(ah); -@@ -1981,6 +2001,7 @@ void ar9003_hw_attach_phy_ops(struct ath +@@ -1983,6 +2003,7 @@ void ar9003_hw_attach_phy_ops(struct ath priv_ops->set_radar_params = ar9003_hw_set_radar_params; priv_ops->fast_chan_change = ar9003_hw_fast_chan_change; @@ -55,7 +55,7 @@ ops->spectral_scan_config = ar9003_hw_spectral_scan_config; --- a/drivers/net/wireless/ath/ath9k/init.c +++ b/drivers/net/wireless/ath/ath9k/init.c -@@ -716,7 +716,8 @@ static void ath9k_init_txpower_limits(st +@@ -719,7 +719,8 @@ static void ath9k_init_txpower_limits(st if (ah->caps.hw_caps & ATH9K_HW_CAP_5GHZ) ath9k_init_band_txpower(sc, NL80211_BAND_5GHZ); @@ -65,7 +65,7 @@ } static const struct ieee80211_iface_limit if_limits[] = { -@@ -903,6 +904,18 @@ static void ath9k_set_hw_capab(struct at +@@ -906,6 +907,18 @@ static void ath9k_set_hw_capab(struct at SET_IEEE80211_PERM_ADDR(hw, common->macaddr); } @@ -84,7 +84,7 @@ int ath9k_init_device(u16 devid, struct ath_softc *sc, const struct ath_bus_ops *bus_ops) { -@@ -948,6 +961,8 @@ int ath9k_init_device(u16 devid, struct +@@ -951,6 +964,8 @@ int ath9k_init_device(u16 devid, struct ARRAY_SIZE(ath9k_tpt_blink)); #endif @@ -110,7 +110,7 @@ static inline void ath9k_hw_set_bt_ant_diversity(struct ath_hw *ah, bool enable) --- a/drivers/net/wireless/ath/ath9k/ar5008_phy.c +++ b/drivers/net/wireless/ath/ath9k/ar5008_phy.c -@@ -1325,9 +1325,30 @@ void ar5008_hw_init_rate_txpower(struct +@@ -1322,9 +1322,30 @@ void ar5008_hw_init_rate_txpower(struct } } @@ -141,7 +141,7 @@ static const u32 ar5416_cca_regs[6] = { AR_PHY_CCA, AR_PHY_CH1_CCA, -@@ -1342,6 +1363,8 @@ int ar5008_hw_attach_phy_ops(struct ath_ +@@ -1339,6 +1360,8 @@ int ar5008_hw_attach_phy_ops(struct ath_ if (ret) return ret; diff --git a/package/kernel/mac80211/patches/544-ath9k-ar933x-usb-hang-workaround.patch b/package/kernel/mac80211/patches/544-ath9k-ar933x-usb-hang-workaround.patch index b9c962e1b5..bb4c121af8 100644 --- a/package/kernel/mac80211/patches/544-ath9k-ar933x-usb-hang-workaround.patch +++ b/package/kernel/mac80211/patches/544-ath9k-ar933x-usb-hang-workaround.patch @@ -20,7 +20,7 @@ /******************/ /* Chip Revisions */ /******************/ -@@ -1417,6 +1430,9 @@ static bool ath9k_hw_set_reset(struct at +@@ -1413,6 +1426,9 @@ static bool ath9k_hw_set_reset(struct at udelay(50); } @@ -30,7 +30,7 @@ return true; } -@@ -1516,6 +1532,9 @@ static bool ath9k_hw_chip_reset(struct a +@@ -1512,6 +1528,9 @@ static bool ath9k_hw_chip_reset(struct a ar9003_hw_internal_regulator_apply(ah); ath9k_hw_init_pll(ah, chan); @@ -40,7 +40,7 @@ return true; } -@@ -1819,8 +1838,14 @@ static int ath9k_hw_do_fastcc(struct ath +@@ -1815,8 +1834,14 @@ static int ath9k_hw_do_fastcc(struct ath if (AR_SREV_9271(ah)) ar9002_hw_load_ani_reg(ah, chan); @@ -55,7 +55,7 @@ return -EINVAL; } -@@ -2074,6 +2099,9 @@ int ath9k_hw_reset(struct ath_hw *ah, st +@@ -2070,6 +2095,9 @@ int ath9k_hw_reset(struct ath_hw *ah, st ath9k_hw_set_radar_params(ah); } diff --git a/package/kernel/mac80211/patches/545-ath9k_ani_ws_detect.patch b/package/kernel/mac80211/patches/545-ath9k_ani_ws_detect.patch index b639f972d8..22a2308a0b 100644 --- a/package/kernel/mac80211/patches/545-ath9k_ani_ws_detect.patch +++ b/package/kernel/mac80211/patches/545-ath9k_ani_ws_detect.patch @@ -1,6 +1,6 @@ --- a/drivers/net/wireless/ath/ath9k/ar5008_phy.c +++ b/drivers/net/wireless/ath/ath9k/ar5008_phy.c -@@ -954,55 +954,6 @@ static bool ar5008_hw_ani_control_new(st +@@ -951,55 +951,6 @@ static bool ar5008_hw_ani_control_new(st * on == 0 means more noise imm */ u32 on = param ? 1 : 0; diff --git a/package/kernel/mac80211/patches/650-0001-rtl8xxxu-Add-bit-definitions-for-REG_USB_SPECIAL_OPT.patch b/package/kernel/mac80211/patches/650-0001-rtl8xxxu-Add-bit-definitions-for-REG_USB_SPECIAL_OPT.patch deleted file mode 100644 index 0a0caecbfd..0000000000 --- a/package/kernel/mac80211/patches/650-0001-rtl8xxxu-Add-bit-definitions-for-REG_USB_SPECIAL_OPT.patch +++ /dev/null @@ -1,27 +0,0 @@ -From e4ac0a8ac8ba3cbcafcc3c6142c022245439d057 Mon Sep 17 00:00:00 2001 -From: Jes Sorensen -Date: Thu, 9 Jun 2016 14:38:47 -0400 -Subject: [PATCH] rtl8xxxu: Add bit definitions for REG_USB_SPECIAL_OPTION - -Documentation for enabling USB aggregation and whether to select -interrupt or bulk delivery of interrupt events. - -Signed-off-by: Jes Sorensen -Signed-off-by: Kalle Valo ---- - drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_regs.h | 4 ++++ - 1 file changed, 4 insertions(+) - ---- a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_regs.h -+++ b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_regs.h -@@ -1052,6 +1052,10 @@ - #define USB_HIMR_ROK BIT(0) /* Receive DMA OK Interrupt */ - - #define REG_USB_SPECIAL_OPTION 0xfe55 -+#define USB_SPEC_USB_AGG_ENABLE BIT(3) /* Enable USB aggregation */ -+#define USB_SPEC_INT_BULK_SELECT BIT(4) /* Use interrupt endpoint to -+ deliver interrupt packet. -+ 0: Use int, 1: use bulk */ - #define REG_USB_HRPWM 0xfe58 - #define REG_USB_DMA_AGG_TO 0xfe5b - #define REG_USB_AGG_TO 0xfe5c diff --git a/package/kernel/mac80211/patches/650-0001-rtl8xxxu-Fix-memory-leak-in-handling-rxdesc16-packet.patch b/package/kernel/mac80211/patches/650-0001-rtl8xxxu-Fix-memory-leak-in-handling-rxdesc16-packet.patch new file mode 100644 index 0000000000..31604b6264 --- /dev/null +++ b/package/kernel/mac80211/patches/650-0001-rtl8xxxu-Fix-memory-leak-in-handling-rxdesc16-packet.patch @@ -0,0 +1,34 @@ +From 51be39337a10a8bf9d8ec65419e78b76bf5adf60 Mon Sep 17 00:00:00 2001 +From: Jes Sorensen +Date: Wed, 28 Sep 2016 14:48:51 -0400 +Subject: [PATCH] rtl8xxxu: Fix memory leak in handling rxdesc16 packets + +A device running without RX package aggregation could return more data +in the USB packet than the actual network packet. In this case the +could would clone the skb but then determine that that there was no +packet to handle and exit without freeing the cloned skb first. + +This has so far only been observed with 8188eu devices, but could +affect others. + +Signed-off-by: Jes Sorensen +--- + drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c | 7 ++++++- + 1 file changed, 6 insertions(+), 1 deletion(-) + +--- a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c ++++ b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c +@@ -5197,7 +5197,12 @@ int rtl8xxxu_parse_rxdesc16(struct rtl8x + pkt_offset = roundup(pkt_len + drvinfo_sz + desc_shift + + sizeof(struct rtl8xxxu_rxdesc16), 128); + +- if (pkt_cnt > 1) ++ /* ++ * Only clone the skb if there's enough data at the end to ++ * at least cover the rx descriptor ++ */ ++ if (pkt_cnt > 1 && ++ urb_len > (pkt_offset + sizeof(struct rtl8xxxu_rxdesc16))) + next_skb = skb_clone(skb, GFP_ATOMIC); + + rx_status = IEEE80211_SKB_RXCB(skb); diff --git a/package/kernel/mac80211/patches/650-0002-rtl8xxxu-Add-additional-documentation-for-RX-DMA-reg.patch b/package/kernel/mac80211/patches/650-0002-rtl8xxxu-Add-additional-documentation-for-RX-DMA-reg.patch deleted file mode 100644 index aa9334a38b..0000000000 --- a/package/kernel/mac80211/patches/650-0002-rtl8xxxu-Add-additional-documentation-for-RX-DMA-reg.patch +++ /dev/null @@ -1,39 +0,0 @@ -From 08eca32ebc891e9501802522dc4bff5136edde86 Mon Sep 17 00:00:00 2001 -From: Jes Sorensen -Date: Thu, 9 Jun 2016 14:38:48 -0400 -Subject: [PATCH] rtl8xxxu: Add additional documentation for RX DMA registers - -This also renames REG_USB_AGG_{TO,TH} to REG_USB_AGG_{TIMEOUT,THRESH} - -Signed-off-by: Jes Sorensen -Signed-off-by: Kalle Valo ---- - drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_regs.h | 10 +++++++--- - 1 file changed, 7 insertions(+), 3 deletions(-) - ---- a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_regs.h -+++ b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_regs.h -@@ -405,7 +405,11 @@ - #define REG_DWBCN1_CTRL_8723B 0x0228 - - /* 0x0280 ~ 0x02FF RXDMA Configuration */ --#define REG_RXDMA_AGG_PG_TH 0x0280 -+#define REG_RXDMA_AGG_PG_TH 0x0280 /* 0-7 : USB DMA size bits -+ 8-14: USB DMA timeout -+ 15 : Aggregation enable -+ Only seems to be used -+ on 8723bu/8192eu */ - #define RXDMA_USB_AGG_ENABLE BIT(31) - #define REG_RXPKT_NUM 0x0284 - #define RXPKT_NUM_RXDMA_IDLE BIT(17) -@@ -1058,8 +1062,8 @@ - 0: Use int, 1: use bulk */ - #define REG_USB_HRPWM 0xfe58 - #define REG_USB_DMA_AGG_TO 0xfe5b --#define REG_USB_AGG_TO 0xfe5c --#define REG_USB_AGG_TH 0xfe5d -+#define REG_USB_AGG_TIMEOUT 0xfe5c -+#define REG_USB_AGG_THRESH 0xfe5d - - #define REG_NORMAL_SIE_VID 0xfe60 /* 0xfe60 - 0xfe61 */ - #define REG_NORMAL_SIE_PID 0xfe62 /* 0xfe62 - 0xfe63 */ diff --git a/package/kernel/mac80211/patches/650-0002-rtl8xxxu-Fix-big-endian-problem-reporting-mactime.patch b/package/kernel/mac80211/patches/650-0002-rtl8xxxu-Fix-big-endian-problem-reporting-mactime.patch new file mode 100644 index 0000000000..7531d510b8 --- /dev/null +++ b/package/kernel/mac80211/patches/650-0002-rtl8xxxu-Fix-big-endian-problem-reporting-mactime.patch @@ -0,0 +1,54 @@ +From 8d829444c8a860ba69ca8c51b9b609e29eaa4596 Mon Sep 17 00:00:00 2001 +From: Jes Sorensen +Date: Wed, 28 Sep 2016 15:43:42 -0400 +Subject: [PATCH] rtl8xxxu: Fix big-endian problem reporting mactime + +The full RX descriptor is converted so converting tsfl again would +return it to it's original endian value. + +Signed-off-by: Jes Sorensen +--- + drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu.h | 4 ++-- + drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c | 4 ++-- + 2 files changed, 4 insertions(+), 4 deletions(-) + +--- a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu.h ++++ b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu.h +@@ -238,7 +238,7 @@ struct rtl8xxxu_rxdesc16 { + u32 pattern1match:1; + u32 pattern0match:1; + #endif +- __le32 tsfl; ++ u32 tsfl; + #if 0 + u32 bassn:12; + u32 bavld:1; +@@ -368,7 +368,7 @@ struct rtl8xxxu_rxdesc24 { + u32 ldcp:1; + u32 splcp:1; + #endif +- __le32 tsfl; ++ u32 tsfl; + }; + + struct rtl8xxxu_txdesc32 { +--- a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c ++++ b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c +@@ -5220,7 +5220,7 @@ int rtl8xxxu_parse_rxdesc16(struct rtl8x + rtl8xxxu_rx_parse_phystats(priv, rx_status, phy_stats, + rx_desc->rxmcs); + +- rx_status->mactime = le32_to_cpu(rx_desc->tsfl); ++ rx_status->mactime = rx_desc->tsfl; + rx_status->flag |= RX_FLAG_MACTIME_START; + + if (!rx_desc->swdec) +@@ -5290,7 +5290,7 @@ int rtl8xxxu_parse_rxdesc24(struct rtl8x + rtl8xxxu_rx_parse_phystats(priv, rx_status, phy_stats, + rx_desc->rxmcs); + +- rx_status->mactime = le32_to_cpu(rx_desc->tsfl); ++ rx_status->mactime = rx_desc->tsfl; + rx_status->flag |= RX_FLAG_MACTIME_START; + + if (!rx_desc->swdec) diff --git a/package/kernel/mac80211/patches/650-0003-rtl8xxxu-tuse-ph-to-dump-buffers.patch b/package/kernel/mac80211/patches/650-0003-rtl8xxxu-tuse-ph-to-dump-buffers.patch deleted file mode 100644 index ee0e0d6756..0000000000 --- a/package/kernel/mac80211/patches/650-0003-rtl8xxxu-tuse-ph-to-dump-buffers.patch +++ /dev/null @@ -1,71 +0,0 @@ -From 2b9c9f52dc03b298c845def62ea890a2d77e9f21 Mon Sep 17 00:00:00 2001 -From: Andy Shevchenko -Date: Thu, 9 Jun 2016 14:38:49 -0400 -Subject: [PATCH] rtl8xxxu: tuse %*ph to dump buffers - -Use %*ph specifier to dump small buffers in hex format instead of doing this -byte-by-byte. - -Signed-off-by: Andy Shevchenko -Signed-off-by: Jes Sorensen -Signed-off-by: Kalle Valo ---- - drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_8192c.c | 9 ++------- - drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_8192e.c | 9 ++------- - drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_8723b.c | 9 ++------- - 3 files changed, 6 insertions(+), 21 deletions(-) - ---- a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_8192c.c -+++ b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_8192c.c -@@ -413,13 +413,8 @@ static int rtl8192cu_parse_efuse(struct - dev_info(&priv->udev->dev, - "%s: dumping efuse (0x%02zx bytes):\n", - __func__, sizeof(struct rtl8192cu_efuse)); -- for (i = 0; i < sizeof(struct rtl8192cu_efuse); i += 8) { -- dev_info(&priv->udev->dev, "%02x: " -- "%02x %02x %02x %02x %02x %02x %02x %02x\n", i, -- raw[i], raw[i + 1], raw[i + 2], -- raw[i + 3], raw[i + 4], raw[i + 5], -- raw[i + 6], raw[i + 7]); -- } -+ for (i = 0; i < sizeof(struct rtl8192cu_efuse); i += 8) -+ dev_info(&priv->udev->dev, "%02x: %8ph\n", i, &raw[i]); - } - return 0; - } ---- a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_8192e.c -+++ b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_8192e.c -@@ -622,13 +622,8 @@ static int rtl8192eu_parse_efuse(struct - dev_info(&priv->udev->dev, - "%s: dumping efuse (0x%02zx bytes):\n", - __func__, sizeof(struct rtl8192eu_efuse)); -- for (i = 0; i < sizeof(struct rtl8192eu_efuse); i += 8) { -- dev_info(&priv->udev->dev, "%02x: " -- "%02x %02x %02x %02x %02x %02x %02x %02x\n", i, -- raw[i], raw[i + 1], raw[i + 2], -- raw[i + 3], raw[i + 4], raw[i + 5], -- raw[i + 6], raw[i + 7]); -- } -+ for (i = 0; i < sizeof(struct rtl8192eu_efuse); i += 8) -+ dev_info(&priv->udev->dev, "%02x: %8ph\n", i, &raw[i]); - } - return 0; - } ---- a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_8723b.c -+++ b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_8723b.c -@@ -466,13 +466,8 @@ static int rtl8723bu_parse_efuse(struct - dev_info(&priv->udev->dev, - "%s: dumping efuse (0x%02zx bytes):\n", - __func__, sizeof(struct rtl8723bu_efuse)); -- for (i = 0; i < sizeof(struct rtl8723bu_efuse); i += 8) { -- dev_info(&priv->udev->dev, "%02x: " -- "%02x %02x %02x %02x %02x %02x %02x %02x\n", i, -- raw[i], raw[i + 1], raw[i + 2], -- raw[i + 3], raw[i + 4], raw[i + 5], -- raw[i + 6], raw[i + 7]); -- } -+ for (i = 0; i < sizeof(struct rtl8723bu_efuse); i += 8) -+ dev_info(&priv->udev->dev, "%02x: %8ph\n", i, &raw[i]); - } - - return 0; diff --git a/package/kernel/mac80211/patches/651-0001-rtl8xxxu-Fix-rtl8723bu-driver-reload-issue.patch b/package/kernel/mac80211/patches/651-0001-rtl8xxxu-Fix-rtl8723bu-driver-reload-issue.patch new file mode 100644 index 0000000000..600317c493 --- /dev/null +++ b/package/kernel/mac80211/patches/651-0001-rtl8xxxu-Fix-rtl8723bu-driver-reload-issue.patch @@ -0,0 +1,30 @@ +From ee286f4b57536ec4a7c1b52d0a3476f8e52594d5 Mon Sep 17 00:00:00 2001 +From: Jes Sorensen +Date: Fri, 30 Sep 2016 16:39:39 -0400 +Subject: [PATCH] rtl8xxxu: Fix rtl8723bu driver reload issue + +The generic disable_rf() function clears bits 22 and 23 in +REG_RX_WAIT_CCA, however we did not re-enable them again in +rtl8723b_enable_rf() + +This resolves the problem for me with 8723bu devices not working again +after reloading the driver. + +Signed-off-by: Jes Sorensen +--- + drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_8723b.c | 4 ++++ + 1 file changed, 4 insertions(+) + +--- a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_8723b.c ++++ b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_8723b.c +@@ -1498,6 +1498,10 @@ static void rtl8723b_enable_rf(struct rt + u32 val32; + u8 val8; + ++ val32 = rtl8xxxu_read32(priv, REG_RX_WAIT_CCA); ++ val32 |= (BIT(22) | BIT(23)); ++ rtl8xxxu_write32(priv, REG_RX_WAIT_CCA, val32); ++ + /* + * No indication anywhere as to what 0x0790 does. The 2 antenna + * vendor code preserves bits 6-7 here. diff --git a/package/kernel/mac80211/patches/651-0001-rtl8xxxu-remove-unneeded-assignments.patch b/package/kernel/mac80211/patches/651-0001-rtl8xxxu-remove-unneeded-assignments.patch deleted file mode 100644 index 05324f0de9..0000000000 --- a/package/kernel/mac80211/patches/651-0001-rtl8xxxu-remove-unneeded-assignments.patch +++ /dev/null @@ -1,30 +0,0 @@ -From efcb32883f365cb458a5cb376132965eacaf5571 Mon Sep 17 00:00:00 2001 -From: Luis de Bethencourt -Date: Thu, 23 Jun 2016 14:35:52 -0400 -Subject: [PATCH] rtl8xxxu: remove unneeded assignments - -reg_eac and reg_ecc are only used if candidate is bigger than 0, and in -that case new values will be given to them. Removing the unused -assignments. - -Signed-off-by: Luis de Bethencourt -Signed-off-by: Jes Sorensen -Signed-off-by: Kalle Valo ---- - drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_8192e.c | 2 -- - 1 file changed, 2 deletions(-) - ---- a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_8192e.c -+++ b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_8192e.c -@@ -1244,11 +1244,9 @@ static void rtl8192eu_phy_iq_calibrate(s - reg_e94 = result[i][0]; - reg_e9c = result[i][1]; - reg_ea4 = result[i][2]; -- reg_eac = result[i][3]; - reg_eb4 = result[i][4]; - reg_ebc = result[i][5]; - reg_ec4 = result[i][6]; -- reg_ecc = result[i][7]; - } - - if (candidate >= 0) { diff --git a/package/kernel/mac80211/patches/651-0002-rtl8xxxu-Fix-rtl8192eu-driver-reload-issue.patch b/package/kernel/mac80211/patches/651-0002-rtl8xxxu-Fix-rtl8192eu-driver-reload-issue.patch new file mode 100644 index 0000000000..ba7477b3d3 --- /dev/null +++ b/package/kernel/mac80211/patches/651-0002-rtl8xxxu-Fix-rtl8192eu-driver-reload-issue.patch @@ -0,0 +1,46 @@ +From 93064d0ae3e9d97c03a3aabd71e6048e1ac82f46 Mon Sep 17 00:00:00 2001 +From: Jes Sorensen +Date: Fri, 30 Sep 2016 19:18:34 -0400 +Subject: [PATCH] rtl8xxxu: Fix rtl8192eu driver reload issue + +The 8192eu suffered from two issues when reloading the driver. + +The same problems as with the 8723bu where REG_RX_WAIT_CCA bits 22 and +23 didn't get set in rtl8192e_enable_rf(). + +In addition it also seems prone to issues when setting REG_RF_CTRL to +0 intead of just disabling the RF_ENABLE bit. Similar to what was +causing issues with the 8188eu. + +With this patch I can successfully reload the driver and reassociate +to an APi with an 8192eu dongle. + +Signed-off-by: Jes Sorensen +--- + drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_8192e.c | 8 +++++++- + 1 file changed, 7 insertions(+), 1 deletion(-) + +--- a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_8192e.c ++++ b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_8192e.c +@@ -1461,7 +1461,9 @@ static int rtl8192eu_active_to_emu(struc + int count, ret = 0; + + /* Turn off RF */ +- rtl8xxxu_write8(priv, REG_RF_CTRL, 0); ++ val8 = rtl8xxxu_read8(priv, REG_RF_CTRL); ++ val8 &= ~RF_ENABLE; ++ rtl8xxxu_write8(priv, REG_RF_CTRL, val8); + + /* Switch DPDT_SEL_P output from register 0x65[2] */ + val8 = rtl8xxxu_read8(priv, REG_LEDCFG2); +@@ -1593,6 +1595,10 @@ static void rtl8192e_enable_rf(struct rt + u32 val32; + u8 val8; + ++ val32 = rtl8xxxu_read32(priv, REG_RX_WAIT_CCA); ++ val32 |= (BIT(22) | BIT(23)); ++ rtl8xxxu_write32(priv, REG_RX_WAIT_CCA, val32); ++ + val8 = rtl8xxxu_read8(priv, REG_GPIO_MUXCFG); + val8 |= BIT(5); + rtl8xxxu_write8(priv, REG_GPIO_MUXCFG, val8); diff --git a/package/kernel/mac80211/patches/651-0002-rtl8xxxu-Reduce-console-noise-when-removing-the-kern.patch b/package/kernel/mac80211/patches/651-0002-rtl8xxxu-Reduce-console-noise-when-removing-the-kern.patch deleted file mode 100644 index e8b3848375..0000000000 --- a/package/kernel/mac80211/patches/651-0002-rtl8xxxu-Reduce-console-noise-when-removing-the-kern.patch +++ /dev/null @@ -1,26 +0,0 @@ -From 78383ac951816a64657ca3e17868ad8c7c1b9393 Mon Sep 17 00:00:00 2001 -From: Jes Sorensen -Date: Thu, 23 Jun 2016 14:35:53 -0400 -Subject: [PATCH] rtl8xxxu: Reduce console noise when removing the kernel - module - -USB urbs will return with a status != 0 when rmmod'ing the driver. No -need to fill the log with messages from rtl8xxxu_int_complete() - -Signed-off-by: Jes Sorensen -Signed-off-by: Kalle Valo ---- - drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - ---- a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c -+++ b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c -@@ -5267,7 +5267,7 @@ static void rtl8xxxu_int_complete(struct - if (ret) - usb_unanchor_urb(urb); - } else { -- dev_info(dev, "%s: Error %i\n", __func__, urb->status); -+ dev_dbg(dev, "%s: Error %i\n", __func__, urb->status); - } - } - diff --git a/package/kernel/mac80211/patches/652-0001-rtl8xxxu-Obtain-RTS-rates-from-mac80211.patch b/package/kernel/mac80211/patches/652-0001-rtl8xxxu-Obtain-RTS-rates-from-mac80211.patch new file mode 100644 index 0000000000..3ebc685f6a --- /dev/null +++ b/package/kernel/mac80211/patches/652-0001-rtl8xxxu-Obtain-RTS-rates-from-mac80211.patch @@ -0,0 +1,138 @@ +From 3d1d6d96f14881c421860973b4eb4b2fff7cb812 Mon Sep 17 00:00:00 2001 +From: Jes Sorensen +Date: Wed, 5 Oct 2016 16:04:54 -0400 +Subject: [PATCH] rtl8xxxu: Obtain RTS rates from mac80211 + +Use the mac80211 provided rate for RTS rather than the hard coded +24Mbps as suggested by the vendor drivers. + +Reported-by: Andrea Merello +Signed-off-by: Jes Sorensen +--- + drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu.h | 6 +-- + .../net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c | 46 ++++++++++++++-------- + 2 files changed, 32 insertions(+), 20 deletions(-) + +--- a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu.h ++++ b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu.h +@@ -1340,7 +1340,7 @@ struct rtl8xxxu_fileops { + void (*fill_txdesc) (struct ieee80211_hdr *hdr, + struct rtl8xxxu_txdesc32 *tx_desc, u32 rate, + u16 rate_flag, bool sgi, bool short_preamble, +- bool ampdu_enable); ++ bool ampdu_enable, u32 rts_rate); + int writeN_block_size; + int rx_agg_buf_size; + char tx_desc_size; +@@ -1437,11 +1437,11 @@ bool rtl8xxxu_gen2_simularity_compare(st + void rtl8xxxu_fill_txdesc_v1(struct ieee80211_hdr *hdr, + struct rtl8xxxu_txdesc32 *tx_desc, u32 rate, + u16 rate_flag, bool sgi, bool short_preamble, +- bool ampdu_enable); ++ bool ampdu_enable, u32 rts_rate); + void rtl8xxxu_fill_txdesc_v2(struct ieee80211_hdr *hdr, + struct rtl8xxxu_txdesc32 *tx_desc32, u32 rate, + u16 rate_flag, bool sgi, bool short_preamble, +- bool ampdu_enable); ++ bool ampdu_enable, u32 rts_rate); + + extern struct rtl8xxxu_fileops rtl8192cu_fops; + extern struct rtl8xxxu_fileops rtl8192eu_fops; +--- a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c ++++ b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c +@@ -4762,7 +4762,7 @@ void + rtl8xxxu_fill_txdesc_v1(struct ieee80211_hdr *hdr, + struct rtl8xxxu_txdesc32 *tx_desc, u32 rate, + u16 rate_flag, bool sgi, bool short_preamble, +- bool ampdu_enable) ++ bool ampdu_enable, u32 rts_rate) + { + u16 seq_number; + +@@ -4796,15 +4796,16 @@ rtl8xxxu_fill_txdesc_v1(struct ieee80211 + if (sgi) + tx_desc->txdw5 |= cpu_to_le32(TXDESC32_SHORT_GI); + ++ /* ++ * rts_rate is zero if RTS/CTS or CTS to SELF are not enabled ++ */ ++ tx_desc->txdw4 |= cpu_to_le32(rts_rate << TXDESC32_RTS_RATE_SHIFT); + if (rate_flag & IEEE80211_TX_RC_USE_RTS_CTS) { +- /* +- * Use RTS rate 24M - does the mac80211 tell +- * us which to use? +- */ +- tx_desc->txdw4 |= cpu_to_le32(DESC_RATE_24M << +- TXDESC32_RTS_RATE_SHIFT); + tx_desc->txdw4 |= cpu_to_le32(TXDESC32_RTS_CTS_ENABLE); + tx_desc->txdw4 |= cpu_to_le32(TXDESC32_HW_RTS_ENABLE); ++ } else if (rate_flag & IEEE80211_TX_RC_USE_CTS_PROTECT) { ++ tx_desc->txdw4 |= cpu_to_le32(TXDESC32_CTS_SELF_ENABLE); ++ tx_desc->txdw4 |= cpu_to_le32(TXDESC32_HW_RTS_ENABLE); + } + } + +@@ -4816,7 +4817,7 @@ void + rtl8xxxu_fill_txdesc_v2(struct ieee80211_hdr *hdr, + struct rtl8xxxu_txdesc32 *tx_desc32, u32 rate, + u16 rate_flag, bool sgi, bool short_preamble, +- bool ampdu_enable) ++ bool ampdu_enable, u32 rts_rate) + { + struct rtl8xxxu_txdesc40 *tx_desc40; + u16 seq_number; +@@ -4849,15 +4850,19 @@ rtl8xxxu_fill_txdesc_v2(struct ieee80211 + if (short_preamble) + tx_desc40->txdw5 |= cpu_to_le32(TXDESC40_SHORT_PREAMBLE); + ++ tx_desc40->txdw4 |= cpu_to_le32(rts_rate << TXDESC40_RTS_RATE_SHIFT); ++ /* ++ * rts_rate is zero if RTS/CTS or CTS to SELF are not enabled ++ */ + if (rate_flag & IEEE80211_TX_RC_USE_RTS_CTS) { +- /* +- * Use RTS rate 24M - does the mac80211 tell +- * us which to use? +- */ +- tx_desc40->txdw4 |= cpu_to_le32(DESC_RATE_24M << +- TXDESC40_RTS_RATE_SHIFT); + tx_desc40->txdw3 |= cpu_to_le32(TXDESC40_RTS_CTS_ENABLE); + tx_desc40->txdw3 |= cpu_to_le32(TXDESC40_HW_RTS_ENABLE); ++ } else if (rate_flag & IEEE80211_TX_RC_USE_CTS_PROTECT) { ++ /* ++ * For some reason the vendor driver doesn't set ++ * TXDESC40_HW_RTS_ENABLE for CTS to SELF ++ */ ++ tx_desc40->txdw3 |= cpu_to_le32(TXDESC40_CTS_SELF_ENABLE); + } + } + +@@ -4874,7 +4879,7 @@ static void rtl8xxxu_tx(struct ieee80211 + struct ieee80211_sta *sta = NULL; + struct ieee80211_vif *vif = tx_info->control.vif; + struct device *dev = &priv->udev->dev; +- u32 queue, rate; ++ u32 queue, rate, rts_rate; + u16 pktlen = skb->len; + u16 seq_number; + u16 rate_flag = tx_info->control.rates[0].flags; +@@ -4974,10 +4979,17 @@ static void rtl8xxxu_tx(struct ieee80211 + (sta && vif && vif->bss_conf.use_short_preamble)) + short_preamble = true; + ++ if (rate_flag & IEEE80211_TX_RC_USE_RTS_CTS) ++ rts_rate = ieee80211_get_rts_cts_rate(hw, tx_info)->hw_value; ++ else if (rate_flag & IEEE80211_TX_RC_USE_CTS_PROTECT) ++ rts_rate = ieee80211_get_rts_cts_rate(hw, tx_info)->hw_value; ++ else ++ rts_rate = 0; ++ + seq_number = IEEE80211_SEQ_TO_SN(le16_to_cpu(hdr->seq_ctrl)); + +- priv->fops->fill_txdesc(hdr, tx_desc, rate, rate_flag, +- sgi, short_preamble, ampdu_enable); ++ priv->fops->fill_txdesc(hdr, tx_desc, rate, rate_flag, sgi, ++ short_preamble, ampdu_enable, rts_rate); + + rtl8xxxu_calc_tx_desc_csum(tx_desc); + diff --git a/package/kernel/mac80211/patches/652-0001-rtl8xxxu-Set-all-ieee80211_rx_status-values-in-parse.patch b/package/kernel/mac80211/patches/652-0001-rtl8xxxu-Set-all-ieee80211_rx_status-values-in-parse.patch deleted file mode 100644 index ccbd11097d..0000000000 --- a/package/kernel/mac80211/patches/652-0001-rtl8xxxu-Set-all-ieee80211_rx_status-values-in-parse.patch +++ /dev/null @@ -1,84 +0,0 @@ -From c14ee43b8ae2fe0777335daaf278b86a9f6691a1 Mon Sep 17 00:00:00 2001 -From: Jes Sorensen -Date: Mon, 27 Jun 2016 12:31:59 -0400 -Subject: [PATCH] rtl8xxxu: Set all ieee80211_rx_status values in - parse_rx_desc() - -This needs to be handled locally in the parse_rx_desc() function in -order to be able to handle aggregated packets in the future. - -Signed-off-by: Jes Sorensen -Signed-off-by: Kalle Valo ---- - drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c | 17 ++++++++++++----- - 1 file changed, 12 insertions(+), 5 deletions(-) - ---- a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c -+++ b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c -@@ -5048,6 +5048,7 @@ static void rtl8xxxu_rx_urb_work(struct - int rtl8xxxu_parse_rxdesc16(struct rtl8xxxu_priv *priv, struct sk_buff *skb, - struct ieee80211_rx_status *rx_status) - { -+ struct ieee80211_hw *hw = priv->hw; - struct rtl8xxxu_rxdesc16 *rx_desc = - (struct rtl8xxxu_rxdesc16 *)skb->data; - struct rtl8723au_phy_stats *phy_stats; -@@ -5059,6 +5060,8 @@ int rtl8xxxu_parse_rxdesc16(struct rtl8x - for (i = 0; i < (sizeof(struct rtl8xxxu_rxdesc16) / sizeof(u32)); i++) - _rx_desc[i] = le32_to_cpu(_rx_desc_le[i]); - -+ memset(rx_status, 0, sizeof(struct ieee80211_rx_status)); -+ - skb_pull(skb, sizeof(struct rtl8xxxu_rxdesc16)); - - phy_stats = (struct rtl8723au_phy_stats *)skb->data; -@@ -5088,12 +5091,16 @@ int rtl8xxxu_parse_rxdesc16(struct rtl8x - rx_status->rate_idx = rx_desc->rxmcs; - } - -+ rx_status->freq = hw->conf.chandef.chan->center_freq; -+ rx_status->band = hw->conf.chandef.chan->band; -+ - return RX_TYPE_DATA_PKT; - } - - int rtl8xxxu_parse_rxdesc24(struct rtl8xxxu_priv *priv, struct sk_buff *skb, - struct ieee80211_rx_status *rx_status) - { -+ struct ieee80211_hw *hw = priv->hw; - struct rtl8xxxu_rxdesc24 *rx_desc = - (struct rtl8xxxu_rxdesc24 *)skb->data; - struct rtl8723au_phy_stats *phy_stats; -@@ -5105,6 +5112,8 @@ int rtl8xxxu_parse_rxdesc24(struct rtl8x - for (i = 0; i < (sizeof(struct rtl8xxxu_rxdesc24) / sizeof(u32)); i++) - _rx_desc[i] = le32_to_cpu(_rx_desc_le[i]); - -+ memset(rx_status, 0, sizeof(struct ieee80211_rx_status)); -+ - skb_pull(skb, sizeof(struct rtl8xxxu_rxdesc24)); - - phy_stats = (struct rtl8723au_phy_stats *)skb->data; -@@ -5140,6 +5149,9 @@ int rtl8xxxu_parse_rxdesc24(struct rtl8x - rx_status->rate_idx = rx_desc->rxmcs; - } - -+ rx_status->freq = hw->conf.chandef.chan->center_freq; -+ rx_status->band = hw->conf.chandef.chan->band; -+ - return RX_TYPE_DATA_PKT; - } - -@@ -5202,13 +5214,8 @@ static void rtl8xxxu_rx_complete(struct - skb_put(skb, urb->actual_length); - - if (urb->status == 0) { -- memset(rx_status, 0, sizeof(struct ieee80211_rx_status)); -- - rx_type = priv->fops->parse_rx_desc(priv, skb, rx_status); - -- rx_status->freq = hw->conf.chandef.chan->center_freq; -- rx_status->band = hw->conf.chandef.chan->band; -- - if (rx_type == RX_TYPE_DATA_PKT) - ieee80211_rx_irqsafe(hw, skb); - else { diff --git a/package/kernel/mac80211/patches/652-0002-rtl8xxxu-Move-skb-delivery-into-parse_tx_desc-handle.patch b/package/kernel/mac80211/patches/652-0002-rtl8xxxu-Move-skb-delivery-into-parse_tx_desc-handle.patch deleted file mode 100644 index e61ba5bc5a..0000000000 --- a/package/kernel/mac80211/patches/652-0002-rtl8xxxu-Move-skb-delivery-into-parse_tx_desc-handle.patch +++ /dev/null @@ -1,165 +0,0 @@ -From a635df8a41ace30d15cb6fa22a04ba5b4c364cff Mon Sep 17 00:00:00 2001 -From: Jes Sorensen -Date: Mon, 27 Jun 2016 12:32:00 -0400 -Subject: [PATCH] rtl8xxxu: Move skb delivery into parse_tx_desc() handler - -This is another prepatory patch to be able to handle aggregated RX -packets. - -In order to avoid adding a prototype, this also moves the -rtl8723bu_handle_c2h() function. - -Signed-off-by: Jes Sorensen -Signed-off-by: Kalle Valo ---- - .../net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c | 104 ++++++++++----------- - 1 file changed, 50 insertions(+), 54 deletions(-) - ---- a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c -+++ b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c -@@ -5045,6 +5045,51 @@ static void rtl8xxxu_rx_urb_work(struct - } - } - -+static void rtl8723bu_handle_c2h(struct rtl8xxxu_priv *priv, -+ struct sk_buff *skb) -+{ -+ struct rtl8723bu_c2h *c2h = (struct rtl8723bu_c2h *)skb->data; -+ struct device *dev = &priv->udev->dev; -+ int len; -+ -+ len = skb->len - 2; -+ -+ dev_dbg(dev, "C2H ID %02x seq %02x, len %02x source %02x\n", -+ c2h->id, c2h->seq, len, c2h->bt_info.response_source); -+ -+ switch(c2h->id) { -+ case C2H_8723B_BT_INFO: -+ if (c2h->bt_info.response_source > -+ BT_INFO_SRC_8723B_BT_ACTIVE_SEND) -+ dev_dbg(dev, "C2H_BT_INFO WiFi only firmware\n"); -+ else -+ dev_dbg(dev, "C2H_BT_INFO BT/WiFi coexist firmware\n"); -+ -+ if (c2h->bt_info.bt_has_reset) -+ dev_dbg(dev, "BT has been reset\n"); -+ if (c2h->bt_info.tx_rx_mask) -+ dev_dbg(dev, "BT TRx mask\n"); -+ -+ break; -+ case C2H_8723B_BT_MP_INFO: -+ dev_dbg(dev, "C2H_MP_INFO ext ID %02x, status %02x\n", -+ c2h->bt_mp_info.ext_id, c2h->bt_mp_info.status); -+ break; -+ case C2H_8723B_RA_REPORT: -+ dev_dbg(dev, -+ "C2H RA RPT: rate %02x, unk %i, macid %02x, noise %i\n", -+ c2h->ra_report.rate, c2h->ra_report.dummy0_0, -+ c2h->ra_report.macid, c2h->ra_report.noisy_state); -+ break; -+ default: -+ dev_info(dev, "Unhandled C2H event %02x seq %02x\n", -+ c2h->id, c2h->seq); -+ print_hex_dump(KERN_INFO, "C2H content: ", DUMP_PREFIX_NONE, -+ 16, 1, c2h->raw.payload, len, false); -+ break; -+ } -+} -+ - int rtl8xxxu_parse_rxdesc16(struct rtl8xxxu_priv *priv, struct sk_buff *skb, - struct ieee80211_rx_status *rx_status) - { -@@ -5094,6 +5139,7 @@ int rtl8xxxu_parse_rxdesc16(struct rtl8x - rx_status->freq = hw->conf.chandef.chan->center_freq; - rx_status->band = hw->conf.chandef.chan->band; - -+ ieee80211_rx_irqsafe(hw, skb); - return RX_TYPE_DATA_PKT; - } - -@@ -5125,6 +5171,8 @@ int rtl8xxxu_parse_rxdesc24(struct rtl8x - if (rx_desc->rpt_sel) { - struct device *dev = &priv->udev->dev; - dev_dbg(dev, "%s: C2H packet\n", __func__); -+ rtl8723bu_handle_c2h(priv, skb); -+ dev_kfree_skb(skb); - return RX_TYPE_C2H; - } - -@@ -5152,54 +5200,10 @@ int rtl8xxxu_parse_rxdesc24(struct rtl8x - rx_status->freq = hw->conf.chandef.chan->center_freq; - rx_status->band = hw->conf.chandef.chan->band; - -+ ieee80211_rx_irqsafe(hw, skb); - return RX_TYPE_DATA_PKT; - } - --static void rtl8723bu_handle_c2h(struct rtl8xxxu_priv *priv, -- struct sk_buff *skb) --{ -- struct rtl8723bu_c2h *c2h = (struct rtl8723bu_c2h *)skb->data; -- struct device *dev = &priv->udev->dev; -- int len; -- -- len = skb->len - 2; -- -- dev_dbg(dev, "C2H ID %02x seq %02x, len %02x source %02x\n", -- c2h->id, c2h->seq, len, c2h->bt_info.response_source); -- -- switch(c2h->id) { -- case C2H_8723B_BT_INFO: -- if (c2h->bt_info.response_source > -- BT_INFO_SRC_8723B_BT_ACTIVE_SEND) -- dev_dbg(dev, "C2H_BT_INFO WiFi only firmware\n"); -- else -- dev_dbg(dev, "C2H_BT_INFO BT/WiFi coexist firmware\n"); -- -- if (c2h->bt_info.bt_has_reset) -- dev_dbg(dev, "BT has been reset\n"); -- if (c2h->bt_info.tx_rx_mask) -- dev_dbg(dev, "BT TRx mask\n"); -- -- break; -- case C2H_8723B_BT_MP_INFO: -- dev_dbg(dev, "C2H_MP_INFO ext ID %02x, status %02x\n", -- c2h->bt_mp_info.ext_id, c2h->bt_mp_info.status); -- break; -- case C2H_8723B_RA_REPORT: -- dev_dbg(dev, -- "C2H RA RPT: rate %02x, unk %i, macid %02x, noise %i\n", -- c2h->ra_report.rate, c2h->ra_report.dummy0_0, -- c2h->ra_report.macid, c2h->ra_report.noisy_state); -- break; -- default: -- dev_info(dev, "Unhandled C2H event %02x seq %02x\n", -- c2h->id, c2h->seq); -- print_hex_dump(KERN_INFO, "C2H content: ", DUMP_PREFIX_NONE, -- 16, 1, c2h->raw.payload, len, false); -- break; -- } --} -- - static void rtl8xxxu_rx_complete(struct urb *urb) - { - struct rtl8xxxu_rx_urb *rx_urb = -@@ -5209,19 +5213,11 @@ static void rtl8xxxu_rx_complete(struct - struct sk_buff *skb = (struct sk_buff *)urb->context; - struct ieee80211_rx_status *rx_status = IEEE80211_SKB_RXCB(skb); - struct device *dev = &priv->udev->dev; -- int rx_type; - - skb_put(skb, urb->actual_length); - - if (urb->status == 0) { -- rx_type = priv->fops->parse_rx_desc(priv, skb, rx_status); -- -- if (rx_type == RX_TYPE_DATA_PKT) -- ieee80211_rx_irqsafe(hw, skb); -- else { -- rtl8723bu_handle_c2h(priv, skb); -- dev_kfree_skb(skb); -- } -+ priv->fops->parse_rx_desc(priv, skb, rx_status); - - skb = NULL; - rx_urb->urb.context = NULL; diff --git a/package/kernel/mac80211/patches/652-0002-rtl8xxxu-Pass-tx_info-to-fill_txdesc-in-order-to-hav.patch b/package/kernel/mac80211/patches/652-0002-rtl8xxxu-Pass-tx_info-to-fill_txdesc-in-order-to-hav.patch new file mode 100644 index 0000000000..4b81a9d422 --- /dev/null +++ b/package/kernel/mac80211/patches/652-0002-rtl8xxxu-Pass-tx_info-to-fill_txdesc-in-order-to-hav.patch @@ -0,0 +1,213 @@ +From f958b1e0806c045830d78c4287fbcddf9e5fd9d0 Mon Sep 17 00:00:00 2001 +From: Jes Sorensen +Date: Thu, 6 Oct 2016 21:08:53 -0400 +Subject: [PATCH] rtl8xxxu: Pass tx_info to fill_txdesc in order to have access + to retry count + +In order to obtain retry count for a given rate we need to pass the +full struct ieee80211_tx_info to the function setting the rate in he +TX descriptor. + +This uncovered a huge bug where the old code would use struct +ieee80211_rate.flags to test for rate parameters, which is always +zero, instead of the flags value from struct ieee80211_tx_rate. + +Time to find a brown paper bag :( + +Signed-off-by: Jes Sorensen +--- + drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu.h | 27 ++++---- + .../net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c | 71 ++++++++++++++-------- + 2 files changed, 60 insertions(+), 38 deletions(-) + +--- a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu.h ++++ b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu.h +@@ -1337,10 +1337,11 @@ struct rtl8xxxu_fileops { + u32 ramask, int sgi); + void (*report_connect) (struct rtl8xxxu_priv *priv, + u8 macid, bool connect); +- void (*fill_txdesc) (struct ieee80211_hdr *hdr, +- struct rtl8xxxu_txdesc32 *tx_desc, u32 rate, +- u16 rate_flag, bool sgi, bool short_preamble, +- bool ampdu_enable, u32 rts_rate); ++ void (*fill_txdesc) (struct ieee80211_hw *hw, struct ieee80211_hdr *hdr, ++ struct ieee80211_tx_info *tx_info, ++ struct rtl8xxxu_txdesc32 *tx_desc, bool sgi, ++ bool short_preamble, bool ampdu_enable, ++ u32 rts_rate); + int writeN_block_size; + int rx_agg_buf_size; + char tx_desc_size; +@@ -1434,14 +1435,16 @@ int rtl8xxxu_parse_rxdesc24(struct rtl8x + int rtl8xxxu_gen2_channel_to_group(int channel); + bool rtl8xxxu_gen2_simularity_compare(struct rtl8xxxu_priv *priv, + int result[][8], int c1, int c2); +-void rtl8xxxu_fill_txdesc_v1(struct ieee80211_hdr *hdr, +- struct rtl8xxxu_txdesc32 *tx_desc, u32 rate, +- u16 rate_flag, bool sgi, bool short_preamble, +- bool ampdu_enable, u32 rts_rate); +-void rtl8xxxu_fill_txdesc_v2(struct ieee80211_hdr *hdr, +- struct rtl8xxxu_txdesc32 *tx_desc32, u32 rate, +- u16 rate_flag, bool sgi, bool short_preamble, +- bool ampdu_enable, u32 rts_rate); ++void rtl8xxxu_fill_txdesc_v1(struct ieee80211_hw *hw, struct ieee80211_hdr *hdr, ++ struct ieee80211_tx_info *tx_info, ++ struct rtl8xxxu_txdesc32 *tx_desc, bool sgi, ++ bool short_preamble, bool ampdu_enable, ++ u32 rts_rate); ++void rtl8xxxu_fill_txdesc_v2(struct ieee80211_hw *hw, struct ieee80211_hdr *hdr, ++ struct ieee80211_tx_info *tx_info, ++ struct rtl8xxxu_txdesc32 *tx_desc32, bool sgi, ++ bool short_preamble, bool ampdu_enable, ++ u32 rts_rate); + + extern struct rtl8xxxu_fileops rtl8192cu_fops; + extern struct rtl8xxxu_fileops rtl8192eu_fops; +--- a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c ++++ b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c +@@ -4759,13 +4759,28 @@ static void rtl8xxxu_dump_action(struct + * This format is used on 8188cu/8192cu/8723au + */ + void +-rtl8xxxu_fill_txdesc_v1(struct ieee80211_hdr *hdr, +- struct rtl8xxxu_txdesc32 *tx_desc, u32 rate, +- u16 rate_flag, bool sgi, bool short_preamble, +- bool ampdu_enable, u32 rts_rate) ++rtl8xxxu_fill_txdesc_v1(struct ieee80211_hw *hw, struct ieee80211_hdr *hdr, ++ struct ieee80211_tx_info *tx_info, ++ struct rtl8xxxu_txdesc32 *tx_desc, bool sgi, ++ bool short_preamble, bool ampdu_enable, u32 rts_rate) + { ++ struct ieee80211_rate *tx_rate = ieee80211_get_tx_rate(hw, tx_info); ++ struct rtl8xxxu_priv *priv = hw->priv; ++ struct device *dev = &priv->udev->dev; ++ u32 rate; ++ u16 rate_flags = tx_info->control.rates[0].flags; + u16 seq_number; + ++ if (rate_flags & IEEE80211_TX_RC_MCS && ++ !ieee80211_is_mgmt(hdr->frame_control)) ++ rate = tx_info->control.rates[0].idx + DESC_RATE_MCS0; ++ else ++ rate = tx_rate->hw_value; ++ ++ if (rtl8xxxu_debug & RTL8XXXU_DEBUG_TX) ++ dev_info(dev, "%s: TX rate: %d, pkt size %d\n", ++ __func__, rate, cpu_to_le16(tx_desc->pkt_size)); ++ + seq_number = IEEE80211_SEQ_TO_SN(le16_to_cpu(hdr->seq_ctrl)); + + tx_desc->txdw5 = cpu_to_le32(rate); +@@ -4800,10 +4815,10 @@ rtl8xxxu_fill_txdesc_v1(struct ieee80211 + * rts_rate is zero if RTS/CTS or CTS to SELF are not enabled + */ + tx_desc->txdw4 |= cpu_to_le32(rts_rate << TXDESC32_RTS_RATE_SHIFT); +- if (rate_flag & IEEE80211_TX_RC_USE_RTS_CTS) { ++ if (rate_flags & IEEE80211_TX_RC_USE_RTS_CTS) { + tx_desc->txdw4 |= cpu_to_le32(TXDESC32_RTS_CTS_ENABLE); + tx_desc->txdw4 |= cpu_to_le32(TXDESC32_HW_RTS_ENABLE); +- } else if (rate_flag & IEEE80211_TX_RC_USE_CTS_PROTECT) { ++ } else if (rate_flags & IEEE80211_TX_RC_USE_CTS_PROTECT) { + tx_desc->txdw4 |= cpu_to_le32(TXDESC32_CTS_SELF_ENABLE); + tx_desc->txdw4 |= cpu_to_le32(TXDESC32_HW_RTS_ENABLE); + } +@@ -4814,16 +4829,31 @@ rtl8xxxu_fill_txdesc_v1(struct ieee80211 + * This format is used on 8192eu/8723bu + */ + void +-rtl8xxxu_fill_txdesc_v2(struct ieee80211_hdr *hdr, +- struct rtl8xxxu_txdesc32 *tx_desc32, u32 rate, +- u16 rate_flag, bool sgi, bool short_preamble, +- bool ampdu_enable, u32 rts_rate) ++rtl8xxxu_fill_txdesc_v2(struct ieee80211_hw *hw, struct ieee80211_hdr *hdr, ++ struct ieee80211_tx_info *tx_info, ++ struct rtl8xxxu_txdesc32 *tx_desc32, bool sgi, ++ bool short_preamble, bool ampdu_enable, u32 rts_rate) + { ++ struct ieee80211_rate *tx_rate = ieee80211_get_tx_rate(hw, tx_info); ++ struct rtl8xxxu_priv *priv = hw->priv; ++ struct device *dev = &priv->udev->dev; + struct rtl8xxxu_txdesc40 *tx_desc40; ++ u32 rate; ++ u16 rate_flags = tx_info->control.rates[0].flags; + u16 seq_number; + + tx_desc40 = (struct rtl8xxxu_txdesc40 *)tx_desc32; + ++ if (rtl8xxxu_debug & RTL8XXXU_DEBUG_TX) ++ dev_info(dev, "%s: TX rate: %d, pkt size %d\n", ++ __func__, rate, cpu_to_le16(tx_desc40->pkt_size)); ++ ++ if (rate_flags & IEEE80211_TX_RC_MCS && ++ !ieee80211_is_mgmt(hdr->frame_control)) ++ rate = tx_info->control.rates[0].idx + DESC_RATE_MCS0; ++ else ++ rate = tx_rate->hw_value; ++ + seq_number = IEEE80211_SEQ_TO_SN(le16_to_cpu(hdr->seq_ctrl)); + + tx_desc40->txdw4 = cpu_to_le32(rate); +@@ -4854,10 +4884,10 @@ rtl8xxxu_fill_txdesc_v2(struct ieee80211 + /* + * rts_rate is zero if RTS/CTS or CTS to SELF are not enabled + */ +- if (rate_flag & IEEE80211_TX_RC_USE_RTS_CTS) { ++ if (rate_flags & IEEE80211_TX_RC_USE_RTS_CTS) { + tx_desc40->txdw3 |= cpu_to_le32(TXDESC40_RTS_CTS_ENABLE); + tx_desc40->txdw3 |= cpu_to_le32(TXDESC40_HW_RTS_ENABLE); +- } else if (rate_flag & IEEE80211_TX_RC_USE_CTS_PROTECT) { ++ } else if (rate_flags & IEEE80211_TX_RC_USE_CTS_PROTECT) { + /* + * For some reason the vendor driver doesn't set + * TXDESC40_HW_RTS_ENABLE for CTS to SELF +@@ -4872,14 +4902,13 @@ static void rtl8xxxu_tx(struct ieee80211 + { + struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)skb->data; + struct ieee80211_tx_info *tx_info = IEEE80211_SKB_CB(skb); +- struct ieee80211_rate *tx_rate = ieee80211_get_tx_rate(hw, tx_info); + struct rtl8xxxu_priv *priv = hw->priv; + struct rtl8xxxu_txdesc32 *tx_desc; + struct rtl8xxxu_tx_urb *tx_urb; + struct ieee80211_sta *sta = NULL; + struct ieee80211_vif *vif = tx_info->control.vif; + struct device *dev = &priv->udev->dev; +- u32 queue, rate, rts_rate; ++ u32 queue, rts_rate; + u16 pktlen = skb->len; + u16 seq_number; + u16 rate_flag = tx_info->control.rates[0].flags; +@@ -4906,10 +4935,6 @@ static void rtl8xxxu_tx(struct ieee80211 + goto error; + } + +- if (rtl8xxxu_debug & RTL8XXXU_DEBUG_TX) +- dev_info(dev, "%s: TX rate: %d (%d), pkt size %d\n", +- __func__, tx_rate->bitrate, tx_rate->hw_value, pktlen); +- + if (ieee80211_is_action(hdr->frame_control)) + rtl8xxxu_dump_action(dev, hdr); + +@@ -4963,12 +4988,6 @@ static void rtl8xxxu_tx(struct ieee80211 + } + } + +- if (rate_flag & IEEE80211_TX_RC_MCS && +- !ieee80211_is_mgmt(hdr->frame_control)) +- rate = tx_info->control.rates[0].idx + DESC_RATE_MCS0; +- else +- rate = tx_rate->hw_value; +- + if (rate_flag & IEEE80211_TX_RC_SHORT_GI || + (ieee80211_is_data_qos(hdr->frame_control) && + sta && sta->ht_cap.cap & +@@ -4988,8 +5007,8 @@ static void rtl8xxxu_tx(struct ieee80211 + + seq_number = IEEE80211_SEQ_TO_SN(le16_to_cpu(hdr->seq_ctrl)); + +- priv->fops->fill_txdesc(hdr, tx_desc, rate, rate_flag, sgi, +- short_preamble, ampdu_enable, rts_rate); ++ priv->fops->fill_txdesc(hw, hdr, tx_info, tx_desc, sgi, short_preamble, ++ ampdu_enable, rts_rate); + + rtl8xxxu_calc_tx_desc_csum(tx_desc); + diff --git a/package/kernel/mac80211/patches/652-0003-rtl8xxxu-Obtain-ieee80211_rx_status-within-parse_rx_.patch b/package/kernel/mac80211/patches/652-0003-rtl8xxxu-Obtain-ieee80211_rx_status-within-parse_rx_.patch deleted file mode 100644 index 62f4679c44..0000000000 --- a/package/kernel/mac80211/patches/652-0003-rtl8xxxu-Obtain-ieee80211_rx_status-within-parse_rx_.patch +++ /dev/null @@ -1,84 +0,0 @@ -From 2db125d4af4c503564b66c615488e6e7a4583b86 Mon Sep 17 00:00:00 2001 -From: Jes Sorensen -Date: Mon, 27 Jun 2016 12:32:01 -0400 -Subject: [PATCH] rtl8xxxu: Obtain ieee80211_rx_status within parse_rx_desc() - -When handling aggregated packets, we'll get a new ieee80211_rx_status -for each cloned skb, so passing in the pointer from the outside -doesn't make sense. - -Signed-off-by: Jes Sorensen -Signed-off-by: Kalle Valo ---- - drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu.h | 9 +++------ - drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c | 11 +++++------ - 2 files changed, 8 insertions(+), 12 deletions(-) - ---- a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu.h -+++ b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu.h -@@ -1315,8 +1315,7 @@ struct rtl8xxxu_fileops { - void (*phy_init_antenna_selection) (struct rtl8xxxu_priv *priv); - void (*phy_iq_calibrate) (struct rtl8xxxu_priv *priv); - void (*config_channel) (struct ieee80211_hw *hw); -- int (*parse_rx_desc) (struct rtl8xxxu_priv *priv, struct sk_buff *skb, -- struct ieee80211_rx_status *rx_status); -+ int (*parse_rx_desc) (struct rtl8xxxu_priv *priv, struct sk_buff *skb); - void (*init_aggregation) (struct rtl8xxxu_priv *priv); - void (*init_statistics) (struct rtl8xxxu_priv *priv); - void (*enable_rf) (struct rtl8xxxu_priv *priv); -@@ -1412,10 +1411,8 @@ void rtl8xxxu_gen2_report_connect(struct - void rtl8xxxu_gen1_enable_rf(struct rtl8xxxu_priv *priv); - void rtl8xxxu_gen1_disable_rf(struct rtl8xxxu_priv *priv); - void rtl8xxxu_gen2_disable_rf(struct rtl8xxxu_priv *priv); --int rtl8xxxu_parse_rxdesc16(struct rtl8xxxu_priv *priv, struct sk_buff *skb, -- struct ieee80211_rx_status *rx_status); --int rtl8xxxu_parse_rxdesc24(struct rtl8xxxu_priv *priv, struct sk_buff *skb, -- struct ieee80211_rx_status *rx_status); -+int rtl8xxxu_parse_rxdesc16(struct rtl8xxxu_priv *priv, struct sk_buff *skb); -+int rtl8xxxu_parse_rxdesc24(struct rtl8xxxu_priv *priv, struct sk_buff *skb); - int rtl8xxxu_gen2_channel_to_group(int channel); - bool rtl8xxxu_gen2_simularity_compare(struct rtl8xxxu_priv *priv, - int result[][8], int c1, int c2); ---- a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c -+++ b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c -@@ -5090,10 +5090,10 @@ static void rtl8723bu_handle_c2h(struct - } - } - --int rtl8xxxu_parse_rxdesc16(struct rtl8xxxu_priv *priv, struct sk_buff *skb, -- struct ieee80211_rx_status *rx_status) -+int rtl8xxxu_parse_rxdesc16(struct rtl8xxxu_priv *priv, struct sk_buff *skb) - { - struct ieee80211_hw *hw = priv->hw; -+ struct ieee80211_rx_status *rx_status = IEEE80211_SKB_RXCB(skb); - struct rtl8xxxu_rxdesc16 *rx_desc = - (struct rtl8xxxu_rxdesc16 *)skb->data; - struct rtl8723au_phy_stats *phy_stats; -@@ -5143,10 +5143,10 @@ int rtl8xxxu_parse_rxdesc16(struct rtl8x - return RX_TYPE_DATA_PKT; - } - --int rtl8xxxu_parse_rxdesc24(struct rtl8xxxu_priv *priv, struct sk_buff *skb, -- struct ieee80211_rx_status *rx_status) -+int rtl8xxxu_parse_rxdesc24(struct rtl8xxxu_priv *priv, struct sk_buff *skb) - { - struct ieee80211_hw *hw = priv->hw; -+ struct ieee80211_rx_status *rx_status = IEEE80211_SKB_RXCB(skb); - struct rtl8xxxu_rxdesc24 *rx_desc = - (struct rtl8xxxu_rxdesc24 *)skb->data; - struct rtl8723au_phy_stats *phy_stats; -@@ -5211,13 +5211,12 @@ static void rtl8xxxu_rx_complete(struct - struct ieee80211_hw *hw = rx_urb->hw; - struct rtl8xxxu_priv *priv = hw->priv; - struct sk_buff *skb = (struct sk_buff *)urb->context; -- struct ieee80211_rx_status *rx_status = IEEE80211_SKB_RXCB(skb); - struct device *dev = &priv->udev->dev; - - skb_put(skb, urb->actual_length); - - if (urb->status == 0) { -- priv->fops->parse_rx_desc(priv, skb, rx_status); -+ priv->fops->parse_rx_desc(priv, skb); - - skb = NULL; - rx_urb->urb.context = NULL; diff --git a/package/kernel/mac80211/patches/652-0004-rtl8xxxu-Correct-rxdesc16-definition.patch b/package/kernel/mac80211/patches/652-0004-rtl8xxxu-Correct-rxdesc16-definition.patch deleted file mode 100644 index ea953290a7..0000000000 --- a/package/kernel/mac80211/patches/652-0004-rtl8xxxu-Correct-rxdesc16-definition.patch +++ /dev/null @@ -1,37 +0,0 @@ -From 41892729cf60a600fb14ed924f0d18440e2dfac9 Mon Sep 17 00:00:00 2001 -From: Jes Sorensen -Date: Mon, 27 Jun 2016 12:32:02 -0400 -Subject: [PATCH] rtl8xxxu: Correct rxdesc16 definition - -This corrects the definition of rxdesc16 to correctly specify pkt_cnt -for aggregated packets. This is based on the code of the vendor -rtl8723au driver, as opposed to the struct definitions they use. - -Signed-off-by: Jes Sorensen -Signed-off-by: Kalle Valo ---- - drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu.h | 6 ++++-- - 1 file changed, 4 insertions(+), 2 deletions(-) - ---- a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu.h -+++ b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu.h -@@ -135,7 +135,8 @@ struct rtl8xxxu_rxdesc16 { - - u32 seq:12; - u32 frag:4; -- u32 nextpktlen:14; -+ u32 pkt_cnt:8; -+ u32 reserved:6; - u32 nextind:1; - u32 reserved0:1; - -@@ -198,7 +199,8 @@ struct rtl8xxxu_rxdesc16 { - - u32 reserved0:1; - u32 nextind:1; -- u32 nextpktlen:14; -+ u32 reserved:6; -+ u32 pkt_cnt:8; - u32 frag:4; - u32 seq:12; - diff --git a/package/kernel/mac80211/patches/652-0005-rtl8xxxu-Add-support-for-aggregated-RX-packets-on-ge.patch b/package/kernel/mac80211/patches/652-0005-rtl8xxxu-Add-support-for-aggregated-RX-packets-on-ge.patch deleted file mode 100644 index 199d158b87..0000000000 --- a/package/kernel/mac80211/patches/652-0005-rtl8xxxu-Add-support-for-aggregated-RX-packets-on-ge.patch +++ /dev/null @@ -1,141 +0,0 @@ -From 040b97be60567b819b97442d30533884bd266874 Mon Sep 17 00:00:00 2001 -From: Jes Sorensen -Date: Mon, 27 Jun 2016 12:32:03 -0400 -Subject: [PATCH] rtl8xxxu: Add support for aggregated RX packets on gen1 parts - -This implements support for demuxing aggregated RX packets on gen1 -devices, using the rxdesc16 format. - -So far this has only been tested with rtl8723au devices. - -Signed-off-by: Jes Sorensen -Signed-off-by: Kalle Valo ---- - .../net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c | 103 ++++++++++++++------- - 1 file changed, 69 insertions(+), 34 deletions(-) - ---- a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c -+++ b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c -@@ -5093,53 +5093,88 @@ static void rtl8723bu_handle_c2h(struct - int rtl8xxxu_parse_rxdesc16(struct rtl8xxxu_priv *priv, struct sk_buff *skb) - { - struct ieee80211_hw *hw = priv->hw; -- struct ieee80211_rx_status *rx_status = IEEE80211_SKB_RXCB(skb); -- struct rtl8xxxu_rxdesc16 *rx_desc = -- (struct rtl8xxxu_rxdesc16 *)skb->data; -+ struct ieee80211_rx_status *rx_status; -+ struct rtl8xxxu_rxdesc16 *rx_desc; - struct rtl8723au_phy_stats *phy_stats; -- __le32 *_rx_desc_le = (__le32 *)skb->data; -- u32 *_rx_desc = (u32 *)skb->data; -+ struct sk_buff *next_skb = NULL; -+ __le32 *_rx_desc_le; -+ u32 *_rx_desc; - int drvinfo_sz, desc_shift; -- int i; -+ int i, pkt_cnt, pkt_len, urb_len, pkt_offset; - -- for (i = 0; i < (sizeof(struct rtl8xxxu_rxdesc16) / sizeof(u32)); i++) -- _rx_desc[i] = le32_to_cpu(_rx_desc_le[i]); -+ urb_len = skb->len; -+ pkt_cnt = 0; - -- memset(rx_status, 0, sizeof(struct ieee80211_rx_status)); -+ do { -+ rx_desc = (struct rtl8xxxu_rxdesc16 *)skb->data; -+ _rx_desc_le = (__le32 *)skb->data; -+ _rx_desc = (u32 *)skb->data; - -- skb_pull(skb, sizeof(struct rtl8xxxu_rxdesc16)); -+ for (i = 0; -+ i < (sizeof(struct rtl8xxxu_rxdesc16) / sizeof(u32)); i++) -+ _rx_desc[i] = le32_to_cpu(_rx_desc_le[i]); - -- phy_stats = (struct rtl8723au_phy_stats *)skb->data; -+ /* -+ * Only read pkt_cnt from the header if we're parsing the -+ * first packet -+ */ -+ if (!pkt_cnt) -+ pkt_cnt = rx_desc->pkt_cnt; -+ pkt_len = rx_desc->pktlen; - -- drvinfo_sz = rx_desc->drvinfo_sz * 8; -- desc_shift = rx_desc->shift; -- skb_pull(skb, drvinfo_sz + desc_shift); -+ drvinfo_sz = rx_desc->drvinfo_sz * 8; -+ desc_shift = rx_desc->shift; -+ pkt_offset = roundup(pkt_len + drvinfo_sz + desc_shift + -+ sizeof(struct rtl8xxxu_rxdesc16), 128); - -- if (rx_desc->phy_stats) -- rtl8xxxu_rx_parse_phystats(priv, rx_status, phy_stats, -- rx_desc->rxmcs); -+ if (pkt_cnt > 1) -+ next_skb = skb_clone(skb, GFP_ATOMIC); - -- rx_status->mactime = le32_to_cpu(rx_desc->tsfl); -- rx_status->flag |= RX_FLAG_MACTIME_START; -+ rx_status = IEEE80211_SKB_RXCB(skb); -+ memset(rx_status, 0, sizeof(struct ieee80211_rx_status)); - -- if (!rx_desc->swdec) -- rx_status->flag |= RX_FLAG_DECRYPTED; -- if (rx_desc->crc32) -- rx_status->flag |= RX_FLAG_FAILED_FCS_CRC; -- if (rx_desc->bw) -- rx_status->flag |= RX_FLAG_40MHZ; -+ skb_pull(skb, sizeof(struct rtl8xxxu_rxdesc16)); - -- if (rx_desc->rxht) { -- rx_status->flag |= RX_FLAG_HT; -- rx_status->rate_idx = rx_desc->rxmcs - DESC_RATE_MCS0; -- } else { -- rx_status->rate_idx = rx_desc->rxmcs; -- } -+ phy_stats = (struct rtl8723au_phy_stats *)skb->data; - -- rx_status->freq = hw->conf.chandef.chan->center_freq; -- rx_status->band = hw->conf.chandef.chan->band; -+ skb_pull(skb, drvinfo_sz + desc_shift); -+ -+ skb_trim(skb, pkt_len); -+ -+ if (rx_desc->phy_stats) -+ rtl8xxxu_rx_parse_phystats(priv, rx_status, phy_stats, -+ rx_desc->rxmcs); -+ -+ rx_status->mactime = le32_to_cpu(rx_desc->tsfl); -+ rx_status->flag |= RX_FLAG_MACTIME_START; -+ -+ if (!rx_desc->swdec) -+ rx_status->flag |= RX_FLAG_DECRYPTED; -+ if (rx_desc->crc32) -+ rx_status->flag |= RX_FLAG_FAILED_FCS_CRC; -+ if (rx_desc->bw) -+ rx_status->flag |= RX_FLAG_40MHZ; -+ -+ if (rx_desc->rxht) { -+ rx_status->flag |= RX_FLAG_HT; -+ rx_status->rate_idx = rx_desc->rxmcs - DESC_RATE_MCS0; -+ } else { -+ rx_status->rate_idx = rx_desc->rxmcs; -+ } -+ -+ rx_status->freq = hw->conf.chandef.chan->center_freq; -+ rx_status->band = hw->conf.chandef.chan->band; -+ -+ ieee80211_rx_irqsafe(hw, skb); -+ -+ skb = next_skb; -+ if (skb) -+ skb_pull(next_skb, pkt_offset); -+ -+ pkt_cnt--; -+ urb_len -= pkt_offset; -+ } while (skb && urb_len > 0 && pkt_cnt > 0); - -- ieee80211_rx_irqsafe(hw, skb); - return RX_TYPE_DATA_PKT; - } - diff --git a/package/kernel/mac80211/patches/652-0006-rtl8xxxu-Allocate-larger-RX-skbs-when-aggregation-is.patch b/package/kernel/mac80211/patches/652-0006-rtl8xxxu-Allocate-larger-RX-skbs-when-aggregation-is.patch deleted file mode 100644 index 1355826bfb..0000000000 --- a/package/kernel/mac80211/patches/652-0006-rtl8xxxu-Allocate-larger-RX-skbs-when-aggregation-is.patch +++ /dev/null @@ -1,66 +0,0 @@ -From 04319ae2f60974fa218f16fdf7a8576d1db6d673 Mon Sep 17 00:00:00 2001 -From: Jes Sorensen -Date: Mon, 27 Jun 2016 12:32:04 -0400 -Subject: [PATCH] rtl8xxxu: Allocate larger RX skbs when aggregation is enabled - -This adds support for allocating larger skbs for devices which -indicate they support it. - -Signed-off-by: Jes Sorensen -Signed-off-by: Kalle Valo ---- - drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu.h | 2 ++ - drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c | 13 +++++++++---- - 2 files changed, 11 insertions(+), 4 deletions(-) - ---- a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu.h -+++ b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu.h -@@ -1247,6 +1247,7 @@ struct rtl8xxxu_priv { - u32 ep_tx_normal_queue:1; - u32 ep_tx_low_queue:1; - u32 has_xtalk:1; -+ u32 rx_buf_aggregation:1; - u8 xtalk; - unsigned int pipe_interrupt; - unsigned int pipe_in; -@@ -1330,6 +1331,7 @@ struct rtl8xxxu_fileops { - void (*report_connect) (struct rtl8xxxu_priv *priv, - u8 macid, bool connect); - int writeN_block_size; -+ int rx_agg_buf_size; - char tx_desc_size; - char rx_desc_size; - char has_s0s1; ---- a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c -+++ b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c -@@ -64,8 +64,6 @@ module_param_named(ht40_2g, rtl8xxxu_ht4 - MODULE_PARM_DESC(ht40_2g, "Enable HT40 support on the 2.4GHz band"); - - #define USB_VENDOR_ID_REALTEK 0x0bda --/* Minimum IEEE80211_MAX_FRAME_LEN */ --#define RTL_RX_BUFFER_SIZE IEEE80211_MAX_FRAME_LEN - #define RTL8XXXU_RX_URBS 32 - #define RTL8XXXU_RX_URB_PENDING_WATER 8 - #define RTL8XXXU_TX_URBS 64 -@@ -5271,12 +5269,19 @@ cleanup: - static int rtl8xxxu_submit_rx_urb(struct rtl8xxxu_priv *priv, - struct rtl8xxxu_rx_urb *rx_urb) - { -+ struct rtl8xxxu_fileops *fops = priv->fops; - struct sk_buff *skb; - int skb_size; - int ret, rx_desc_sz; - -- rx_desc_sz = priv->fops->rx_desc_size; -- skb_size = rx_desc_sz + RTL_RX_BUFFER_SIZE; -+ rx_desc_sz = fops->rx_desc_size; -+ -+ if (priv->rx_buf_aggregation && fops->rx_agg_buf_size) -+ skb_size = fops->rx_agg_buf_size; -+ else -+ skb_size = IEEE80211_MAX_FRAME_LEN; -+ skb_size += rx_desc_sz; -+ - skb = __netdev_alloc_skb(NULL, skb_size, GFP_KERNEL); - if (!skb) - return -ENOMEM; diff --git a/package/kernel/mac80211/patches/652-0007-rtl8xxxu-Adjust-RX-skb-size-to-include-space-for-phy.patch b/package/kernel/mac80211/patches/652-0007-rtl8xxxu-Adjust-RX-skb-size-to-include-space-for-phy.patch deleted file mode 100644 index 58fa1d7bc4..0000000000 --- a/package/kernel/mac80211/patches/652-0007-rtl8xxxu-Adjust-RX-skb-size-to-include-space-for-phy.patch +++ /dev/null @@ -1,33 +0,0 @@ -From 1e5b3b3fe9e00a3afe3092dbe1a3fc1e9079bf35 Mon Sep 17 00:00:00 2001 -From: Jes Sorensen -Date: Mon, 27 Jun 2016 12:32:05 -0400 -Subject: [PATCH] rtl8xxxu: Adjust RX skb size to include space for phystats - -The old allocation didn't leave space for phystats in the buffer, -allowing the packet to be rejected if a frame size of size -IEEE80211_MAX_FRAME_LEN was received. - -Signed-off-by: Jes Sorensen -Signed-off-by: Kalle Valo ---- - drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c | 7 ++++--- - 1 file changed, 4 insertions(+), 3 deletions(-) - ---- a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c -+++ b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c -@@ -5276,11 +5276,12 @@ static int rtl8xxxu_submit_rx_urb(struct - - rx_desc_sz = fops->rx_desc_size; - -- if (priv->rx_buf_aggregation && fops->rx_agg_buf_size) -+ if (priv->rx_buf_aggregation && fops->rx_agg_buf_size) { - skb_size = fops->rx_agg_buf_size; -- else -+ skb_size += (rx_desc_sz + sizeof(struct rtl8723au_phy_stats)); -+ } else { - skb_size = IEEE80211_MAX_FRAME_LEN; -- skb_size += rx_desc_sz; -+ } - - skb = __netdev_alloc_skb(NULL, skb_size, GFP_KERNEL); - if (!skb) diff --git a/package/kernel/mac80211/patches/652-0008-rtl8xxxu-Enable-aggregation-for-rtl8723au.patch b/package/kernel/mac80211/patches/652-0008-rtl8xxxu-Enable-aggregation-for-rtl8723au.patch deleted file mode 100644 index bf2075819f..0000000000 --- a/package/kernel/mac80211/patches/652-0008-rtl8xxxu-Enable-aggregation-for-rtl8723au.patch +++ /dev/null @@ -1,90 +0,0 @@ -From 91dcbb7175317da7caafc3b05b002addd42cdabd Mon Sep 17 00:00:00 2001 -From: Jes Sorensen -Date: Mon, 27 Jun 2016 12:32:06 -0400 -Subject: [PATCH] rtl8xxxu: Enable aggregation for rtl8723au - -Implement rtl8xxxu_gen1_init_aggregation(). Aggregation should be the -same for all gen1 parts. We may want to allow for tuning parameters in -the fileopes struct. For now this is based allocating 16KB RX buffers, -leaving 16000 bytes for actual packets, and the rest for the skb -overhead. - -Signed-off-by: Jes Sorensen -Signed-off-by: Kalle Valo ---- - drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu.h | 1 + - .../net/wireless/realtek/rtl8xxxu/rtl8xxxu_8723a.c | 2 ++ - .../net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c | 34 ++++++++++++++++++++++ - 3 files changed, 37 insertions(+) - ---- a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu.h -+++ b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu.h -@@ -1412,6 +1412,7 @@ void rtl8xxxu_gen1_report_connect(struct - u8 macid, bool connect); - void rtl8xxxu_gen2_report_connect(struct rtl8xxxu_priv *priv, - u8 macid, bool connect); -+void rtl8xxxu_gen1_init_aggregation(struct rtl8xxxu_priv *priv); - void rtl8xxxu_gen1_enable_rf(struct rtl8xxxu_priv *priv); - void rtl8xxxu_gen1_disable_rf(struct rtl8xxxu_priv *priv); - void rtl8xxxu_gen2_disable_rf(struct rtl8xxxu_priv *priv); ---- a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_8723a.c -+++ b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_8723a.c -@@ -377,6 +377,7 @@ struct rtl8xxxu_fileops rtl8723au_fops = - .phy_iq_calibrate = rtl8xxxu_gen1_phy_iq_calibrate, - .config_channel = rtl8xxxu_gen1_config_channel, - .parse_rx_desc = rtl8xxxu_parse_rxdesc16, -+ .init_aggregation = rtl8xxxu_gen1_init_aggregation, - .enable_rf = rtl8xxxu_gen1_enable_rf, - .disable_rf = rtl8xxxu_gen1_disable_rf, - .usb_quirks = rtl8xxxu_gen1_usb_quirks, -@@ -384,6 +385,7 @@ struct rtl8xxxu_fileops rtl8723au_fops = - .update_rate_mask = rtl8xxxu_update_rate_mask, - .report_connect = rtl8xxxu_gen1_report_connect, - .writeN_block_size = 1024, -+ .rx_agg_buf_size = 16000, - .tx_desc_size = sizeof(struct rtl8xxxu_txdesc32), - .rx_desc_size = sizeof(struct rtl8xxxu_rxdesc16), - .adda_1t_init = 0x0b1b25a0, ---- a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c -+++ b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c -@@ -4405,6 +4405,40 @@ void rtl8xxxu_gen2_report_connect(struct - rtl8xxxu_gen2_h2c_cmd(priv, &h2c, sizeof(h2c.media_status_rpt)); - } - -+void rtl8xxxu_gen1_init_aggregation(struct rtl8xxxu_priv *priv) -+{ -+ u8 agg_ctrl, usb_spec, page_thresh; -+ -+ usb_spec = rtl8xxxu_read8(priv, REG_USB_SPECIAL_OPTION); -+ usb_spec &= ~USB_SPEC_USB_AGG_ENABLE; -+ -+ agg_ctrl = rtl8xxxu_read8(priv, REG_TRXDMA_CTRL); -+ agg_ctrl &= ~TRXDMA_CTRL_RXDMA_AGG_EN; -+ -+ agg_ctrl |= TRXDMA_CTRL_RXDMA_AGG_EN; -+ -+ rtl8xxxu_write8(priv, REG_TRXDMA_CTRL, agg_ctrl); -+ rtl8xxxu_write8(priv, REG_USB_SPECIAL_OPTION, usb_spec); -+ -+ /* -+ * The number of packets we can take looks to be buffer size / 512 -+ * which matches the 512 byte rounding we have to do when de-muxing -+ * the packets. -+ * -+ * Sample numbers from the vendor driver: -+ * USB High-Speed mode values: -+ * RxAggBlockCount = 8 : 512 byte unit -+ * RxAggBlockTimeout = 6 -+ * RxAggPageCount = 48 : 128 byte unit -+ * RxAggPageTimeout = 4 or 6 (absolute time 34ms/(2^6)) -+ */ -+ -+ page_thresh = (priv->fops->rx_agg_buf_size / 512); -+ rtl8xxxu_write8(priv, REG_RXDMA_AGG_PG_TH, page_thresh); -+ rtl8xxxu_write8(priv, REG_USB_DMA_AGG_TO, 4); -+ priv->rx_buf_aggregation = 1; -+} -+ - static void rtl8xxxu_set_basic_rates(struct rtl8xxxu_priv *priv, u32 rate_cfg) - { - u32 val32; diff --git a/package/kernel/mac80211/patches/652-0009-rtl8xxxu-Enable-aggregation-for-rtl8192cu-rtl8188cu-.patch b/package/kernel/mac80211/patches/652-0009-rtl8xxxu-Enable-aggregation-for-rtl8192cu-rtl8188cu-.patch deleted file mode 100644 index e1074fe61f..0000000000 --- a/package/kernel/mac80211/patches/652-0009-rtl8xxxu-Enable-aggregation-for-rtl8192cu-rtl8188cu-.patch +++ /dev/null @@ -1,33 +0,0 @@ -From 0a20ed8bd057c05ed138d8d39ac496d874c3ccb6 Mon Sep 17 00:00:00 2001 -From: Jes Sorensen -Date: Mon, 27 Jun 2016 12:32:07 -0400 -Subject: [PATCH] rtl8xxxu: Enable aggregation for - rtl8192cu/rtl8188cu/rtl8188ru - -This enables aggregation on rtl8192cu and derivative parts. This uses -the same parameters as for rtl8723au. - -Signed-off-by: Jes Sorensen -Signed-off-by: Kalle Valo ---- - drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_8192c.c | 2 ++ - 1 file changed, 2 insertions(+) - ---- a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_8192c.c -+++ b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_8192c.c -@@ -560,6 +560,7 @@ struct rtl8xxxu_fileops rtl8192cu_fops = - .phy_iq_calibrate = rtl8xxxu_gen1_phy_iq_calibrate, - .config_channel = rtl8xxxu_gen1_config_channel, - .parse_rx_desc = rtl8xxxu_parse_rxdesc16, -+ .init_aggregation = rtl8xxxu_gen1_init_aggregation, - .enable_rf = rtl8xxxu_gen1_enable_rf, - .disable_rf = rtl8xxxu_gen1_disable_rf, - .usb_quirks = rtl8xxxu_gen1_usb_quirks, -@@ -567,6 +568,7 @@ struct rtl8xxxu_fileops rtl8192cu_fops = - .update_rate_mask = rtl8xxxu_update_rate_mask, - .report_connect = rtl8xxxu_gen1_report_connect, - .writeN_block_size = 128, -+ .rx_agg_buf_size = 16000, - .tx_desc_size = sizeof(struct rtl8xxxu_txdesc32), - .rx_desc_size = sizeof(struct rtl8xxxu_rxdesc16), - .adda_1t_init = 0x0b1b25a0, diff --git a/package/kernel/mac80211/patches/652-0010-rtl8xxxu-Make-DMA-aggregation-optional-by-setting-a-.patch b/package/kernel/mac80211/patches/652-0010-rtl8xxxu-Make-DMA-aggregation-optional-by-setting-a-.patch deleted file mode 100644 index 27a8522f2a..0000000000 --- a/package/kernel/mac80211/patches/652-0010-rtl8xxxu-Make-DMA-aggregation-optional-by-setting-a-.patch +++ /dev/null @@ -1,55 +0,0 @@ -From 82cce22acd8ec7c75087825f23c053a642e7b672 Mon Sep 17 00:00:00 2001 -From: Jes Sorensen -Date: Mon, 27 Jun 2016 12:32:08 -0400 -Subject: [PATCH] rtl8xxxu: Make DMA aggregation optional by setting a module - parameter - -Let the default to off until we have more data on the right default -tuning values. - -Signed-off-by: Jes Sorensen -Signed-off-by: Kalle Valo ---- - drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c | 11 +++++++++-- - 1 file changed, 9 insertions(+), 2 deletions(-) - ---- a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c -+++ b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c -@@ -44,6 +44,7 @@ - - int rtl8xxxu_debug = RTL8XXXU_DEBUG_EFUSE; - static bool rtl8xxxu_ht40_2g; -+static bool rtl8xxxu_dma_aggregation; - - MODULE_AUTHOR("Jes Sorensen "); - MODULE_DESCRIPTION("RTL8XXXu USB mac80211 Wireless LAN Driver"); -@@ -62,6 +63,8 @@ module_param_named(debug, rtl8xxxu_debug - MODULE_PARM_DESC(debug, "Set debug mask"); - module_param_named(ht40_2g, rtl8xxxu_ht40_2g, bool, 0600); - MODULE_PARM_DESC(ht40_2g, "Enable HT40 support on the 2.4GHz band"); -+module_param_named(dma_aggregation, rtl8xxxu_dma_aggregation, bool, 0600); -+MODULE_PARM_DESC(dma_aggregation, "Enable DMA packet aggregation"); - - #define USB_VENDOR_ID_REALTEK 0x0bda - #define RTL8XXXU_RX_URBS 32 -@@ -4411,14 +4414,18 @@ void rtl8xxxu_gen1_init_aggregation(stru - - usb_spec = rtl8xxxu_read8(priv, REG_USB_SPECIAL_OPTION); - usb_spec &= ~USB_SPEC_USB_AGG_ENABLE; -+ rtl8xxxu_write8(priv, REG_USB_SPECIAL_OPTION, usb_spec); - - agg_ctrl = rtl8xxxu_read8(priv, REG_TRXDMA_CTRL); - agg_ctrl &= ~TRXDMA_CTRL_RXDMA_AGG_EN; - -- agg_ctrl |= TRXDMA_CTRL_RXDMA_AGG_EN; -+ if (!rtl8xxxu_dma_aggregation) { -+ rtl8xxxu_write8(priv, REG_TRXDMA_CTRL, agg_ctrl); -+ return; -+ } - -+ agg_ctrl |= TRXDMA_CTRL_RXDMA_AGG_EN; - rtl8xxxu_write8(priv, REG_TRXDMA_CTRL, agg_ctrl); -- rtl8xxxu_write8(priv, REG_USB_SPECIAL_OPTION, usb_spec); - - /* - * The number of packets we can take looks to be buffer size / 512 diff --git a/package/kernel/mac80211/patches/652-0011-rtl8xxxu-gen1-Set-aggregation-timeout-REG_RXDMA_AGG_.patch b/package/kernel/mac80211/patches/652-0011-rtl8xxxu-gen1-Set-aggregation-timeout-REG_RXDMA_AGG_.patch deleted file mode 100644 index f4deb234fe..0000000000 --- a/package/kernel/mac80211/patches/652-0011-rtl8xxxu-gen1-Set-aggregation-timeout-REG_RXDMA_AGG_.patch +++ /dev/null @@ -1,43 +0,0 @@ -From 614e389f36a9d709469a74508d76c5df5141149a Mon Sep 17 00:00:00 2001 -From: Jes Sorensen -Date: Mon, 27 Jun 2016 12:32:09 -0400 -Subject: [PATCH] rtl8xxxu: gen1: Set aggregation timeout (REG_RXDMA_AGG_PG_TH - + 1) as well - -gen2 chips as well as 8188eu seems to use this register for setting -DMA timeout threshold values, however the 8192cu is using -REG_USB_DMA_AGG_TO. Set both to be on the safe side. - -Signed-off-by: Jes Sorensen -Signed-off-by: Kalle Valo ---- - drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c | 11 +++++++++-- - 1 file changed, 9 insertions(+), 2 deletions(-) - ---- a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c -+++ b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c -@@ -4410,7 +4410,7 @@ void rtl8xxxu_gen2_report_connect(struct - - void rtl8xxxu_gen1_init_aggregation(struct rtl8xxxu_priv *priv) - { -- u8 agg_ctrl, usb_spec, page_thresh; -+ u8 agg_ctrl, usb_spec, page_thresh, timeout; - - usb_spec = rtl8xxxu_read8(priv, REG_USB_SPECIAL_OPTION); - usb_spec &= ~USB_SPEC_USB_AGG_ENABLE; -@@ -4442,7 +4442,14 @@ void rtl8xxxu_gen1_init_aggregation(stru - - page_thresh = (priv->fops->rx_agg_buf_size / 512); - rtl8xxxu_write8(priv, REG_RXDMA_AGG_PG_TH, page_thresh); -- rtl8xxxu_write8(priv, REG_USB_DMA_AGG_TO, 4); -+ /* -+ * REG_RXDMA_AGG_PG_TH + 1 seems to be the timeout register on -+ * gen2 chips and rtl8188eu. The rtl8723au seems unhappy if we -+ * don't set it, so better set both. -+ */ -+ timeout = 4; -+ rtl8xxxu_write8(priv, REG_RXDMA_AGG_PG_TH + 1, timeout); -+ rtl8xxxu_write8(priv, REG_USB_DMA_AGG_TO, timeout); - priv->rx_buf_aggregation = 1; - } - diff --git a/package/kernel/mac80211/patches/652-0012-rtl8xxxu-gen1-Add-module-parameters-to-adjust-DMA-ag.patch b/package/kernel/mac80211/patches/652-0012-rtl8xxxu-gen1-Add-module-parameters-to-adjust-DMA-ag.patch deleted file mode 100644 index 90c2a4af27..0000000000 --- a/package/kernel/mac80211/patches/652-0012-rtl8xxxu-gen1-Add-module-parameters-to-adjust-DMA-ag.patch +++ /dev/null @@ -1,74 +0,0 @@ -From fd83f12278262feccd012b62c30643bd6a6c2888 Mon Sep 17 00:00:00 2001 -From: Jes Sorensen -Date: Mon, 27 Jun 2016 12:32:10 -0400 -Subject: [PATCH] rtl8xxxu: gen1: Add module parameters to adjust DMA - aggregation parameters - -This allows the user to specify DMA aggregation timout and block -count. Blocks are presumably always 512 bytes, so the minimum block -count is 6 for 802.11 packets. - -Signed-off-by: Jes Sorensen -Signed-off-by: Kalle Valo ---- - .../net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c | 28 ++++++++++++++++++++++ - 1 file changed, 28 insertions(+) - ---- a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c -+++ b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c -@@ -45,6 +45,8 @@ - int rtl8xxxu_debug = RTL8XXXU_DEBUG_EFUSE; - static bool rtl8xxxu_ht40_2g; - static bool rtl8xxxu_dma_aggregation; -+static int rtl8xxxu_dma_agg_timeout = -1; -+static int rtl8xxxu_dma_agg_pages = -1; - - MODULE_AUTHOR("Jes Sorensen "); - MODULE_DESCRIPTION("RTL8XXXu USB mac80211 Wireless LAN Driver"); -@@ -65,6 +67,10 @@ module_param_named(ht40_2g, rtl8xxxu_ht4 - MODULE_PARM_DESC(ht40_2g, "Enable HT40 support on the 2.4GHz band"); - module_param_named(dma_aggregation, rtl8xxxu_dma_aggregation, bool, 0600); - MODULE_PARM_DESC(dma_aggregation, "Enable DMA packet aggregation"); -+module_param_named(dma_agg_timeout, rtl8xxxu_dma_agg_timeout, int, 0600); -+MODULE_PARM_DESC(dma_agg_timeout, "Set DMA aggregation timeout (range 1-127)"); -+module_param_named(dma_agg_pages, rtl8xxxu_dma_agg_pages, int, 0600); -+MODULE_PARM_DESC(dma_agg_pages, "Set DMA aggregation pages (range 1-127, 0 to disable)"); - - #define USB_VENDOR_ID_REALTEK 0x0bda - #define RTL8XXXU_RX_URBS 32 -@@ -4441,6 +4447,18 @@ void rtl8xxxu_gen1_init_aggregation(stru - */ - - page_thresh = (priv->fops->rx_agg_buf_size / 512); -+ if (rtl8xxxu_dma_agg_pages >= 0) { -+ if (rtl8xxxu_dma_agg_pages <= page_thresh) -+ timeout = page_thresh; -+ else if (rtl8xxxu_dma_agg_pages <= 6) -+ dev_err(&priv->udev->dev, -+ "%s: dma_agg_pages=%i too small, minium is 6\n", -+ __func__, rtl8xxxu_dma_agg_pages); -+ else -+ dev_err(&priv->udev->dev, -+ "%s: dma_agg_pages=%i larger than limit %i\n", -+ __func__, rtl8xxxu_dma_agg_pages, page_thresh); -+ } - rtl8xxxu_write8(priv, REG_RXDMA_AGG_PG_TH, page_thresh); - /* - * REG_RXDMA_AGG_PG_TH + 1 seems to be the timeout register on -@@ -4448,6 +4466,16 @@ void rtl8xxxu_gen1_init_aggregation(stru - * don't set it, so better set both. - */ - timeout = 4; -+ -+ if (rtl8xxxu_dma_agg_timeout >= 0) { -+ if (rtl8xxxu_dma_agg_timeout <= 127) -+ timeout = rtl8xxxu_dma_agg_timeout; -+ else -+ dev_err(&priv->udev->dev, -+ "%s: Invalid dma_agg_timeout: %i\n", -+ __func__, rtl8xxxu_dma_agg_timeout); -+ } -+ - rtl8xxxu_write8(priv, REG_RXDMA_AGG_PG_TH + 1, timeout); - rtl8xxxu_write8(priv, REG_USB_DMA_AGG_TO, timeout); - priv->rx_buf_aggregation = 1; diff --git a/package/kernel/mac80211/patches/653-0001-rtl8xxxu-Accept-firmware-signature-0x88e0.patch b/package/kernel/mac80211/patches/653-0001-rtl8xxxu-Accept-firmware-signature-0x88e0.patch new file mode 100644 index 0000000000..c9b2e13a94 --- /dev/null +++ b/package/kernel/mac80211/patches/653-0001-rtl8xxxu-Accept-firmware-signature-0x88e0.patch @@ -0,0 +1,22 @@ +From f15fbdcb03abdf7403e8ebba52791cc596a8a8a6 Mon Sep 17 00:00:00 2001 +From: Jes Sorensen +Date: Mon, 27 Jun 2016 14:08:47 -0400 +Subject: [PATCH] rtl8xxxu: Accept firmware signature 0x88e0 + +rtl8188eu uses firmware signature 0x88e0 + +Signed-off-by: Jes Sorensen +--- + drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c | 1 + + 1 file changed, 1 insertion(+) + +--- a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c ++++ b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c +@@ -2097,6 +2097,7 @@ int rtl8xxxu_load_firmware(struct rtl8xx + switch (signature & 0xfff0) { + case 0x92e0: + case 0x92c0: ++ case 0x88e0: + case 0x88c0: + case 0x5300: + case 0x2300: diff --git a/package/kernel/mac80211/patches/653-0001-rtl8xxxu-Mark-0x20f4-0x648b-as-tested.patch b/package/kernel/mac80211/patches/653-0001-rtl8xxxu-Mark-0x20f4-0x648b-as-tested.patch deleted file mode 100644 index 6459c6b0a2..0000000000 --- a/package/kernel/mac80211/patches/653-0001-rtl8xxxu-Mark-0x20f4-0x648b-as-tested.patch +++ /dev/null @@ -1,46 +0,0 @@ -From b81669b9e0b4864f59421e7681512731fae01ab9 Mon Sep 17 00:00:00 2001 -From: Jes Sorensen -Date: Fri, 19 Aug 2016 17:46:23 -0400 -Subject: [PATCH] rtl8xxxu: Mark 0x20f4:0x648b as tested - -Successfully tested by Jocelyn Mayer - -Reported-by: J. Mayer -Signed-off-by: Jes Sorensen -Signed-off-by: Kalle Valo ---- - drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c | 9 +++++++-- - 1 file changed, 7 insertions(+), 2 deletions(-) - ---- a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c -+++ b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c -@@ -5971,6 +5971,10 @@ static int rtl8xxxu_probe(struct usb_int - if (id->idProduct == 0x1004) - untested = 0; - break; -+ case 0x20f4: -+ if (id->idProduct == 0x648b) -+ untested = 0; -+ break; - default: - break; - } -@@ -6140,6 +6144,9 @@ static struct usb_device_id dev_table[] - /* Tested by Andrea Merello */ - {USB_DEVICE_AND_INTERFACE_INFO(0x050d, 0x1004, 0xff, 0xff, 0xff), - .driver_info = (unsigned long)&rtl8192cu_fops}, -+/* Tested by Jocelyn Mayer */ -+{USB_DEVICE_AND_INTERFACE_INFO(0x20f4, 0x648b, 0xff, 0xff, 0xff), -+ .driver_info = (unsigned long)&rtl8192cu_fops}, - /* Currently untested 8188 series devices */ - {USB_DEVICE_AND_INTERFACE_INFO(USB_VENDOR_ID_REALTEK, 0x8191, 0xff, 0xff, 0xff), - .driver_info = (unsigned long)&rtl8192cu_fops}, -@@ -6199,8 +6206,6 @@ static struct usb_device_id dev_table[] - .driver_info = (unsigned long)&rtl8192cu_fops}, - {USB_DEVICE_AND_INTERFACE_INFO(0x2019, 0xed17, 0xff, 0xff, 0xff), - .driver_info = (unsigned long)&rtl8192cu_fops}, --{USB_DEVICE_AND_INTERFACE_INFO(0x20f4, 0x648b, 0xff, 0xff, 0xff), -- .driver_info = (unsigned long)&rtl8192cu_fops}, - {USB_DEVICE_AND_INTERFACE_INFO(0x4855, 0x0090, 0xff, 0xff, 0xff), - .driver_info = (unsigned long)&rtl8192cu_fops}, - {USB_DEVICE_AND_INTERFACE_INFO(0x4856, 0x0091, 0xff, 0xff, 0xff), diff --git a/package/kernel/mac80211/patches/653-0002-rtl8xxxu-Add-initial-code-to-detect-8188eu-devices.patch b/package/kernel/mac80211/patches/653-0002-rtl8xxxu-Add-initial-code-to-detect-8188eu-devices.patch new file mode 100644 index 0000000000..ebd35fcb29 --- /dev/null +++ b/package/kernel/mac80211/patches/653-0002-rtl8xxxu-Add-initial-code-to-detect-8188eu-devices.patch @@ -0,0 +1,121 @@ +From 6f971392cd52524058f179d7c78464d692fbb018 Mon Sep 17 00:00:00 2001 +From: Jes Sorensen +Date: Mon, 27 Jun 2016 14:23:44 -0400 +Subject: [PATCH] rtl8xxxu: Add initial code to detect 8188eu devices + +So far this just detects the device and tries to load firmware. + +Signed-off-by: Jes Sorensen +--- + drivers/net/wireless/realtek/rtl8xxxu/Makefile | 2 +- + drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu.h | 1 + + .../net/wireless/realtek/rtl8xxxu/rtl8xxxu_8188e.c | 65 ++++++++++++++++++++++ + .../net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c | 3 + + 4 files changed, 70 insertions(+), 1 deletion(-) + create mode 100644 drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_8188e.c + +--- a/drivers/net/wireless/realtek/rtl8xxxu/Makefile ++++ b/drivers/net/wireless/realtek/rtl8xxxu/Makefile +@@ -1,4 +1,4 @@ + obj-$(CPTCFG_RTL8XXXU) += rtl8xxxu.o + + rtl8xxxu-y := rtl8xxxu_core.o rtl8xxxu_8192e.o rtl8xxxu_8723b.o \ +- rtl8xxxu_8723a.o rtl8xxxu_8192c.o ++ rtl8xxxu_8723a.o rtl8xxxu_8192c.o rtl8xxxu_8188e.o +--- a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu.h ++++ b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu.h +@@ -1446,6 +1446,7 @@ void rtl8xxxu_fill_txdesc_v2(struct ieee + bool short_preamble, bool ampdu_enable, + u32 rts_rate); + ++extern struct rtl8xxxu_fileops rtl8188eu_fops; + extern struct rtl8xxxu_fileops rtl8192cu_fops; + extern struct rtl8xxxu_fileops rtl8192eu_fops; + extern struct rtl8xxxu_fileops rtl8723au_fops; +--- /dev/null ++++ b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_8188e.c +@@ -0,0 +1,65 @@ ++/* ++ * RTL8XXXU mac80211 USB driver - 8188e specific subdriver ++ * ++ * Copyright (c) 2014 - 2016 Jes Sorensen ++ * ++ * Portions, notably calibration code: ++ * Copyright(c) 2007 - 2011 Realtek Corporation. All rights reserved. ++ * ++ * This driver was written as a replacement for the vendor provided ++ * rtl8723au driver. As the Realtek 8xxx chips are very similar in ++ * their programming interface, I have started adding support for ++ * additional 8xxx chips like the 8192cu, 8188cus, etc. ++ * ++ * This program is free software; you can redistribute it and/or modify it ++ * under the terms of version 2 of the GNU General Public License as ++ * published by the Free Software Foundation. ++ * ++ * This program is distributed in the hope that it will be useful, but WITHOUT ++ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or ++ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for ++ * more details. ++ */ ++ ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include "rtl8xxxu.h" ++#include "rtl8xxxu_regs.h" ++ ++static int rtl8188eu_parse_efuse(struct rtl8xxxu_priv *priv) ++{ ++ return 0; ++} ++ ++static int rtl8188eu_load_firmware(struct rtl8xxxu_priv *priv) ++{ ++ char *fw_name; ++ int ret; ++ ++ fw_name = "rtlwifi/rtl8188eufw.bin"; ++ ++ ret = rtl8xxxu_load_firmware(priv, fw_name); ++ ++ return -EINVAL; ++ return ret; ++} ++ ++struct rtl8xxxu_fileops rtl8188eu_fops = { ++ .parse_efuse = rtl8188eu_parse_efuse, ++ .load_firmware = rtl8188eu_load_firmware, ++ .reset_8051 = rtl8xxxu_reset_8051, ++}; +--- a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c ++++ b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c +@@ -54,6 +54,7 @@ MODULE_LICENSE("GPL"); + MODULE_FIRMWARE("rtlwifi/rtl8723aufw_A.bin"); + MODULE_FIRMWARE("rtlwifi/rtl8723aufw_B.bin"); + MODULE_FIRMWARE("rtlwifi/rtl8723aufw_B_NoBT.bin"); ++MODULE_FIRMWARE("rtlwifi/rtl8188eufw.bin"); + MODULE_FIRMWARE("rtlwifi/rtl8192cufw_A.bin"); + MODULE_FIRMWARE("rtlwifi/rtl8192cufw_B.bin"); + MODULE_FIRMWARE("rtlwifi/rtl8192cufw_TMSC.bin"); +@@ -6195,6 +6196,8 @@ static struct usb_device_id dev_table[] + {USB_DEVICE_AND_INTERFACE_INFO(USB_VENDOR_ID_REALTEK, 0xb720, 0xff, 0xff, 0xff), + .driver_info = (unsigned long)&rtl8723bu_fops}, + #ifdef CPTCFG_RTL8XXXU_UNTESTED ++{USB_DEVICE_AND_INTERFACE_INFO(USB_VENDOR_ID_REALTEK, 0x8179, 0xff, 0xff, 0xff), ++ .driver_info = (unsigned long)&rtl8188eu_fops}, + /* Still supported by rtlwifi */ + {USB_DEVICE_AND_INTERFACE_INFO(USB_VENDOR_ID_REALTEK, 0x8176, 0xff, 0xff, 0xff), + .driver_info = (unsigned long)&rtl8192cu_fops}, diff --git a/package/kernel/mac80211/patches/653-0002-rtl8xxxu-Mark-0x2001-0x3308-as-tested.patch b/package/kernel/mac80211/patches/653-0002-rtl8xxxu-Mark-0x2001-0x3308-as-tested.patch deleted file mode 100644 index 0da8f36a1f..0000000000 --- a/package/kernel/mac80211/patches/653-0002-rtl8xxxu-Mark-0x2001-0x3308-as-tested.patch +++ /dev/null @@ -1,46 +0,0 @@ -From 76a8e07d49b65294ed006ff1e37fa152a1bfd230 Mon Sep 17 00:00:00 2001 -From: Jes Sorensen -Date: Fri, 19 Aug 2016 17:46:24 -0400 -Subject: [PATCH] rtl8xxxu: Mark 0x2001:0x3308 as tested - -D-Link DWA-121 is reported as working. - -Reported-by: Stefano Bravi -Signed-off-by: Jes Sorensen -Signed-off-by: Kalle Valo ---- - drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c | 9 +++++++-- - 1 file changed, 7 insertions(+), 2 deletions(-) - ---- a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c -+++ b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c -@@ -5975,6 +5975,10 @@ static int rtl8xxxu_probe(struct usb_int - if (id->idProduct == 0x648b) - untested = 0; - break; -+ case 0x2001: -+ if (id->idProduct == 0x3308) -+ untested = 0; -+ break; - default: - break; - } -@@ -6147,6 +6151,9 @@ static struct usb_device_id dev_table[] - /* Tested by Jocelyn Mayer */ - {USB_DEVICE_AND_INTERFACE_INFO(0x20f4, 0x648b, 0xff, 0xff, 0xff), - .driver_info = (unsigned long)&rtl8192cu_fops}, -+/* Tested by Stefano Bravi */ -+{USB_DEVICE_AND_INTERFACE_INFO(0x2001, 0x3308, 0xff, 0xff, 0xff), -+ .driver_info = (unsigned long)&rtl8192cu_fops}, - /* Currently untested 8188 series devices */ - {USB_DEVICE_AND_INTERFACE_INFO(USB_VENDOR_ID_REALTEK, 0x8191, 0xff, 0xff, 0xff), - .driver_info = (unsigned long)&rtl8192cu_fops}, -@@ -6194,8 +6201,6 @@ static struct usb_device_id dev_table[] - .driver_info = (unsigned long)&rtl8192cu_fops}, - {USB_DEVICE_AND_INTERFACE_INFO(0x13d3, 0x3357, 0xff, 0xff, 0xff), - .driver_info = (unsigned long)&rtl8192cu_fops}, --{USB_DEVICE_AND_INTERFACE_INFO(0x2001, 0x3308, 0xff, 0xff, 0xff), -- .driver_info = (unsigned long)&rtl8192cu_fops}, - {USB_DEVICE_AND_INTERFACE_INFO(0x2001, 0x330b, 0xff, 0xff, 0xff), - .driver_info = (unsigned long)&rtl8192cu_fops}, - {USB_DEVICE_AND_INTERFACE_INFO(0x2019, 0x4902, 0xff, 0xff, 0xff), diff --git a/package/kernel/mac80211/patches/653-0003-rtl8xxxu-Add-initial-code-to-parse-8188eu-efuse.patch b/package/kernel/mac80211/patches/653-0003-rtl8xxxu-Add-initial-code-to-parse-8188eu-efuse.patch new file mode 100644 index 0000000000..1905899e76 --- /dev/null +++ b/package/kernel/mac80211/patches/653-0003-rtl8xxxu-Add-initial-code-to-parse-8188eu-efuse.patch @@ -0,0 +1,113 @@ +From 6d5b4ef30046d74efe773613767d13d9ab95ed3d Mon Sep 17 00:00:00 2001 +From: Jes Sorensen +Date: Mon, 27 Jun 2016 15:19:04 -0400 +Subject: [PATCH] rtl8xxxu: Add initial code to parse 8188eu efuse + +This obtains the MAC address, but work is still needed to handle TX +power settings. + +Signed-off-by: Jes Sorensen +--- + drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu.h | 40 ++++++++++++++++++++++ + .../net/wireless/realtek/rtl8xxxu/rtl8xxxu_8188e.c | 34 ++++++++++++++++++ + 2 files changed, 74 insertions(+) + +--- a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu.h ++++ b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu.h +@@ -872,6 +872,45 @@ struct rtl8192eu_efuse { + u8 res14[0xc3]; + }; + ++struct rtl8188eu_efuse { ++ __le16 rtl_id; ++ u8 res0[0x0e]; ++ u8 cck_tx_power_index_A[3]; /* 0x10 */ ++ u8 cck_tx_power_index_B[3]; ++ u8 ht40_1s_tx_power_index_A[3]; /* 0x16 */ ++ u8 ht40_1s_tx_power_index_B[3]; ++ u8 res1[0x9c]; ++ u8 channel_plan; /* 0xb8 */ ++ u8 xtal_k; ++ u8 thermal_meter; ++ u8 iqk_lck; ++ u8 res2[5]; ++ u8 rf_board_option; ++ u8 rf_feature_option; ++ u8 rf_bt_setting; ++ u8 eeprom_version; ++ u8 eeprom_customer_id; ++ u8 res3[3]; ++ u8 rf_antenna_option; /* 0xc9 */ ++ u8 res4[6]; ++ u8 vid; /* 0xd0 */ ++ u8 res5[1]; ++ u8 pid; /* 0xd2 */ ++ u8 res6[1]; ++ u8 usb_optional_function; ++ u8 res7[2]; ++ u8 mac_addr[ETH_ALEN]; /* 0xd7 */ ++ u8 res8[2]; ++ u8 vendor_name[7]; ++ u8 res9[2]; ++ u8 device_name[0x0b]; /* 0xe8 */ ++ u8 res10[2]; ++ u8 serial[0x0b]; /* 0xf5 */ ++ u8 res11[0x30]; ++ u8 unknown[0x0d]; /* 0x130 */ ++ u8 res12[0xc3]; ++}; ++ + struct rtl8xxxu_reg8val { + u16 reg; + u8 val; +@@ -1290,6 +1329,7 @@ struct rtl8xxxu_priv { + struct rtl8723bu_efuse efuse8723bu; + struct rtl8192cu_efuse efuse8192; + struct rtl8192eu_efuse efuse8192eu; ++ struct rtl8188eu_efuse efuse8188eu; + } efuse_wifi; + u32 adda_backup[RTL8XXXU_ADDA_REGS]; + u32 mac_backup[RTL8XXXU_MAC_REGS]; +--- a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_8188e.c ++++ b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_8188e.c +@@ -42,6 +42,40 @@ + + static int rtl8188eu_parse_efuse(struct rtl8xxxu_priv *priv) + { ++ struct rtl8188eu_efuse *efuse = &priv->efuse_wifi.efuse8188eu; ++ int i; ++ ++ if (efuse->rtl_id != cpu_to_le16(0x8129)) ++ return -EINVAL; ++ ++ ether_addr_copy(priv->mac_addr, efuse->mac_addr); ++ ++ memcpy(priv->cck_tx_power_index_A, efuse->cck_tx_power_index_A, ++ sizeof(efuse->cck_tx_power_index_A)); ++ memcpy(priv->cck_tx_power_index_B, efuse->cck_tx_power_index_B, ++ sizeof(efuse->cck_tx_power_index_B)); ++ ++ memcpy(priv->ht40_1s_tx_power_index_A, ++ priv->efuse_wifi.efuse8188eu.ht40_1s_tx_power_index_A, ++ sizeof(priv->ht40_1s_tx_power_index_A)); ++ memcpy(priv->ht40_1s_tx_power_index_B, ++ priv->efuse_wifi.efuse8188eu.ht40_1s_tx_power_index_B, ++ sizeof(priv->ht40_1s_tx_power_index_B)); ++ ++ dev_info(&priv->udev->dev, "Vendor: %.7s\n", efuse->vendor_name); ++ dev_info(&priv->udev->dev, "Product: %.11s\n", efuse->device_name); ++ dev_info(&priv->udev->dev, "Serial: %.11s\n", efuse->serial); ++ ++ if (rtl8xxxu_debug & RTL8XXXU_DEBUG_EFUSE) { ++ unsigned char *raw = priv->efuse_wifi.raw; ++ ++ dev_info(&priv->udev->dev, ++ "%s: dumping efuse (0x%02zx bytes):\n", ++ __func__, sizeof(struct rtl8188eu_efuse)); ++ for (i = 0; i < sizeof(struct rtl8188eu_efuse); i += 8) ++ dev_info(&priv->udev->dev, "%02x: %8ph\n", i, &raw[i]); ++ } ++ + return 0; + } + diff --git a/package/kernel/mac80211/patches/653-0003-rtl8xxxu-Fix-error-handling-if-rtl8xxxu_init_device-.patch b/package/kernel/mac80211/patches/653-0003-rtl8xxxu-Fix-error-handling-if-rtl8xxxu_init_device-.patch deleted file mode 100644 index d19f48f0eb..0000000000 --- a/package/kernel/mac80211/patches/653-0003-rtl8xxxu-Fix-error-handling-if-rtl8xxxu_init_device-.patch +++ /dev/null @@ -1,67 +0,0 @@ -From deb6176e561324884652dd6a49a862bd8b152959 Mon Sep 17 00:00:00 2001 -From: Jes Sorensen -Date: Fri, 19 Aug 2016 17:46:25 -0400 -Subject: [PATCH] rtl8xxxu: Fix error handling if rtl8xxxu_init_device() fails - -For some reason we lost the code bailing if rtl8xxxu_init_device() -returned an error. - -This catches the error and also cleans up the error handling. - -Signed-off-by: Jes Sorensen -Signed-off-by: Kalle Valo ---- - .../net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c | 20 +++++++++++++++++--- - 1 file changed, 17 insertions(+), 3 deletions(-) - ---- a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c -+++ b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c -@@ -5947,7 +5947,7 @@ static int rtl8xxxu_probe(struct usb_int - struct ieee80211_hw *hw; - struct usb_device *udev; - struct ieee80211_supported_band *sband; -- int ret = 0; -+ int ret; - int untested = 1; - - udev = usb_get_dev(interface_to_usbdev(interface)); -@@ -5995,6 +5995,7 @@ static int rtl8xxxu_probe(struct usb_int - hw = ieee80211_alloc_hw(sizeof(struct rtl8xxxu_priv), &rtl8xxxu_ops); - if (!hw) { - ret = -ENOMEM; -+ priv = NULL; - goto exit; - } - -@@ -6043,6 +6044,8 @@ static int rtl8xxxu_probe(struct usb_int - } - - ret = rtl8xxxu_init_device(hw); -+ if (ret) -+ goto exit; - - hw->wiphy->max_scan_ssids = 1; - hw->wiphy->max_scan_ie_len = IEEE80211_MAX_DATA_LEN; -@@ -6093,9 +6096,20 @@ static int rtl8xxxu_probe(struct usb_int - goto exit; - } - -+ return 0; -+ - exit: -- if (ret < 0) -- usb_put_dev(udev); -+ usb_set_intfdata(interface, NULL); -+ -+ if (priv) { -+ kfree(priv->fw_data); -+ mutex_destroy(&priv->usb_buf_mutex); -+ mutex_destroy(&priv->h2c_mutex); -+ } -+ usb_put_dev(udev); -+ -+ ieee80211_free_hw(hw); -+ - return ret; - } - diff --git a/package/kernel/mac80211/patches/653-0004-rtl8xxxu-Add-TP-Link-TL-WN823N-v2-to-list-of-support.patch b/package/kernel/mac80211/patches/653-0004-rtl8xxxu-Add-TP-Link-TL-WN823N-v2-to-list-of-support.patch deleted file mode 100644 index 8475a82757..0000000000 --- a/package/kernel/mac80211/patches/653-0004-rtl8xxxu-Add-TP-Link-TL-WN823N-v2-to-list-of-support.patch +++ /dev/null @@ -1,39 +0,0 @@ -From 690a6d268bdf85f8d233823a18d3200b99e5568d Mon Sep 17 00:00:00 2001 -From: Jes Sorensen -Date: Fri, 19 Aug 2016 17:46:26 -0400 -Subject: [PATCH] rtl8xxxu: Add TP-Link TL-WN823N v2 to list of supported - devices - -This is an rtl8192eu based dongle (the v1 is an rtl8192cu). Reported -and tested by Myckel Habets. - -Reported-by: Myckel Habets -Signed-off-by: Jes Sorensen -Signed-off-by: Kalle Valo ---- - drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c | 7 +++++++ - 1 file changed, 7 insertions(+) - ---- a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c -+++ b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c -@@ -5979,6 +5979,10 @@ static int rtl8xxxu_probe(struct usb_int - if (id->idProduct == 0x3308) - untested = 0; - break; -+ case 0x2357: -+ if (id->idProduct == 0x0109) -+ untested = 0; -+ break; - default: - break; - } -@@ -6146,6 +6150,9 @@ static struct usb_device_id dev_table[] - .driver_info = (unsigned long)&rtl8723au_fops}, - {USB_DEVICE_AND_INTERFACE_INFO(USB_VENDOR_ID_REALTEK, 0x818b, 0xff, 0xff, 0xff), - .driver_info = (unsigned long)&rtl8192eu_fops}, -+/* Tested by Myckel Habets */ -+{USB_DEVICE_AND_INTERFACE_INFO(0x2357, 0x0109, 0xff, 0xff, 0xff), -+ .driver_info = (unsigned long)&rtl8192eu_fops}, - {USB_DEVICE_AND_INTERFACE_INFO(USB_VENDOR_ID_REALTEK, 0xb720, 0xff, 0xff, 0xff), - .driver_info = (unsigned long)&rtl8723bu_fops}, - #ifdef CPTCFG_RTL8XXXU_UNTESTED diff --git a/package/kernel/mac80211/patches/653-0004-rtl8xxxu-Detect-8188eu-parts-correctly.patch b/package/kernel/mac80211/patches/653-0004-rtl8xxxu-Detect-8188eu-parts-correctly.patch new file mode 100644 index 0000000000..83220e88f6 --- /dev/null +++ b/package/kernel/mac80211/patches/653-0004-rtl8xxxu-Detect-8188eu-parts-correctly.patch @@ -0,0 +1,43 @@ +From ac5a363d61caee80e7b4464e55ab012a4450ef5d Mon Sep 17 00:00:00 2001 +From: Jes Sorensen +Date: Mon, 27 Jun 2016 15:34:00 -0400 +Subject: [PATCH] rtl8xxxu: Detect 8188eu parts correctly + +8188 parts with chip_cut >= 2 are assumed to be 8188eu. + +Signed-off-by: Jes Sorensen +--- + .../net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c | 22 +++++++++++++++------- + 1 file changed, 15 insertions(+), 7 deletions(-) + +--- a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c ++++ b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c +@@ -1683,13 +1683,21 @@ static int rtl8xxxu_identify_chip(struct + } + priv->has_wifi = 1; + } else { +- sprintf(priv->chip_name, "8188CU"); +- priv->rf_paths = 1; +- priv->rx_paths = 1; +- priv->tx_paths = 1; +- priv->rtl_chip = RTL8188C; +- priv->usb_interrupts = 1; +- priv->has_wifi = 1; ++ if (priv->chip_cut >= 2) { ++ sprintf(priv->chip_name, "8188EU"); ++ priv->rf_paths = 1; ++ priv->rx_paths = 1; ++ priv->tx_paths = 1; ++ priv->rtl_chip = RTL8188E; ++ } else { ++ sprintf(priv->chip_name, "8188CU"); ++ priv->rf_paths = 1; ++ priv->rx_paths = 1; ++ priv->tx_paths = 1; ++ priv->rtl_chip = RTL8188C; ++ priv->usb_interrupts = 1; ++ priv->has_wifi = 1; ++ } + } + + switch (priv->rtl_chip) { diff --git a/package/kernel/mac80211/patches/653-0005-rtl8xxxu-Add-TX-page-defines-for-8723b.patch b/package/kernel/mac80211/patches/653-0005-rtl8xxxu-Add-TX-page-defines-for-8723b.patch deleted file mode 100644 index 34bd5d85bf..0000000000 --- a/package/kernel/mac80211/patches/653-0005-rtl8xxxu-Add-TX-page-defines-for-8723b.patch +++ /dev/null @@ -1,48 +0,0 @@ -From 44abaa08d002235e1bbc2b9e0fd46a64e4694596 Mon Sep 17 00:00:00 2001 -From: Jes Sorensen -Date: Fri, 19 Aug 2016 17:46:27 -0400 -Subject: [PATCH] rtl8xxxu: Add TX page defines for 8723b - -This switches the 8723b driver to use the new -rtl8xxxu_init_queue_reserved_page() function. - -Signed-off-by: Jes Sorensen -Signed-off-by: Kalle Valo ---- - drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu.h | 6 ++++++ - drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_8723b.c | 4 ++++ - 2 files changed, 10 insertions(+) - ---- a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu.h -+++ b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu.h -@@ -43,6 +43,7 @@ - - #define TX_TOTAL_PAGE_NUM 0xf8 - #define TX_TOTAL_PAGE_NUM_8192E 0xf3 -+#define TX_TOTAL_PAGE_NUM_8723B 0xf7 - /* (HPQ + LPQ + NPQ + PUBQ) = TX_TOTAL_PAGE_NUM */ - #define TX_PAGE_NUM_PUBQ 0xe7 - #define TX_PAGE_NUM_HI_PQ 0x0c -@@ -54,6 +55,11 @@ - #define TX_PAGE_NUM_LO_PQ_8192E 0x0c - #define TX_PAGE_NUM_NORM_PQ_8192E 0x00 - -+#define TX_PAGE_NUM_PUBQ_8723B 0xe7 -+#define TX_PAGE_NUM_HI_PQ_8723B 0x0c -+#define TX_PAGE_NUM_LO_PQ_8723B 0x02 -+#define TX_PAGE_NUM_NORM_PQ_8723B 0x02 -+ - #define RTL_FW_PAGE_SIZE 4096 - #define RTL8XXXU_FIRMWARE_POLL_MAX 1000 - ---- a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_8723b.c -+++ b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_8723b.c -@@ -1674,4 +1674,8 @@ struct rtl8xxxu_fileops rtl8723bu_fops = - .pbp_rx = PBP_PAGE_SIZE_256, - .pbp_tx = PBP_PAGE_SIZE_256, - .mactable = rtl8723b_mac_init_table, -+ .total_page_num = TX_TOTAL_PAGE_NUM_8723B, -+ .page_num_hi = TX_PAGE_NUM_HI_PQ_8723B, -+ .page_num_lo = TX_PAGE_NUM_LO_PQ_8723B, -+ .page_num_norm = TX_PAGE_NUM_NORM_PQ_8723B, - }; diff --git a/package/kernel/mac80211/patches/653-0005-rtl8xxxu-First-stab-at-rtl8188e_power_on.patch b/package/kernel/mac80211/patches/653-0005-rtl8xxxu-First-stab-at-rtl8188e_power_on.patch new file mode 100644 index 0000000000..dbba85b4b9 --- /dev/null +++ b/package/kernel/mac80211/patches/653-0005-rtl8xxxu-First-stab-at-rtl8188e_power_on.patch @@ -0,0 +1,105 @@ +From a7c3d46915bce6d84e61e684e76564b034bdc1a9 Mon Sep 17 00:00:00 2001 +From: Jes Sorensen +Date: Mon, 27 Jun 2016 17:08:30 -0400 +Subject: [PATCH] rtl8xxxu: First stab at rtl8188e_power_on() + +Code based on code from Andrea Merello. + +Signed-off-by: Jes Sorensen +--- + .../net/wireless/realtek/rtl8xxxu/rtl8xxxu_8188e.c | 82 ++++++++++++++++++++++ + 1 file changed, 82 insertions(+) + +--- a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_8188e.c ++++ b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_8188e.c +@@ -92,8 +92,90 @@ static int rtl8188eu_load_firmware(struc + return ret; + } + ++static int rtl8188e_emu_to_active(struct rtl8xxxu_priv *priv) ++{ ++ u8 val8; ++ u32 val32; ++ u16 val16; ++ int count, ret = 0; ++ ++ /* wait till 0x04[17] = 1 power ready*/ ++ for (count = RTL8XXXU_MAX_REG_POLL; count; count--) { ++ val32 = rtl8xxxu_read32(priv, REG_APS_FSMCO); ++ if (val32 & BIT(17)) ++ break; ++ ++ udelay(10); ++ } ++ ++ if (!count) { ++ ret = -EBUSY; ++ goto exit; ++ } ++ ++ /* reset baseband */ ++ val8 = rtl8xxxu_read8(priv, REG_SYS_FUNC); ++ val8 &= ~(SYS_FUNC_BBRSTB | SYS_FUNC_BB_GLB_RSTN); ++ rtl8xxxu_write8(priv, REG_SYS_FUNC, val8); ++ ++ /*0x24[23] = 2b'01 schmit trigger */ ++ val32 = rtl8xxxu_read32(priv, REG_AFE_XTAL_CTRL); ++ val32 |= BIT(23); ++ rtl8xxxu_write32(priv, REG_AFE_XTAL_CTRL, val32); ++ ++ /* 0x04[15] = 0 disable HWPDN (control by DRV)*/ ++ val16 = rtl8xxxu_read16(priv, REG_APS_FSMCO); ++ val16 &= ~APS_FSMCO_HW_POWERDOWN; ++ rtl8xxxu_write16(priv, REG_APS_FSMCO, val16); ++ ++ /*0x04[12:11] = 2b'00 disable WL suspend*/ ++ val16 = rtl8xxxu_read16(priv, REG_APS_FSMCO); ++ val16 &= ~(APS_FSMCO_HW_SUSPEND | APS_FSMCO_PCIE); ++ rtl8xxxu_write16(priv, REG_APS_FSMCO, val16); ++ ++ /* set, then poll until 0 */ ++ val32 = rtl8xxxu_read32(priv, REG_APS_FSMCO); ++ val32 |= APS_FSMCO_MAC_ENABLE; ++ rtl8xxxu_write32(priv, REG_APS_FSMCO, val32); ++ ++ for (count = RTL8XXXU_MAX_REG_POLL; count; count--) { ++ val32 = rtl8xxxu_read32(priv, REG_APS_FSMCO); ++ if ((val32 & APS_FSMCO_MAC_ENABLE) == 0) { ++ ret = 0; ++ break; ++ } ++ udelay(10); ++ } ++ ++ if (!count) { ++ ret = -EBUSY; ++ goto exit; ++ } ++ ++ /* LDO normal mode*/ ++ val8 = rtl8xxxu_read8(priv, REG_LPLDO_CTRL); ++ val8 &= ~BIT(4); ++ rtl8xxxu_write8(priv, REG_LPLDO_CTRL, val8); ++ ++exit: ++ return ret; ++} ++ ++static int rtl8188eu_power_on(struct rtl8xxxu_priv *priv) ++{ ++ int ret; ++ ++ ret = rtl8188e_emu_to_active(priv); ++ if (ret) ++ goto exit; ++ ++exit: ++ return ret; ++} ++ + struct rtl8xxxu_fileops rtl8188eu_fops = { + .parse_efuse = rtl8188eu_parse_efuse, + .load_firmware = rtl8188eu_load_firmware, ++ .power_on = rtl8188eu_power_on, + .reset_8051 = rtl8xxxu_reset_8051, + }; diff --git a/package/kernel/mac80211/patches/653-0006-rtl8xxxu-Add-rtl8188e_disabled_to_emu.patch b/package/kernel/mac80211/patches/653-0006-rtl8xxxu-Add-rtl8188e_disabled_to_emu.patch new file mode 100644 index 0000000000..066f2fe241 --- /dev/null +++ b/package/kernel/mac80211/patches/653-0006-rtl8xxxu-Add-rtl8188e_disabled_to_emu.patch @@ -0,0 +1,40 @@ +From b7335df2dc1b4c6c69ac6b95910d09a7dd5295a7 Mon Sep 17 00:00:00 2001 +From: Jes Sorensen +Date: Wed, 29 Jun 2016 10:38:52 -0400 +Subject: [PATCH] rtl8xxxu: Add rtl8188e_disabled_to_emu() + +This sequence is found in the vendor driver, but never actually +called. It's unclear if we need it. + +Signed-off-by: Jes Sorensen +--- + drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_8188e.c | 11 +++++++++++ + 1 file changed, 11 insertions(+) + +--- a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_8188e.c ++++ b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_8188e.c +@@ -92,6 +92,15 @@ static int rtl8188eu_load_firmware(struc + return ret; + } + ++static void rtl8188e_disabled_to_emu(struct rtl8xxxu_priv *priv) ++{ ++ u16 val16; ++ ++ val16 = rtl8xxxu_read16(priv, REG_APS_FSMCO); ++ val16 &= ~(APS_FSMCO_PFM_WOWL | APS_FSMCO_ENABLE_POWERDOWN); ++ rtl8xxxu_write16(priv, REG_APS_FSMCO, val16); ++} ++ + static int rtl8188e_emu_to_active(struct rtl8xxxu_priv *priv) + { + u8 val8; +@@ -165,6 +174,8 @@ static int rtl8188eu_power_on(struct rtl + { + int ret; + ++ rtl8188e_disabled_to_emu(priv); ++ + ret = rtl8188e_emu_to_active(priv); + if (ret) + goto exit; diff --git a/package/kernel/mac80211/patches/653-0006-rtl8xxxu-Switch-8723a-to-use-new-rtl8xxxu_init_queue.patch b/package/kernel/mac80211/patches/653-0006-rtl8xxxu-Switch-8723a-to-use-new-rtl8xxxu_init_queue.patch deleted file mode 100644 index 151337ca0f..0000000000 --- a/package/kernel/mac80211/patches/653-0006-rtl8xxxu-Switch-8723a-to-use-new-rtl8xxxu_init_queue.patch +++ /dev/null @@ -1,27 +0,0 @@ -From e366f45d36275b80a5615c68123c88a3de75cc22 Mon Sep 17 00:00:00 2001 -From: Jes Sorensen -Date: Fri, 19 Aug 2016 17:46:28 -0400 -Subject: [PATCH] rtl8xxxu: Switch 8723a to use new - rtl8xxxu_init_queue_reserved_page() routine - -This changes the pub-queue value written to REQ_RQPN, however the old -code used a hard coded minimum value assuming there would always be an -active lo-queue, even when no USB EP was found for it. - -Signed-off-by: Jes Sorensen -Signed-off-by: Kalle Valo ---- - drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_8723a.c | 4 ++++ - 1 file changed, 4 insertions(+) - ---- a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_8723a.c -+++ b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_8723a.c -@@ -396,4 +396,8 @@ struct rtl8xxxu_fileops rtl8723au_fops = - .pbp_rx = PBP_PAGE_SIZE_128, - .pbp_tx = PBP_PAGE_SIZE_128, - .mactable = rtl8xxxu_gen1_mac_init_table, -+ .total_page_num = TX_TOTAL_PAGE_NUM, -+ .page_num_hi = TX_PAGE_NUM_HI_PQ, -+ .page_num_lo = TX_PAGE_NUM_LO_PQ, -+ .page_num_norm = TX_PAGE_NUM_NORM_PQ, - }; diff --git a/package/kernel/mac80211/patches/653-0007-rtl8xxxu-8188e-Enable-scheduler.patch b/package/kernel/mac80211/patches/653-0007-rtl8xxxu-8188e-Enable-scheduler.patch new file mode 100644 index 0000000000..99f9152cac --- /dev/null +++ b/package/kernel/mac80211/patches/653-0007-rtl8xxxu-8188e-Enable-scheduler.patch @@ -0,0 +1,45 @@ +From 682ffd261c494581b8fdbc81f42035a53c67f5c4 Mon Sep 17 00:00:00 2001 +From: Jes Sorensen +Date: Wed, 29 Jun 2016 11:07:13 -0400 +Subject: [PATCH] rtl8xxxu: 8188e: Enable scheduler + +This enables the schduler, DMA, etc, except for MAC RX/TX which has to +be set after REG_TRXFF_BNDY due to a hardware bug in the 8188e + +Signed-off-by: Jes Sorensen +--- + drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_8188e.c | 16 ++++++++++++++++ + 1 file changed, 16 insertions(+) + +--- a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_8188e.c ++++ b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_8188e.c +@@ -172,6 +172,7 @@ exit: + + static int rtl8188eu_power_on(struct rtl8xxxu_priv *priv) + { ++ u16 val16; + int ret; + + rtl8188e_disabled_to_emu(priv); +@@ -180,6 +181,21 @@ static int rtl8188eu_power_on(struct rtl + if (ret) + goto exit; + ++ /* ++ * Enable MAC DMA/WMAC/SCHEDULE/SEC block ++ * Set CR bit10 to enable 32k calibration. ++ * We do not set CR_MAC_TX_ENABLE | CR_MAC_RX_ENABLE here ++ * due to a hardware bug in the 88E, requiring those to be ++ * set after REG_TRXFF_BNDY is set. If not the RXFF bundary ++ * will get set to a larger buffer size than the real buffer ++ * size. ++ */ ++ val16 = (CR_HCI_TXDMA_ENABLE | CR_HCI_RXDMA_ENABLE | ++ CR_TXDMA_ENABLE | CR_RXDMA_ENABLE | ++ CR_PROTOCOL_ENABLE | CR_SCHEDULE_ENABLE | ++ CR_SECURITY_ENABLE | CR_CALTIMER_ENABLE); ++ rtl8xxxu_write16(priv, REG_CR, val16); ++ + exit: + return ret; + } diff --git a/package/kernel/mac80211/patches/653-0007-rtl8xxxu-Switch-8192cu-8188cu-devices-to-use-rtl8xxx.patch b/package/kernel/mac80211/patches/653-0007-rtl8xxxu-Switch-8192cu-8188cu-devices-to-use-rtl8xxx.patch deleted file mode 100644 index e5ccf97be3..0000000000 --- a/package/kernel/mac80211/patches/653-0007-rtl8xxxu-Switch-8192cu-8188cu-devices-to-use-rtl8xxx.patch +++ /dev/null @@ -1,27 +0,0 @@ -From b492940dc1f7372fb95930dc5bde8d7dbc560cd3 Mon Sep 17 00:00:00 2001 -From: Jes Sorensen -Date: Fri, 19 Aug 2016 17:46:29 -0400 -Subject: [PATCH] rtl8xxxu: Switch 8192cu/8188cu devices to use - rtl8xxxu_init_queue_reserved_page() - -This was the last user of the old -rtl8xxxu_old_init_queue_reserved_page() which can now be removed. - -Signed-off-by: Jes Sorensen -Signed-off-by: Kalle Valo ---- - drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_8192c.c | 4 ++++ - 1 file changed, 4 insertions(+) - ---- a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_8192c.c -+++ b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_8192c.c -@@ -579,5 +579,9 @@ struct rtl8xxxu_fileops rtl8192cu_fops = - .pbp_rx = PBP_PAGE_SIZE_128, - .pbp_tx = PBP_PAGE_SIZE_128, - .mactable = rtl8xxxu_gen1_mac_init_table, -+ .total_page_num = TX_TOTAL_PAGE_NUM, -+ .page_num_hi = TX_PAGE_NUM_HI_PQ, -+ .page_num_lo = TX_PAGE_NUM_LO_PQ, -+ .page_num_norm = TX_PAGE_NUM_NORM_PQ, - }; - #endif diff --git a/package/kernel/mac80211/patches/653-0008-rtl8xxxu-Add-rtl8188e_usb_quirk-for-enabling-MAC-TX-.patch b/package/kernel/mac80211/patches/653-0008-rtl8xxxu-Add-rtl8188e_usb_quirk-for-enabling-MAC-TX-.patch new file mode 100644 index 0000000000..fa62d6d9b1 --- /dev/null +++ b/package/kernel/mac80211/patches/653-0008-rtl8xxxu-Add-rtl8188e_usb_quirk-for-enabling-MAC-TX-.patch @@ -0,0 +1,40 @@ +From 58edb5e9811879e0a8e87f90057f12f615eab2d1 Mon Sep 17 00:00:00 2001 +From: Jes Sorensen +Date: Wed, 29 Jun 2016 11:47:10 -0400 +Subject: [PATCH] rtl8xxxu: Add rtl8188e_usb_quirk() for enabling MAC TX/RX + +Due to a bug in the 8188e chips, this has to be done after setting +REG_TRXFF_BNDY. + +Signed-off-by: Jes Sorensen +--- + drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_8188e.c | 15 +++++++++++++++ + 1 file changed, 15 insertions(+) + +--- a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_8188e.c ++++ b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_8188e.c +@@ -200,9 +200,24 @@ exit: + return ret; + } + ++static void rtl8188e_usb_quirks(struct rtl8xxxu_priv *priv) ++{ ++ u16 val16; ++ ++ /* ++ * Technically this is not a USB quirk, but a chip quirk. ++ * This has to be done after REG_TRXFF_BNDY is set, see ++ * rtl8188eu_power_on() for details. ++ */ ++ val16 = rtl8xxxu_read16(priv, REG_CR); ++ val16 |= (CR_MAC_TX_ENABLE | CR_MAC_RX_ENABLE); ++ rtl8xxxu_write16(priv, REG_CR, val16); ++} ++ + struct rtl8xxxu_fileops rtl8188eu_fops = { + .parse_efuse = rtl8188eu_parse_efuse, + .load_firmware = rtl8188eu_load_firmware, + .power_on = rtl8188eu_power_on, + .reset_8051 = rtl8xxxu_reset_8051, ++ .usb_quirks = rtl8188e_usb_quirks, + }; diff --git a/package/kernel/mac80211/patches/653-0008-rtl8xxxu-Remove-now-obsolete-rtl8xxxu_old_init_queue.patch b/package/kernel/mac80211/patches/653-0008-rtl8xxxu-Remove-now-obsolete-rtl8xxxu_old_init_queue.patch deleted file mode 100644 index 9cb4d46e14..0000000000 --- a/package/kernel/mac80211/patches/653-0008-rtl8xxxu-Remove-now-obsolete-rtl8xxxu_old_init_queue.patch +++ /dev/null @@ -1,61 +0,0 @@ -From efeb8ce7a98cfb60932c6a53ce86359bf6b33b67 Mon Sep 17 00:00:00 2001 -From: Jes Sorensen -Date: Fri, 19 Aug 2016 17:46:30 -0400 -Subject: [PATCH] rtl8xxxu: Remove now obsolete - rtl8xxxu_old_init_queue_reserved_page() - -Switching over the old devices to use the new function allows us to -get rid of this legacy. - -Signed-off-by: Jes Sorensen -Signed-off-by: Kalle Valo ---- - .../net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c | 30 ++-------------------- - 1 file changed, 2 insertions(+), 28 deletions(-) - ---- a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c -+++ b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c -@@ -3847,28 +3847,6 @@ void rtl8xxxu_gen2_disable_rf(struct rtl - rtl8xxxu_write32(priv, REG_RX_WAIT_CCA, val32); - } - --static void rtl8xxxu_old_init_queue_reserved_page(struct rtl8xxxu_priv *priv) --{ -- u8 val8; -- u32 val32; -- -- if (priv->ep_tx_normal_queue) -- val8 = TX_PAGE_NUM_NORM_PQ; -- else -- val8 = 0; -- -- rtl8xxxu_write8(priv, REG_RQPN_NPQ, val8); -- -- val32 = (TX_PAGE_NUM_PUBQ << RQPN_PUB_PQ_SHIFT) | RQPN_LOAD; -- -- if (priv->ep_tx_high_queue) -- val32 |= (TX_PAGE_NUM_HI_PQ << RQPN_HI_PQ_SHIFT); -- if (priv->ep_tx_low_queue) -- val32 |= (TX_PAGE_NUM_LO_PQ << RQPN_LO_PQ_SHIFT); -- -- rtl8xxxu_write32(priv, REG_RQPN, val32); --} -- - static void rtl8xxxu_init_queue_reserved_page(struct rtl8xxxu_priv *priv) - { - struct rtl8xxxu_fileops *fops = priv->fops; -@@ -3929,12 +3907,8 @@ static int rtl8xxxu_init_device(struct i - goto exit; - } - -- if (!macpower) { -- if (priv->fops->total_page_num) -- rtl8xxxu_init_queue_reserved_page(priv); -- else -- rtl8xxxu_old_init_queue_reserved_page(priv); -- } -+ if (!macpower) -+ rtl8xxxu_init_queue_reserved_page(priv); - - ret = rtl8xxxu_init_queue_priority(priv); - dev_dbg(dev, "%s: init_queue_priority %i\n", __func__, ret); diff --git a/package/kernel/mac80211/patches/653-0009-rtl8xxxu-8188e-add-REG_TXDMA_OFFSET_CHK-quirk.patch b/package/kernel/mac80211/patches/653-0009-rtl8xxxu-8188e-add-REG_TXDMA_OFFSET_CHK-quirk.patch new file mode 100644 index 0000000000..8a2821640c --- /dev/null +++ b/package/kernel/mac80211/patches/653-0009-rtl8xxxu-8188e-add-REG_TXDMA_OFFSET_CHK-quirk.patch @@ -0,0 +1,34 @@ +From 3ab047939db70fcae2a7c5993a8feaf3ac413e35 Mon Sep 17 00:00:00 2001 +From: Jes Sorensen +Date: Wed, 29 Jun 2016 11:53:31 -0400 +Subject: [PATCH] rtl8xxxu: 8188e add REG_TXDMA_OFFSET_CHK quirk + +Enable quirk allowing TX DMA to drop redundant data of packet. This is +the same quirk enabled on gen2 parts. + +Signed-off-by: Jes Sorensen +--- + drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_8188e.c | 5 +++++ + 1 file changed, 5 insertions(+) + +--- a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_8188e.c ++++ b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_8188e.c +@@ -203,6 +203,7 @@ exit: + static void rtl8188e_usb_quirks(struct rtl8xxxu_priv *priv) + { + u16 val16; ++ u32 val32; + + /* + * Technically this is not a USB quirk, but a chip quirk. +@@ -212,6 +213,10 @@ static void rtl8188e_usb_quirks(struct r + val16 = rtl8xxxu_read16(priv, REG_CR); + val16 |= (CR_MAC_TX_ENABLE | CR_MAC_RX_ENABLE); + rtl8xxxu_write16(priv, REG_CR, val16); ++ ++ val32 = rtl8xxxu_read32(priv, REG_TXDMA_OFFSET_CHK); ++ val32 |= TXDMA_OFFSET_DROP_DATA_EN; ++ rtl8xxxu_write32(priv, REG_TXDMA_OFFSET_CHK, val32); + } + + struct rtl8xxxu_fileops rtl8188eu_fops = { diff --git a/package/kernel/mac80211/patches/653-0009-rtl8xxxu-Simplify-code-setting-TX-buffer-boundary.patch b/package/kernel/mac80211/patches/653-0009-rtl8xxxu-Simplify-code-setting-TX-buffer-boundary.patch deleted file mode 100644 index 836fbc7744..0000000000 --- a/package/kernel/mac80211/patches/653-0009-rtl8xxxu-Simplify-code-setting-TX-buffer-boundary.patch +++ /dev/null @@ -1,31 +0,0 @@ -From e02aa3eef786aab82f9929fea25f5f7e9f77ba69 Mon Sep 17 00:00:00 2001 -From: Jes Sorensen -Date: Fri, 19 Aug 2016 17:46:31 -0400 -Subject: [PATCH] rtl8xxxu: Simplify code setting TX buffer boundary - -With all devices now offering fops->total_page_num, get rid of the -if mess for setting the TX buffer boundary. - -Signed-off-by: Jes Sorensen -Signed-off-by: Kalle Valo ---- - drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c | 8 +------- - 1 file changed, 1 insertion(+), 7 deletions(-) - ---- a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c -+++ b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c -@@ -3968,13 +3968,7 @@ static int rtl8xxxu_init_device(struct i - /* - * Set TX buffer boundary - */ -- if (priv->rtl_chip == RTL8192E) -- val8 = TX_TOTAL_PAGE_NUM_8192E + 1; -- else -- val8 = TX_TOTAL_PAGE_NUM + 1; -- -- if (priv->rtl_chip == RTL8723B) -- val8 -= 1; -+ val8 = priv->fops->total_page_num + 1; - - rtl8xxxu_write8(priv, REG_TXPKTBUF_BCNQ_BDNY, val8); - rtl8xxxu_write8(priv, REG_TXPKTBUF_MGQ_BDNY, val8); diff --git a/package/kernel/mac80211/patches/653-0010-rtl8xxxu-Add-bit-definitions-for-REG_FPGA0_TX_INFO.patch b/package/kernel/mac80211/patches/653-0010-rtl8xxxu-Add-bit-definitions-for-REG_FPGA0_TX_INFO.patch deleted file mode 100644 index 975211c644..0000000000 --- a/package/kernel/mac80211/patches/653-0010-rtl8xxxu-Add-bit-definitions-for-REG_FPGA0_TX_INFO.patch +++ /dev/null @@ -1,26 +0,0 @@ -From dce7548fd9700c4c4ecda936dcf7326b9241a6d3 Mon Sep 17 00:00:00 2001 -From: Jes Sorensen -Date: Fri, 19 Aug 2016 17:46:32 -0400 -Subject: [PATCH] rtl8xxxu: Add bit definitions for REG_FPGA0_TX_INFO - -This adds TX antenna selection bit defines for OFDM mode. - -Signed-off-by: Jes Sorensen -Signed-off-by: Kalle Valo ---- - drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_regs.h | 4 ++++ - 1 file changed, 4 insertions(+) - ---- a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_regs.h -+++ b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_regs.h -@@ -780,6 +780,10 @@ - #define FPGA_RF_MODE_OFDM BIT(25) - - #define REG_FPGA0_TX_INFO 0x0804 -+#define FPGA0_TX_INFO_OFDM_PATH_A BIT(0) -+#define FPGA0_TX_INFO_OFDM_PATH_B BIT(1) -+#define FPGA0_TX_INFO_OFDM_PATH_C BIT(2) -+#define FPGA0_TX_INFO_OFDM_PATH_D BIT(3) - #define REG_FPGA0_PSD_FUNC 0x0808 - #define REG_FPGA0_TX_GAIN 0x080c - #define REG_FPGA0_RF_TIMING1 0x0810 diff --git a/package/kernel/mac80211/patches/653-0010-rtl8xxxu-Add-reserved-page-init-parameters-for-8188e.patch b/package/kernel/mac80211/patches/653-0010-rtl8xxxu-Add-reserved-page-init-parameters-for-8188e.patch new file mode 100644 index 0000000000..424b3b313a --- /dev/null +++ b/package/kernel/mac80211/patches/653-0010-rtl8xxxu-Add-reserved-page-init-parameters-for-8188e.patch @@ -0,0 +1,45 @@ +From 2bfba2657e3f99c6693ea30b60af4eb1d3e3950c Mon Sep 17 00:00:00 2001 +From: Jes Sorensen +Date: Wed, 29 Jun 2016 12:02:18 -0400 +Subject: [PATCH] rtl8xxxu: Add reserved page init parameters for 8188e + +Signed-off-by: Andrea Merello +Signed-off-by: Jes Sorensen +--- + drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu.h | 6 ++++++ + drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_8188e.c | 4 ++++ + 2 files changed, 10 insertions(+) + +--- a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu.h ++++ b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu.h +@@ -43,6 +43,7 @@ + #define REALTEK_USB_CMD_IDX 0x00 + + #define TX_TOTAL_PAGE_NUM 0xf8 ++#define TX_TOTAL_PAGE_NUM_8188E 0xa8 + #define TX_TOTAL_PAGE_NUM_8192E 0xf3 + #define TX_TOTAL_PAGE_NUM_8723B 0xf7 + /* (HPQ + LPQ + NPQ + PUBQ) = TX_TOTAL_PAGE_NUM */ +@@ -51,6 +52,11 @@ + #define TX_PAGE_NUM_LO_PQ 0x02 + #define TX_PAGE_NUM_NORM_PQ 0x02 + ++#define TX_PAGE_NUM_PUBQ_8188E 0x47 ++#define TX_PAGE_NUM_HI_PQ_8188E 0x29 ++#define TX_PAGE_NUM_LO_PQ_8188E 0x1c ++#define TX_PAGE_NUM_NORM_PQ_8188E 0x1c ++ + #define TX_PAGE_NUM_PUBQ_8192E 0xe7 + #define TX_PAGE_NUM_HI_PQ_8192E 0x08 + #define TX_PAGE_NUM_LO_PQ_8192E 0x0c +--- a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_8188e.c ++++ b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_8188e.c +@@ -225,4 +225,8 @@ struct rtl8xxxu_fileops rtl8188eu_fops = + .power_on = rtl8188eu_power_on, + .reset_8051 = rtl8xxxu_reset_8051, + .usb_quirks = rtl8188e_usb_quirks, ++ .total_page_num = TX_TOTAL_PAGE_NUM_8188E, ++ .page_num_hi = TX_PAGE_NUM_HI_PQ_8188E, ++ .page_num_lo = TX_PAGE_NUM_LO_PQ_8188E, ++ .page_num_norm = TX_PAGE_NUM_NORM_PQ_8188E, + }; diff --git a/package/kernel/mac80211/patches/653-0011-rtl8xxxu-Add-interrupt-bit-definitions-for-gen2-part.patch b/package/kernel/mac80211/patches/653-0011-rtl8xxxu-Add-interrupt-bit-definitions-for-gen2-part.patch deleted file mode 100644 index d29579d494..0000000000 --- a/package/kernel/mac80211/patches/653-0011-rtl8xxxu-Add-interrupt-bit-definitions-for-gen2-part.patch +++ /dev/null @@ -1,83 +0,0 @@ -From 0b09628948bce970e14ef61a6788caa93285a132 Mon Sep 17 00:00:00 2001 -From: Jes Sorensen -Date: Fri, 19 Aug 2016 17:46:33 -0400 -Subject: [PATCH] rtl8xxxu: Add interrupt bit definitions for gen2 parts - -These are primarily needed for SDIO/PCI parts, but the vendor driver -still sets them for some USB devices. - -Signed-off-by: Jes Sorensen -Signed-off-by: Kalle Valo ---- - .../net/wireless/realtek/rtl8xxxu/rtl8xxxu_regs.h | 56 ++++++++++++++++++++++ - 1 file changed, 56 insertions(+) - ---- a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_regs.h -+++ b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_regs.h -@@ -213,10 +213,66 @@ - #define REG_HMBOX_EXT_1 0x008a - #define REG_HMBOX_EXT_2 0x008c - #define REG_HMBOX_EXT_3 0x008e -+ - /* Interrupt registers for 8192e/8723bu/8812 */ - #define REG_HIMR0 0x00b0 -+#define IMR0_TXCCK BIT(30) /* TXRPT interrupt when CCX bit -+ of the packet is set */ -+#define IMR0_PSTIMEOUT BIT(29) /* Power Save Time Out Int */ -+#define IMR0_GTINT4 BIT(28) /* Set when GTIMER4 expires */ -+#define IMR0_GTINT3 BIT(27) /* Set when GTIMER3 expires */ -+#define IMR0_TBDER BIT(26) /* Transmit Beacon0 Error */ -+#define IMR0_TBDOK BIT(25) /* Transmit Beacon0 OK */ -+#define IMR0_TSF_BIT32_TOGGLE BIT(24) /* TSF Timer BIT32 toggle -+ indication interrupt */ -+#define IMR0_BCNDMAINT0 BIT(20) /* Beacon DMA Interrupt 0 */ -+#define IMR0_BCNDERR0 BIT(16) /* Beacon Queue DMA Error 0 */ -+#define IMR0_HSISR_IND_ON_INT BIT(15) /* HSISR Indicator (HSIMR & -+ HSISR is true) */ -+#define IMR0_BCNDMAINT_E BIT(14) /* Beacon DMA Interrupt -+ Extension for Win7 */ -+#define IMR0_ATIMEND BIT(12) /* CTWidnow End or -+ ATIM Window End */ -+#define IMR0_HISR1_IND_INT BIT(11) /* HISR1 Indicator -+ (HISR1 & HIMR1 is true) */ -+#define IMR0_C2HCMD BIT(10) /* CPU to Host Command INT -+ Status, Write 1 to clear */ -+#define IMR0_CPWM2 BIT(9) /* CPU power Mode exchange INT -+ Status, Write 1 to clear */ -+#define IMR0_CPWM BIT(8) /* CPU power Mode exchange INT -+ Status, Write 1 to clear */ -+#define IMR0_HIGHDOK BIT(7) /* High Queue DMA OK */ -+#define IMR0_MGNTDOK BIT(6) /* Management Queue DMA OK */ -+#define IMR0_BKDOK BIT(5) /* AC_BK DMA OK */ -+#define IMR0_BEDOK BIT(4) /* AC_BE DMA OK */ -+#define IMR0_VIDOK BIT(3) /* AC_VI DMA OK */ -+#define IMR0_VODOK BIT(2) /* AC_VO DMA OK */ -+#define IMR0_RDU BIT(1) /* Rx Descriptor Unavailable */ -+#define IMR0_ROK BIT(0) /* Receive DMA OK */ - #define REG_HISR0 0x00b4 - #define REG_HIMR1 0x00b8 -+#define IMR1_BCNDMAINT7 BIT(27) /* Beacon DMA Interrupt 7 */ -+#define IMR1_BCNDMAINT6 BIT(26) /* Beacon DMA Interrupt 6 */ -+#define IMR1_BCNDMAINT5 BIT(25) /* Beacon DMA Interrupt 5 */ -+#define IMR1_BCNDMAINT4 BIT(24) /* Beacon DMA Interrupt 4 */ -+#define IMR1_BCNDMAINT3 BIT(23) /* Beacon DMA Interrupt 3 */ -+#define IMR1_BCNDMAINT2 BIT(22) /* Beacon DMA Interrupt 2 */ -+#define IMR1_BCNDMAINT1 BIT(21) /* Beacon DMA Interrupt 1 */ -+#define IMR1_BCNDERR7 BIT(20) /* Beacon Queue DMA Err Int 7 */ -+#define IMR1_BCNDERR6 BIT(19) /* Beacon Queue DMA Err Int 6 */ -+#define IMR1_BCNDERR5 BIT(18) /* Beacon Queue DMA Err Int 5 */ -+#define IMR1_BCNDERR4 BIT(17) /* Beacon Queue DMA Err Int 4 */ -+#define IMR1_BCNDERR3 BIT(16) /* Beacon Queue DMA Err Int 3 */ -+#define IMR1_BCNDERR2 BIT(15) /* Beacon Queue DMA Err Int 2 */ -+#define IMR1_BCNDERR1 BIT(14) /* Beacon Queue DMA Err Int 1 */ -+#define IMR1_ATIMEND_E BIT(13) /* ATIM Window End Extension -+ for Win7 */ -+#define IMR1_TXERR BIT(11) /* Tx Error Flag Int Status, -+ write 1 to clear */ -+#define IMR1_RXERR BIT(10) /* Rx Error Flag Int Status, -+ write 1 to clear */ -+#define IMR1_TXFOVW BIT(9) /* Transmit FIFO Overflow */ -+#define IMR1_RXFOVW BIT(8) /* Receive FIFO Overflow */ - #define REG_HISR1 0x00bc - - /* Host suspend counter on FPGA platform */ diff --git a/package/kernel/mac80211/patches/653-0011-rtl8xxxu-Correct-TX_TOTAL_PAGE_NUM-for-8188eu.patch b/package/kernel/mac80211/patches/653-0011-rtl8xxxu-Correct-TX_TOTAL_PAGE_NUM-for-8188eu.patch new file mode 100644 index 0000000000..5318f32ae4 --- /dev/null +++ b/package/kernel/mac80211/patches/653-0011-rtl8xxxu-Correct-TX_TOTAL_PAGE_NUM-for-8188eu.patch @@ -0,0 +1,24 @@ +From ed4c1c87b4c2653f1528c886591bbddbb68216a1 Mon Sep 17 00:00:00 2001 +From: Jes Sorensen +Date: Mon, 8 Aug 2016 15:04:36 -0400 +Subject: [PATCH] rtl8xxxu: Correct TX_TOTAL_PAGE_NUM for 8188eu + +For some reason I had gotten this off-by-one when pulling them number +from the vendor driver. + +Signed-off-by: Jes Sorensen +--- + drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu.h | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +--- a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu.h ++++ b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu.h +@@ -43,7 +43,7 @@ + #define REALTEK_USB_CMD_IDX 0x00 + + #define TX_TOTAL_PAGE_NUM 0xf8 +-#define TX_TOTAL_PAGE_NUM_8188E 0xa8 ++#define TX_TOTAL_PAGE_NUM_8188E 0xa9 + #define TX_TOTAL_PAGE_NUM_8192E 0xf3 + #define TX_TOTAL_PAGE_NUM_8723B 0xf7 + /* (HPQ + LPQ + NPQ + PUBQ) = TX_TOTAL_PAGE_NUM */ diff --git a/package/kernel/mac80211/patches/653-0012-rtl8xxxu-Add-trxff_boundary-for-8188e.patch b/package/kernel/mac80211/patches/653-0012-rtl8xxxu-Add-trxff_boundary-for-8188e.patch new file mode 100644 index 0000000000..828799ae4a --- /dev/null +++ b/package/kernel/mac80211/patches/653-0012-rtl8xxxu-Add-trxff_boundary-for-8188e.patch @@ -0,0 +1,28 @@ +From bc55b854b404de79353547013a8f1ae31855f7c5 Mon Sep 17 00:00:00 2001 +From: Jes Sorensen +Date: Wed, 29 Jun 2016 12:08:31 -0400 +Subject: [PATCH] rtl8xxxu: Add trxff_boundary for 8188e + +The 8188e presumably has a 10K buffer, but leave space for TX report +or WOL pattern. + +Signed-off-by: Andrea Merello +Signed-off-by: Jes Sorensen +--- + drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_8188e.c | 5 +++++ + 1 file changed, 5 insertions(+) + +--- a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_8188e.c ++++ b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_8188e.c +@@ -225,6 +225,11 @@ struct rtl8xxxu_fileops rtl8188eu_fops = + .power_on = rtl8188eu_power_on, + .reset_8051 = rtl8xxxu_reset_8051, + .usb_quirks = rtl8188e_usb_quirks, ++ /* ++ * Use 9K for 8188e normal chip ++ * Max RX buffer = 10K - max(TxReportSize(64*8), WOLPattern(16*24)) ++ */ ++ .trxff_boundary = 0x23ff, + .total_page_num = TX_TOTAL_PAGE_NUM_8188E, + .page_num_hi = TX_PAGE_NUM_HI_PQ_8188E, + .page_num_lo = TX_PAGE_NUM_LO_PQ_8188E, diff --git a/package/kernel/mac80211/patches/653-0012-rtl8xxxu-Use-flag-to-indicate-whether-device-has-TX-.patch b/package/kernel/mac80211/patches/653-0012-rtl8xxxu-Use-flag-to-indicate-whether-device-has-TX-.patch deleted file mode 100644 index e1b085f0d2..0000000000 --- a/package/kernel/mac80211/patches/653-0012-rtl8xxxu-Use-flag-to-indicate-whether-device-has-TX-.patch +++ /dev/null @@ -1,53 +0,0 @@ -From e3ebcd7428c142fb7b74ded9a624cddfb403d2c5 Mon Sep 17 00:00:00 2001 -From: Jes Sorensen -Date: Fri, 19 Aug 2016 17:46:34 -0400 -Subject: [PATCH] rtl8xxxu: Use flag to indicate whether device has TX report - timer support - -Use a fileops flag to indicate whether the device has TX report timer -support. This will make it easier to include future devices such as -8188eu to use the TX report timer. - -Signed-off-by: Jes Sorensen -Signed-off-by: Kalle Valo ---- - drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu.h | 1 + - drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_8723b.c | 1 + - drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c | 5 ++--- - 3 files changed, 4 insertions(+), 3 deletions(-) - ---- a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu.h -+++ b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu.h -@@ -1341,6 +1341,7 @@ struct rtl8xxxu_fileops { - char tx_desc_size; - char rx_desc_size; - char has_s0s1; -+ char has_tx_report; - u32 adda_1t_init; - u32 adda_1t_path_on; - u32 adda_2t_path_on_a; ---- a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_8723b.c -+++ b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_8723b.c -@@ -1666,6 +1666,7 @@ struct rtl8xxxu_fileops rtl8723bu_fops = - .tx_desc_size = sizeof(struct rtl8xxxu_txdesc40), - .rx_desc_size = sizeof(struct rtl8xxxu_rxdesc24), - .has_s0s1 = 1, -+ .has_tx_report = 1, - .adda_1t_init = 0x01c00014, - .adda_1t_path_on = 0x01c00014, - .adda_2t_path_on_a = 0x01c00014, ---- a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c -+++ b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c -@@ -4000,10 +4000,9 @@ static int rtl8xxxu_init_device(struct i - priv->fops->usb_quirks(priv); - - /* -- * Presumably this is for 8188EU as well -- * Enable TX report and TX report timer -+ * Enable TX report and TX report timer for 8723bu/8188eu/... - */ -- if (priv->rtl_chip == RTL8723B) { -+ if (priv->fops->has_tx_report) { - val8 = rtl8xxxu_read8(priv, REG_TX_REPORT_CTRL); - val8 |= TX_REPORT_CTRL_TIMER_ENABLE; - rtl8xxxu_write8(priv, REG_TX_REPORT_CTRL, val8); diff --git a/package/kernel/mac80211/patches/653-0013-rtl8xxxu-8188eu-specify-firmware-block-size-and-set-.patch b/package/kernel/mac80211/patches/653-0013-rtl8xxxu-8188eu-specify-firmware-block-size-and-set-.patch new file mode 100644 index 0000000000..5076307a92 --- /dev/null +++ b/package/kernel/mac80211/patches/653-0013-rtl8xxxu-8188eu-specify-firmware-block-size-and-set-.patch @@ -0,0 +1,26 @@ +From 29311af488cc1c1790a9b53c8073442548edd4bf Mon Sep 17 00:00:00 2001 +From: Jes Sorensen +Date: Wed, 29 Jun 2016 15:03:54 -0400 +Subject: [PATCH] rtl8xxxu: 8188eu specify firmware block size and set + power_off function + +This uses a conservative firmware block size for now. + +Signed-off-by: Jes Sorensen +--- + drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_8188e.c | 2 ++ + 1 file changed, 2 insertions(+) + +--- a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_8188e.c ++++ b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_8188e.c +@@ -223,8 +223,10 @@ struct rtl8xxxu_fileops rtl8188eu_fops = + .parse_efuse = rtl8188eu_parse_efuse, + .load_firmware = rtl8188eu_load_firmware, + .power_on = rtl8188eu_power_on, ++ .power_off = rtl8xxxu_power_off, + .reset_8051 = rtl8xxxu_reset_8051, + .usb_quirks = rtl8188e_usb_quirks, ++ .writeN_block_size = 128, + /* + * Use 9K for 8188e normal chip + * Max RX buffer = 10K - max(TxReportSize(64*8), WOLPattern(16*24)) diff --git a/package/kernel/mac80211/patches/653-0013-rtl8xxxu-Convert-flags-in-rtl8xxxu_fileops-to-bitfla.patch b/package/kernel/mac80211/patches/653-0013-rtl8xxxu-Convert-flags-in-rtl8xxxu_fileops-to-bitfla.patch deleted file mode 100644 index 7191243b85..0000000000 --- a/package/kernel/mac80211/patches/653-0013-rtl8xxxu-Convert-flags-in-rtl8xxxu_fileops-to-bitfla.patch +++ /dev/null @@ -1,26 +0,0 @@ -From ee675cc30e07cc925489e9663539e69873b04100 Mon Sep 17 00:00:00 2001 -From: Jes Sorensen -Date: Fri, 19 Aug 2016 17:46:35 -0400 -Subject: [PATCH] rtl8xxxu: Convert flags in rtl8xxxu_fileops to bitflags - -This leaves space for a few more flags within the same space. - -Signed-off-by: Jes Sorensen -Signed-off-by: Kalle Valo ---- - drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu.h | 4 ++-- - 1 file changed, 2 insertions(+), 2 deletions(-) - ---- a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu.h -+++ b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu.h -@@ -1340,8 +1340,8 @@ struct rtl8xxxu_fileops { - int rx_agg_buf_size; - char tx_desc_size; - char rx_desc_size; -- char has_s0s1; -- char has_tx_report; -+ u8 has_s0s1:1; -+ u8 has_tx_report:1; - u32 adda_1t_init; - u32 adda_1t_path_on; - u32 adda_2t_path_on_a; diff --git a/package/kernel/mac80211/patches/653-0014-rtl8xxxu-Add-8188e-mac-init-table.patch b/package/kernel/mac80211/patches/653-0014-rtl8xxxu-Add-8188e-mac-init-table.patch new file mode 100644 index 0000000000..5360f5928f --- /dev/null +++ b/package/kernel/mac80211/patches/653-0014-rtl8xxxu-Add-8188e-mac-init-table.patch @@ -0,0 +1,57 @@ +From 96cb7475c4c5750e8dac3dc85638f8438b9bce4e Mon Sep 17 00:00:00 2001 +From: Jes Sorensen +Date: Tue, 19 Jul 2016 15:04:24 -0400 +Subject: [PATCH] rtl8xxxu: Add 8188e mac init table + +This table was pulled from the vendor driver. + +Signed-off-by: Andrea Merello +Signed-off-by: Jes Sorensen +--- + .../net/wireless/realtek/rtl8xxxu/rtl8xxxu_8188e.c | 28 ++++++++++++++++++++++ + 1 file changed, 28 insertions(+) + +--- a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_8188e.c ++++ b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_8188e.c +@@ -40,6 +40,33 @@ + #include "rtl8xxxu.h" + #include "rtl8xxxu_regs.h" + ++static struct rtl8xxxu_reg8val rtl8188e_mac_init_table[] = { ++ {0x026, 0x41}, {0x027, 0x35}, {0x428, 0x0a}, {0x429, 0x10}, ++ {0x430, 0x00}, {0x431, 0x01}, {0x432, 0x02}, {0x433, 0x04}, ++ {0x434, 0x05}, {0x435, 0x06}, {0x436, 0x07}, {0x437, 0x08}, ++ {0x438, 0x00}, {0x439, 0x00}, {0x43a, 0x01}, {0x43b, 0x02}, ++ {0x43c, 0x04}, {0x43d, 0x05}, {0x43e, 0x06}, {0x43f, 0x07}, ++ {0x440, 0x5d}, {0x441, 0x01}, {0x442, 0x00}, {0x444, 0x15}, ++ {0x445, 0xf0}, {0x446, 0x0f}, {0x447, 0x00}, {0x458, 0x41}, ++ {0x459, 0xa8}, {0x45a, 0x72}, {0x45b, 0xb9}, {0x460, 0x66}, ++ {0x461, 0x66}, {0x480, 0x08}, {0x4c8, 0xff}, {0x4c9, 0x08}, ++ {0x4cc, 0xff}, {0x4cd, 0xff}, {0x4ce, 0x01}, {0x4d3, 0x01}, ++ {0x500, 0x26}, {0x501, 0xa2}, {0x502, 0x2f}, {0x503, 0x00}, ++ {0x504, 0x28}, {0x505, 0xa3}, {0x506, 0x5e}, {0x507, 0x00}, ++ {0x508, 0x2b}, {0x509, 0xa4}, {0x50a, 0x5e}, {0x50b, 0x00}, ++ {0x50c, 0x4f}, {0x50d, 0xa4}, {0x50e, 0x00}, {0x50f, 0x00}, ++ {0x512, 0x1c}, {0x514, 0x0a}, {0x516, 0x0a}, {0x525, 0x4f}, ++ {0x550, 0x10}, {0x551, 0x10}, {0x559, 0x02}, {0x55d, 0xff}, ++ {0x605, 0x30}, {0x608, 0x0e}, {0x609, 0x2a}, {0x620, 0xff}, ++ {0x621, 0xff}, {0x622, 0xff}, {0x623, 0xff}, {0x624, 0xff}, ++ {0x625, 0xff}, {0x626, 0xff}, {0x627, 0xff}, {0x652, 0x20}, ++ {0x63c, 0x0a}, {0x63d, 0x0a}, {0x63e, 0x0e}, {0x63f, 0x0e}, ++ {0x640, 0x40}, {0x66e, 0x05}, {0x700, 0x21}, {0x701, 0x43}, ++ {0x702, 0x65}, {0x703, 0x87}, {0x708, 0x21}, {0x709, 0x43}, ++ {0x70a, 0x65}, {0x70b, 0x87}, ++ {0xffff, 0xff}, ++}; ++ + static int rtl8188eu_parse_efuse(struct rtl8xxxu_priv *priv) + { + struct rtl8188eu_efuse *efuse = &priv->efuse_wifi.efuse8188eu; +@@ -232,6 +259,7 @@ struct rtl8xxxu_fileops rtl8188eu_fops = + * Max RX buffer = 10K - max(TxReportSize(64*8), WOLPattern(16*24)) + */ + .trxff_boundary = 0x23ff, ++ .mactable = rtl8188e_mac_init_table, + .total_page_num = TX_TOTAL_PAGE_NUM_8188E, + .page_num_hi = TX_PAGE_NUM_HI_PQ_8188E, + .page_num_lo = TX_PAGE_NUM_LO_PQ_8188E, diff --git a/package/kernel/mac80211/patches/653-0014-rtl8xxxu-Introduce-fops-bitflag-indicating-type-of-t.patch b/package/kernel/mac80211/patches/653-0014-rtl8xxxu-Introduce-fops-bitflag-indicating-type-of-t.patch deleted file mode 100644 index a2b944a894..0000000000 --- a/package/kernel/mac80211/patches/653-0014-rtl8xxxu-Introduce-fops-bitflag-indicating-type-of-t.patch +++ /dev/null @@ -1,59 +0,0 @@ -From eed145ab25a3eeba4caf2d4be0b5c7a3097f39bd Mon Sep 17 00:00:00 2001 -From: Jes Sorensen -Date: Fri, 19 Aug 2016 17:46:36 -0400 -Subject: [PATCH] rtl8xxxu: Introduce fops bitflag indicating type of thermal - meter - -Do not rely on TX descriptor size to determine the thermal meter -type. - -Signed-off-by: Jes Sorensen -Signed-off-by: Kalle Valo ---- - drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu.h | 1 + - drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_8192e.c | 1 + - drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_8723b.c | 1 + - drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c | 2 +- - 4 files changed, 4 insertions(+), 1 deletion(-) - ---- a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu.h -+++ b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu.h -@@ -1342,6 +1342,7 @@ struct rtl8xxxu_fileops { - char rx_desc_size; - u8 has_s0s1:1; - u8 has_tx_report:1; -+ u8 gen2_thermal_meter:1; - u32 adda_1t_init; - u32 adda_1t_path_on; - u32 adda_2t_path_on_a; ---- a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_8192e.c -+++ b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_8192e.c -@@ -1505,6 +1505,7 @@ struct rtl8xxxu_fileops rtl8192eu_fops = - .tx_desc_size = sizeof(struct rtl8xxxu_txdesc40), - .rx_desc_size = sizeof(struct rtl8xxxu_rxdesc24), - .has_s0s1 = 0, -+ .gen2_thermal_meter = 1, - .adda_1t_init = 0x0fc01616, - .adda_1t_path_on = 0x0fc01616, - .adda_2t_path_on_a = 0x0fc01616, ---- a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_8723b.c -+++ b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_8723b.c -@@ -1667,6 +1667,7 @@ struct rtl8xxxu_fileops rtl8723bu_fops = - .rx_desc_size = sizeof(struct rtl8xxxu_rxdesc24), - .has_s0s1 = 1, - .has_tx_report = 1, -+ .gen2_thermal_meter = 1, - .adda_1t_init = 0x01c00014, - .adda_1t_path_on = 0x01c00014, - .adda_2t_path_on_a = 0x01c00014, ---- a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c -+++ b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c -@@ -4195,7 +4195,7 @@ static int rtl8xxxu_init_device(struct i - /* - * This should enable thermal meter - */ -- if (priv->fops->tx_desc_size == sizeof(struct rtl8xxxu_txdesc40)) -+ if (priv->fops->gen2_thermal_meter) - rtl8xxxu_write_rfreg(priv, - RF_A, RF6052_REG_T_METER_8723B, 0x37cf8); - else diff --git a/package/kernel/mac80211/patches/653-0015-rtl8xxxu-Implement-rtl8188eu_init_phy_bb.patch b/package/kernel/mac80211/patches/653-0015-rtl8xxxu-Implement-rtl8188eu_init_phy_bb.patch new file mode 100644 index 0000000000..e7c5b7b651 --- /dev/null +++ b/package/kernel/mac80211/patches/653-0015-rtl8xxxu-Implement-rtl8188eu_init_phy_bb.patch @@ -0,0 +1,245 @@ +From b6770f88fd208978bd84e7217fee9fedd9b3fa9f Mon Sep 17 00:00:00 2001 +From: Jes Sorensen +Date: Tue, 19 Jul 2016 16:19:30 -0400 +Subject: [PATCH] rtl8xxxu: Implement rtl8188eu_init_phy_bb() + +This includes adding rtl8188eu_phy_init_table rtl8188e_agc_table, both +extracted from the vendor driver. + +Signed-off-by: Jes Sorensen +--- + .../net/wireless/realtek/rtl8xxxu/rtl8xxxu_8188e.c | 202 +++++++++++++++++++++ + 1 file changed, 202 insertions(+) + +--- a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_8188e.c ++++ b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_8188e.c +@@ -67,6 +67,174 @@ static struct rtl8xxxu_reg8val rtl8188e_ + {0xffff, 0xff}, + }; + ++static struct rtl8xxxu_reg32val rtl8188eu_phy_init_table[] = { ++ {0x800, 0x80040000}, {0x804, 0x00000003}, ++ {0x808, 0x0000fc00}, {0x80c, 0x0000000a}, ++ {0x810, 0x10001331}, {0x814, 0x020c3d10}, ++ {0x818, 0x02200385}, {0x81c, 0x00000000}, ++ {0x820, 0x01000100}, {0x824, 0x00390204}, ++ {0x828, 0x00000000}, {0x82c, 0x00000000}, ++ {0x830, 0x00000000}, {0x834, 0x00000000}, ++ {0x838, 0x00000000}, {0x83c, 0x00000000}, ++ {0x840, 0x00010000}, {0x844, 0x00000000}, ++ {0x848, 0x00000000}, {0x84c, 0x00000000}, ++ {0x850, 0x00000000}, {0x854, 0x00000000}, ++ {0x858, 0x569a11a9}, {0x85c, 0x01000014}, ++ {0x860, 0x66f60110}, {0x864, 0x061f0649}, ++ {0x868, 0x00000000}, {0x86c, 0x27272700}, ++ {0x870, 0x07000760}, {0x874, 0x25004000}, ++ {0x878, 0x00000808}, {0x87c, 0x00000000}, ++ {0x880, 0xb0000c1c}, {0x884, 0x00000001}, ++ {0x888, 0x00000000}, {0x88c, 0xccc000c0}, ++ {0x890, 0x00000800}, {0x894, 0xfffffffe}, ++ {0x898, 0x40302010}, {0x89c, 0x00706050}, ++ {0x900, 0x00000000}, {0x904, 0x00000023}, ++ {0x908, 0x00000000}, {0x90c, 0x81121111}, ++ {0x910, 0x00000002}, {0x914, 0x00000201}, ++ {0xa00, 0x00d047c8}, {0xa04, 0x80ff000c}, ++ {0xa08, 0x8c838300}, {0xa0c, 0x2e7f120f}, ++ {0xa10, 0x9500bb78}, {0xa14, 0x1114d028}, ++ {0xa18, 0x00881117}, {0xa1c, 0x89140f00}, ++ {0xa20, 0x1a1b0000}, {0xa24, 0x090e1317}, ++ {0xa28, 0x00000204}, {0xa2c, 0x00d30000}, ++ {0xa70, 0x101fbf00}, {0xa74, 0x00000007}, ++ {0xa78, 0x00000900}, {0xa7c, 0x225b0606}, ++ {0xa80, 0x218075b1}, {0xb2c, 0x80000000}, ++ {0xc00, 0x48071d40}, {0xc04, 0x03a05611}, ++ {0xc08, 0x000000e4}, {0xc0c, 0x6c6c6c6c}, ++ {0xc10, 0x08800000}, {0xc14, 0x40000100}, ++ {0xc18, 0x08800000}, {0xc1c, 0x40000100}, ++ {0xc20, 0x00000000}, {0xc24, 0x00000000}, ++ {0xc28, 0x00000000}, {0xc2c, 0x00000000}, ++ {0xc30, 0x69e9ac47}, {0xc34, 0x469652af}, ++ {0xc38, 0x49795994}, {0xc3c, 0x0a97971c}, ++ {0xc40, 0x1f7c403f}, {0xc44, 0x000100b7}, ++ {0xc48, 0xec020107}, {0xc4c, 0x007f037f}, ++ {0xc50, 0x69553420}, {0xc54, 0x43bc0094}, ++ {0xc58, 0x00013169}, {0xc5c, 0x00250492}, ++ {0xc60, 0x00000000}, {0xc64, 0x7112848b}, ++ {0xc68, 0x47c00bff}, {0xc6c, 0x00000036}, ++ {0xc70, 0x2c7f000d}, {0xc74, 0x020610db}, ++ {0xc78, 0x0000001f}, {0xc7c, 0x00b91612}, ++ {0xc80, 0x390000e4}, {0xc84, 0x20f60000}, ++ {0xc88, 0x40000100}, {0xc8c, 0x20200000}, ++ {0xc90, 0x00091521}, {0xc94, 0x00000000}, ++ {0xc98, 0x00121820}, {0xc9c, 0x00007f7f}, ++ {0xca0, 0x00000000}, {0xca4, 0x000300a0}, ++ {0xca8, 0x00000000}, {0xcac, 0x00000000}, ++ {0xcb0, 0x00000000}, {0xcb4, 0x00000000}, ++ {0xcb8, 0x00000000}, {0xcbc, 0x28000000}, ++ {0xcc0, 0x00000000}, {0xcc4, 0x00000000}, ++ {0xcc8, 0x00000000}, {0xccc, 0x00000000}, ++ {0xcd0, 0x00000000}, {0xcd4, 0x00000000}, ++ {0xcd8, 0x64b22427}, {0xcdc, 0x00766932}, ++ {0xce0, 0x00222222}, {0xce4, 0x00000000}, ++ {0xce8, 0x37644302}, {0xcec, 0x2f97d40c}, ++ {0xd00, 0x00000740}, {0xd04, 0x00020401}, ++ {0xd08, 0x0000907f}, {0xd0c, 0x20010201}, ++ {0xd10, 0xa0633333}, {0xd14, 0x3333bc43}, ++ {0xd18, 0x7a8f5b6f}, {0xd2c, 0xcc979975}, ++ {0xd30, 0x00000000}, {0xd34, 0x80608000}, ++ {0xd38, 0x00000000}, {0xd3c, 0x00127353}, ++ {0xd40, 0x00000000}, {0xd44, 0x00000000}, ++ {0xd48, 0x00000000}, {0xd4c, 0x00000000}, ++ {0xd50, 0x6437140a}, {0xd54, 0x00000000}, ++ {0xd58, 0x00000282}, {0xd5c, 0x30032064}, ++ {0xd60, 0x4653de68}, {0xd64, 0x04518a3c}, ++ {0xd68, 0x00002101}, {0xd6c, 0x2a201c16}, ++ {0xd70, 0x1812362e}, {0xd74, 0x322c2220}, ++ {0xd78, 0x000e3c24}, {0xe00, 0x2d2d2d2d}, ++ {0xe04, 0x2d2d2d2d}, {0xe08, 0x0390272d}, ++ {0xe10, 0x2d2d2d2d}, {0xe14, 0x2d2d2d2d}, ++ {0xe18, 0x2d2d2d2d}, {0xe1c, 0x2d2d2d2d}, ++ {0xe28, 0x00000000}, {0xe30, 0x1000dc1f}, ++ {0xe34, 0x10008c1f}, {0xe38, 0x02140102}, ++ {0xe3c, 0x681604c2}, {0xe40, 0x01007c00}, ++ {0xe44, 0x01004800}, {0xe48, 0xfb000000}, ++ {0xe4c, 0x000028d1}, {0xe50, 0x1000dc1f}, ++ {0xe54, 0x10008c1f}, {0xe58, 0x02140102}, ++ {0xe5c, 0x28160d05}, {0xe60, 0x00000008}, ++ {0xe68, 0x001b25a4}, {0xe6c, 0x00c00014}, ++ {0xe70, 0x00c00014}, {0xe74, 0x01000014}, ++ {0xe78, 0x01000014}, {0xe7c, 0x01000014}, ++ {0xe80, 0x01000014}, {0xe84, 0x00c00014}, ++ {0xe88, 0x01000014}, {0xe8c, 0x00c00014}, ++ {0xed0, 0x00c00014}, {0xed4, 0x00c00014}, ++ {0xed8, 0x00c00014}, {0xedc, 0x00000014}, ++ {0xee0, 0x00000014}, {0xeec, 0x01c00014}, ++ {0xf14, 0x00000003}, {0xf4c, 0x00000000}, ++ {0xf00, 0x00000300}, ++ {0xffff, 0xffffffff}, ++}; ++ ++static struct rtl8xxxu_reg32val rtl8188e_agc_table[] = { ++ {0xc78, 0xfb000001}, {0xc78, 0xfb010001}, ++ {0xc78, 0xfb020001}, {0xc78, 0xfb030001}, ++ {0xc78, 0xfb040001}, {0xc78, 0xfb050001}, ++ {0xc78, 0xfa060001}, {0xc78, 0xf9070001}, ++ {0xc78, 0xf8080001}, {0xc78, 0xf7090001}, ++ {0xc78, 0xf60a0001}, {0xc78, 0xf50b0001}, ++ {0xc78, 0xf40c0001}, {0xc78, 0xf30d0001}, ++ {0xc78, 0xf20e0001}, {0xc78, 0xf10f0001}, ++ {0xc78, 0xf0100001}, {0xc78, 0xef110001}, ++ {0xc78, 0xee120001}, {0xc78, 0xed130001}, ++ {0xc78, 0xec140001}, {0xc78, 0xeb150001}, ++ {0xc78, 0xea160001}, {0xc78, 0xe9170001}, ++ {0xc78, 0xe8180001}, {0xc78, 0xe7190001}, ++ {0xc78, 0xe61a0001}, {0xc78, 0xe51b0001}, ++ {0xc78, 0xe41c0001}, {0xc78, 0xe31d0001}, ++ {0xc78, 0xe21e0001}, {0xc78, 0xe11f0001}, ++ {0xc78, 0x8a200001}, {0xc78, 0x89210001}, ++ {0xc78, 0x88220001}, {0xc78, 0x87230001}, ++ {0xc78, 0x86240001}, {0xc78, 0x85250001}, ++ {0xc78, 0x84260001}, {0xc78, 0x83270001}, ++ {0xc78, 0x82280001}, {0xc78, 0x6b290001}, ++ {0xc78, 0x6a2a0001}, {0xc78, 0x692b0001}, ++ {0xc78, 0x682c0001}, {0xc78, 0x672d0001}, ++ {0xc78, 0x662e0001}, {0xc78, 0x652f0001}, ++ {0xc78, 0x64300001}, {0xc78, 0x63310001}, ++ {0xc78, 0x62320001}, {0xc78, 0x61330001}, ++ {0xc78, 0x46340001}, {0xc78, 0x45350001}, ++ {0xc78, 0x44360001}, {0xc78, 0x43370001}, ++ {0xc78, 0x42380001}, {0xc78, 0x41390001}, ++ {0xc78, 0x403a0001}, {0xc78, 0x403b0001}, ++ {0xc78, 0x403c0001}, {0xc78, 0x403d0001}, ++ {0xc78, 0x403e0001}, {0xc78, 0x403f0001}, ++ {0xc78, 0xfb400001}, {0xc78, 0xfb410001}, ++ {0xc78, 0xfb420001}, {0xc78, 0xfb430001}, ++ {0xc78, 0xfb440001}, {0xc78, 0xfb450001}, ++ {0xc78, 0xfb460001}, {0xc78, 0xfb470001}, ++ {0xc78, 0xfb480001}, {0xc78, 0xfa490001}, ++ {0xc78, 0xf94a0001}, {0xc78, 0xf84b0001}, ++ {0xc78, 0xf74c0001}, {0xc78, 0xf64d0001}, ++ {0xc78, 0xf54e0001}, {0xc78, 0xf44f0001}, ++ {0xc78, 0xf3500001}, {0xc78, 0xf2510001}, ++ {0xc78, 0xf1520001}, {0xc78, 0xf0530001}, ++ {0xc78, 0xef540001}, {0xc78, 0xee550001}, ++ {0xc78, 0xed560001}, {0xc78, 0xec570001}, ++ {0xc78, 0xeb580001}, {0xc78, 0xea590001}, ++ {0xc78, 0xe95a0001}, {0xc78, 0xe85b0001}, ++ {0xc78, 0xe75c0001}, {0xc78, 0xe65d0001}, ++ {0xc78, 0xe55e0001}, {0xc78, 0xe45f0001}, ++ {0xc78, 0xe3600001}, {0xc78, 0xe2610001}, ++ {0xc78, 0xc3620001}, {0xc78, 0xc2630001}, ++ {0xc78, 0xc1640001}, {0xc78, 0x8b650001}, ++ {0xc78, 0x8a660001}, {0xc78, 0x89670001}, ++ {0xc78, 0x88680001}, {0xc78, 0x87690001}, ++ {0xc78, 0x866a0001}, {0xc78, 0x856b0001}, ++ {0xc78, 0x846c0001}, {0xc78, 0x676d0001}, ++ {0xc78, 0x666e0001}, {0xc78, 0x656f0001}, ++ {0xc78, 0x64700001}, {0xc78, 0x63710001}, ++ {0xc78, 0x62720001}, {0xc78, 0x61730001}, ++ {0xc78, 0x60740001}, {0xc78, 0x46750001}, ++ {0xc78, 0x45760001}, {0xc78, 0x44770001}, ++ {0xc78, 0x43780001}, {0xc78, 0x42790001}, ++ {0xc78, 0x417a0001}, {0xc78, 0x407b0001}, ++ {0xc78, 0x407c0001}, {0xc78, 0x407d0001}, ++ {0xc78, 0x407e0001}, {0xc78, 0x407f0001}, ++ {0xffff, 0xffffffff} ++}; ++ + static int rtl8188eu_parse_efuse(struct rtl8xxxu_priv *priv) + { + struct rtl8188eu_efuse *efuse = &priv->efuse_wifi.efuse8188eu; +@@ -89,6 +257,8 @@ static int rtl8188eu_parse_efuse(struct + priv->efuse_wifi.efuse8188eu.ht40_1s_tx_power_index_B, + sizeof(priv->ht40_1s_tx_power_index_B)); + ++ priv->xtalk = priv->efuse_wifi.efuse8188eu.xtal_k & 0x3f; ++ + dev_info(&priv->udev->dev, "Vendor: %.7s\n", efuse->vendor_name); + dev_info(&priv->udev->dev, "Product: %.11s\n", efuse->device_name); + dev_info(&priv->udev->dev, "Serial: %.11s\n", efuse->serial); +@@ -119,6 +289,37 @@ static int rtl8188eu_load_firmware(struc + return ret; + } + ++static void rtl8188eu_init_phy_bb(struct rtl8xxxu_priv *priv) ++{ ++ u8 val8; ++ u16 val16; ++ u32 val32; ++ ++ val16 = rtl8xxxu_read16(priv, REG_SYS_FUNC); ++ val16 |= SYS_FUNC_BB_GLB_RSTN | SYS_FUNC_BBRSTB | SYS_FUNC_DIO_RF; ++ rtl8xxxu_write16(priv, REG_SYS_FUNC, val16); ++ ++ /* ++ * Per vendor driver, run power sequence before init of RF ++ */ ++ val8 = RF_ENABLE | RF_RSTB | RF_SDMRSTB; ++ rtl8xxxu_write8(priv, REG_RF_CTRL, val8); ++ ++ val16 = rtl8xxxu_read16(priv, REG_SYS_FUNC); ++ val16 |= (SYS_FUNC_USBA | SYS_FUNC_USBD | ++ SYS_FUNC_BB_GLB_RSTN | SYS_FUNC_BBRSTB); ++ rtl8xxxu_write16(priv, REG_SYS_FUNC, val16); ++ ++ rtl8xxxu_init_phy_regs(priv, rtl8188eu_phy_init_table); ++ rtl8xxxu_init_phy_regs(priv, rtl8188e_agc_table); ++ ++ val32 = rtl8xxxu_read32(priv, REG_AFE_XTAL_CTRL); ++ val8 = priv->xtalk; ++ val32 &= 0xff8007ff; ++ val32 |= ((val8 | (val8 << 6)) << 11); ++ rtl8xxxu_write32(priv, REG_AFE_XTAL_CTRL, val32); ++} ++ + static void rtl8188e_disabled_to_emu(struct rtl8xxxu_priv *priv) + { + u16 val16; +@@ -252,6 +453,7 @@ struct rtl8xxxu_fileops rtl8188eu_fops = + .power_on = rtl8188eu_power_on, + .power_off = rtl8xxxu_power_off, + .reset_8051 = rtl8xxxu_reset_8051, ++ .init_phy_bb = rtl8188eu_init_phy_bb, + .usb_quirks = rtl8188e_usb_quirks, + .writeN_block_size = 128, + /* diff --git a/package/kernel/mac80211/patches/653-0015-rtl8xxxu-Simplify-calculating-of-hw-value-used-for-s.patch b/package/kernel/mac80211/patches/653-0015-rtl8xxxu-Simplify-calculating-of-hw-value-used-for-s.patch deleted file mode 100644 index eb2fbbb236..0000000000 --- a/package/kernel/mac80211/patches/653-0015-rtl8xxxu-Simplify-calculating-of-hw-value-used-for-s.patch +++ /dev/null @@ -1,46 +0,0 @@ -From be49b1f111c76ce20a60a90587e2b8e8ab809a06 Mon Sep 17 00:00:00 2001 -From: Jes Sorensen -Date: Fri, 19 Aug 2016 17:46:37 -0400 -Subject: [PATCH] rtl8xxxu: Simplify calculating of hw value used for setting - TX rate - -Calculating the value in one place rather than using one calculation -in one place and a different one for management frames in another -location makes little sense. - -Signed-off-by: Jes Sorensen -Signed-off-by: Kalle Valo ---- - drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c | 7 ++++--- - 1 file changed, 4 insertions(+), 3 deletions(-) - ---- a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c -+++ b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c -@@ -4848,7 +4848,8 @@ static void rtl8xxxu_tx(struct ieee80211 - } - } - -- if (rate_flag & IEEE80211_TX_RC_MCS) -+ if (rate_flag & IEEE80211_TX_RC_MCS && -+ !ieee80211_is_mgmt(hdr->frame_control)) - rate = tx_info->control.rates[0].idx + DESC_RATE_MCS0; - else - rate = tx_rate->hw_value; -@@ -4869,7 +4870,7 @@ static void rtl8xxxu_tx(struct ieee80211 - tx_desc->txdw1 |= cpu_to_le32(TXDESC32_AGG_BREAK); - - if (ieee80211_is_mgmt(hdr->frame_control)) { -- tx_desc->txdw5 = cpu_to_le32(tx_rate->hw_value); -+ tx_desc->txdw5 = cpu_to_le32(rate); - tx_desc->txdw4 |= - cpu_to_le32(TXDESC32_USE_DRIVER_RATE); - tx_desc->txdw5 |= -@@ -4923,7 +4924,7 @@ static void rtl8xxxu_tx(struct ieee80211 - tx_desc40->txdw2 |= cpu_to_le32(TXDESC40_AGG_BREAK); - - if (ieee80211_is_mgmt(hdr->frame_control)) { -- tx_desc40->txdw4 = cpu_to_le32(tx_rate->hw_value); -+ tx_desc40->txdw4 = cpu_to_le32(rate); - tx_desc40->txdw3 |= - cpu_to_le32(TXDESC40_USE_DRIVER_RATE); - tx_desc40->txdw4 |= diff --git a/package/kernel/mac80211/patches/653-0016-rtl8xxxu-Determine-the-need-for-SGI-before-handling-.patch b/package/kernel/mac80211/patches/653-0016-rtl8xxxu-Determine-the-need-for-SGI-before-handling-.patch deleted file mode 100644 index c87a49ee80..0000000000 --- a/package/kernel/mac80211/patches/653-0016-rtl8xxxu-Determine-the-need-for-SGI-before-handling-.patch +++ /dev/null @@ -1,53 +0,0 @@ -From 3972cc579140e48e8390fff5e94f6e9e78c3dd87 Mon Sep 17 00:00:00 2001 -From: Jes Sorensen -Date: Fri, 19 Aug 2016 17:46:38 -0400 -Subject: [PATCH] rtl8xxxu: Determine the need for SGI before handling specific - TX desc formats - -In order to be able to split out the TX descriptor handling code, -determine in advance the need to mark SGI. - -Signed-off-by: Jes Sorensen -Signed-off-by: Kalle Valo ---- - drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c | 14 ++++++++------ - 1 file changed, 8 insertions(+), 6 deletions(-) - ---- a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c -+++ b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c -@@ -4770,7 +4770,7 @@ static void rtl8xxxu_tx(struct ieee80211 - u16 rate_flag = tx_info->control.rates[0].flags; - int tx_desc_size = priv->fops->tx_desc_size; - int ret; -- bool usedesc40, ampdu_enable; -+ bool usedesc40, ampdu_enable, sgi = false; - - if (skb_headroom(skb) < tx_desc_size) { - dev_warn(dev, -@@ -4854,6 +4854,12 @@ static void rtl8xxxu_tx(struct ieee80211 - else - rate = tx_rate->hw_value; - -+ if (rate_flag & IEEE80211_TX_RC_SHORT_GI || -+ (ieee80211_is_data_qos(hdr->frame_control) && -+ sta && sta->ht_cap.cap & -+ (IEEE80211_HT_CAP_SGI_40 | IEEE80211_HT_CAP_SGI_20))) -+ sgi = true; -+ - seq_number = IEEE80211_SEQ_TO_SN(le16_to_cpu(hdr->seq_ctrl)); - if (!usedesc40) { - tx_desc->txdw5 = cpu_to_le32(rate); -@@ -4886,12 +4892,8 @@ static void rtl8xxxu_tx(struct ieee80211 - (sta && vif && vif->bss_conf.use_short_preamble)) - tx_desc->txdw4 |= cpu_to_le32(TXDESC32_SHORT_PREAMBLE); - -- if (rate_flag & IEEE80211_TX_RC_SHORT_GI || -- (ieee80211_is_data_qos(hdr->frame_control) && -- sta && sta->ht_cap.cap & -- (IEEE80211_HT_CAP_SGI_40 | IEEE80211_HT_CAP_SGI_20))) { -+ if (sgi) - tx_desc->txdw5 |= cpu_to_le32(TXDESC32_SHORT_GI); -- } - - if (rate_flag & IEEE80211_TX_RC_USE_RTS_CTS) { - /* diff --git a/package/kernel/mac80211/patches/653-0016-rtl8xxxu-Implement-rtl8188eu_init_phy_rf.patch b/package/kernel/mac80211/patches/653-0016-rtl8xxxu-Implement-rtl8188eu_init_phy_rf.patch new file mode 100644 index 0000000000..89e481cdcd --- /dev/null +++ b/package/kernel/mac80211/patches/653-0016-rtl8xxxu-Implement-rtl8188eu_init_phy_rf.patch @@ -0,0 +1,103 @@ +From 0c6fa292a9c6d7f1b870c42ed9166674463206f1 Mon Sep 17 00:00:00 2001 +From: Jes Sorensen +Date: Tue, 19 Jul 2016 17:12:42 -0400 +Subject: [PATCH] rtl8xxxu: Implement rtl8188eu_init_phy_rf() + +Include the table rtl8188eu_radioa_init_table derived from vendor +driver. The vendor table relies on a hack setting RF6052_REG_RCK1 + +RF6052_REG_RCK2 with delays. This workaround is open coded here +instead of modifying the table parsing code. + +Signed-off-by: Jes Sorensen +--- + .../net/wireless/realtek/rtl8xxxu/rtl8xxxu_8188e.c | 65 ++++++++++++++++++++++ + 1 file changed, 65 insertions(+) + +--- a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_8188e.c ++++ b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_8188e.c +@@ -235,6 +235,54 @@ static struct rtl8xxxu_reg32val rtl8188e + {0xffff, 0xffffffff} + }; + ++static struct rtl8xxxu_rfregval rtl8188eu_radioa_init_table[] = { ++ {0x00, 0x00030000}, {0x08, 0x00084000}, ++ {0x18, 0x00000407}, {0x19, 0x00000012}, ++ {0x1e, 0x00080009}, {0x1f, 0x00000880}, ++ {0x2f, 0x0001a060}, {0x3f, 0x00000000}, ++ {0x42, 0x000060c0}, {0x57, 0x000d0000}, ++ {0x58, 0x000be180}, {0x67, 0x00001552}, ++ {0x83, 0x00000000}, {0xb0, 0x000ff8fc}, ++ {0xb1, 0x00054400}, {0xb2, 0x000ccc19}, ++ {0xb4, 0x00043003}, {0xb6, 0x0004953e}, ++ {0xb7, 0x0001c718}, {0xb8, 0x000060ff}, ++ {0xb9, 0x00080001}, {0xba, 0x00040000}, ++ {0xbb, 0x00000400}, {0xbf, 0x000c0000}, ++ {0xc2, 0x00002400}, {0xc3, 0x00000009}, ++ {0xc4, 0x00040c91}, {0xc5, 0x00099999}, ++ {0xc6, 0x000000a3}, {0xc7, 0x00088820}, ++ {0xc8, 0x00076c06}, {0xc9, 0x00000000}, ++ {0xca, 0x00080000}, {0xdf, 0x00000180}, ++ {0xef, 0x000001a0}, {0x51, 0x0006b27d}, ++ {0x52, 0x0007e49d}, /* Set to 0x0007e4dd for SDIO */ ++ {0x53, 0x00000073}, {0x56, 0x00051ff3}, ++ {0x35, 0x00000086}, {0x35, 0x00000186}, ++ {0x35, 0x00000286}, {0x36, 0x00001c25}, ++ {0x36, 0x00009c25}, {0x36, 0x00011c25}, ++ {0x36, 0x00019c25}, {0xb6, 0x00048538}, ++ {0x18, 0x00000c07}, {0x5a, 0x0004bd00}, ++ {0x19, 0x000739d0}, {0x34, 0x0000adf3}, ++ {0x34, 0x00009df0}, {0x34, 0x00008ded}, ++ {0x34, 0x00007dea}, {0x34, 0x00006de7}, ++ {0x34, 0x000054ee}, {0x34, 0x000044eb}, ++ {0x34, 0x000034e8}, {0x34, 0x0000246b}, ++ {0x34, 0x00001468}, {0x34, 0x0000006d}, ++ {0x00, 0x00030159}, {0x84, 0x00068200}, ++ {0x86, 0x000000ce}, {0x87, 0x00048a00}, ++ {0x8e, 0x00065540}, {0x8f, 0x00088000}, ++ {0xef, 0x000020a0}, {0x3b, 0x000f02b0}, ++ {0x3b, 0x000ef7b0}, {0x3b, 0x000d4fb0}, ++ {0x3b, 0x000cf060}, {0x3b, 0x000b0090}, ++ {0x3b, 0x000a0080}, {0x3b, 0x00090080}, ++ {0x3b, 0x0008f780}, {0x3b, 0x000722b0}, ++ {0x3b, 0x0006f7b0}, {0x3b, 0x00054fb0}, ++ {0x3b, 0x0004f060}, {0x3b, 0x00030090}, ++ {0x3b, 0x00020080}, {0x3b, 0x00010080}, ++ {0x3b, 0x0000f780}, {0xef, 0x000000a0}, ++ {0x00, 0x00010159}, {0x18, 0x0000f407}, ++ {0xff, 0xffffffff} ++}; ++ + static int rtl8188eu_parse_efuse(struct rtl8xxxu_priv *priv) + { + struct rtl8188eu_efuse *efuse = &priv->efuse_wifi.efuse8188eu; +@@ -320,6 +368,22 @@ static void rtl8188eu_init_phy_bb(struct + rtl8xxxu_write32(priv, REG_AFE_XTAL_CTRL, val32); + } + ++static int rtl8188eu_init_phy_rf(struct rtl8xxxu_priv *priv) ++{ ++ int ret; ++ ++ ret = rtl8xxxu_init_phy_rf(priv, rtl8188eu_radioa_init_table, RF_A); ++ ++ msleep(100); ++ rtl8xxxu_write_rfreg(priv, RF_A, RF6052_REG_RCK2, 0x80003); ++ msleep(100); ++ rtl8xxxu_write_rfreg(priv, RF_A, RF6052_REG_RCK1, 0x00001); ++ rtl8xxxu_write_rfreg(priv, RF_A, RF6052_REG_RCK2, 0x80000); ++ rtl8xxxu_write_rfreg(priv, RF_A, RF6052_REG_AC, 0x33e60); ++ ++ return ret; ++} ++ + static void rtl8188e_disabled_to_emu(struct rtl8xxxu_priv *priv) + { + u16 val16; +@@ -454,6 +518,7 @@ struct rtl8xxxu_fileops rtl8188eu_fops = + .power_off = rtl8xxxu_power_off, + .reset_8051 = rtl8xxxu_reset_8051, + .init_phy_bb = rtl8188eu_init_phy_bb, ++ .init_phy_rf = rtl8188eu_init_phy_rf, + .usb_quirks = rtl8188e_usb_quirks, + .writeN_block_size = 128, + /* diff --git a/package/kernel/mac80211/patches/653-0017-rtl8xxxu-Determine-need-for-shore-preamble-before-up.patch b/package/kernel/mac80211/patches/653-0017-rtl8xxxu-Determine-need-for-shore-preamble-before-up.patch deleted file mode 100644 index 4d19127cac..0000000000 --- a/package/kernel/mac80211/patches/653-0017-rtl8xxxu-Determine-need-for-shore-preamble-before-up.patch +++ /dev/null @@ -1,57 +0,0 @@ -From 99afaac4278c9581cef17ddc0c842b51f9b6206d Mon Sep 17 00:00:00 2001 -From: Jes Sorensen -Date: Fri, 19 Aug 2016 17:46:39 -0400 -Subject: [PATCH] rtl8xxxu: Determine need for shore preamble before updating - TX descriptors - -Another patch to move this detection out of the code handling the TX -descriptor update. - -Signed-off-by: Jes Sorensen -Signed-off-by: Kalle Valo ---- - drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c | 12 +++++++----- - 1 file changed, 7 insertions(+), 5 deletions(-) - ---- a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c -+++ b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c -@@ -4770,7 +4770,7 @@ static void rtl8xxxu_tx(struct ieee80211 - u16 rate_flag = tx_info->control.rates[0].flags; - int tx_desc_size = priv->fops->tx_desc_size; - int ret; -- bool usedesc40, ampdu_enable, sgi = false; -+ bool usedesc40, ampdu_enable, sgi = false, short_preamble = false; - - if (skb_headroom(skb) < tx_desc_size) { - dev_warn(dev, -@@ -4860,6 +4860,10 @@ static void rtl8xxxu_tx(struct ieee80211 - (IEEE80211_HT_CAP_SGI_40 | IEEE80211_HT_CAP_SGI_20))) - sgi = true; - -+ if (rate_flag & IEEE80211_TX_RC_USE_SHORT_PREAMBLE || -+ (sta && vif && vif->bss_conf.use_short_preamble)) -+ short_preamble = true; -+ - seq_number = IEEE80211_SEQ_TO_SN(le16_to_cpu(hdr->seq_ctrl)); - if (!usedesc40) { - tx_desc->txdw5 = cpu_to_le32(rate); -@@ -4888,8 +4892,7 @@ static void rtl8xxxu_tx(struct ieee80211 - if (ieee80211_is_data_qos(hdr->frame_control)) - tx_desc->txdw4 |= cpu_to_le32(TXDESC32_QOS); - -- if (rate_flag & IEEE80211_TX_RC_USE_SHORT_PREAMBLE || -- (sta && vif && vif->bss_conf.use_short_preamble)) -+ if (short_preamble) - tx_desc->txdw4 |= cpu_to_le32(TXDESC32_SHORT_PREAMBLE); - - if (sgi) -@@ -4935,8 +4938,7 @@ static void rtl8xxxu_tx(struct ieee80211 - cpu_to_le32(TXDESC40_RETRY_LIMIT_ENABLE); - } - -- if (rate_flag & IEEE80211_TX_RC_USE_SHORT_PREAMBLE || -- (sta && vif && vif->bss_conf.use_short_preamble)) -+ if (short_preamble) - tx_desc40->txdw5 |= - cpu_to_le32(TXDESC40_SHORT_PREAMBLE); - diff --git a/package/kernel/mac80211/patches/653-0017-rtl8xxxu-Use-auto-LLT-init-for-8188e.patch b/package/kernel/mac80211/patches/653-0017-rtl8xxxu-Use-auto-LLT-init-for-8188e.patch new file mode 100644 index 0000000000..da306deb11 --- /dev/null +++ b/package/kernel/mac80211/patches/653-0017-rtl8xxxu-Use-auto-LLT-init-for-8188e.patch @@ -0,0 +1,24 @@ +From 86d5a5f8e59e46c51a76a303f37ad6ce9c97b73e Mon Sep 17 00:00:00 2001 +From: Jes Sorensen +Date: Tue, 19 Jul 2016 17:27:48 -0400 +Subject: [PATCH] rtl8xxxu: Use auto LLT init for 8188e + +The vendor driver uses IOL to init the LLT table for 8188e. Since we +are trying to avoid dealing with IOL for now, gamble that auto LLT +will work. + +Signed-off-by: Jes Sorensen +--- + drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_8188e.c | 1 + + 1 file changed, 1 insertion(+) + +--- a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_8188e.c ++++ b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_8188e.c +@@ -517,6 +517,7 @@ struct rtl8xxxu_fileops rtl8188eu_fops = + .power_on = rtl8188eu_power_on, + .power_off = rtl8xxxu_power_off, + .reset_8051 = rtl8xxxu_reset_8051, ++ .llt_init = rtl8xxxu_auto_llt_table, + .init_phy_bb = rtl8188eu_init_phy_bb, + .init_phy_rf = rtl8188eu_init_phy_rf, + .usb_quirks = rtl8188e_usb_quirks, diff --git a/package/kernel/mac80211/patches/653-0018-rtl8xxxu-Do-not-set-REG_FPGA0_TX_INFO-on-8188eu.patch b/package/kernel/mac80211/patches/653-0018-rtl8xxxu-Do-not-set-REG_FPGA0_TX_INFO-on-8188eu.patch new file mode 100644 index 0000000000..7d150eb31f --- /dev/null +++ b/package/kernel/mac80211/patches/653-0018-rtl8xxxu-Do-not-set-REG_FPGA0_TX_INFO-on-8188eu.patch @@ -0,0 +1,25 @@ +From 519d0047f84cdd1050418bb86dd34a0c6df1206a Mon Sep 17 00:00:00 2001 +From: Jes Sorensen +Date: Wed, 20 Jul 2016 14:32:46 -0400 +Subject: [PATCH] rtl8xxxu: Do not set REG_FPGA0_TX_INFO on 8188eu + +The vendor driver doesn't set this for 8188eu either. It is unclear if +this is only relevant for gen1 parts. + +Signed-off-by: Jes Sorensen +--- + drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c | 3 ++- + 1 file changed, 2 insertions(+), 1 deletion(-) + +--- a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c ++++ b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c +@@ -3962,7 +3962,8 @@ static int rtl8xxxu_init_device(struct i + goto exit; + + /* RFSW Control - clear bit 14 ?? */ +- if (priv->rtl_chip != RTL8723B && priv->rtl_chip != RTL8192E) ++ if (priv->rtl_chip != RTL8723B && priv->rtl_chip != RTL8192E && ++ priv->rtl_chip != RTL8188E) + rtl8xxxu_write32(priv, REG_FPGA0_TX_INFO, 0x00000003); + + val32 = FPGA0_RF_TRSW | FPGA0_RF_TRSWB | FPGA0_RF_ANTSW | diff --git a/package/kernel/mac80211/patches/653-0018-rtl8xxxu-Split-filling-of-TX-descriptors-into-separa.patch b/package/kernel/mac80211/patches/653-0018-rtl8xxxu-Split-filling-of-TX-descriptors-into-separa.patch deleted file mode 100644 index 9f3cf07637..0000000000 --- a/package/kernel/mac80211/patches/653-0018-rtl8xxxu-Split-filling-of-TX-descriptors-into-separa.patch +++ /dev/null @@ -1,315 +0,0 @@ -From b59415c2dd088ffce62fbde737c8b2d04fb6e015 Mon Sep 17 00:00:00 2001 -From: Jes Sorensen -Date: Fri, 19 Aug 2016 17:46:40 -0400 -Subject: [PATCH] rtl8xxxu: Split filling of TX descriptors into separate - functions - -Split the filling of TX descriptors into a generic portion used on all -devices, and format specific helper functions provided in the fops -structure. - -This also cleaned up some mess, even if non harmful, in the handling -of txdesc40 descriptors, where the code randomly would switch between -the pointer to tx_desc and tx_desc40. - -Signed-off-by: Jes Sorensen -Signed-off-by: Kalle Valo ---- - drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu.h | 12 ++ - .../net/wireless/realtek/rtl8xxxu/rtl8xxxu_8192c.c | 1 + - .../net/wireless/realtek/rtl8xxxu/rtl8xxxu_8192e.c | 1 + - .../net/wireless/realtek/rtl8xxxu/rtl8xxxu_8723a.c | 1 + - .../net/wireless/realtek/rtl8xxxu/rtl8xxxu_8723b.c | 1 + - .../net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c | 198 ++++++++++++--------- - 6 files changed, 125 insertions(+), 89 deletions(-) - ---- a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu.h -+++ b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu.h -@@ -1336,6 +1336,10 @@ struct rtl8xxxu_fileops { - u32 ramask, int sgi); - void (*report_connect) (struct rtl8xxxu_priv *priv, - u8 macid, bool connect); -+ void (*fill_txdesc) (struct ieee80211_hdr *hdr, -+ struct rtl8xxxu_txdesc32 *tx_desc, u32 rate, -+ u16 rate_flag, bool sgi, bool short_preamble, -+ bool ampdu_enable); - int writeN_block_size; - int rx_agg_buf_size; - char tx_desc_size; -@@ -1429,6 +1433,14 @@ int rtl8xxxu_parse_rxdesc24(struct rtl8x - int rtl8xxxu_gen2_channel_to_group(int channel); - bool rtl8xxxu_gen2_simularity_compare(struct rtl8xxxu_priv *priv, - int result[][8], int c1, int c2); -+void rtl8xxxu_fill_txdesc_v1(struct ieee80211_hdr *hdr, -+ struct rtl8xxxu_txdesc32 *tx_desc, u32 rate, -+ u16 rate_flag, bool sgi, bool short_preamble, -+ bool ampdu_enable); -+void rtl8xxxu_fill_txdesc_v2(struct ieee80211_hdr *hdr, -+ struct rtl8xxxu_txdesc32 *tx_desc32, u32 rate, -+ u16 rate_flag, bool sgi, bool short_preamble, -+ bool ampdu_enable); - - extern struct rtl8xxxu_fileops rtl8192cu_fops; - extern struct rtl8xxxu_fileops rtl8192eu_fops; ---- a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_8192c.c -+++ b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_8192c.c -@@ -567,6 +567,7 @@ struct rtl8xxxu_fileops rtl8192cu_fops = - .set_tx_power = rtl8xxxu_gen1_set_tx_power, - .update_rate_mask = rtl8xxxu_update_rate_mask, - .report_connect = rtl8xxxu_gen1_report_connect, -+ .fill_txdesc = rtl8xxxu_fill_txdesc_v1, - .writeN_block_size = 128, - .rx_agg_buf_size = 16000, - .tx_desc_size = sizeof(struct rtl8xxxu_txdesc32), ---- a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_8192e.c -+++ b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_8192e.c -@@ -1501,6 +1501,7 @@ struct rtl8xxxu_fileops rtl8192eu_fops = - .set_tx_power = rtl8192e_set_tx_power, - .update_rate_mask = rtl8xxxu_gen2_update_rate_mask, - .report_connect = rtl8xxxu_gen2_report_connect, -+ .fill_txdesc = rtl8xxxu_fill_txdesc_v2, - .writeN_block_size = 128, - .tx_desc_size = sizeof(struct rtl8xxxu_txdesc40), - .rx_desc_size = sizeof(struct rtl8xxxu_rxdesc24), ---- a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_8723a.c -+++ b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_8723a.c -@@ -384,6 +384,7 @@ struct rtl8xxxu_fileops rtl8723au_fops = - .set_tx_power = rtl8xxxu_gen1_set_tx_power, - .update_rate_mask = rtl8xxxu_update_rate_mask, - .report_connect = rtl8xxxu_gen1_report_connect, -+ .fill_txdesc = rtl8xxxu_fill_txdesc_v1, - .writeN_block_size = 1024, - .rx_agg_buf_size = 16000, - .tx_desc_size = sizeof(struct rtl8xxxu_txdesc32), ---- a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_8723b.c -+++ b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_8723b.c -@@ -1662,6 +1662,7 @@ struct rtl8xxxu_fileops rtl8723bu_fops = - .set_tx_power = rtl8723b_set_tx_power, - .update_rate_mask = rtl8xxxu_gen2_update_rate_mask, - .report_connect = rtl8xxxu_gen2_report_connect, -+ .fill_txdesc = rtl8xxxu_fill_txdesc_v2, - .writeN_block_size = 1024, - .tx_desc_size = sizeof(struct rtl8xxxu_txdesc40), - .rx_desc_size = sizeof(struct rtl8xxxu_rxdesc24), ---- a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c -+++ b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c -@@ -4750,6 +4750,113 @@ static void rtl8xxxu_dump_action(struct - } - } - -+/* -+ * Fill in v1 (gen1) specific TX descriptor bits. -+ * This format is used on 8188cu/8192cu/8723au -+ */ -+void -+rtl8xxxu_fill_txdesc_v1(struct ieee80211_hdr *hdr, -+ struct rtl8xxxu_txdesc32 *tx_desc, u32 rate, -+ u16 rate_flag, bool sgi, bool short_preamble, -+ bool ampdu_enable) -+{ -+ u16 seq_number; -+ -+ seq_number = IEEE80211_SEQ_TO_SN(le16_to_cpu(hdr->seq_ctrl)); -+ -+ tx_desc->txdw5 = cpu_to_le32(rate); -+ -+ if (ieee80211_is_data(hdr->frame_control)) -+ tx_desc->txdw5 |= cpu_to_le32(0x0001ff00); -+ -+ tx_desc->txdw3 = cpu_to_le32((u32)seq_number << TXDESC32_SEQ_SHIFT); -+ -+ if (ampdu_enable) -+ tx_desc->txdw1 |= cpu_to_le32(TXDESC32_AGG_ENABLE); -+ else -+ tx_desc->txdw1 |= cpu_to_le32(TXDESC32_AGG_BREAK); -+ -+ if (ieee80211_is_mgmt(hdr->frame_control)) { -+ tx_desc->txdw5 = cpu_to_le32(rate); -+ tx_desc->txdw4 |= cpu_to_le32(TXDESC32_USE_DRIVER_RATE); -+ tx_desc->txdw5 |= cpu_to_le32(6 << TXDESC32_RETRY_LIMIT_SHIFT); -+ tx_desc->txdw5 |= cpu_to_le32(TXDESC32_RETRY_LIMIT_ENABLE); -+ } -+ -+ if (ieee80211_is_data_qos(hdr->frame_control)) -+ tx_desc->txdw4 |= cpu_to_le32(TXDESC32_QOS); -+ -+ if (short_preamble) -+ tx_desc->txdw4 |= cpu_to_le32(TXDESC32_SHORT_PREAMBLE); -+ -+ if (sgi) -+ tx_desc->txdw5 |= cpu_to_le32(TXDESC32_SHORT_GI); -+ -+ if (rate_flag & IEEE80211_TX_RC_USE_RTS_CTS) { -+ /* -+ * Use RTS rate 24M - does the mac80211 tell -+ * us which to use? -+ */ -+ tx_desc->txdw4 |= cpu_to_le32(DESC_RATE_24M << -+ TXDESC32_RTS_RATE_SHIFT); -+ tx_desc->txdw4 |= cpu_to_le32(TXDESC32_RTS_CTS_ENABLE); -+ tx_desc->txdw4 |= cpu_to_le32(TXDESC32_HW_RTS_ENABLE); -+ } -+} -+ -+/* -+ * Fill in v2 (gen2) specific TX descriptor bits. -+ * This format is used on 8192eu/8723bu -+ */ -+void -+rtl8xxxu_fill_txdesc_v2(struct ieee80211_hdr *hdr, -+ struct rtl8xxxu_txdesc32 *tx_desc32, u32 rate, -+ u16 rate_flag, bool sgi, bool short_preamble, -+ bool ampdu_enable) -+{ -+ struct rtl8xxxu_txdesc40 *tx_desc40; -+ u16 seq_number; -+ -+ tx_desc40 = (struct rtl8xxxu_txdesc40 *)tx_desc32; -+ -+ seq_number = IEEE80211_SEQ_TO_SN(le16_to_cpu(hdr->seq_ctrl)); -+ -+ tx_desc40->txdw4 = cpu_to_le32(rate); -+ if (ieee80211_is_data(hdr->frame_control)) { -+ tx_desc40->txdw4 |= cpu_to_le32(0x1f << -+ TXDESC40_DATA_RATE_FB_SHIFT); -+ } -+ -+ tx_desc40->txdw9 = cpu_to_le32((u32)seq_number << TXDESC40_SEQ_SHIFT); -+ -+ if (ampdu_enable) -+ tx_desc40->txdw2 |= cpu_to_le32(TXDESC40_AGG_ENABLE); -+ else -+ tx_desc40->txdw2 |= cpu_to_le32(TXDESC40_AGG_BREAK); -+ -+ if (ieee80211_is_mgmt(hdr->frame_control)) { -+ tx_desc40->txdw4 = cpu_to_le32(rate); -+ tx_desc40->txdw3 |= cpu_to_le32(TXDESC40_USE_DRIVER_RATE); -+ tx_desc40->txdw4 |= -+ cpu_to_le32(6 << TXDESC40_RETRY_LIMIT_SHIFT); -+ tx_desc40->txdw4 |= cpu_to_le32(TXDESC40_RETRY_LIMIT_ENABLE); -+ } -+ -+ if (short_preamble) -+ tx_desc40->txdw5 |= cpu_to_le32(TXDESC40_SHORT_PREAMBLE); -+ -+ if (rate_flag & IEEE80211_TX_RC_USE_RTS_CTS) { -+ /* -+ * Use RTS rate 24M - does the mac80211 tell -+ * us which to use? -+ */ -+ tx_desc40->txdw4 |= cpu_to_le32(DESC_RATE_24M << -+ TXDESC40_RTS_RATE_SHIFT); -+ tx_desc40->txdw3 |= cpu_to_le32(TXDESC40_RTS_CTS_ENABLE); -+ tx_desc40->txdw3 |= cpu_to_le32(TXDESC40_HW_RTS_ENABLE); -+ } -+} -+ - static void rtl8xxxu_tx(struct ieee80211_hw *hw, - struct ieee80211_tx_control *control, - struct sk_buff *skb) -@@ -4759,7 +4866,6 @@ static void rtl8xxxu_tx(struct ieee80211 - struct ieee80211_rate *tx_rate = ieee80211_get_tx_rate(hw, tx_info); - struct rtl8xxxu_priv *priv = hw->priv; - struct rtl8xxxu_txdesc32 *tx_desc; -- struct rtl8xxxu_txdesc40 *tx_desc40; - struct rtl8xxxu_tx_urb *tx_urb; - struct ieee80211_sta *sta = NULL; - struct ieee80211_vif *vif = tx_info->control.vif; -@@ -4865,95 +4971,9 @@ static void rtl8xxxu_tx(struct ieee80211 - short_preamble = true; - - seq_number = IEEE80211_SEQ_TO_SN(le16_to_cpu(hdr->seq_ctrl)); -- if (!usedesc40) { -- tx_desc->txdw5 = cpu_to_le32(rate); -- -- if (ieee80211_is_data(hdr->frame_control)) -- tx_desc->txdw5 |= cpu_to_le32(0x0001ff00); -- -- tx_desc->txdw3 = -- cpu_to_le32((u32)seq_number << TXDESC32_SEQ_SHIFT); -- -- if (ampdu_enable) -- tx_desc->txdw1 |= cpu_to_le32(TXDESC32_AGG_ENABLE); -- else -- tx_desc->txdw1 |= cpu_to_le32(TXDESC32_AGG_BREAK); -- -- if (ieee80211_is_mgmt(hdr->frame_control)) { -- tx_desc->txdw5 = cpu_to_le32(rate); -- tx_desc->txdw4 |= -- cpu_to_le32(TXDESC32_USE_DRIVER_RATE); -- tx_desc->txdw5 |= -- cpu_to_le32(6 << TXDESC32_RETRY_LIMIT_SHIFT); -- tx_desc->txdw5 |= -- cpu_to_le32(TXDESC32_RETRY_LIMIT_ENABLE); -- } -- -- if (ieee80211_is_data_qos(hdr->frame_control)) -- tx_desc->txdw4 |= cpu_to_le32(TXDESC32_QOS); - -- if (short_preamble) -- tx_desc->txdw4 |= cpu_to_le32(TXDESC32_SHORT_PREAMBLE); -- -- if (sgi) -- tx_desc->txdw5 |= cpu_to_le32(TXDESC32_SHORT_GI); -- -- if (rate_flag & IEEE80211_TX_RC_USE_RTS_CTS) { -- /* -- * Use RTS rate 24M - does the mac80211 tell -- * us which to use? -- */ -- tx_desc->txdw4 |= -- cpu_to_le32(DESC_RATE_24M << -- TXDESC32_RTS_RATE_SHIFT); -- tx_desc->txdw4 |= -- cpu_to_le32(TXDESC32_RTS_CTS_ENABLE); -- tx_desc->txdw4 |= cpu_to_le32(TXDESC32_HW_RTS_ENABLE); -- } -- } else { -- tx_desc40 = (struct rtl8xxxu_txdesc40 *)tx_desc; -- -- tx_desc40->txdw4 = cpu_to_le32(rate); -- if (ieee80211_is_data(hdr->frame_control)) { -- tx_desc->txdw4 |= -- cpu_to_le32(0x1f << -- TXDESC40_DATA_RATE_FB_SHIFT); -- } -- -- tx_desc40->txdw9 = -- cpu_to_le32((u32)seq_number << TXDESC40_SEQ_SHIFT); -- -- if (ampdu_enable) -- tx_desc40->txdw2 |= cpu_to_le32(TXDESC40_AGG_ENABLE); -- else -- tx_desc40->txdw2 |= cpu_to_le32(TXDESC40_AGG_BREAK); -- -- if (ieee80211_is_mgmt(hdr->frame_control)) { -- tx_desc40->txdw4 = cpu_to_le32(rate); -- tx_desc40->txdw3 |= -- cpu_to_le32(TXDESC40_USE_DRIVER_RATE); -- tx_desc40->txdw4 |= -- cpu_to_le32(6 << TXDESC40_RETRY_LIMIT_SHIFT); -- tx_desc40->txdw4 |= -- cpu_to_le32(TXDESC40_RETRY_LIMIT_ENABLE); -- } -- -- if (short_preamble) -- tx_desc40->txdw5 |= -- cpu_to_le32(TXDESC40_SHORT_PREAMBLE); -- -- if (rate_flag & IEEE80211_TX_RC_USE_RTS_CTS) { -- /* -- * Use RTS rate 24M - does the mac80211 tell -- * us which to use? -- */ -- tx_desc->txdw4 |= -- cpu_to_le32(DESC_RATE_24M << -- TXDESC40_RTS_RATE_SHIFT); -- tx_desc->txdw3 |= cpu_to_le32(TXDESC40_RTS_CTS_ENABLE); -- tx_desc->txdw3 |= cpu_to_le32(TXDESC40_HW_RTS_ENABLE); -- } -- } -+ priv->fops->fill_txdesc(hdr, tx_desc, rate, rate_flag, -+ sgi, short_preamble, ampdu_enable); - - rtl8xxxu_calc_tx_desc_csum(tx_desc); - diff --git a/package/kernel/mac80211/patches/653-0019-rtl8xxxu-Do-not-mess-with-REG_FPGA0_XA_RF_INT_OE-eit.patch b/package/kernel/mac80211/patches/653-0019-rtl8xxxu-Do-not-mess-with-REG_FPGA0_XA_RF_INT_OE-eit.patch new file mode 100644 index 0000000000..0a3bab0524 --- /dev/null +++ b/package/kernel/mac80211/patches/653-0019-rtl8xxxu-Do-not-mess-with-REG_FPGA0_XA_RF_INT_OE-eit.patch @@ -0,0 +1,27 @@ +From a4234121f383eed37e0a5ea8aed56bb75027305c Mon Sep 17 00:00:00 2001 +From: Jes Sorensen +Date: Wed, 20 Jul 2016 14:38:23 -0400 +Subject: [PATCH] rtl8xxxu: Do not mess with REG_FPGA0_XA_RF_INT_OE either on + 8188eu + +On older devices the vendor driver hard codes a value into +REG_FPGA0_XA_RF_INT_OE for antenna selection. This probably shouldn't +be done in the first place, but more investigation needs to be done to +figure out how this really works. + +Signed-off-by: Jes Sorensen +--- + drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +--- a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c ++++ b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c +@@ -3976,7 +3976,7 @@ static int rtl8xxxu_init_device(struct i + rtl8xxxu_write32(priv, REG_FPGA0_XAB_RF_SW_CTRL, val32); + + /* 0x860[6:5]= 00 - why? - this sets antenna B */ +- if (priv->rtl_chip != RTL8192E) ++ if (priv->rtl_chip != RTL8192E && priv->rtl_chip != RTL8188E) + rtl8xxxu_write32(priv, REG_FPGA0_XA_RF_INT_OE, 0x66f60210); + + if (!macpower) { diff --git a/package/kernel/mac80211/patches/653-0019-rtl8xxxu-gen1-Fix-non-static-symbol-warning.patch b/package/kernel/mac80211/patches/653-0019-rtl8xxxu-gen1-Fix-non-static-symbol-warning.patch deleted file mode 100644 index 4cfdd7cd1e..0000000000 --- a/package/kernel/mac80211/patches/653-0019-rtl8xxxu-gen1-Fix-non-static-symbol-warning.patch +++ /dev/null @@ -1,28 +0,0 @@ -From 77e3980201e7d54b2e63653b46a6baba26040cef Mon Sep 17 00:00:00 2001 -From: Wei Yongjun -Date: Fri, 19 Aug 2016 17:46:41 -0400 -Subject: [PATCH] rtl8xxxu: gen1: Fix non static symbol warning - -Fixes the following sparse warning: - -drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c:898:1: warning: - symbol 'rtl8xxxu_gen1_h2c_cmd' was not declared. Should it be static? - -Signed-off-by: Wei Yongjun -Signed-off-by: Jes Sorensen -Signed-off-by: Kalle Valo ---- - drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - ---- a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c -+++ b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c -@@ -894,7 +894,7 @@ int rtl8xxxu_write_rfreg(struct rtl8xxxu - return retval; - } - --int -+static int - rtl8xxxu_gen1_h2c_cmd(struct rtl8xxxu_priv *priv, struct h2c_cmd *h2c, int len) - { - struct device *dev = &priv->udev->dev; diff --git a/package/kernel/mac80211/patches/653-0020-rtl8xxxu-Make-rtl8xxxu_ampdu_action-less-chatty.patch b/package/kernel/mac80211/patches/653-0020-rtl8xxxu-Make-rtl8xxxu_ampdu_action-less-chatty.patch deleted file mode 100644 index 306faab657..0000000000 --- a/package/kernel/mac80211/patches/653-0020-rtl8xxxu-Make-rtl8xxxu_ampdu_action-less-chatty.patch +++ /dev/null @@ -1,54 +0,0 @@ -From 7329dc13107b2315a7b8ba5a75048935304c55a0 Mon Sep 17 00:00:00 2001 -From: Hans de Goede -Date: Fri, 19 Aug 2016 17:46:42 -0400 -Subject: [PATCH] rtl8xxxu: Make rtl8xxxu_ampdu_action less chatty - -On my home network rtl8xxxu is spamming the log with -IEEE80211_AMPDU_RX_START / IEEE80211_AMPDU_RX_STOP every few seconds -turn these messages into debug messages. - -Signed-off-by: Hans de Goede -Signed-off-by: Jes Sorensen -[kvalo@codeaurora.org: fix commit title] -Signed-off-by: Kalle Valo ---- - drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c | 10 +++++----- - 1 file changed, 5 insertions(+), 5 deletions(-) - ---- a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c -+++ b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c -@@ -5696,7 +5696,7 @@ rtl8xxxu_ampdu_action(struct ieee80211_h - - switch (action) { - case IEEE80211_AMPDU_TX_START: -- dev_info(dev, "%s: IEEE80211_AMPDU_TX_START\n", __func__); -+ dev_dbg(dev, "%s: IEEE80211_AMPDU_TX_START\n", __func__); - ampdu_factor = sta->ht_cap.ampdu_factor; - ampdu_density = sta->ht_cap.ampdu_density; - rtl8xxxu_set_ampdu_factor(priv, ampdu_factor); -@@ -5706,21 +5706,21 @@ rtl8xxxu_ampdu_action(struct ieee80211_h - ampdu_factor, ampdu_density); - break; - case IEEE80211_AMPDU_TX_STOP_FLUSH: -- dev_info(dev, "%s: IEEE80211_AMPDU_TX_STOP_FLUSH\n", __func__); -+ dev_dbg(dev, "%s: IEEE80211_AMPDU_TX_STOP_FLUSH\n", __func__); - rtl8xxxu_set_ampdu_factor(priv, 0); - rtl8xxxu_set_ampdu_min_space(priv, 0); - break; - case IEEE80211_AMPDU_TX_STOP_FLUSH_CONT: -- dev_info(dev, "%s: IEEE80211_AMPDU_TX_STOP_FLUSH_CONT\n", -+ dev_dbg(dev, "%s: IEEE80211_AMPDU_TX_STOP_FLUSH_CONT\n", - __func__); - rtl8xxxu_set_ampdu_factor(priv, 0); - rtl8xxxu_set_ampdu_min_space(priv, 0); - break; - case IEEE80211_AMPDU_RX_START: -- dev_info(dev, "%s: IEEE80211_AMPDU_RX_START\n", __func__); -+ dev_dbg(dev, "%s: IEEE80211_AMPDU_RX_START\n", __func__); - break; - case IEEE80211_AMPDU_RX_STOP: -- dev_info(dev, "%s: IEEE80211_AMPDU_RX_STOP\n", __func__); -+ dev_dbg(dev, "%s: IEEE80211_AMPDU_RX_STOP\n", __func__); - break; - default: - break; diff --git a/package/kernel/mac80211/patches/653-0020-rtl8xxxu-Set-transfer-page-size-for-8188eu.patch b/package/kernel/mac80211/patches/653-0020-rtl8xxxu-Set-transfer-page-size-for-8188eu.patch new file mode 100644 index 0000000000..595d1430ff --- /dev/null +++ b/package/kernel/mac80211/patches/653-0020-rtl8xxxu-Set-transfer-page-size-for-8188eu.patch @@ -0,0 +1,21 @@ +From 497b244578992c6353d214140f026154e4f4f710 Mon Sep 17 00:00:00 2001 +From: Jes Sorensen +Date: Wed, 20 Jul 2016 15:59:31 -0400 +Subject: [PATCH] rtl8xxxu: Set transfer page size for 8188eu + +Signed-off-by: Jes Sorensen +--- + drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_8188e.c | 2 ++ + 1 file changed, 2 insertions(+) + +--- a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_8188e.c ++++ b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_8188e.c +@@ -527,6 +527,8 @@ struct rtl8xxxu_fileops rtl8188eu_fops = + * Max RX buffer = 10K - max(TxReportSize(64*8), WOLPattern(16*24)) + */ + .trxff_boundary = 0x23ff, ++ .pbp_rx = PBP_PAGE_SIZE_128, ++ .pbp_tx = PBP_PAGE_SIZE_128, + .mactable = rtl8188e_mac_init_table, + .total_page_num = TX_TOTAL_PAGE_NUM_8188E, + .page_num_hi = TX_PAGE_NUM_HI_PQ_8188E, diff --git a/package/kernel/mac80211/patches/653-0021-rtl8xxxu-Enable-TX-report-timer-on-8188eu.patch b/package/kernel/mac80211/patches/653-0021-rtl8xxxu-Enable-TX-report-timer-on-8188eu.patch new file mode 100644 index 0000000000..c1bc3fa683 --- /dev/null +++ b/package/kernel/mac80211/patches/653-0021-rtl8xxxu-Enable-TX-report-timer-on-8188eu.patch @@ -0,0 +1,22 @@ +From a57a3fbb1a22544ce96e4dbe423694e982d54700 Mon Sep 17 00:00:00 2001 +From: Jes Sorensen +Date: Wed, 20 Jul 2016 16:13:06 -0400 +Subject: [PATCH] rtl8xxxu: Enable TX report timer on 8188eu + +The 8188eu uses the same TX report timer as found on the 8723b. + +Signed-off-by: Jes Sorensen +--- + drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_8188e.c | 1 + + 1 file changed, 1 insertion(+) + +--- a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_8188e.c ++++ b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_8188e.c +@@ -522,6 +522,7 @@ struct rtl8xxxu_fileops rtl8188eu_fops = + .init_phy_rf = rtl8188eu_init_phy_rf, + .usb_quirks = rtl8188e_usb_quirks, + .writeN_block_size = 128, ++ .has_tx_report = 1, + /* + * Use 9K for 8188e normal chip + * Max RX buffer = 10K - max(TxReportSize(64*8), WOLPattern(16*24)) diff --git a/package/kernel/mac80211/patches/653-0022-rtl8xxxu-Setup-interrupts-for-8188eu.patch b/package/kernel/mac80211/patches/653-0022-rtl8xxxu-Setup-interrupts-for-8188eu.patch new file mode 100644 index 0000000000..774b2a2bdd --- /dev/null +++ b/package/kernel/mac80211/patches/653-0022-rtl8xxxu-Setup-interrupts-for-8188eu.patch @@ -0,0 +1,31 @@ +From 4c85a1704e555aa04d72e31a4a90b9c4bf01d83b Mon Sep 17 00:00:00 2001 +From: Jes Sorensen +Date: Wed, 20 Jul 2016 16:59:18 -0400 +Subject: [PATCH] rtl8xxxu: Setup interrupts for 8188eu + +This sets up interrupts for 8188eu, but per vendor driver, it's not +obvious this is really needed for USB devices. + +Signed-off-by: Jes Sorensen +--- + drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c | 9 +++++++++ + 1 file changed, 9 insertions(+) + +--- a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c ++++ b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c +@@ -4041,6 +4041,15 @@ static int rtl8xxxu_init_device(struct i + if (priv->rtl_chip == RTL8192E) { + rtl8xxxu_write32(priv, REG_HIMR0, 0x00); + rtl8xxxu_write32(priv, REG_HIMR1, 0x00); ++ } else if (priv->rtl_chip == RTL8188E) { ++ rtl8xxxu_write32(priv, REG_HISR0, 0xffffffff); ++ val32 = IMR0_PSTIMEOUT | IMR0_TBDER | IMR0_CPWM | IMR0_CPWM2; ++ rtl8xxxu_write32(priv, REG_HIMR0, val32); ++ val32 = IMR1_TXERR | IMR1_RXERR | IMR1_TXFOVW | IMR1_RXFOVW; ++ rtl8xxxu_write32(priv, REG_HIMR1, val32); ++ val8 = rtl8xxxu_read8(priv, REG_USB_SPECIAL_OPTION); ++ val8 |= USB_SPEC_INT_BULK_SELECT; ++ rtl8xxxu_write8(priv, REG_USB_SPECIAL_OPTION, val8); + } else { + /* + * Enable all interrupts - not obvious USB needs to do this diff --git a/package/kernel/mac80211/patches/653-0023-rtl8xxxu-Use-rxdesc16-and-32-byte-tx-descriptors-for.patch b/package/kernel/mac80211/patches/653-0023-rtl8xxxu-Use-rxdesc16-and-32-byte-tx-descriptors-for.patch new file mode 100644 index 0000000000..c46522ecbb --- /dev/null +++ b/package/kernel/mac80211/patches/653-0023-rtl8xxxu-Use-rxdesc16-and-32-byte-tx-descriptors-for.patch @@ -0,0 +1,30 @@ +From 444b8212457b611f482ee6a5f52e8a14e6881f6e Mon Sep 17 00:00:00 2001 +From: Jes Sorensen +Date: Thu, 21 Jul 2016 14:52:49 -0400 +Subject: [PATCH] rtl8xxxu: Use rxdesc16 and 32 byte tx descriptors for 8188eu + +The RX descriptor format looks like the gen1 RX descriptor format, so +use that for now. + +The TX descriptor format is different and looks to be some bizarre +hybrid of the gen1 and gen2 formats. + +Signed-off-by: Jes Sorensen +--- + drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_8188e.c | 3 +++ + 1 file changed, 3 insertions(+) + +--- a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_8188e.c ++++ b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_8188e.c +@@ -520,8 +520,11 @@ struct rtl8xxxu_fileops rtl8188eu_fops = + .llt_init = rtl8xxxu_auto_llt_table, + .init_phy_bb = rtl8188eu_init_phy_bb, + .init_phy_rf = rtl8188eu_init_phy_rf, ++ .parse_rx_desc = rtl8xxxu_parse_rxdesc16, + .usb_quirks = rtl8188e_usb_quirks, + .writeN_block_size = 128, ++ .rx_desc_size = sizeof(struct rtl8xxxu_rxdesc16), ++ .tx_desc_size = sizeof(struct rtl8xxxu_txdesc32), + .has_tx_report = 1, + /* + * Use 9K for 8188e normal chip diff --git a/package/kernel/mac80211/patches/653-0024-rtl8xxxu-8188eu-use-same-ADDA-on-parameters-as-8723a.patch b/package/kernel/mac80211/patches/653-0024-rtl8xxxu-8188eu-use-same-ADDA-on-parameters-as-8723a.patch new file mode 100644 index 0000000000..3177ee35fc --- /dev/null +++ b/package/kernel/mac80211/patches/653-0024-rtl8xxxu-8188eu-use-same-ADDA-on-parameters-as-8723a.patch @@ -0,0 +1,25 @@ +From 399409ff2196eb6d3f758579b63a1091fff93870 Mon Sep 17 00:00:00 2001 +From: Jes Sorensen +Date: Thu, 21 Jul 2016 15:23:16 -0400 +Subject: [PATCH] rtl8xxxu: 8188eu use same ADDA on parameters as 8723au/8192cu + +For ADDA setup the 8188eu looks to match the gen1 parts. + +Signed-off-by: Jes Sorensen +--- + drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_8188e.c | 4 ++++ + 1 file changed, 4 insertions(+) + +--- a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_8188e.c ++++ b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_8188e.c +@@ -526,6 +526,10 @@ struct rtl8xxxu_fileops rtl8188eu_fops = + .rx_desc_size = sizeof(struct rtl8xxxu_rxdesc16), + .tx_desc_size = sizeof(struct rtl8xxxu_txdesc32), + .has_tx_report = 1, ++ .adda_1t_init = 0x0b1b25a0, ++ .adda_1t_path_on = 0x0bdb25a0, ++ .adda_2t_path_on_a = 0x04db25a4, ++ .adda_2t_path_on_b = 0x0b1b25a4, + /* + * Use 9K for 8188e normal chip + * Max RX buffer = 10K - max(TxReportSize(64*8), WOLPattern(16*24)) diff --git a/package/kernel/mac80211/patches/653-0025-rtl8xxxu-Add-PHY-IQ-calibration-code-for-8188eu.patch b/package/kernel/mac80211/patches/653-0025-rtl8xxxu-Add-PHY-IQ-calibration-code-for-8188eu.patch new file mode 100644 index 0000000000..ce76a67d9e --- /dev/null +++ b/package/kernel/mac80211/patches/653-0025-rtl8xxxu-Add-PHY-IQ-calibration-code-for-8188eu.patch @@ -0,0 +1,521 @@ +From 9a3c53da5228607375ab69d6e3cbc375f18a4f82 Mon Sep 17 00:00:00 2001 +From: Jes Sorensen +Date: Thu, 21 Jul 2016 17:25:56 -0400 +Subject: [PATCH] rtl8xxxu: Add PHY IQ calibration code for 8188eu + +The vendor driver for 8188eu is a bizarre modern style code for path A +and old-style code for path B. Most likely because the 8188eu is a +1T1R part which never gets to the path B code. + +Eventually we should look into unifying all the IQ calibration code. + +Signed-off-by: Jes Sorensen +--- + .../net/wireless/realtek/rtl8xxxu/rtl8xxxu_8188e.c | 489 +++++++++++++++++++++ + 1 file changed, 489 insertions(+) + +--- a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_8188e.c ++++ b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_8188e.c +@@ -384,6 +384,494 @@ static int rtl8188eu_init_phy_rf(struct + return ret; + } + ++static int rtl8188eu_iqk_path_a(struct rtl8xxxu_priv *priv) ++{ ++ u32 reg_eac, reg_e94, reg_e9c; ++ int result = 0; ++ ++ /* Path A IQK setting */ ++ rtl8xxxu_write32(priv, REG_TX_IQK_TONE_A, 0x10008c1c); ++ rtl8xxxu_write32(priv, REG_RX_IQK_TONE_A, 0x30008c1c); ++ ++ rtl8xxxu_write32(priv, REG_TX_IQK_PI_A, 0x8214032a); ++ rtl8xxxu_write32(priv, REG_RX_IQK_PI_A, 0x28160000); ++ ++ /* LO calibration setting */ ++ rtl8xxxu_write32(priv, REG_IQK_AGC_RSP, 0x00462911); ++ ++ /* One shot, path A LOK & IQK */ ++ rtl8xxxu_write32(priv, REG_IQK_AGC_PTS, 0xf9000000); ++ rtl8xxxu_write32(priv, REG_IQK_AGC_PTS, 0xf8000000); ++ ++ mdelay(10); ++ ++ /* Check failed */ ++ reg_eac = rtl8xxxu_read32(priv, REG_RX_POWER_AFTER_IQK_A_2); ++ reg_e94 = rtl8xxxu_read32(priv, REG_TX_POWER_BEFORE_IQK_A); ++ reg_e9c = rtl8xxxu_read32(priv, REG_TX_POWER_AFTER_IQK_A); ++ ++ if (!(reg_eac & BIT(28)) && ++ ((reg_e94 & 0x03ff0000) != 0x01420000) && ++ ((reg_e9c & 0x03ff0000) != 0x00420000)) ++ result |= 0x01; ++ ++ return result; ++} ++ ++static int rtl8188eu_rx_iqk_path_a(struct rtl8xxxu_priv *priv) ++{ ++ u32 reg_ea4, reg_eac, reg_e94, reg_e9c, val32; ++ int result = 0; ++ ++ /* Leave IQK mode */ ++ rtl8xxxu_write32(priv, REG_FPGA0_IQK, 0x00); ++ ++ /* Enable path A PA in TX IQK mode */ ++ rtl8xxxu_write_rfreg(priv, RF_A, RF6052_REG_WE_LUT, 0x800a0); ++ rtl8xxxu_write_rfreg(priv, RF_A, RF6052_REG_RCK_OS, 0x30000); ++ rtl8xxxu_write_rfreg(priv, RF_A, RF6052_REG_TXPA_G1, 0x0000f); ++ rtl8xxxu_write_rfreg(priv, RF_A, RF6052_REG_TXPA_G2, 0xf117b); ++ ++ /* PA/PAD control by 0x56, and set = 0x0 */ ++ rtl8xxxu_write_rfreg(priv, RF_A, RF6052_REG_UNKNOWN_DF, 0x00980); ++ rtl8xxxu_write_rfreg(priv, RF_A, RF6052_REG_UNKNOWN_56, 0x51000); ++ ++ /* Enter IQK mode */ ++ rtl8xxxu_write32(priv, REG_FPGA0_IQK, 0x80800000); ++ ++ /* TX IQK setting */ ++ rtl8xxxu_write32(priv, REG_TX_IQK, 0x01007c00); ++ rtl8xxxu_write32(priv, REG_RX_IQK, 0x81004800); ++ ++ /* path-A IQK setting */ ++ rtl8xxxu_write32(priv, REG_TX_IQK_TONE_A, 0x10008c1c); ++ rtl8xxxu_write32(priv, REG_RX_IQK_TONE_A, 0x30008c1c); ++ ++ rtl8xxxu_write32(priv, REG_TX_IQK_PI_A, 0x82160c1f); ++ rtl8xxxu_write32(priv, REG_RX_IQK_PI_A, 0x28160000); ++ ++ /* LO calibration setting */ ++ rtl8xxxu_write32(priv, REG_IQK_AGC_RSP, 0x0046a911); ++ ++ /* One shot, path A LOK & IQK */ ++ rtl8xxxu_write32(priv, REG_IQK_AGC_PTS, 0xf9000000); ++ rtl8xxxu_write32(priv, REG_IQK_AGC_PTS, 0xf8000000); ++ ++ mdelay(10); ++ ++ /* Check failed */ ++ reg_eac = rtl8xxxu_read32(priv, REG_RX_POWER_AFTER_IQK_A_2); ++ reg_e94 = rtl8xxxu_read32(priv, REG_TX_POWER_BEFORE_IQK_A); ++ reg_e9c = rtl8xxxu_read32(priv, REG_TX_POWER_AFTER_IQK_A); ++ ++ if (!(reg_eac & BIT(28)) && ++ ((reg_e94 & 0x03ff0000) != 0x01420000) && ++ ((reg_e9c & 0x03ff0000) != 0x00420000)) { ++ result |= 0x01; ++ } else { ++ /* PA/PAD controlled by 0x0 */ ++ rtl8xxxu_write32(priv, REG_FPGA0_IQK, 0x00000000); ++ rtl8xxxu_write_rfreg(priv, RF_A, RF6052_REG_UNKNOWN_DF, 0x180); ++ goto out; ++ } ++ ++ val32 = 0x80007c00 | ++ (reg_e94 & 0x03ff0000) | ((reg_e9c >> 16) & 0x03ff); ++ rtl8xxxu_write32(priv, REG_TX_IQK, val32); ++ ++ /* Modify RX IQK mode table */ ++ rtl8xxxu_write32(priv, REG_FPGA0_IQK, 0x00000000); ++ ++ rtl8xxxu_write_rfreg(priv, RF_A, RF6052_REG_WE_LUT, 0x800a0); ++ rtl8xxxu_write_rfreg(priv, RF_A, RF6052_REG_RCK_OS, 0x30000); ++ rtl8xxxu_write_rfreg(priv, RF_A, RF6052_REG_TXPA_G1, 0x0000f); ++ rtl8xxxu_write_rfreg(priv, RF_A, RF6052_REG_TXPA_G2, 0xf7ffa); ++ ++ /* Enter IQK mode */ ++ rtl8xxxu_write32(priv, REG_FPGA0_IQK, 0x80800000); ++ ++ /* IQK setting */ ++ rtl8xxxu_write32(priv, REG_RX_IQK, 0x01004800); ++ ++ /* Path A IQK setting */ ++ rtl8xxxu_write32(priv, REG_TX_IQK_TONE_A, 0x38008c1c); ++ rtl8xxxu_write32(priv, REG_RX_IQK_TONE_A, 0x18008c1c); ++ ++ rtl8xxxu_write32(priv, REG_TX_IQK_PI_A, 0x82160c05); ++ rtl8xxxu_write32(priv, REG_RX_IQK_PI_A, 0x28160c1f); ++ ++ /* LO calibration setting */ ++ rtl8xxxu_write32(priv, REG_IQK_AGC_RSP, 0x0046a911); ++ ++ /* One shot, path A LOK & IQK */ ++ rtl8xxxu_write32(priv, REG_IQK_AGC_PTS, 0xf9000000); ++ rtl8xxxu_write32(priv, REG_IQK_AGC_PTS, 0xf8000000); ++ ++ mdelay(10); ++ ++ reg_eac = rtl8xxxu_read32(priv, REG_RX_POWER_AFTER_IQK_A_2); ++ reg_ea4 = rtl8xxxu_read32(priv, REG_RX_POWER_BEFORE_IQK_A_2); ++ ++ rtl8xxxu_write32(priv, REG_FPGA0_IQK, 0x00000000); ++ rtl8xxxu_write_rfreg(priv, RF_A, RF6052_REG_UNKNOWN_DF, 0x180); ++ ++ if (!(reg_eac & BIT(27)) && ++ ((reg_ea4 & 0x03ff0000) != 0x01320000) && ++ ((reg_eac & 0x03ff0000) != 0x00360000)) ++ result |= 0x02; ++ else ++ dev_warn(&priv->udev->dev, "%s: Path A RX IQK failed!\n", ++ __func__); ++ ++out: ++ return result; ++} ++ ++static int rtl8188eu_iqk_path_b(struct rtl8xxxu_priv *priv) ++{ ++ u32 reg_eac, reg_eb4, reg_ebc, reg_ec4, reg_ecc; ++ int result = 0; ++ ++ rtl8xxxu_write32(priv, REG_IQK_AGC_CONT, 0x00000002); ++ rtl8xxxu_write32(priv, REG_IQK_AGC_CONT, 0x00000000); ++ ++ mdelay(1); ++ ++ /* Check failed */ ++ reg_eac = rtl8xxxu_read32(priv, REG_RX_POWER_AFTER_IQK_A_2); ++ reg_eb4 = rtl8xxxu_read32(priv, REG_TX_POWER_BEFORE_IQK_B); ++ reg_ebc = rtl8xxxu_read32(priv, REG_TX_POWER_AFTER_IQK_B); ++ reg_ec4 = rtl8xxxu_read32(priv, REG_RX_POWER_BEFORE_IQK_B_2); ++ reg_ecc = rtl8xxxu_read32(priv, REG_RX_POWER_AFTER_IQK_B_2); ++ ++ if (!(reg_eac & BIT(31)) && ++ ((reg_eb4 & 0x03ff0000) != 0x01420000) && ++ ((reg_ebc & 0x03ff0000) != 0x00420000)) ++ result |= 0x01; ++ else ++ dev_warn(&priv->udev->dev, "%s: Path B IQK failed!\n", ++ __func__); ++ ++ if (!(reg_eac & BIT(30)) && ++ ((reg_ec4 & 0x03ff0000) != 0x01320000) && ++ ((reg_ecc & 0x03ff0000) != 0x00360000)) ++ result |= 0x01; ++ else ++ dev_warn(&priv->udev->dev, "%s: Path B RX IQK failed!\n", ++ __func__); ++ ++ return result; ++} ++ ++static void rtl8188eu_phy_iqcalibrate(struct rtl8xxxu_priv *priv, ++ int result[][8], int t) ++{ ++ struct device *dev = &priv->udev->dev; ++ u32 i, val32; ++ int path_a_ok, path_b_ok; ++ int retry = 2; ++ const u32 adda_regs[RTL8XXXU_ADDA_REGS] = { ++ REG_FPGA0_XCD_SWITCH_CTRL, REG_BLUETOOTH, ++ REG_RX_WAIT_CCA, REG_TX_CCK_RFON, ++ REG_TX_CCK_BBON, REG_TX_OFDM_RFON, ++ REG_TX_OFDM_BBON, REG_TX_TO_RX, ++ REG_TX_TO_TX, REG_RX_CCK, ++ REG_RX_OFDM, REG_RX_WAIT_RIFS, ++ REG_RX_TO_RX, REG_STANDBY, ++ REG_SLEEP, REG_PMPD_ANAEN ++ }; ++ const u32 iqk_mac_regs[RTL8XXXU_MAC_REGS] = { ++ REG_TXPAUSE, REG_BEACON_CTRL, ++ REG_BEACON_CTRL_1, REG_GPIO_MUXCFG ++ }; ++ const u32 iqk_bb_regs[RTL8XXXU_BB_REGS] = { ++ REG_OFDM0_TRX_PATH_ENABLE, REG_OFDM0_TR_MUX_PAR, ++ REG_FPGA0_XCD_RF_SW_CTRL, REG_CONFIG_ANT_A, REG_CONFIG_ANT_B, ++ REG_FPGA0_XAB_RF_SW_CTRL, REG_FPGA0_XA_RF_INT_OE, ++ REG_FPGA0_XB_RF_INT_OE, REG_FPGA0_RF_MODE ++ }; ++ ++ /* ++ * Note: IQ calibration must be performed after loading ++ * PHY_REG.txt , and radio_a, radio_b.txt ++ */ ++ ++ if (t == 0) { ++ /* Save ADDA parameters, turn Path A ADDA on */ ++ rtl8xxxu_save_regs(priv, adda_regs, priv->adda_backup, ++ RTL8XXXU_ADDA_REGS); ++ rtl8xxxu_save_mac_regs(priv, iqk_mac_regs, priv->mac_backup); ++ rtl8xxxu_save_regs(priv, iqk_bb_regs, ++ priv->bb_backup, RTL8XXXU_BB_REGS); ++ } ++ ++ rtl8xxxu_path_adda_on(priv, adda_regs, true); ++ ++ if (t == 0) { ++ val32 = rtl8xxxu_read32(priv, REG_FPGA0_XA_HSSI_PARM1); ++ if (val32 & FPGA0_HSSI_PARM1_PI) ++ priv->pi_enabled = 1; ++ } ++ ++ if (!priv->pi_enabled) { ++ /* Switch BB to PI mode to do IQ Calibration. */ ++ rtl8xxxu_write32(priv, REG_FPGA0_XA_HSSI_PARM1, 0x01000100); ++ rtl8xxxu_write32(priv, REG_FPGA0_XB_HSSI_PARM1, 0x01000100); ++ } ++ ++ val32 = rtl8xxxu_read32(priv, REG_FPGA0_RF_MODE); ++ val32 &= ~FPGA_RF_MODE_CCK; ++ rtl8xxxu_write32(priv, REG_FPGA0_RF_MODE, val32); ++ ++ rtl8xxxu_write32(priv, REG_OFDM0_TRX_PATH_ENABLE, 0x03a05600); ++ rtl8xxxu_write32(priv, REG_OFDM0_TR_MUX_PAR, 0x000800e4); ++ rtl8xxxu_write32(priv, REG_FPGA0_XCD_RF_SW_CTRL, 0x22204000); ++ ++ if (!priv->no_pape) { ++ val32 = rtl8xxxu_read32(priv, REG_FPGA0_XAB_RF_SW_CTRL); ++ val32 |= (FPGA0_RF_PAPE | ++ (FPGA0_RF_PAPE << FPGA0_RF_BD_CTRL_SHIFT)); ++ rtl8xxxu_write32(priv, REG_FPGA0_XAB_RF_SW_CTRL, val32); ++ } ++ ++ val32 = rtl8xxxu_read32(priv, REG_FPGA0_XA_RF_INT_OE); ++ val32 &= ~BIT(10); ++ rtl8xxxu_write32(priv, REG_FPGA0_XA_RF_INT_OE, val32); ++ val32 = rtl8xxxu_read32(priv, REG_FPGA0_XB_RF_INT_OE); ++ val32 &= ~BIT(10); ++ rtl8xxxu_write32(priv, REG_FPGA0_XB_RF_INT_OE, val32); ++ ++ if (priv->tx_paths > 1) { ++ rtl8xxxu_write32(priv, REG_FPGA0_XA_LSSI_PARM, 0x00010000); ++ rtl8xxxu_write32(priv, REG_FPGA0_XB_LSSI_PARM, 0x00010000); ++ } ++ ++ /* MAC settings */ ++ rtl8xxxu_mac_calibration(priv, iqk_mac_regs, priv->mac_backup); ++ ++ /* Page B init */ ++ rtl8xxxu_write32(priv, REG_CONFIG_ANT_A, 0x0f600000); ++ ++ if (priv->tx_paths > 1) ++ rtl8xxxu_write32(priv, REG_CONFIG_ANT_B, 0x0f600000); ++ ++ /* IQ calibration setting */ ++ rtl8xxxu_write32(priv, REG_FPGA0_IQK, 0x80800000); ++ rtl8xxxu_write32(priv, REG_TX_IQK, 0x01007c00); ++ rtl8xxxu_write32(priv, REG_RX_IQK, 0x81004800); ++ ++ for (i = 0; i < retry; i++) { ++ path_a_ok = rtl8188eu_iqk_path_a(priv); ++ if (path_a_ok == 0x01) { ++ val32 = rtl8xxxu_read32(priv, ++ REG_TX_POWER_BEFORE_IQK_A); ++ result[t][0] = (val32 >> 16) & 0x3ff; ++ val32 = rtl8xxxu_read32(priv, ++ REG_TX_POWER_AFTER_IQK_A); ++ result[t][1] = (val32 >> 16) & 0x3ff; ++ break; ++ } ++ } ++ ++ if (!path_a_ok) ++ dev_dbg(dev, "%s: Path A TX IQK failed!\n", __func__); ++ ++ for (i = 0; i < retry; i++) { ++ path_a_ok = rtl8188eu_rx_iqk_path_a(priv); ++ if (path_a_ok == 0x03) { ++ val32 = rtl8xxxu_read32(priv, ++ REG_RX_POWER_BEFORE_IQK_A_2); ++ result[t][2] = (val32 >> 16) & 0x3ff; ++ val32 = rtl8xxxu_read32(priv, ++ REG_RX_POWER_AFTER_IQK_A_2); ++ result[t][3] = (val32 >> 16) & 0x3ff; ++ ++ break; ++ } ++ } ++ ++ if (!path_a_ok) ++ dev_dbg(dev, "%s: Path A RX IQK failed!\n", __func__); ++ ++ /* ++ * Path B calibration code in the vendor driver seems to be ++ * old style and not updated for the 8188eu since it's a 1T1R ++ * part. Keeping the code here in sync with the vendor code ++ * to not divert unncessarily, but probably would be good to ++ * look into modernizing all the code including that for the ++ * old gen1 devices ++ */ ++ if (priv->tx_paths > 1) { ++ /* ++ * Path A into standby ++ */ ++ rtl8xxxu_write32(priv, REG_FPGA0_IQK, 0x0); ++ rtl8xxxu_write32(priv, REG_FPGA0_XA_LSSI_PARM, 0x00010000); ++ rtl8xxxu_write32(priv, REG_FPGA0_IQK, 0x80800000); ++ ++ /* Turn Path B ADDA on */ ++ rtl8xxxu_path_adda_on(priv, adda_regs, false); ++ ++ for (i = 0; i < retry; i++) { ++ path_b_ok = rtl8188eu_iqk_path_b(priv); ++ if (path_b_ok == 0x03) { ++ val32 = rtl8xxxu_read32(priv, REG_TX_POWER_BEFORE_IQK_B); ++ result[t][4] = (val32 >> 16) & 0x3ff; ++ val32 = rtl8xxxu_read32(priv, REG_TX_POWER_AFTER_IQK_B); ++ result[t][5] = (val32 >> 16) & 0x3ff; ++ val32 = rtl8xxxu_read32(priv, REG_RX_POWER_BEFORE_IQK_B_2); ++ result[t][6] = (val32 >> 16) & 0x3ff; ++ val32 = rtl8xxxu_read32(priv, REG_RX_POWER_AFTER_IQK_B_2); ++ result[t][7] = (val32 >> 16) & 0x3ff; ++ break; ++ } else if (i == (retry - 1) && path_b_ok == 0x01) { ++ /* TX IQK OK */ ++ val32 = rtl8xxxu_read32(priv, REG_TX_POWER_BEFORE_IQK_B); ++ result[t][4] = (val32 >> 16) & 0x3ff; ++ val32 = rtl8xxxu_read32(priv, REG_TX_POWER_AFTER_IQK_B); ++ result[t][5] = (val32 >> 16) & 0x3ff; ++ } ++ } ++ ++ if (!path_b_ok) ++ dev_dbg(dev, "%s: Path B IQK failed!\n", __func__); ++ } ++ ++ /* Back to BB mode, load original value */ ++ rtl8xxxu_write32(priv, REG_FPGA0_IQK, 0); ++ ++ if (t) { ++ if (!priv->pi_enabled) { ++ /* ++ * Switch back BB to SI mode after finishing ++ * IQ Calibration ++ */ ++ val32 = 0x01000000; ++ rtl8xxxu_write32(priv, REG_FPGA0_XA_HSSI_PARM1, val32); ++ rtl8xxxu_write32(priv, REG_FPGA0_XB_HSSI_PARM1, val32); ++ } ++ ++ /* Reload ADDA power saving parameters */ ++ rtl8xxxu_restore_regs(priv, adda_regs, priv->adda_backup, ++ RTL8XXXU_ADDA_REGS); ++ ++ /* Reload MAC parameters */ ++ rtl8xxxu_restore_mac_regs(priv, iqk_mac_regs, priv->mac_backup); ++ ++ /* Reload BB parameters */ ++ rtl8xxxu_restore_regs(priv, iqk_bb_regs, ++ priv->bb_backup, RTL8XXXU_BB_REGS); ++ ++ /* Restore RX initial gain */ ++ rtl8xxxu_write32(priv, REG_FPGA0_XA_LSSI_PARM, 0x00032ed3); ++ ++ if (priv->tx_paths > 1) { ++ rtl8xxxu_write32(priv, REG_FPGA0_XB_LSSI_PARM, ++ 0x00032ed3); ++ } ++ ++ /* Load 0xe30 IQC default value */ ++ rtl8xxxu_write32(priv, REG_TX_IQK_TONE_A, 0x01008c00); ++ rtl8xxxu_write32(priv, REG_RX_IQK_TONE_A, 0x01008c00); ++ } ++} ++ ++static void rtl8188eu_phy_iq_calibrate(struct rtl8xxxu_priv *priv) ++{ ++ struct device *dev = &priv->udev->dev; ++ int result[4][8]; /* last is final result */ ++ int i, candidate; ++ bool path_a_ok, path_b_ok; ++ u32 reg_e94, reg_e9c, reg_ea4, reg_eac; ++ u32 reg_eb4, reg_ebc, reg_ec4, reg_ecc; ++ bool simu; ++ ++ memset(result, 0, sizeof(result)); ++ result[3][0] = 0x100; ++ result[3][2] = 0x100; ++ result[3][4] = 0x100; ++ result[3][6] = 0x100; ++ ++ candidate = -1; ++ ++ path_a_ok = false; ++ path_b_ok = false; ++ ++ for (i = 0; i < 3; i++) { ++ rtl8188eu_phy_iqcalibrate(priv, result, i); ++ ++ if (i == 1) { ++ simu = rtl8xxxu_gen2_simularity_compare(priv, ++ result, 0, 1); ++ if (simu) { ++ candidate = 0; ++ break; ++ } ++ } ++ ++ if (i == 2) { ++ simu = rtl8xxxu_gen2_simularity_compare(priv, ++ result, 0, 2); ++ if (simu) { ++ candidate = 0; ++ break; ++ } ++ ++ simu = rtl8xxxu_gen2_simularity_compare(priv, ++ result, 1, 2); ++ if (simu) ++ candidate = 1; ++ else ++ candidate = 3; ++ } ++ } ++ ++ for (i = 0; i < 4; i++) { ++ reg_e94 = result[i][0]; ++ reg_e9c = result[i][1]; ++ reg_ea4 = result[i][2]; ++ reg_eb4 = result[i][4]; ++ reg_ebc = result[i][5]; ++ reg_ec4 = result[i][6]; ++ } ++ ++ if (candidate >= 0) { ++ reg_e94 = result[candidate][0]; ++ priv->rege94 = reg_e94; ++ reg_e9c = result[candidate][1]; ++ priv->rege9c = reg_e9c; ++ reg_ea4 = result[candidate][2]; ++ reg_eac = result[candidate][3]; ++ reg_eb4 = result[candidate][4]; ++ priv->regeb4 = reg_eb4; ++ reg_ebc = result[candidate][5]; ++ priv->regebc = reg_ebc; ++ reg_ec4 = result[candidate][6]; ++ reg_ecc = result[candidate][7]; ++ dev_dbg(dev, "%s: candidate is %x\n", __func__, candidate); ++ dev_dbg(dev, ++ "%s: e94 =%x e9c=%x ea4=%x eac=%x eb4=%x ebc=%x ec4=%x " ++ "ecc=%x\n ", __func__, reg_e94, reg_e9c, ++ reg_ea4, reg_eac, reg_eb4, reg_ebc, reg_ec4, reg_ecc); ++ path_a_ok = true; ++ path_b_ok = true; ++ } else { ++ reg_e94 = reg_eb4 = priv->rege94 = priv->regeb4 = 0x100; ++ reg_e9c = reg_ebc = priv->rege9c = priv->regebc = 0x0; ++ } ++ ++ if (reg_e94 && candidate >= 0) ++ rtl8xxxu_fill_iqk_matrix_a(priv, path_a_ok, result, ++ candidate, (reg_ea4 == 0)); ++ ++ if (priv->rf_paths > 1 && reg_eb4) ++ rtl8xxxu_fill_iqk_matrix_b(priv, path_b_ok, result, ++ candidate, (reg_ec4 == 0)); ++ ++ rtl8xxxu_save_regs(priv, rtl8xxxu_iqk_phy_iq_bb_reg, ++ priv->bb_recovery_backup, RTL8XXXU_BB_REGS); ++} ++ + static void rtl8188e_disabled_to_emu(struct rtl8xxxu_priv *priv) + { + u16 val16; +@@ -520,6 +1008,7 @@ struct rtl8xxxu_fileops rtl8188eu_fops = + .llt_init = rtl8xxxu_auto_llt_table, + .init_phy_bb = rtl8188eu_init_phy_bb, + .init_phy_rf = rtl8188eu_init_phy_rf, ++ .phy_iq_calibrate = rtl8188eu_phy_iq_calibrate, + .parse_rx_desc = rtl8xxxu_parse_rxdesc16, + .usb_quirks = rtl8188e_usb_quirks, + .writeN_block_size = 128, diff --git a/package/kernel/mac80211/patches/653-0026-rtl8xxxu-8188eu-uses-the-gen2-thermal-meter.patch b/package/kernel/mac80211/patches/653-0026-rtl8xxxu-8188eu-uses-the-gen2-thermal-meter.patch new file mode 100644 index 0000000000..81b1d848a3 --- /dev/null +++ b/package/kernel/mac80211/patches/653-0026-rtl8xxxu-8188eu-uses-the-gen2-thermal-meter.patch @@ -0,0 +1,23 @@ +From e33fed77d7493ef16c3afd32eb0d7c99fc95bfad Mon Sep 17 00:00:00 2001 +From: Jes Sorensen +Date: Fri, 22 Jul 2016 11:20:00 -0400 +Subject: [PATCH] rtl8xxxu: 8188eu uses the gen2 thermal meter + +Vendor driver writes thermal meter setup to RF register 0x42, hence +the gen2 setup. However the driver doesn't do much with it. + +Signed-off-by: Jes Sorensen +--- + drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_8188e.c | 1 + + 1 file changed, 1 insertion(+) + +--- a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_8188e.c ++++ b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_8188e.c +@@ -1015,6 +1015,7 @@ struct rtl8xxxu_fileops rtl8188eu_fops = + .rx_desc_size = sizeof(struct rtl8xxxu_rxdesc16), + .tx_desc_size = sizeof(struct rtl8xxxu_txdesc32), + .has_tx_report = 1, ++ .gen2_thermal_meter = 1, + .adda_1t_init = 0x0b1b25a0, + .adda_1t_path_on = 0x0bdb25a0, + .adda_2t_path_on_a = 0x04db25a4, diff --git a/package/kernel/mac80211/patches/653-0027-rtl8xxxu-Set-REG_USB_HRPWM-to-0-for-8188eu.patch b/package/kernel/mac80211/patches/653-0027-rtl8xxxu-Set-REG_USB_HRPWM-to-0-for-8188eu.patch new file mode 100644 index 0000000000..4c242453b8 --- /dev/null +++ b/package/kernel/mac80211/patches/653-0027-rtl8xxxu-Set-REG_USB_HRPWM-to-0-for-8188eu.patch @@ -0,0 +1,23 @@ +From 42808faad1b2cf0366a39074c08dbd181fa51b07 Mon Sep 17 00:00:00 2001 +From: Jes Sorensen +Date: Fri, 22 Jul 2016 11:33:29 -0400 +Subject: [PATCH] rtl8xxxu: Set REG_USB_HRPWM to 0 for 8188eu + +This matches what 8192eu does + +Signed-off-by: Jes Sorensen +--- + drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +--- a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c ++++ b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c +@@ -4240,7 +4240,7 @@ static int rtl8xxxu_init_device(struct i + val32 |= FPGA_RF_MODE_CCK; + rtl8xxxu_write32(priv, REG_FPGA0_RF_MODE, val32); + } +- } else if (priv->rtl_chip == RTL8192E) { ++ } else if (priv->rtl_chip == RTL8192E || priv->rtl_chip == RTL8188E) { + rtl8xxxu_write8(priv, REG_USB_HRPWM, 0x00); + } + diff --git a/package/kernel/mac80211/patches/653-0028-rtl8xxxu-Implement-rtl8188eu_config_channel.patch b/package/kernel/mac80211/patches/653-0028-rtl8xxxu-Implement-rtl8188eu_config_channel.patch new file mode 100644 index 0000000000..a397125e8c --- /dev/null +++ b/package/kernel/mac80211/patches/653-0028-rtl8xxxu-Implement-rtl8188eu_config_channel.patch @@ -0,0 +1,146 @@ +From 9796f3807764567ecde6e3787a66e4b4edbc35df Mon Sep 17 00:00:00 2001 +From: Jes Sorensen +Date: Fri, 22 Jul 2016 11:40:13 -0400 +Subject: [PATCH] rtl8xxxu: Implement rtl8188eu_config_channel() + +The 8188eu doesn't seem to have REG_FPGA0_ANALOG2, so implement it's +own specific version. + +Signed-off-by: Jes Sorensen +--- + .../net/wireless/realtek/rtl8xxxu/rtl8xxxu_8188e.c | 117 +++++++++++++++++++++ + 1 file changed, 117 insertions(+) + +--- a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_8188e.c ++++ b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_8188e.c +@@ -283,6 +283,122 @@ static struct rtl8xxxu_rfregval rtl8188e + {0xff, 0xffffffff} + }; + ++void rtl8188eu_config_channel(struct ieee80211_hw *hw) ++{ ++ struct rtl8xxxu_priv *priv = hw->priv; ++ u32 val32, rsr; ++ u8 val8, opmode; ++ bool ht = true; ++ int sec_ch_above, channel; ++ int i; ++ ++ opmode = rtl8xxxu_read8(priv, REG_BW_OPMODE); ++ rsr = rtl8xxxu_read32(priv, REG_RESPONSE_RATE_SET); ++ channel = hw->conf.chandef.chan->hw_value; ++ ++ switch (hw->conf.chandef.width) { ++ case NL80211_CHAN_WIDTH_20_NOHT: ++ ht = false; ++ case NL80211_CHAN_WIDTH_20: ++ opmode |= BW_OPMODE_20MHZ; ++ rtl8xxxu_write8(priv, REG_BW_OPMODE, opmode); ++ ++ val32 = rtl8xxxu_read32(priv, REG_FPGA0_RF_MODE); ++ val32 &= ~FPGA_RF_MODE; ++ rtl8xxxu_write32(priv, REG_FPGA0_RF_MODE, val32); ++ ++ val32 = rtl8xxxu_read32(priv, REG_FPGA1_RF_MODE); ++ val32 &= ~FPGA_RF_MODE; ++ rtl8xxxu_write32(priv, REG_FPGA1_RF_MODE, val32); ++ break; ++ case NL80211_CHAN_WIDTH_40: ++ if (hw->conf.chandef.center_freq1 > ++ hw->conf.chandef.chan->center_freq) { ++ sec_ch_above = 1; ++ channel += 2; ++ } else { ++ sec_ch_above = 0; ++ channel -= 2; ++ } ++ ++ opmode &= ~BW_OPMODE_20MHZ; ++ rtl8xxxu_write8(priv, REG_BW_OPMODE, opmode); ++ rsr &= ~RSR_RSC_BANDWIDTH_40M; ++ if (sec_ch_above) ++ rsr |= RSR_RSC_UPPER_SUB_CHANNEL; ++ else ++ rsr |= RSR_RSC_LOWER_SUB_CHANNEL; ++ rtl8xxxu_write32(priv, REG_RESPONSE_RATE_SET, rsr); ++ ++ val32 = rtl8xxxu_read32(priv, REG_FPGA0_RF_MODE); ++ val32 |= FPGA_RF_MODE; ++ rtl8xxxu_write32(priv, REG_FPGA0_RF_MODE, val32); ++ ++ val32 = rtl8xxxu_read32(priv, REG_FPGA1_RF_MODE); ++ val32 |= FPGA_RF_MODE; ++ rtl8xxxu_write32(priv, REG_FPGA1_RF_MODE, val32); ++ ++ /* ++ * Set Control channel to upper or lower. These settings ++ * are required only for 40MHz ++ */ ++ val32 = rtl8xxxu_read32(priv, REG_CCK0_SYSTEM); ++ val32 &= ~CCK0_SIDEBAND; ++ if (!sec_ch_above) ++ val32 |= CCK0_SIDEBAND; ++ rtl8xxxu_write32(priv, REG_CCK0_SYSTEM, val32); ++ ++ val32 = rtl8xxxu_read32(priv, REG_OFDM1_LSTF); ++ val32 &= ~OFDM_LSTF_PRIME_CH_MASK; /* 0xc00 */ ++ if (sec_ch_above) ++ val32 |= OFDM_LSTF_PRIME_CH_LOW; ++ else ++ val32 |= OFDM_LSTF_PRIME_CH_HIGH; ++ rtl8xxxu_write32(priv, REG_OFDM1_LSTF, val32); ++ ++ val32 = rtl8xxxu_read32(priv, REG_FPGA0_POWER_SAVE); ++ val32 &= ~(FPGA0_PS_LOWER_CHANNEL | FPGA0_PS_UPPER_CHANNEL); ++ if (sec_ch_above) ++ val32 |= FPGA0_PS_UPPER_CHANNEL; ++ else ++ val32 |= FPGA0_PS_LOWER_CHANNEL; ++ rtl8xxxu_write32(priv, REG_FPGA0_POWER_SAVE, val32); ++ break; ++ ++ default: ++ break; ++ } ++ ++ for (i = RF_A; i < priv->rf_paths; i++) { ++ val32 = rtl8xxxu_read_rfreg(priv, i, RF6052_REG_MODE_AG); ++ val32 &= ~MODE_AG_CHANNEL_MASK; ++ val32 |= channel; ++ rtl8xxxu_write_rfreg(priv, i, RF6052_REG_MODE_AG, val32); ++ } ++ ++ if (ht) ++ val8 = 0x0e; ++ else ++ val8 = 0x0a; ++ ++#if 0 ++ rtl8xxxu_write8(priv, REG_SIFS_CCK + 1, val8); ++ rtl8xxxu_write8(priv, REG_SIFS_OFDM + 1, val8); ++ ++ rtl8xxxu_write16(priv, REG_R2T_SIFS, 0x0808); ++ rtl8xxxu_write16(priv, REG_T2T_SIFS, 0x0a0a); ++#endif ++ ++ for (i = RF_A; i < priv->rf_paths; i++) { ++ val32 = rtl8xxxu_read_rfreg(priv, i, RF6052_REG_MODE_AG); ++ if (hw->conf.chandef.width == NL80211_CHAN_WIDTH_40) ++ val32 &= ~MODE_AG_CHANNEL_20MHZ; ++ else ++ val32 |= MODE_AG_CHANNEL_20MHZ; ++ rtl8xxxu_write_rfreg(priv, i, RF6052_REG_MODE_AG, val32); ++ } ++} ++ + static int rtl8188eu_parse_efuse(struct rtl8xxxu_priv *priv) + { + struct rtl8188eu_efuse *efuse = &priv->efuse_wifi.efuse8188eu; +@@ -1009,6 +1125,7 @@ struct rtl8xxxu_fileops rtl8188eu_fops = + .init_phy_bb = rtl8188eu_init_phy_bb, + .init_phy_rf = rtl8188eu_init_phy_rf, + .phy_iq_calibrate = rtl8188eu_phy_iq_calibrate, ++ .config_channel = rtl8188eu_config_channel, + .parse_rx_desc = rtl8xxxu_parse_rxdesc16, + .usb_quirks = rtl8188e_usb_quirks, + .writeN_block_size = 128, diff --git a/package/kernel/mac80211/patches/653-0029-rtl8xxxu-Use-gen2-H2C-commands-for-8188eu.patch b/package/kernel/mac80211/patches/653-0029-rtl8xxxu-Use-gen2-H2C-commands-for-8188eu.patch new file mode 100644 index 0000000000..cf3cde70b0 --- /dev/null +++ b/package/kernel/mac80211/patches/653-0029-rtl8xxxu-Use-gen2-H2C-commands-for-8188eu.patch @@ -0,0 +1,25 @@ +From 4ec1cada65cc1876277f5325b78019667f6e18c4 Mon Sep 17 00:00:00 2001 +From: Jes Sorensen +Date: Fri, 22 Jul 2016 11:44:12 -0400 +Subject: [PATCH] rtl8xxxu: Use gen2 H2C commands for 8188eu + +The 8188eu is a weird hybrid between the old gen1 and newer gen2 +APIs. It uses the newer API for H2C commands, hence use +rtl8xxxu_gen2_update_rate_mask() and rtl8xxxu_gen2_report_connect(). + +Signed-off-by: Jes Sorensen +--- + drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_8188e.c | 2 ++ + 1 file changed, 2 insertions(+) + +--- a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_8188e.c ++++ b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_8188e.c +@@ -1128,6 +1128,8 @@ struct rtl8xxxu_fileops rtl8188eu_fops = + .config_channel = rtl8188eu_config_channel, + .parse_rx_desc = rtl8xxxu_parse_rxdesc16, + .usb_quirks = rtl8188e_usb_quirks, ++ .update_rate_mask = rtl8xxxu_gen2_update_rate_mask, ++ .report_connect = rtl8xxxu_gen2_report_connect, + .writeN_block_size = 128, + .rx_desc_size = sizeof(struct rtl8xxxu_rxdesc16), + .tx_desc_size = sizeof(struct rtl8xxxu_txdesc32), diff --git a/package/kernel/mac80211/patches/653-0030-rtl8xxxu-Initialize-GPIO-settings-for-8188eu.patch b/package/kernel/mac80211/patches/653-0030-rtl8xxxu-Initialize-GPIO-settings-for-8188eu.patch new file mode 100644 index 0000000000..2a5bb00b40 --- /dev/null +++ b/package/kernel/mac80211/patches/653-0030-rtl8xxxu-Initialize-GPIO-settings-for-8188eu.patch @@ -0,0 +1,40 @@ +From 061838d68d2c20acb5a57fbd92e3ed0ae906142e Mon Sep 17 00:00:00 2001 +From: Jes Sorensen +Date: Fri, 22 Jul 2016 12:56:30 -0400 +Subject: [PATCH] rtl8xxxu: Initialize GPIO settings for 8188eu + +This matches what the vendor driver does, but is actually opposite of +what it does for 8192eu. + +Signed-off-by: Jes Sorensen +--- + drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c | 7 +++++++ + drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_regs.h | 1 + + 2 files changed, 8 insertions(+) + +--- a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c ++++ b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c +@@ -4210,6 +4210,13 @@ static int rtl8xxxu_init_device(struct i + * Reset USB mode switch setting + */ + rtl8xxxu_write8(priv, REG_ACLK_MON, 0x00); ++ } else if (priv->rtl_chip == RTL8188E) { ++ /* ++ * Init GPIO settings for 8188e ++ */ ++ val8 = rtl8xxxu_read8(priv, REG_GPIO_MUXCFG); ++ val8 &= ~GPIO_MUXCFG_IO_SEL_ENBT; ++ rtl8xxxu_write8(priv, REG_GPIO_MUXCFG, val8); + } + + rtl8723a_phy_lc_calibrate(priv); +--- a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_regs.h ++++ b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_regs.h +@@ -143,6 +143,7 @@ + #define REG_CAL_TIMER 0x003c + #define REG_ACLK_MON 0x003e + #define REG_GPIO_MUXCFG 0x0040 ++#define GPIO_MUXCFG_IO_SEL_ENBT BIT(5) + #define REG_GPIO_IO_SEL 0x0042 + #define REG_MAC_PINMUX_CFG 0x0043 + #define REG_GPIO_PIN_CTRL 0x0044 diff --git a/package/kernel/mac80211/patches/653-0031-rtl8xxxu-Add-simple-rtl8188eu_rf_on-routine.patch b/package/kernel/mac80211/patches/653-0031-rtl8xxxu-Add-simple-rtl8188eu_rf_on-routine.patch new file mode 100644 index 0000000000..2803b9747a --- /dev/null +++ b/package/kernel/mac80211/patches/653-0031-rtl8xxxu-Add-simple-rtl8188eu_rf_on-routine.patch @@ -0,0 +1,34 @@ +From 2024562ed45d905bee00aea923c218c493c09d27 Mon Sep 17 00:00:00 2001 +From: Jes Sorensen +Date: Fri, 22 Jul 2016 13:10:02 -0400 +Subject: [PATCH] rtl8xxxu: Add simple rtl8188eu_rf_on() routine + +It is not obvious from the vendor driver if we need more than this. + +Signed-off-by: Jes Sorensen +--- + drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_8188e.c | 6 ++++++ + 1 file changed, 6 insertions(+) + +--- a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_8188e.c ++++ b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_8188e.c +@@ -1096,6 +1096,11 @@ exit: + return ret; + } + ++static void rtl8188e_enable_rf(struct rtl8xxxu_priv *priv) ++{ ++ rtl8xxxu_write8(priv, REG_TXPAUSE, 0x00); ++} ++ + static void rtl8188e_usb_quirks(struct rtl8xxxu_priv *priv) + { + u16 val16; +@@ -1127,6 +1132,7 @@ struct rtl8xxxu_fileops rtl8188eu_fops = + .phy_iq_calibrate = rtl8188eu_phy_iq_calibrate, + .config_channel = rtl8188eu_config_channel, + .parse_rx_desc = rtl8xxxu_parse_rxdesc16, ++ .enable_rf = rtl8188e_enable_rf, + .usb_quirks = rtl8188e_usb_quirks, + .update_rate_mask = rtl8xxxu_gen2_update_rate_mask, + .report_connect = rtl8xxxu_gen2_report_connect, diff --git a/package/kernel/mac80211/patches/653-0032-rtl8xxxu-Implement-rtl8188e_disable_rf.patch b/package/kernel/mac80211/patches/653-0032-rtl8xxxu-Implement-rtl8188e_disable_rf.patch new file mode 100644 index 0000000000..1778b1636b --- /dev/null +++ b/package/kernel/mac80211/patches/653-0032-rtl8xxxu-Implement-rtl8188e_disable_rf.patch @@ -0,0 +1,44 @@ +From f26f81e233f7a9b1bf21aa0de16a8db733c317ec Mon Sep 17 00:00:00 2001 +From: Jes Sorensen +Date: Fri, 22 Jul 2016 13:17:36 -0400 +Subject: [PATCH] rtl8xxxu: Implement rtl8188e_disable_rf() + +This is partly guessware as there is no straight forward disable RF +routine in the vendor driver. + +Signed-off-by: Jes Sorensen +--- + drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_8188e.c | 15 +++++++++++++++ + 1 file changed, 15 insertions(+) + +--- a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_8188e.c ++++ b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_8188e.c +@@ -1101,6 +1101,20 @@ static void rtl8188e_enable_rf(struct rt + rtl8xxxu_write8(priv, REG_TXPAUSE, 0x00); + } + ++static void rtl8188e_disable_rf(struct rtl8xxxu_priv *priv) ++{ ++ u32 val32; ++ ++ val32 = rtl8xxxu_read32(priv, REG_OFDM0_TRX_PATH_ENABLE); ++ val32 &= ~OFDM_RF_PATH_TX_MASK; ++ rtl8xxxu_write32(priv, REG_OFDM0_TRX_PATH_ENABLE, val32); ++ ++ /* Power down RF module */ ++ rtl8xxxu_write_rfreg(priv, RF_A, RF6052_REG_AC, 0); ++ if (priv->rf_paths == 2) ++ rtl8xxxu_write_rfreg(priv, RF_B, RF6052_REG_AC, 0); ++} ++ + static void rtl8188e_usb_quirks(struct rtl8xxxu_priv *priv) + { + u16 val16; +@@ -1133,6 +1147,7 @@ struct rtl8xxxu_fileops rtl8188eu_fops = + .config_channel = rtl8188eu_config_channel, + .parse_rx_desc = rtl8xxxu_parse_rxdesc16, + .enable_rf = rtl8188e_enable_rf, ++ .disable_rf = rtl8188e_disable_rf, + .usb_quirks = rtl8188e_usb_quirks, + .update_rate_mask = rtl8xxxu_gen2_update_rate_mask, + .report_connect = rtl8xxxu_gen2_report_connect, diff --git a/package/kernel/mac80211/patches/653-0033-rtl8xxxu-Update-8188e-efuse-definition-for-power-val.patch b/package/kernel/mac80211/patches/653-0033-rtl8xxxu-Update-8188e-efuse-definition-for-power-val.patch new file mode 100644 index 0000000000..c6d3d62351 --- /dev/null +++ b/package/kernel/mac80211/patches/653-0033-rtl8xxxu-Update-8188e-efuse-definition-for-power-val.patch @@ -0,0 +1,62 @@ +From 9067e08ea9ba380340388c3ad4ab85bd54ff4e8d Mon Sep 17 00:00:00 2001 +From: Jes Sorensen +Date: Fri, 22 Jul 2016 16:46:11 -0400 +Subject: [PATCH] rtl8xxxu: Update 8188e efuse definition for power values + +The 8188e uses a similar layout as the 8192e, however it does not have +values for path B. Update struct rtl8188eu_efuse to reflect this and +copy over path A values for path B. + +Signed-off-by: Jes Sorensen +--- + drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu.h | 7 ++----- + .../net/wireless/realtek/rtl8xxxu/rtl8xxxu_8188e.c | 19 +++++++++++-------- + 2 files changed, 13 insertions(+), 13 deletions(-) + +--- a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu.h ++++ b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu.h +@@ -881,11 +881,8 @@ struct rtl8192eu_efuse { + struct rtl8188eu_efuse { + __le16 rtl_id; + u8 res0[0x0e]; +- u8 cck_tx_power_index_A[3]; /* 0x10 */ +- u8 cck_tx_power_index_B[3]; +- u8 ht40_1s_tx_power_index_A[3]; /* 0x16 */ +- u8 ht40_1s_tx_power_index_B[3]; +- u8 res1[0x9c]; ++ struct rtl8192eu_efuse_tx_power tx_power_index_A; /* 0x10 */ ++ u8 res1[0x7e]; /* 0x3a */ + u8 channel_plan; /* 0xb8 */ + u8 xtal_k; + u8 thermal_meter; +--- a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_8188e.c ++++ b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_8188e.c +@@ -409,17 +409,20 @@ static int rtl8188eu_parse_efuse(struct + + ether_addr_copy(priv->mac_addr, efuse->mac_addr); + +- memcpy(priv->cck_tx_power_index_A, efuse->cck_tx_power_index_A, +- sizeof(efuse->cck_tx_power_index_A)); +- memcpy(priv->cck_tx_power_index_B, efuse->cck_tx_power_index_B, +- sizeof(efuse->cck_tx_power_index_B)); ++ memcpy(priv->cck_tx_power_index_A, efuse->tx_power_index_A.cck_base, ++ sizeof(efuse->tx_power_index_A.cck_base)); ++ /* ++ * Efuse is empty for path B, so copy in values from path A ++ */ ++ memcpy(priv->cck_tx_power_index_B, efuse->tx_power_index_A.cck_base, ++ sizeof(efuse->tx_power_index_A.cck_base)); + + memcpy(priv->ht40_1s_tx_power_index_A, +- priv->efuse_wifi.efuse8188eu.ht40_1s_tx_power_index_A, +- sizeof(priv->ht40_1s_tx_power_index_A)); ++ efuse->tx_power_index_A.ht40_base, ++ sizeof(efuse->tx_power_index_A.ht40_base)); + memcpy(priv->ht40_1s_tx_power_index_B, +- priv->efuse_wifi.efuse8188eu.ht40_1s_tx_power_index_B, +- sizeof(priv->ht40_1s_tx_power_index_B)); ++ efuse->tx_power_index_A.ht40_base, ++ sizeof(efuse->tx_power_index_A.ht40_base)); + + priv->xtalk = priv->efuse_wifi.efuse8188eu.xtal_k & 0x3f; + diff --git a/package/kernel/mac80211/patches/653-0034-rtl8xxxu-Implement-rtl8188e_set_tx_power.patch b/package/kernel/mac80211/patches/653-0034-rtl8xxxu-Implement-rtl8188e_set_tx_power.patch new file mode 100644 index 0000000000..7cc0c1b76b --- /dev/null +++ b/package/kernel/mac80211/patches/653-0034-rtl8xxxu-Implement-rtl8188e_set_tx_power.patch @@ -0,0 +1,94 @@ +From cd4a93d1532b2f0ffe508f7fb5d464ec49634dcd Mon Sep 17 00:00:00 2001 +From: Jes Sorensen +Date: Fri, 22 Jul 2016 13:55:24 -0400 +Subject: [PATCH] rtl8xxxu: Implement rtl8188e_set_tx_power() + +This matches the code used to set TX power on 8192eu, except it only +handles path A. + +We should be able to consolidate this code. + +Signed-off-by: Jes Sorensen +--- + .../net/wireless/realtek/rtl8xxxu/rtl8xxxu_8188e.c | 63 ++++++++++++++++++++++ + 1 file changed, 63 insertions(+) + +--- a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_8188e.c ++++ b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_8188e.c +@@ -283,6 +283,68 @@ static struct rtl8xxxu_rfregval rtl8188e + {0xff, 0xffffffff} + }; + ++int rtl8xxxu_8188e_channel_to_group(int channel) ++{ ++ int group; ++ ++ if (channel < 3) ++ group = 0; ++ else if (channel < 6) ++ group = 1; ++ else if (channel < 9) ++ group = 2; ++ else if (channel < 12) ++ group = 3; ++ else if (channel < 14) ++ group = 4; ++ else ++ group = 5; ++ ++ return group; ++} ++ ++static void ++rtl8188e_set_tx_power(struct rtl8xxxu_priv *priv, int channel, bool ht40) ++{ ++ u32 val32, ofdm, mcs; ++ u8 cck, ofdmbase, mcsbase; ++ int group, tx_idx; ++ ++ tx_idx = 0; ++ group = rtl8xxxu_8188e_channel_to_group(channel); ++ ++ cck = priv->cck_tx_power_index_A[group]; ++ ++ val32 = rtl8xxxu_read32(priv, REG_TX_AGC_A_CCK1_MCS32); ++ val32 &= 0xffff00ff; ++ val32 |= (cck << 8); ++ rtl8xxxu_write32(priv, REG_TX_AGC_A_CCK1_MCS32, val32); ++ ++ val32 = rtl8xxxu_read32(priv, REG_TX_AGC_B_CCK11_A_CCK2_11); ++ val32 &= 0xff; ++ val32 |= ((cck << 8) | (cck << 16) | (cck << 24)); ++ rtl8xxxu_write32(priv, REG_TX_AGC_B_CCK11_A_CCK2_11, val32); ++ ++ ofdmbase = priv->ht40_1s_tx_power_index_A[group]; ++ ofdmbase += priv->ofdm_tx_power_diff[tx_idx].a; ++ ofdm = ofdmbase | ofdmbase << 8 | ofdmbase << 16 | ofdmbase << 24; ++ ++ rtl8xxxu_write32(priv, REG_TX_AGC_A_RATE18_06, ofdm); ++ rtl8xxxu_write32(priv, REG_TX_AGC_A_RATE54_24, ofdm); ++ ++ mcsbase = priv->ht40_1s_tx_power_index_A[group]; ++ if (ht40) ++ mcsbase += priv->ht40_tx_power_diff[tx_idx++].a; ++ else ++ mcsbase += priv->ht20_tx_power_diff[tx_idx++].a; ++ mcs = mcsbase | mcsbase << 8 | mcsbase << 16 | mcsbase << 24; ++ ++ rtl8xxxu_write32(priv, REG_TX_AGC_A_MCS03_MCS00, mcs); ++ rtl8xxxu_write32(priv, REG_TX_AGC_A_MCS07_MCS04, mcs); ++ rtl8xxxu_write32(priv, REG_TX_AGC_A_MCS11_MCS08, mcs); ++ rtl8xxxu_write32(priv, REG_TX_AGC_A_MCS15_MCS12, mcs); ++} ++ + void rtl8188eu_config_channel(struct ieee80211_hw *hw) + { + struct rtl8xxxu_priv *priv = hw->priv; +@@ -1152,6 +1214,7 @@ struct rtl8xxxu_fileops rtl8188eu_fops = + .enable_rf = rtl8188e_enable_rf, + .disable_rf = rtl8188e_disable_rf, + .usb_quirks = rtl8188e_usb_quirks, ++ .set_tx_power = rtl8188e_set_tx_power, + .update_rate_mask = rtl8xxxu_gen2_update_rate_mask, + .report_connect = rtl8xxxu_gen2_report_connect, + .writeN_block_size = 128, diff --git a/package/kernel/mac80211/patches/653-0035-rtl8xxxu-Implement-rtl8xxxu_fill_txdesc_v3-for-8188e.patch b/package/kernel/mac80211/patches/653-0035-rtl8xxxu-Implement-rtl8xxxu_fill_txdesc_v3-for-8188e.patch new file mode 100644 index 0000000000..8ad4c70109 --- /dev/null +++ b/package/kernel/mac80211/patches/653-0035-rtl8xxxu-Implement-rtl8xxxu_fill_txdesc_v3-for-8188e.patch @@ -0,0 +1,145 @@ +From 3c50918b180d091a49e412742a4f7aa1a89802b1 Mon Sep 17 00:00:00 2001 +From: Jes Sorensen +Date: Tue, 26 Jul 2016 14:01:14 -0400 +Subject: [PATCH] rtl8xxxu: Implement rtl8xxxu_fill_txdesc_v3() for 8188eu + +Getting closer but still no cigar. + +Signed-off-by: Jes Sorensen +--- + drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu.h | 11 +++ + .../net/wireless/realtek/rtl8xxxu/rtl8xxxu_8188e.c | 1 + + .../net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c | 78 ++++++++++++++++++++++ + 3 files changed, 90 insertions(+) + +--- a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu.h ++++ b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu.h +@@ -510,6 +510,8 @@ struct rtl8xxxu_txdesc40 { + #define TXDESC_AMPDU_DENSITY_SHIFT 20 + #define TXDESC40_BT_INT BIT(23) + #define TXDESC40_GID_SHIFT 24 ++#define TXDESC_ANTENNA_SELECT_A BIT(24) ++#define TXDESC_ANTENNA_SELECT_B BIT(25) + + /* Word 3 */ + #define TXDESC40_USE_DRIVER_RATE BIT(8) +@@ -554,6 +556,10 @@ struct rtl8xxxu_txdesc40 { + + /* Word 6 */ + #define TXDESC_MAX_AGG_SHIFT 11 ++#define TXDESC_USB_TX_AGG_SHIT 24 ++ ++/* Word 7 */ ++#define TXDESC_ANTENNA_SELECT_C BIT(29) + + /* Word 8 */ + #define TXDESC40_HW_SEQ_ENABLE BIT(15) +@@ -1487,6 +1493,11 @@ void rtl8xxxu_fill_txdesc_v2(struct ieee + struct ieee80211_tx_info *tx_info, + struct rtl8xxxu_txdesc32 *tx_desc32, bool sgi, + bool short_preamble, bool ampdu_enable, ++ u32 rts_rate); ++void rtl8xxxu_fill_txdesc_v3(struct ieee80211_hw *hw, struct ieee80211_hdr *hdr, ++ struct ieee80211_tx_info *tx_info, ++ struct rtl8xxxu_txdesc32 *tx_desc32, bool sgi, ++ bool short_preamble, bool ampdu_enable, + u32 rts_rate); + + extern struct rtl8xxxu_fileops rtl8188eu_fops; +--- a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_8188e.c ++++ b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_8188e.c +@@ -1217,6 +1217,7 @@ struct rtl8xxxu_fileops rtl8188eu_fops = + .set_tx_power = rtl8188e_set_tx_power, + .update_rate_mask = rtl8xxxu_gen2_update_rate_mask, + .report_connect = rtl8xxxu_gen2_report_connect, ++ .fill_txdesc = rtl8xxxu_fill_txdesc_v3, + .writeN_block_size = 128, + .rx_desc_size = sizeof(struct rtl8xxxu_rxdesc16), + .tx_desc_size = sizeof(struct rtl8xxxu_txdesc32), +--- a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c ++++ b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c +@@ -4923,6 +4923,84 @@ rtl8xxxu_fill_txdesc_v2(struct ieee80211 + } + } + ++/* ++ * Fill in v3 (gen1) specific TX descriptor bits. ++ * This format is a hybrid between the v1 and v2 formats, only seen ++ * on 8188eu devices so far. ++ */ ++void ++rtl8xxxu_fill_txdesc_v3(struct ieee80211_hw *hw, struct ieee80211_hdr *hdr, ++ struct ieee80211_tx_info *tx_info, ++ struct rtl8xxxu_txdesc32 *tx_desc, bool sgi, ++ bool short_preamble, bool ampdu_enable, u32 rts_rate) ++{ ++ struct ieee80211_rate *tx_rate = ieee80211_get_tx_rate(hw, tx_info); ++ struct rtl8xxxu_priv *priv = hw->priv; ++ struct device *dev = &priv->udev->dev; ++ u32 rate; ++ u16 rate_flags = tx_info->control.rates[0].flags; ++ u16 seq_number; ++ ++ if (rate_flags & IEEE80211_TX_RC_MCS && ++ !ieee80211_is_mgmt(hdr->frame_control)) ++ rate = tx_info->control.rates[0].idx + DESC_RATE_MCS0; ++ else ++ rate = tx_rate->hw_value; ++ ++ if (rtl8xxxu_debug & RTL8XXXU_DEBUG_TX) ++ dev_info(dev, "%s: TX rate: %d, pkt size %d\n", ++ __func__, rate, cpu_to_le16(tx_desc->pkt_size)); ++ ++ seq_number = IEEE80211_SEQ_TO_SN(le16_to_cpu(hdr->seq_ctrl)); ++ ++ tx_desc->txdw5 = cpu_to_le32(rate); ++ ++ /* ++ * Data/RTS rate FB limit ++ */ ++ if (ieee80211_is_data(hdr->frame_control)) ++ tx_desc->txdw5 |= cpu_to_le32(0x0001ff00); ++ ++ tx_desc->txdw3 = cpu_to_le32((u32)seq_number << TXDESC32_SEQ_SHIFT); ++ ++ if (ampdu_enable) ++ tx_desc->txdw2 |= cpu_to_le32(TXDESC40_AGG_ENABLE); ++ else ++ tx_desc->txdw2 |= cpu_to_le32(TXDESC40_AGG_BREAK); ++ ++ if (ieee80211_is_mgmt(hdr->frame_control)) { ++ tx_desc->txdw5 = cpu_to_le32(rate); ++ tx_desc->txdw4 |= cpu_to_le32(TXDESC32_USE_DRIVER_RATE); ++ tx_desc->txdw5 |= cpu_to_le32(6 << TXDESC32_RETRY_LIMIT_SHIFT); ++ tx_desc->txdw5 |= cpu_to_le32(TXDESC32_RETRY_LIMIT_ENABLE); ++ } ++ ++ if (ieee80211_is_data_qos(hdr->frame_control)) ++ tx_desc->txdw4 |= cpu_to_le32(TXDESC32_QOS); ++ ++ if (short_preamble) ++ tx_desc->txdw4 |= cpu_to_le32(TXDESC32_SHORT_PREAMBLE); ++ ++ if (sgi) ++ tx_desc->txdw5 |= cpu_to_le32(TXDESC32_SHORT_GI); ++ ++ /* ++ * rts_rate is zero if RTS/CTS or CTS to SELF are not enabled ++ */ ++ tx_desc->txdw4 |= cpu_to_le32(rts_rate << TXDESC32_RTS_RATE_SHIFT); ++ if (rate_flags & IEEE80211_TX_RC_USE_RTS_CTS) { ++ tx_desc->txdw4 |= cpu_to_le32(TXDESC32_RTS_CTS_ENABLE); ++ tx_desc->txdw4 |= cpu_to_le32(TXDESC32_HW_RTS_ENABLE); ++ } else if (rate_flags & IEEE80211_TX_RC_USE_CTS_PROTECT) { ++ tx_desc->txdw4 |= cpu_to_le32(TXDESC32_CTS_SELF_ENABLE); ++ tx_desc->txdw4 |= cpu_to_le32(TXDESC32_HW_RTS_ENABLE); ++ } ++ ++ tx_desc->txdw2 |= cpu_to_le32(TXDESC_ANTENNA_SELECT_A | ++ TXDESC_ANTENNA_SELECT_B); ++ tx_desc->txdw7 |= cpu_to_le32(TXDESC_ANTENNA_SELECT_C); ++} ++ + static void rtl8xxxu_tx(struct ieee80211_hw *hw, + struct ieee80211_tx_control *control, + struct sk_buff *skb) diff --git a/package/kernel/mac80211/patches/653-0036-rtl8xxxu-Add-some-8188eu-registers-and-update-CCK0_A.patch b/package/kernel/mac80211/patches/653-0036-rtl8xxxu-Add-some-8188eu-registers-and-update-CCK0_A.patch new file mode 100644 index 0000000000..e7f97a5b9d --- /dev/null +++ b/package/kernel/mac80211/patches/653-0036-rtl8xxxu-Add-some-8188eu-registers-and-update-CCK0_A.patch @@ -0,0 +1,87 @@ +From a9f5a167be625cf0cd157aa38f3635b2b1f0cc0f Mon Sep 17 00:00:00 2001 +From: Jes Sorensen +Date: Fri, 29 Jul 2016 15:25:34 -0400 +Subject: [PATCH] rtl8xxxu: Add some 8188eu registers and update + CCK0_AFE_SETTING bit defines + +CCK0_AFE_SETTING is particular, it has the notion of primary RX antenna +and optional RX antenna. When configuring RX for single antenna, setup +should use the same antenna for default and optional. For AB setup, +use antenna A as default and B as optional. + +In addition add info for 8188eu IOL magic interface used to send +firmware and register init files to the firmware. + +Signed-off-by: Jes Sorensen +--- + .../net/wireless/realtek/rtl8xxxu/rtl8xxxu_regs.h | 30 ++++++++++++++++++++-- + 1 file changed, 28 insertions(+), 2 deletions(-) + +--- a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_regs.h ++++ b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_regs.h +@@ -378,6 +378,11 @@ + #define PBP_PAGE_SIZE_512 0x3 + #define PBP_PAGE_SIZE_1024 0x4 + ++/* 8188eu IOL magic */ ++#define REG_PKT_BUF_ACCESS_CTRL 0x0106 ++#define PKT_BUF_ACCESS_CTRL_TX 0x69 ++#define PKT_BUF_ACCESS_CTRL_RX 0xa5 ++ + #define REG_TRXDMA_CTRL 0x010c + #define TRXDMA_CTRL_RXDMA_AGG_EN BIT(2) + #define TRXDMA_CTRL_VOQ_SHIFT 4 +@@ -449,6 +454,7 @@ + + #define REG_FIFOPAGE 0x0204 + #define REG_TDECTRL 0x0208 ++ + #define REG_TXDMA_OFFSET_CHK 0x020c + #define TXDMA_OFFSET_DROP_DATA_EN BIT(9) + #define REG_TXDMA_STATUS 0x0210 +@@ -938,6 +944,7 @@ + #define REG_FPGA1_RF_MODE 0x0900 + + #define REG_FPGA1_TX_INFO 0x090c ++#define REG_ANT_MAPPING1 0x0914 + #define REG_DPDT_CTRL 0x092c /* 8723BU */ + #define REG_RFE_CTRL_ANTA_SRC 0x0930 /* 8723BU */ + #define REG_RFE_PATH_SELECT 0x0940 /* 8723BU */ +@@ -949,9 +956,25 @@ + + #define REG_CCK0_AFE_SETTING 0x0a04 + #define CCK0_AFE_RX_MASK 0x0f000000 +-#define CCK0_AFE_RX_ANT_AB BIT(24) ++#define CCK0_AFE_TX_MASK 0xf0000000 + #define CCK0_AFE_RX_ANT_A 0 +-#define CCK0_AFE_RX_ANT_B (BIT(24) | BIT(26)) ++#define CCK0_AFE_RX_ANT_B BIT(26) ++#define CCK0_AFE_RX_ANT_C BIT(27) ++#define CCK0_AFE_RX_ANT_D (BIT(26) | BIT(27)) ++#define CCK0_AFE_RX_ANT_OPTION_A 0 ++#define CCK0_AFE_RX_ANT_OPTION_B BIT(24) ++#define CCK0_AFE_RX_ANT_OPTION_C BIT(25) ++#define CCK0_AFE_RX_ANT_OPTION_D (BIT(24) | BIT(25)) ++#define CCK0_AFE_TX_ANT_A BIT(31) ++#define CCK0_AFE_TX_ANT_B BIT(30) ++ ++#define REG_CCK_ANTDIV_PARA2 0x0a04 ++#define REG_BB_POWER_SAVE4 0x0a74 ++ ++/* 8188eu */ ++#define REG_LNA_SWITCH 0x0b2c ++#define LNA_SWITCH_DISABLE_CSCG BIT(22) ++#define LNA_SWITCH_OUTPUT_CG BIT(31) + + #define REG_CONFIG_ANT_A 0x0b68 + #define REG_CONFIG_ANT_B 0x0b6c +@@ -1004,6 +1027,9 @@ + + #define REG_OFDM0_RX_IQ_EXT_ANTA 0x0ca0 + ++/* 8188eu */ ++#define REG_ANTDIV_PARA1 0x0ca4 ++ + /* 8723bu */ + #define REG_OFDM0_TX_PSDO_NOISE_WEIGHT 0x0ce4 + diff --git a/package/kernel/mac80211/patches/653-0037-rtl8xxxu-Improve-register-description-for-REG_FPGA1_.patch b/package/kernel/mac80211/patches/653-0037-rtl8xxxu-Improve-register-description-for-REG_FPGA1_.patch new file mode 100644 index 0000000000..bb940db3c8 --- /dev/null +++ b/package/kernel/mac80211/patches/653-0037-rtl8xxxu-Improve-register-description-for-REG_FPGA1_.patch @@ -0,0 +1,30 @@ +From 5731f8a7485120836c42e0dfae61644588ffd119 Mon Sep 17 00:00:00 2001 +From: Jes Sorensen +Date: Fri, 29 Jul 2016 15:57:19 -0400 +Subject: [PATCH] rtl8xxxu: Improve register description for REG_FPGA1_TX_INFO + +This is based on Hal_SetAntenna() from the 8188eu driver + +Signed-off-by: Jes Sorensen +--- + drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_regs.h | 9 +++++++++ + 1 file changed, 9 insertions(+) + +--- a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_regs.h ++++ b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_regs.h +@@ -944,6 +944,15 @@ + #define REG_FPGA1_RF_MODE 0x0900 + + #define REG_FPGA1_TX_INFO 0x090c ++#define FPGA1_TX_ANT_MASK 0x0000000f ++#define FPGA1_TX_ANT_L_MASK 0x000000f0 ++#define FPGA1_TX_ANT_NON_HT_MASK 0x00000f00 ++#define FPGA1_TX_ANT_HT1_MASK 0x0000f000 ++#define FPGA1_TX_ANT_HT2_MASK 0x000f0000 ++#define FPGA1_TX_ANT_HT_S1_MASK 0x00f00000 ++#define FPGA1_TX_ANT_NON_HT_S1_MASK 0x0f000000 ++#define FPGA1_TX_OFDM_TXSC_MASK 0x30000000 ++ + #define REG_ANT_MAPPING1 0x0914 + #define REG_DPDT_CTRL 0x092c /* 8723BU */ + #define REG_RFE_CTRL_ANTA_SRC 0x0930 /* 8723BU */ diff --git a/package/kernel/mac80211/patches/653-0038-rtl8xxxu-properly-detect-RTL8188EU-devices.patch b/package/kernel/mac80211/patches/653-0038-rtl8xxxu-properly-detect-RTL8188EU-devices.patch new file mode 100644 index 0000000000..ed3a27be40 --- /dev/null +++ b/package/kernel/mac80211/patches/653-0038-rtl8xxxu-properly-detect-RTL8188EU-devices.patch @@ -0,0 +1,29 @@ +From 36c071e30dc5759be3e53ac93459c24fb64d41c3 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?=C3=81lvaro=20Fern=C3=A1ndez=20Rojas?= +Date: Fri, 29 Jul 2016 18:22:37 +0200 +Subject: [PATCH] rtl8xxxu: properly detect RTL8188EU devices +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +The assumption that all RTL8188EU have chip cut >= C is wrong. +However, RTL8188EU devices can be easily differentiated from RTL8188CU devices +relying on TX report capbility. + +Signed-off-by: Álvaro Fernández Rojas +Signed-off-by: Jes Sorensen +--- + drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +--- a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c ++++ b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c +@@ -1683,7 +1683,7 @@ static int rtl8xxxu_identify_chip(struct + } + priv->has_wifi = 1; + } else { +- if (priv->chip_cut >= 2) { ++ if (priv->fops->has_tx_report) { + sprintf(priv->chip_name, "8188EU"); + priv->rf_paths = 1; + priv->rx_paths = 1; diff --git a/package/kernel/mac80211/patches/653-0039-rtl8xxxu-Implement-8188eu-specific-8051-reset-functi.patch b/package/kernel/mac80211/patches/653-0039-rtl8xxxu-Implement-8188eu-specific-8051-reset-functi.patch new file mode 100644 index 0000000000..65bab0deee --- /dev/null +++ b/package/kernel/mac80211/patches/653-0039-rtl8xxxu-Implement-8188eu-specific-8051-reset-functi.patch @@ -0,0 +1,43 @@ +From 660a287a0a32ce9f8be9b3ad625c597ad1ed38a2 Mon Sep 17 00:00:00 2001 +From: Jes Sorensen +Date: Wed, 10 Aug 2016 15:40:30 -0400 +Subject: [PATCH] rtl8xxxu: Implement 8188eu specific 8051 reset function + +The 8188eu doesn't seem to require the additional hacks used on some +other chips. + +Signed-off-by: Jes Sorensen +--- + drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_8188e.c | 14 +++++++++++++- + 1 file changed, 13 insertions(+), 1 deletion(-) + +--- a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_8188e.c ++++ b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_8188e.c +@@ -505,6 +505,18 @@ static int rtl8188eu_parse_efuse(struct + return 0; + } + ++void rtl8188eu_reset_8051(struct rtl8xxxu_priv *priv) ++{ ++ u16 sys_func; ++ ++ sys_func = rtl8xxxu_read16(priv, REG_SYS_FUNC); ++ sys_func &= ~SYS_FUNC_CPU_ENABLE; ++ rtl8xxxu_write16(priv, REG_SYS_FUNC, sys_func); ++ ++ sys_func |= SYS_FUNC_CPU_ENABLE; ++ rtl8xxxu_write16(priv, REG_SYS_FUNC, sys_func); ++} ++ + static int rtl8188eu_load_firmware(struct rtl8xxxu_priv *priv) + { + char *fw_name; +@@ -1204,7 +1216,7 @@ struct rtl8xxxu_fileops rtl8188eu_fops = + .load_firmware = rtl8188eu_load_firmware, + .power_on = rtl8188eu_power_on, + .power_off = rtl8xxxu_power_off, +- .reset_8051 = rtl8xxxu_reset_8051, ++ .reset_8051 = rtl8188eu_reset_8051, + .llt_init = rtl8xxxu_auto_llt_table, + .init_phy_bb = rtl8188eu_init_phy_bb, + .init_phy_rf = rtl8188eu_init_phy_rf, diff --git a/package/kernel/mac80211/patches/653-0040-rtl8xxxu-Disable-packet-DMA-aggregation-on-8188eu.patch b/package/kernel/mac80211/patches/653-0040-rtl8xxxu-Disable-packet-DMA-aggregation-on-8188eu.patch new file mode 100644 index 0000000000..ada4f2df52 --- /dev/null +++ b/package/kernel/mac80211/patches/653-0040-rtl8xxxu-Disable-packet-DMA-aggregation-on-8188eu.patch @@ -0,0 +1,43 @@ +From f435337a2fc97c97476d833700e4a8fd17d99007 Mon Sep 17 00:00:00 2001 +From: Jes Sorensen +Date: Wed, 10 Aug 2016 15:41:13 -0400 +Subject: [PATCH] rtl8xxxu: Disable packet DMA aggregation on 8188eu + +For now disable packet DMA aggregation on the 8188eu, rather then +risking the feature being left on by the init tables. + +Signed-off-by: Jes Sorensen +--- + drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_8188e.c | 14 ++++++++++++++ + 1 file changed, 14 insertions(+) + +--- a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_8188e.c ++++ b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_8188e.c +@@ -461,6 +461,19 @@ void rtl8188eu_config_channel(struct iee + } + } + ++void rtl8188eu_init_aggregation(struct rtl8xxxu_priv *priv) ++{ ++ u8 agg_ctrl, usb_spec; ++ ++ usb_spec = rtl8xxxu_read8(priv, REG_USB_SPECIAL_OPTION); ++ usb_spec &= ~USB_SPEC_USB_AGG_ENABLE; ++ rtl8xxxu_write8(priv, REG_USB_SPECIAL_OPTION, usb_spec); ++ ++ agg_ctrl = rtl8xxxu_read8(priv, REG_TRXDMA_CTRL); ++ agg_ctrl &= ~TRXDMA_CTRL_RXDMA_AGG_EN; ++ rtl8xxxu_write8(priv, REG_TRXDMA_CTRL, agg_ctrl); ++} ++ + static int rtl8188eu_parse_efuse(struct rtl8xxxu_priv *priv) + { + struct rtl8188eu_efuse *efuse = &priv->efuse_wifi.efuse8188eu; +@@ -1223,6 +1236,7 @@ struct rtl8xxxu_fileops rtl8188eu_fops = + .phy_iq_calibrate = rtl8188eu_phy_iq_calibrate, + .config_channel = rtl8188eu_config_channel, + .parse_rx_desc = rtl8xxxu_parse_rxdesc16, ++ .init_aggregation = rtl8188eu_init_aggregation, + .enable_rf = rtl8188e_enable_rf, + .disable_rf = rtl8188e_disable_rf, + .usb_quirks = rtl8188e_usb_quirks, diff --git a/package/kernel/mac80211/patches/653-0041-rtl8xxxu-8188eu-set-REG_OFDM0_XA_AGC_CORE1-to-match-.patch b/package/kernel/mac80211/patches/653-0041-rtl8xxxu-8188eu-set-REG_OFDM0_XA_AGC_CORE1-to-match-.patch new file mode 100644 index 0000000000..0370693e46 --- /dev/null +++ b/package/kernel/mac80211/patches/653-0041-rtl8xxxu-8188eu-set-REG_OFDM0_XA_AGC_CORE1-to-match-.patch @@ -0,0 +1,28 @@ +From 4aecb21cdc491804c936a71e98192ba144757ea3 Mon Sep 17 00:00:00 2001 +From: Jes Sorensen +Date: Wed, 10 Aug 2016 16:06:37 -0400 +Subject: [PATCH] rtl8xxxu: 8188eu set REG_OFDM0_XA_AGC_CORE1 to match vendor + driver + +We have no description of this register, so not sure why this differs +from say 8723au. + +Signed-off-by: Jes Sorensen +--- + drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c | 5 ++++- + 1 file changed, 4 insertions(+), 1 deletion(-) + +--- a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c ++++ b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c +@@ -5937,7 +5937,10 @@ exit: + rtl8xxxu_write16(priv, REG_RXFLTMAP2, 0xffff); + rtl8xxxu_write16(priv, REG_RXFLTMAP0, 0xffff); + +- rtl8xxxu_write32(priv, REG_OFDM0_XA_AGC_CORE1, 0x6954341e); ++ if (priv->rtl_chip == RTL8188E) ++ rtl8xxxu_write32(priv, REG_OFDM0_XA_AGC_CORE1, 0x6955341e); ++ else ++ rtl8xxxu_write32(priv, REG_OFDM0_XA_AGC_CORE1, 0x6954341e); + + return ret; + diff --git a/package/kernel/mac80211/patches/653-0042-rtl8xxxu-Fix-rtl8188eu-connection-fail.patch b/package/kernel/mac80211/patches/653-0042-rtl8xxxu-Fix-rtl8188eu-connection-fail.patch new file mode 100644 index 0000000000..1a39cc461a --- /dev/null +++ b/package/kernel/mac80211/patches/653-0042-rtl8xxxu-Fix-rtl8188eu-connection-fail.patch @@ -0,0 +1,27 @@ +From ef6a147ea381e76fa02358aa5b65816121d57a4c Mon Sep 17 00:00:00 2001 +From: Taehee Yoo +Date: Sun, 21 Aug 2016 20:38:22 +0900 +Subject: [PATCH] rtl8xxxu: Fix rtl8188eu connection fail + +rtl8188eu vendor driver's LLT init routine is similar +rtl8xxxu_init_llt_table() than rtl8xxxu_auto_llt_table(). + +So now, rtl8188eu can connect to AP. + +Signed-off-by: Taehee Yoo +Signed-off-by: Jes Sorensen +--- + drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_8188e.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +--- a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_8188e.c ++++ b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_8188e.c +@@ -1230,7 +1230,7 @@ struct rtl8xxxu_fileops rtl8188eu_fops = + .power_on = rtl8188eu_power_on, + .power_off = rtl8xxxu_power_off, + .reset_8051 = rtl8188eu_reset_8051, +- .llt_init = rtl8xxxu_auto_llt_table, ++ .llt_init = rtl8xxxu_init_llt_table, + .init_phy_bb = rtl8188eu_init_phy_bb, + .init_phy_rf = rtl8188eu_init_phy_rf, + .phy_iq_calibrate = rtl8188eu_phy_iq_calibrate, diff --git a/package/kernel/mac80211/patches/653-0043-rtl8xxxu-Do-not-set-auto-rate-fallback-on-8188eu.patch b/package/kernel/mac80211/patches/653-0043-rtl8xxxu-Do-not-set-auto-rate-fallback-on-8188eu.patch new file mode 100644 index 0000000000..c69de5b0a7 --- /dev/null +++ b/package/kernel/mac80211/patches/653-0043-rtl8xxxu-Do-not-set-auto-rate-fallback-on-8188eu.patch @@ -0,0 +1,93 @@ +From 738832d9e91098f5b3ddb4e71fe8e666575c6bdb Mon Sep 17 00:00:00 2001 +From: Jes Sorensen +Date: Wed, 24 Aug 2016 13:54:00 -0400 +Subject: [PATCH] rtl8xxxu: Do not set auto rate fallback on 8188eu + +Introduce a fileops flag to indicate whether the device has this +feature. + +Reported-by: Taehee Yoo +Signed-off-by: Jes Sorensen +--- + drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu.h | 1 + + drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_8192c.c | 1 + + drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_8192e.c | 1 + + drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_8723a.c | 1 + + drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_8723b.c | 1 + + drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c | 15 ++++++++++----- + 6 files changed, 15 insertions(+), 5 deletions(-) + +--- a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu.h ++++ b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu.h +@@ -1398,6 +1398,7 @@ struct rtl8xxxu_fileops { + u8 has_s0s1:1; + u8 has_tx_report:1; + u8 gen2_thermal_meter:1; ++ u8 has_darfrc:1; + u32 adda_1t_init; + u32 adda_1t_path_on; + u32 adda_2t_path_on_a; +--- a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_8192c.c ++++ b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_8192c.c +@@ -572,6 +572,7 @@ struct rtl8xxxu_fileops rtl8192cu_fops = + .rx_agg_buf_size = 16000, + .tx_desc_size = sizeof(struct rtl8xxxu_txdesc32), + .rx_desc_size = sizeof(struct rtl8xxxu_rxdesc16), ++ .has_darfrc = 1, + .adda_1t_init = 0x0b1b25a0, + .adda_1t_path_on = 0x0bdb25a0, + .adda_2t_path_on_a = 0x04db25a4, +--- a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_8192e.c ++++ b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_8192e.c +@@ -1655,6 +1655,7 @@ struct rtl8xxxu_fileops rtl8192eu_fops = + .rx_desc_size = sizeof(struct rtl8xxxu_rxdesc24), + .has_s0s1 = 0, + .gen2_thermal_meter = 1, ++ .has_darfrc = 1, + .adda_1t_init = 0x0fc01616, + .adda_1t_path_on = 0x0fc01616, + .adda_2t_path_on_a = 0x0fc01616, +--- a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_8723a.c ++++ b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_8723a.c +@@ -389,6 +389,7 @@ struct rtl8xxxu_fileops rtl8723au_fops = + .rx_agg_buf_size = 16000, + .tx_desc_size = sizeof(struct rtl8xxxu_txdesc32), + .rx_desc_size = sizeof(struct rtl8xxxu_rxdesc16), ++ .has_darfrc = 1, + .adda_1t_init = 0x0b1b25a0, + .adda_1t_path_on = 0x0bdb25a0, + .adda_2t_path_on_a = 0x04db25a4, +--- a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_8723b.c ++++ b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_8723b.c +@@ -1673,6 +1673,7 @@ struct rtl8xxxu_fileops rtl8723bu_fops = + .has_s0s1 = 1, + .has_tx_report = 1, + .gen2_thermal_meter = 1, ++ .has_darfrc = 1, + .adda_1t_init = 0x01c00014, + .adda_1t_path_on = 0x01c00014, + .adda_2t_path_on_a = 0x01c00014, +--- a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c ++++ b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c +@@ -4105,11 +4105,16 @@ static int rtl8xxxu_init_device(struct i + rtl8xxxu_write32(priv, REG_EDCA_VI_PARAM, 0x005ea324); + rtl8xxxu_write32(priv, REG_EDCA_VO_PARAM, 0x002fa226); + +- /* Set data auto rate fallback retry count */ +- rtl8xxxu_write32(priv, REG_DARFRC, 0x00000000); +- rtl8xxxu_write32(priv, REG_DARFRC + 4, 0x10080404); +- rtl8xxxu_write32(priv, REG_RARFRC, 0x04030201); +- rtl8xxxu_write32(priv, REG_RARFRC + 4, 0x08070605); ++ /* ++ * Set data auto rate fallback retry count. ++ * Notably the 8188eu doesn't seem to use this ++ */ ++ if (fops->has_darfrc) { ++ rtl8xxxu_write32(priv, REG_DARFRC, 0x00000000); ++ rtl8xxxu_write32(priv, REG_DARFRC + 4, 0x10080404); ++ rtl8xxxu_write32(priv, REG_RARFRC, 0x04030201); ++ rtl8xxxu_write32(priv, REG_RARFRC + 4, 0x08070605); ++ } + + val8 = rtl8xxxu_read8(priv, REG_FWHW_TXQ_CTRL); + val8 |= FWHW_TXQ_CTRL_AMPDU_RETRY; diff --git a/package/kernel/mac80211/patches/653-0044-rtl8xxxu-Enable-8188eu-driver.patch b/package/kernel/mac80211/patches/653-0044-rtl8xxxu-Enable-8188eu-driver.patch new file mode 100644 index 0000000000..49aba984b5 --- /dev/null +++ b/package/kernel/mac80211/patches/653-0044-rtl8xxxu-Enable-8188eu-driver.patch @@ -0,0 +1,22 @@ +From b7aed472c6639e2a523d0ef90dba61246d7bd9b4 Mon Sep 17 00:00:00 2001 +From: Jes Sorensen +Date: Mon, 25 Jul 2016 12:32:02 -0400 +Subject: [PATCH] rtl8xxxu: Enable 8188eu driver + +This enables the 8188eu driver - this should work by now. + +Signed-off-by: Jes Sorensen +--- + drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_8188e.c | 1 - + 1 file changed, 1 deletion(-) + +--- a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_8188e.c ++++ b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_8188e.c +@@ -539,7 +539,6 @@ static int rtl8188eu_load_firmware(struc + + ret = rtl8xxxu_load_firmware(priv, fw_name); + +- return -EINVAL; + return ret; + } + diff --git a/package/kernel/mac80211/patches/653-0045-rtl8xxxu-Add-rtl8188etv-to-USB-device-list.patch b/package/kernel/mac80211/patches/653-0045-rtl8xxxu-Add-rtl8188etv-to-USB-device-list.patch new file mode 100644 index 0000000000..6bc507797c --- /dev/null +++ b/package/kernel/mac80211/patches/653-0045-rtl8xxxu-Add-rtl8188etv-to-USB-device-list.patch @@ -0,0 +1,25 @@ +From 13d8b1bb62307242615f1bebd67d165a91b9f7d5 Mon Sep 17 00:00:00 2001 +From: Jes Sorensen +Date: Fri, 26 Aug 2016 10:28:45 -0400 +Subject: [PATCH] rtl8xxxu: Add rtl8188etv to USB device list + +Hans de Goede reported this works for him with two different tablets. + +Reported-by: Hans de Goede +Signed-off-by: Jes Sorensen +--- + drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c | 3 +++ + 1 file changed, 3 insertions(+) + +--- a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c ++++ b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c +@@ -6309,6 +6309,9 @@ static struct usb_device_id dev_table[] + #ifdef CPTCFG_RTL8XXXU_UNTESTED + {USB_DEVICE_AND_INTERFACE_INFO(USB_VENDOR_ID_REALTEK, 0x8179, 0xff, 0xff, 0xff), + .driver_info = (unsigned long)&rtl8188eu_fops}, ++/* Tested by Hans de Goede - rtl8188etv */ ++{USB_DEVICE_AND_INTERFACE_INFO(USB_VENDOR_ID_REALTEK, 0x0179, 0xff, 0xff, 0xff), ++ .driver_info = (unsigned long)&rtl8188eu_fops}, + /* Still supported by rtlwifi */ + {USB_DEVICE_AND_INTERFACE_INFO(USB_VENDOR_ID_REALTEK, 0x8176, 0xff, 0xff, 0xff), + .driver_info = (unsigned long)&rtl8192cu_fops}, diff --git a/package/kernel/mac80211/patches/653-0046-rtl8xxxu-Add-sitecom-dongle-to-USB-device-list.patch b/package/kernel/mac80211/patches/653-0046-rtl8xxxu-Add-sitecom-dongle-to-USB-device-list.patch new file mode 100644 index 0000000000..3797206359 --- /dev/null +++ b/package/kernel/mac80211/patches/653-0046-rtl8xxxu-Add-sitecom-dongle-to-USB-device-list.patch @@ -0,0 +1,23 @@ +From e7be61a187c902ae296acf70981a899e9e34a885 Mon Sep 17 00:00:00 2001 +From: Andrea Merello +Date: Fri, 26 Aug 2016 19:18:17 +0200 +Subject: [PATCH] rtl8xxxu: Add sitecom dongle to USB device list + +Signed-off-by: Andrea Merello +Signed-off-by: Jes Sorensen +--- + drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c | 3 +++ + 1 file changed, 3 insertions(+) + +--- a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c ++++ b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c +@@ -6312,6 +6312,9 @@ static struct usb_device_id dev_table[] + /* Tested by Hans de Goede - rtl8188etv */ + {USB_DEVICE_AND_INTERFACE_INFO(USB_VENDOR_ID_REALTEK, 0x0179, 0xff, 0xff, 0xff), + .driver_info = (unsigned long)&rtl8188eu_fops}, ++/* Sitecom rtl8188eus */ ++{USB_DEVICE_AND_INTERFACE_INFO(0x0df6, 0x0076, 0xff, 0xff, 0xff), ++ .driver_info = (unsigned long)&rtl8188eu_fops}, + /* Still supported by rtlwifi */ + {USB_DEVICE_AND_INTERFACE_INFO(USB_VENDOR_ID_REALTEK, 0x8176, 0xff, 0xff, 0xff), + .driver_info = (unsigned long)&rtl8192cu_fops}, diff --git a/package/kernel/mac80211/patches/653-0047-rtl8xxxu-Implement-rtl8188eu_active_to_emu.patch b/package/kernel/mac80211/patches/653-0047-rtl8xxxu-Implement-rtl8188eu_active_to_emu.patch new file mode 100644 index 0000000000..853f2f9ec4 --- /dev/null +++ b/package/kernel/mac80211/patches/653-0047-rtl8xxxu-Implement-rtl8188eu_active_to_emu.patch @@ -0,0 +1,68 @@ +From b3edeceb7c8c3b0eb70b26e3237afa5086afe8ed Mon Sep 17 00:00:00 2001 +From: Jes Sorensen +Date: Fri, 26 Aug 2016 15:16:32 -0400 +Subject: [PATCH] rtl8xxxu: Implement rtl8188eu_active_to_emu() + +Per the vendor driver's sequence table, this seems to be the correct +way to disable RF on the 8188eu, even if the driver doesn't actually +call the sequence by itself. + +Signed-off-by: Jes Sorensen +--- + .../net/wireless/realtek/rtl8xxxu/rtl8xxxu_8188e.c | 38 ++++++++++++++++++++++ + 1 file changed, 38 insertions(+) + +--- a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_8188e.c ++++ b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_8188e.c +@@ -1155,6 +1155,42 @@ exit: + return ret; + } + ++static int rtl8188eu_active_to_emu(struct rtl8xxxu_priv *priv) ++{ ++ u8 val8; ++ int count, ret = 0; ++ ++ /* Turn off RF */ ++ rtl8xxxu_write8(priv, REG_RF_CTRL, 0); ++ ++ /* LDO Sleep mode */ ++ val8 = rtl8xxxu_read8(priv, REG_LPLDO_CTRL); ++ val8 |= BIT(4); ++ rtl8xxxu_write8(priv, REG_LPLDO_CTRL, val8); ++ ++ /* 0x0005[1] = 1 turn off MAC by HW state machine*/ ++ val8 = rtl8xxxu_read8(priv, REG_APS_FSMCO + 1); ++ val8 |= BIT(1); ++ rtl8xxxu_write8(priv, REG_APS_FSMCO + 1, val8); ++ ++ for (count = RTL8XXXU_MAX_REG_POLL; count; count--) { ++ val8 = rtl8xxxu_read8(priv, REG_APS_FSMCO + 1); ++ if ((val8 & BIT(1)) == 0) ++ break; ++ udelay(10); ++ } ++ ++ if (!count) { ++ dev_warn(&priv->udev->dev, "%s: Disabling MAC timed out\n", ++ __func__); ++ ret = -EBUSY; ++ goto exit; ++ } ++ ++exit: ++ return ret; ++} ++ + static int rtl8188eu_power_on(struct rtl8xxxu_priv *priv) + { + u16 val16; +@@ -1202,6 +1238,8 @@ static void rtl8188e_disable_rf(struct r + rtl8xxxu_write_rfreg(priv, RF_A, RF6052_REG_AC, 0); + if (priv->rf_paths == 2) + rtl8xxxu_write_rfreg(priv, RF_B, RF6052_REG_AC, 0); ++ ++ rtl8188eu_active_to_emu(priv); + } + + static void rtl8188e_usb_quirks(struct rtl8xxxu_priv *priv) diff --git a/package/kernel/mac80211/patches/653-0048-rtl8xxxu-Implement-rtl8188eu_power_off.patch b/package/kernel/mac80211/patches/653-0048-rtl8xxxu-Implement-rtl8188eu_power_off.patch new file mode 100644 index 0000000000..69b0f02852 --- /dev/null +++ b/package/kernel/mac80211/patches/653-0048-rtl8xxxu-Implement-rtl8188eu_power_off.patch @@ -0,0 +1,185 @@ +From 34e65b6f310234cf3e3629bd3d896a4f84df71f4 Mon Sep 17 00:00:00 2001 +From: Jes Sorensen +Date: Fri, 26 Aug 2016 16:09:00 -0400 +Subject: [PATCH] rtl8xxxu: Implement rtl8188eu_power_off() + +This makes the driver match the poweroff sequence of the vendor driver +and allows the firmware to reload correctly upon rmmod/insmod. +However the device still doesn't receive data upon reloading. + +Signed-off-by: Jes Sorensen +--- + .../net/wireless/realtek/rtl8xxxu/rtl8xxxu_8188e.c | 136 ++++++++++++++++++++- + .../net/wireless/realtek/rtl8xxxu/rtl8xxxu_regs.h | 2 + + 2 files changed, 137 insertions(+), 1 deletion(-) + +--- a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_8188e.c ++++ b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_8188e.c +@@ -1191,6 +1191,71 @@ exit: + return ret; + } + ++static int rtl8188eu_emu_to_disabled(struct rtl8xxxu_priv *priv) ++{ ++ u8 val8; ++ ++ /* 0x04[12:11] = 01 enable WL suspend */ ++ val8 = rtl8xxxu_read8(priv, REG_APS_FSMCO + 2); ++ val8 &= ~BIT(0); ++ rtl8xxxu_write8(priv, REG_APS_FSMCO + 2, val8); ++ ++ val8 = rtl8xxxu_read8(priv, REG_APS_FSMCO + 1); ++ val8 |= BIT(7); ++ rtl8xxxu_write8(priv, REG_APS_FSMCO + 1, val8); ++ ++ return 0; ++} ++ ++static int rtl8188eu_active_to_lps(struct rtl8xxxu_priv *priv) ++{ ++ struct device *dev = &priv->udev->dev; ++ u8 val8; ++ u16 val16; ++ u32 val32; ++ int retry, retval; ++ ++ rtl8xxxu_write8(priv, REG_TXPAUSE, 0x7f); ++ ++ retry = 100; ++ retval = -EBUSY; ++ /* ++ * Poll 32 bit wide 0x05f8 for 0x00000000 to ensure no TX is pending. ++ */ ++ do { ++ val32 = rtl8xxxu_read32(priv, 0x05f8); ++ if (!val32) { ++ retval = 0; ++ break; ++ } ++ } while (retry--); ++ ++ if (!retry) { ++ dev_warn(dev, "Failed to flush TX queue\n"); ++ retval = -EBUSY; ++ goto out; ++ } ++ ++ /* Disable CCK and OFDM, clock gated */ ++ val8 = rtl8xxxu_read8(priv, REG_SYS_FUNC); ++ val8 &= ~SYS_FUNC_BBRSTB; ++ rtl8xxxu_write8(priv, REG_SYS_FUNC, val8); ++ ++ udelay(2); ++ ++ /* Reset MAC TRX */ ++ val16 = rtl8xxxu_read16(priv, REG_CR); ++ val16 &= ~(CR_MAC_TX_ENABLE | CR_MAC_RX_ENABLE | CR_SECURITY_ENABLE); ++ rtl8xxxu_write16(priv, REG_CR, val16); ++ ++ val8 = rtl8xxxu_read8(priv, REG_DUAL_TSF_RST); ++ val8 |= DUAL_TSF_TX_OK; ++ rtl8xxxu_write8(priv, REG_DUAL_TSF_RST, val8); ++ ++out: ++ return retval; ++} ++ + static int rtl8188eu_power_on(struct rtl8xxxu_priv *priv) + { + u16 val16; +@@ -1221,6 +1286,75 @@ exit: + return ret; + } + ++void rtl8188eu_power_off(struct rtl8xxxu_priv *priv) ++{ ++ u8 val8; ++ u16 val16; ++ ++ rtl8xxxu_flush_fifo(priv); ++ ++ val8 = rtl8xxxu_read8(priv, REG_TX_REPORT_CTRL); ++ val8 &= ~TX_REPORT_CTRL_TIMER_ENABLE; ++ rtl8xxxu_write8(priv, REG_TX_REPORT_CTRL, val8); ++ ++ /* Turn off RF */ ++ rtl8xxxu_write8(priv, REG_RF_CTRL, 0x00); ++ ++ rtl8188eu_active_to_lps(priv); ++ ++ /* Reset Firmware if running in RAM */ ++ if (rtl8xxxu_read8(priv, REG_MCU_FW_DL) & MCU_FW_RAM_SEL) ++ rtl8xxxu_firmware_self_reset(priv); ++ ++ /* Reset MCU */ ++ val16 = rtl8xxxu_read16(priv, REG_SYS_FUNC); ++ val16 &= ~SYS_FUNC_CPU_ENABLE; ++ rtl8xxxu_write16(priv, REG_SYS_FUNC, val16); ++ ++ /* Reset MCU ready status */ ++ rtl8xxxu_write8(priv, REG_MCU_FW_DL, 0x00); ++ ++ /* 32K_CTRL looks to be very 8188e specific */ ++ val8 = rtl8xxxu_read8(priv, REG_32K_CTRL); ++ val8 &= ~BIT(0); ++ rtl8xxxu_write8(priv, REG_32K_CTRL, val8); ++ ++ rtl8188eu_active_to_emu(priv); ++ rtl8188eu_emu_to_disabled(priv); ++ ++ /* Reset MCU IO Wrapper */ ++ val8 = rtl8xxxu_read8(priv, REG_RSV_CTRL + 1); ++ val8 &= ~BIT(3); ++ rtl8xxxu_write8(priv, REG_RSV_CTRL + 1, val8); ++ ++ val8 = rtl8xxxu_read8(priv, REG_RSV_CTRL + 1); ++ val8 |= BIT(3); ++ rtl8xxxu_write8(priv, REG_RSV_CTRL + 1, val8); ++ ++ /* Vendor driver refers to GPIO_IN */ ++ val8 = rtl8xxxu_read8(priv, REG_GPIO_PIN_CTRL); ++ /* Vendor driver refers to GPIO_OUT */ ++ rtl8xxxu_write8(priv, REG_GPIO_PIN_CTRL + 1, val8); ++ rtl8xxxu_write8(priv, REG_GPIO_PIN_CTRL + 2, 0xff); ++ ++ val8 = rtl8xxxu_read8(priv, REG_GPIO_IO_SEL); ++ rtl8xxxu_write8(priv, REG_GPIO_IO_SEL + 1, val8 << 4); ++ val8 = rtl8xxxu_read8(priv, REG_GPIO_IO_SEL + 1); ++ rtl8xxxu_write8(priv, REG_GPIO_IO_SEL + 1, val8 | 0x0f); ++ ++ /* ++ * Set LNA, TRSW, EX_PA Pin to output mode ++ * Referred to as REG_BB_PAD_CTRL in 8188eu vendor driver ++ */ ++ rtl8xxxu_write32(priv, REG_PAD_CTRL1, 0x00080808); ++ ++ rtl8xxxu_write8(priv, REG_RSV_CTRL, 0x00); ++ ++ val16 = rtl8xxxu_read16(priv, REG_APS_FSMCO); ++ val16 |= APS_FSMCO_ENABLE_POWERDOWN | APS_FSMCO_HW_POWERDOWN; ++ rtl8xxxu_write16(priv, REG_APS_FSMCO, val16); ++} ++ + static void rtl8188e_enable_rf(struct rtl8xxxu_priv *priv) + { + rtl8xxxu_write8(priv, REG_TXPAUSE, 0x00); +@@ -1265,7 +1399,7 @@ struct rtl8xxxu_fileops rtl8188eu_fops = + .parse_efuse = rtl8188eu_parse_efuse, + .load_firmware = rtl8188eu_load_firmware, + .power_on = rtl8188eu_power_on, +- .power_off = rtl8xxxu_power_off, ++ .power_off = rtl8188eu_power_off, + .reset_8051 = rtl8188eu_reset_8051, + .llt_init = rtl8xxxu_init_llt_table, + .init_phy_bb = rtl8188eu_init_phy_bb, +--- a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_regs.h ++++ b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_regs.h +@@ -418,6 +418,8 @@ + #define REG_MBIST_START 0x0174 + #define REG_MBIST_DONE 0x0178 + #define REG_MBIST_FAIL 0x017c ++/* 8188EU */ ++#define REG_32K_CTRL 0x0194 + #define REG_C2HEVT_MSG_NORMAL 0x01a0 + /* 8192EU/8723BU/8812 */ + #define REG_C2HEVT_CMD_ID_8723B 0x01ae diff --git a/package/kernel/mac80211/patches/653-0049-rtl8xxxu-Add-rtl8188eu-USB-ID-for-D-Link-USB-GO-N150.patch b/package/kernel/mac80211/patches/653-0049-rtl8xxxu-Add-rtl8188eu-USB-ID-for-D-Link-USB-GO-N150.patch new file mode 100644 index 0000000000..1c3df95796 --- /dev/null +++ b/package/kernel/mac80211/patches/653-0049-rtl8xxxu-Add-rtl8188eu-USB-ID-for-D-Link-USB-GO-N150.patch @@ -0,0 +1,25 @@ +From 5cd16e6a4660c07f01753e460eafdb805e71b9e9 Mon Sep 17 00:00:00 2001 +From: Jes Sorensen +Date: Mon, 29 Aug 2016 12:55:37 -0400 +Subject: [PATCH] rtl8xxxu: Add rtl8188eu USB ID for D-Link USB-GO-N150 + +Received one in the mail yesterday, seems to work like all the other +8188eu dongles I have. + +Signed-off-by: Jes Sorensen +--- + drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c | 3 +++ + 1 file changed, 3 insertions(+) + +--- a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c ++++ b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c +@@ -6315,6 +6315,9 @@ static struct usb_device_id dev_table[] + /* Sitecom rtl8188eus */ + {USB_DEVICE_AND_INTERFACE_INFO(0x0df6, 0x0076, 0xff, 0xff, 0xff), + .driver_info = (unsigned long)&rtl8188eu_fops}, ++/* D-Link USB-GO-N150 */ ++{USB_DEVICE_AND_INTERFACE_INFO(0x2001, 0x3311, 0xff, 0xff, 0xff), ++ .driver_info = (unsigned long)&rtl8188eu_fops}, + /* Still supported by rtlwifi */ + {USB_DEVICE_AND_INTERFACE_INFO(USB_VENDOR_ID_REALTEK, 0x8176, 0xff, 0xff, 0xff), + .driver_info = (unsigned long)&rtl8192cu_fops}, diff --git a/package/kernel/mac80211/patches/653-0050-rtl8xxxu-Clear-SYS_FUNC_UPLL-during-power-up-on-8188.patch b/package/kernel/mac80211/patches/653-0050-rtl8xxxu-Clear-SYS_FUNC_UPLL-during-power-up-on-8188.patch new file mode 100644 index 0000000000..2c7413e35b --- /dev/null +++ b/package/kernel/mac80211/patches/653-0050-rtl8xxxu-Clear-SYS_FUNC_UPLL-during-power-up-on-8188.patch @@ -0,0 +1,23 @@ +From 59a94447d4a98ab56cefe0b277251c660a333ce0 Mon Sep 17 00:00:00 2001 +From: Jes Sorensen +Date: Tue, 30 Aug 2016 14:33:18 -0400 +Subject: [PATCH] rtl8xxxu: Clear SYS_FUNC_UPLL during power up on 8188eu + +The vendor driver doesn't set this bit during BB config, so avoid +setting it here too. + +Signed-off-by: Jes Sorensen +--- + drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_8188e.c | 1 + + 1 file changed, 1 insertion(+) + +--- a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_8188e.c ++++ b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_8188e.c +@@ -561,6 +561,7 @@ static void rtl8188eu_init_phy_bb(struct + val16 = rtl8xxxu_read16(priv, REG_SYS_FUNC); + val16 |= (SYS_FUNC_USBA | SYS_FUNC_USBD | + SYS_FUNC_BB_GLB_RSTN | SYS_FUNC_BBRSTB); ++ val16 &= ~SYS_FUNC_UPLL; + rtl8xxxu_write16(priv, REG_SYS_FUNC, val16); + + rtl8xxxu_init_phy_regs(priv, rtl8188eu_phy_init_table); diff --git a/package/kernel/mac80211/patches/653-0051-rtl8xxxu-Early-enable-of-WEP-TKIP-security-on-8188eu.patch b/package/kernel/mac80211/patches/653-0051-rtl8xxxu-Early-enable-of-WEP-TKIP-security-on-8188eu.patch new file mode 100644 index 0000000000..56be43a599 --- /dev/null +++ b/package/kernel/mac80211/patches/653-0051-rtl8xxxu-Early-enable-of-WEP-TKIP-security-on-8188eu.patch @@ -0,0 +1,25 @@ +From 845f14c57fd50ec7e94f59bb1b5ad0cd1ecdbdd1 Mon Sep 17 00:00:00 2001 +From: Jes Sorensen +Date: Tue, 30 Aug 2016 15:47:05 -0400 +Subject: [PATCH] rtl8xxxu: Early enable of WEP/TKIP security on 8188eu + +This matches action taken in the vendor driver, however it is unclear +why this is done. + +Signed-off-by: Jes Sorensen +--- + drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_8188e.c | 3 +++ + 1 file changed, 3 insertions(+) + +--- a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_8188e.c ++++ b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_8188e.c +@@ -1394,6 +1394,9 @@ static void rtl8188e_usb_quirks(struct r + val32 = rtl8xxxu_read32(priv, REG_TXDMA_OFFSET_CHK); + val32 |= TXDMA_OFFSET_DROP_DATA_EN; + rtl8xxxu_write32(priv, REG_TXDMA_OFFSET_CHK, val32); ++ ++ /* Pre-TX enable WEP/TKIP security */ ++ rtl8xxxu_write8(priv, REG_EARLY_MODE_CONTROL_8188E + 3, 0x01); + } + + struct rtl8xxxu_fileops rtl8188eu_fops = { diff --git a/package/kernel/mac80211/patches/653-0052-rtl8xxxu-Correct-power-down-sequence-for-8188eu.patch b/package/kernel/mac80211/patches/653-0052-rtl8xxxu-Correct-power-down-sequence-for-8188eu.patch new file mode 100644 index 0000000000..603785b5d2 --- /dev/null +++ b/package/kernel/mac80211/patches/653-0052-rtl8xxxu-Correct-power-down-sequence-for-8188eu.patch @@ -0,0 +1,65 @@ +From 2764703c3c896d427731391aa978c536aaf4cb91 Mon Sep 17 00:00:00 2001 +From: Jes Sorensen +Date: Tue, 30 Aug 2016 17:23:35 -0400 +Subject: [PATCH] rtl8xxxu: Correct power down sequence for 8188eu + +This matches the vendor driver more correctly + +Signed-off-by: Jes Sorensen +--- + .../net/wireless/realtek/rtl8xxxu/rtl8xxxu_8188e.c | 26 ++++++++++++++++------ + 1 file changed, 19 insertions(+), 7 deletions(-) + +--- a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_8188e.c ++++ b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_8188e.c +@@ -1083,7 +1083,8 @@ static void rtl8188e_disabled_to_emu(str + u16 val16; + + val16 = rtl8xxxu_read16(priv, REG_APS_FSMCO); +- val16 &= ~(APS_FSMCO_PFM_WOWL | APS_FSMCO_ENABLE_POWERDOWN); ++ val16 &= ~(APS_FSMCO_PFM_WOWL | APS_FSMCO_ENABLE_POWERDOWN | ++ APS_FSMCO_HW_POWERDOWN); + rtl8xxxu_write16(priv, REG_APS_FSMCO, val16); + } + +@@ -1196,15 +1197,26 @@ static int rtl8188eu_emu_to_disabled(str + { + u8 val8; + +- /* 0x04[12:11] = 01 enable WL suspend */ +- val8 = rtl8xxxu_read8(priv, REG_APS_FSMCO + 2); +- val8 &= ~BIT(0); +- rtl8xxxu_write8(priv, REG_APS_FSMCO + 2, val8); ++ val8 = rtl8xxxu_read8(priv, REG_AFE_XTAL_CTRL + 2); ++ val8 |= BIT(7); ++ rtl8xxxu_write8(priv, REG_AFE_XTAL_CTRL + 2, val8); + + val8 = rtl8xxxu_read8(priv, REG_APS_FSMCO + 1); +- val8 |= BIT(7); ++ val8 &= ~(BIT(3) | BIT(4)); ++ val8 |= BIT(3); + rtl8xxxu_write8(priv, REG_APS_FSMCO + 1, val8); + ++ rtl8xxxu_write8(priv, REG_APS_FSMCO + 3, 0x00); ++ ++ val8 = rtl8xxxu_read8(priv, REG_GPIO_MUXCFG + 1); ++ val8 &= ~BIT(4); ++ rtl8xxxu_write8(priv, REG_GPIO_MUXCFG + 1, val8); ++ ++ /* Set USB suspend enable local register 0xfe10[4]=1 */ ++ val8 = rtl8xxxu_read8(priv, 0xfe10); ++ val8 |= BIT(4); ++ rtl8xxxu_write8(priv, 0xfe10, val8); ++ + return 0; + } + +@@ -1339,7 +1351,7 @@ void rtl8188eu_power_off(struct rtl8xxxu + rtl8xxxu_write8(priv, REG_GPIO_PIN_CTRL + 2, 0xff); + + val8 = rtl8xxxu_read8(priv, REG_GPIO_IO_SEL); +- rtl8xxxu_write8(priv, REG_GPIO_IO_SEL + 1, val8 << 4); ++ rtl8xxxu_write8(priv, REG_GPIO_IO_SEL, val8 << 4); + val8 = rtl8xxxu_read8(priv, REG_GPIO_IO_SEL + 1); + rtl8xxxu_write8(priv, REG_GPIO_IO_SEL + 1, val8 | 0x0f); + diff --git a/package/kernel/mac80211/patches/653-0053-rtl8xxxu-Reset-8188eu-REG_GPIO_MUXCFG-on-power-off.patch b/package/kernel/mac80211/patches/653-0053-rtl8xxxu-Reset-8188eu-REG_GPIO_MUXCFG-on-power-off.patch new file mode 100644 index 0000000000..9da901f93b --- /dev/null +++ b/package/kernel/mac80211/patches/653-0053-rtl8xxxu-Reset-8188eu-REG_GPIO_MUXCFG-on-power-off.patch @@ -0,0 +1,21 @@ +From 89bc2e59923ffc65b4b4fc123ef152c1a9a49639 Mon Sep 17 00:00:00 2001 +From: Jes Sorensen +Date: Tue, 30 Aug 2016 17:30:14 -0400 +Subject: [PATCH] rtl8xxxu: Reset 8188eu REG_GPIO_MUXCFG on power off + +Signed-off-by: Jes Sorensen +--- + drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_8188e.c | 2 ++ + 1 file changed, 2 insertions(+) + +--- a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_8188e.c ++++ b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_8188e.c +@@ -1363,6 +1363,8 @@ void rtl8188eu_power_off(struct rtl8xxxu + + rtl8xxxu_write8(priv, REG_RSV_CTRL, 0x00); + ++ rtl8xxxu_write32(priv, REG_GPIO_MUXCFG, 0x00000000); ++ + val16 = rtl8xxxu_read16(priv, REG_APS_FSMCO); + val16 |= APS_FSMCO_ENABLE_POWERDOWN | APS_FSMCO_HW_POWERDOWN; + rtl8xxxu_write16(priv, REG_APS_FSMCO, val16); diff --git a/package/kernel/mac80211/patches/653-0054-rtl8xxxu-Handle-devices-with-a-smaller-LLT-buffer.patch b/package/kernel/mac80211/patches/653-0054-rtl8xxxu-Handle-devices-with-a-smaller-LLT-buffer.patch new file mode 100644 index 0000000000..49a9f8bd8a --- /dev/null +++ b/package/kernel/mac80211/patches/653-0054-rtl8xxxu-Handle-devices-with-a-smaller-LLT-buffer.patch @@ -0,0 +1,70 @@ +From 5dd3f1799baf4683c0161f7e49d65bee17f3e35d Mon Sep 17 00:00:00 2001 +From: Jes Sorensen +Date: Wed, 31 Aug 2016 16:31:38 -0400 +Subject: [PATCH] rtl8xxxu: Handle devices with a smaller LLT buffer + +The 8188e (except for I cut parts) seem to have a smaller LLT buffer +than all other known devices. + +Signed-off-by: Jes Sorensen +--- + drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu.h | 1 + + drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_8188e.c | 1 + + drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c | 11 ++++++++--- + 3 files changed, 10 insertions(+), 3 deletions(-) + +--- a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu.h ++++ b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu.h +@@ -1411,6 +1411,7 @@ struct rtl8xxxu_fileops { + u8 page_num_hi; + u8 page_num_lo; + u8 page_num_norm; ++ u8 last_llt_entry; + }; + + extern int rtl8xxxu_debug; +--- a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_8188e.c ++++ b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_8188e.c +@@ -1454,4 +1454,5 @@ struct rtl8xxxu_fileops rtl8188eu_fops = + .page_num_hi = TX_PAGE_NUM_HI_PQ_8188E, + .page_num_lo = TX_PAGE_NUM_LO_PQ_8188E, + .page_num_norm = TX_PAGE_NUM_NORM_PQ_8188E, ++ .last_llt_entry = 176, + }; +--- a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c ++++ b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c +@@ -2485,11 +2485,16 @@ static int rtl8xxxu_llt_write(struct rtl + int rtl8xxxu_init_llt_table(struct rtl8xxxu_priv *priv) + { + int ret; +- int i; ++ int i, last_entry; + u8 last_tx_page; + + last_tx_page = priv->fops->total_page_num; + ++ if (priv->fops->last_llt_entry) ++ last_entry = priv->fops->last_llt_entry; ++ else ++ last_entry = 255; ++ + for (i = 0; i < last_tx_page; i++) { + ret = rtl8xxxu_llt_write(priv, i, i + 1); + if (ret) +@@ -2501,14 +2506,14 @@ int rtl8xxxu_init_llt_table(struct rtl8x + goto exit; + + /* Mark remaining pages as a ring buffer */ +- for (i = last_tx_page + 1; i < 0xff; i++) { ++ for (i = last_tx_page + 1; i < last_entry; i++) { + ret = rtl8xxxu_llt_write(priv, i, (i + 1)); + if (ret) + goto exit; + } + + /* Let last entry point to the start entry of ring buffer */ +- ret = rtl8xxxu_llt_write(priv, 0xff, last_tx_page + 1); ++ ret = rtl8xxxu_llt_write(priv, last_entry, last_tx_page + 1); + if (ret) + goto exit; + diff --git a/package/kernel/mac80211/patches/653-0055-rtl8xxxu-Fix-reloading-of-driver-for-8188eu-devices.patch b/package/kernel/mac80211/patches/653-0055-rtl8xxxu-Fix-reloading-of-driver-for-8188eu-devices.patch new file mode 100644 index 0000000000..dc0b19161e --- /dev/null +++ b/package/kernel/mac80211/patches/653-0055-rtl8xxxu-Fix-reloading-of-driver-for-8188eu-devices.patch @@ -0,0 +1,72 @@ +From 7b4161933d0a409023f5ef70cdc9296ab1cf5430 Mon Sep 17 00:00:00 2001 +From: Jes Sorensen +Date: Wed, 14 Sep 2016 14:10:42 -0400 +Subject: [PATCH] rtl8xxxu: Fix reloading of driver for 8188eu devices + +For 8188eu, once the MAC is asked to power down by setting +APS_FSMCO_MAC_OFF, there seems to be no way to bring it back to life. + +In addition, only disable RF_ENABLE in RF_CTRL rather than all bits. + +This was spotted by Andrea Merello who noticed that if we dropped the +call to rtl8188eu_active_to_emu() reloading started working. + +Reported-by: Andrea Merello +Signed-off-by: Jes Sorensen +--- + .../net/wireless/realtek/rtl8xxxu/rtl8xxxu_8188e.c | 29 +++++----------------- + 1 file changed, 6 insertions(+), 23 deletions(-) + +--- a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_8188e.c ++++ b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_8188e.c +@@ -1160,37 +1160,18 @@ exit: + static int rtl8188eu_active_to_emu(struct rtl8xxxu_priv *priv) + { + u8 val8; +- int count, ret = 0; + + /* Turn off RF */ +- rtl8xxxu_write8(priv, REG_RF_CTRL, 0); ++ val8 = rtl8xxxu_read8(priv, REG_RF_CTRL); ++ val8 &= ~RF_ENABLE; ++ rtl8xxxu_write8(priv, REG_RF_CTRL, val8); + + /* LDO Sleep mode */ + val8 = rtl8xxxu_read8(priv, REG_LPLDO_CTRL); + val8 |= BIT(4); + rtl8xxxu_write8(priv, REG_LPLDO_CTRL, val8); + +- /* 0x0005[1] = 1 turn off MAC by HW state machine*/ +- val8 = rtl8xxxu_read8(priv, REG_APS_FSMCO + 1); +- val8 |= BIT(1); +- rtl8xxxu_write8(priv, REG_APS_FSMCO + 1, val8); +- +- for (count = RTL8XXXU_MAX_REG_POLL; count; count--) { +- val8 = rtl8xxxu_read8(priv, REG_APS_FSMCO + 1); +- if ((val8 & BIT(1)) == 0) +- break; +- udelay(10); +- } +- +- if (!count) { +- dev_warn(&priv->udev->dev, "%s: Disabling MAC timed out\n", +- __func__); +- ret = -EBUSY; +- goto exit; +- } +- +-exit: +- return ret; ++ return 0; + } + + static int rtl8188eu_emu_to_disabled(struct rtl8xxxu_priv *priv) +@@ -1372,6 +1353,8 @@ void rtl8188eu_power_off(struct rtl8xxxu + + static void rtl8188e_enable_rf(struct rtl8xxxu_priv *priv) + { ++ rtl8xxxu_write8(priv, REG_RF_CTRL, RF_ENABLE | RF_RSTB | RF_SDMRSTB); ++ + rtl8xxxu_write8(priv, REG_TXPAUSE, 0x00); + } + diff --git a/package/kernel/mac80211/patches/653-0056-rtl8xxxu-Make-sure-to-enable-OFDM-paths-for-8188eu-i.patch b/package/kernel/mac80211/patches/653-0056-rtl8xxxu-Make-sure-to-enable-OFDM-paths-for-8188eu-i.patch new file mode 100644 index 0000000000..b5c98ddbde --- /dev/null +++ b/package/kernel/mac80211/patches/653-0056-rtl8xxxu-Make-sure-to-enable-OFDM-paths-for-8188eu-i.patch @@ -0,0 +1,39 @@ +From ba518f046cc1ce63b6984948b19b4d3903c5c30b Mon Sep 17 00:00:00 2001 +From: Jes Sorensen +Date: Mon, 3 Oct 2016 11:46:37 -0400 +Subject: [PATCH] rtl8xxxu: Make sure to enable OFDM paths for 8188eu in + rtl8188e_enable_rf() + +Failure to re-enable OFDM paths results in the dongle only receiving +CCK packets which isn't overly exciting. + +Signed-off-by: Jes Sorensen +--- + drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_8188e.c | 14 ++++++++++++++ + 1 file changed, 14 insertions(+) + +--- a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_8188e.c ++++ b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_8188e.c +@@ -1353,8 +1353,22 @@ void rtl8188eu_power_off(struct rtl8xxxu + + static void rtl8188e_enable_rf(struct rtl8xxxu_priv *priv) + { ++ u32 val32; ++ + rtl8xxxu_write8(priv, REG_RF_CTRL, RF_ENABLE | RF_RSTB | RF_SDMRSTB); + ++ val32 = rtl8xxxu_read32(priv, REG_OFDM0_TRX_PATH_ENABLE); ++ val32 &= ~(OFDM_RF_PATH_RX_MASK | OFDM_RF_PATH_TX_MASK); ++ if (priv->rx_paths == 2) ++ val32 |= OFDM_RF_PATH_RX_A | OFDM_RF_PATH_RX_B; ++ else ++ val32 |= OFDM_RF_PATH_RX_A; ++ if (priv->tx_paths == 2) ++ val32 |= OFDM_RF_PATH_TX_A | OFDM_RF_PATH_TX_B; ++ else ++ val32 |= OFDM_RF_PATH_TX_A; ++ rtl8xxxu_write32(priv, REG_OFDM0_TRX_PATH_ENABLE, val32); ++ + rtl8xxxu_write8(priv, REG_TXPAUSE, 0x00); + } + diff --git a/package/kernel/mac80211/patches/653-0057-rtl8xxxu-Add-rpt_sel-entry-to-struct-rtl8xxxu_rxdesc.patch b/package/kernel/mac80211/patches/653-0057-rtl8xxxu-Add-rpt_sel-entry-to-struct-rtl8xxxu_rxdesc.patch new file mode 100644 index 0000000000..620783a89d --- /dev/null +++ b/package/kernel/mac80211/patches/653-0057-rtl8xxxu-Add-rpt_sel-entry-to-struct-rtl8xxxu_rxdesc.patch @@ -0,0 +1,35 @@ +From f670de32e58c1623ee30d7511e62e7b7e2164684 Mon Sep 17 00:00:00 2001 +From: Jes Sorensen +Date: Tue, 4 Oct 2016 12:40:22 -0400 +Subject: [PATCH] rtl8xxxu: Add rpt_sel entry to struct rtl8xxxu_rxdesc16 + +The 8188e supports TX reports which will show up as an RX packet, +similar to how the gen2 parts handle it. + +Signed-off-by: Jes Sorensen +--- + drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu.h | 6 ++++-- + 1 file changed, 4 insertions(+), 2 deletions(-) + +--- a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu.h ++++ b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu.h +@@ -161,7 +161,8 @@ struct rtl8xxxu_rxdesc16 { + u32 htc:1; + u32 eosp:1; + u32 bssidfit:2; +- u32 reserved1:16; ++ u32 rpt_sel:2; /* 8188e */ ++ u32 reserved1:14; + u32 unicastwake:1; + u32 magicwake:1; + +@@ -219,7 +220,8 @@ struct rtl8xxxu_rxdesc16 { + + u32 magicwake:1; + u32 unicastwake:1; +- u32 reserved1:16; ++ u32 reserved1:14; ++ u32 rpt_sel:2; /* 8188e */ + u32 bssidfit:2; + u32 eosp:1; + u32 htc:1; diff --git a/package/kernel/mac80211/patches/654-0001-rtl8xxxu-Reset-device-on-module-unload-if-still-atta.patch b/package/kernel/mac80211/patches/654-0001-rtl8xxxu-Reset-device-on-module-unload-if-still-atta.patch deleted file mode 100644 index a9ae368dbf..0000000000 --- a/package/kernel/mac80211/patches/654-0001-rtl8xxxu-Reset-device-on-module-unload-if-still-atta.patch +++ /dev/null @@ -1,28 +0,0 @@ -From 54cdf5c727cb3d3124e61433a13e9724a7a4a952 Mon Sep 17 00:00:00 2001 -From: Jes Sorensen -Date: Fri, 9 Sep 2016 14:01:24 -0400 -Subject: [PATCH] rtl8xxxu: Reset device on module unload if still attached - -If the USB dongle is still attached, reset it on module unload to -avoid scans failing when reloading the driver. - -Signed-off-by: Jes Sorensen -Signed-off-by: Kalle Valo ---- - drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c | 5 +++++ - 1 file changed, 5 insertions(+) - ---- a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c -+++ b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c -@@ -6129,6 +6129,11 @@ static void rtl8xxxu_disconnect(struct u - mutex_destroy(&priv->usb_buf_mutex); - mutex_destroy(&priv->h2c_mutex); - -+ if (priv->udev->state != USB_STATE_NOTATTACHED) { -+ dev_info(&priv->udev->dev, -+ "Device still attached, trying to reset\n"); -+ usb_reset_device(priv->udev); -+ } - usb_put_dev(priv->udev); - ieee80211_free_hw(hw); - } diff --git a/package/kernel/mac80211/patches/654-0002-rtl8xxxu-fix-spelling-mistake-firmare-firmware.patch b/package/kernel/mac80211/patches/654-0002-rtl8xxxu-fix-spelling-mistake-firmare-firmware.patch deleted file mode 100644 index afe6cd0680..0000000000 --- a/package/kernel/mac80211/patches/654-0002-rtl8xxxu-fix-spelling-mistake-firmare-firmware.patch +++ /dev/null @@ -1,30 +0,0 @@ -From 0cd7f70399f71fdd87b34d28670248c36e4db455 Mon Sep 17 00:00:00 2001 -From: Colin Ian King -Date: Fri, 9 Sep 2016 14:01:25 -0400 -Subject: [PATCH] rtl8xxxu: fix spelling mistake "firmare" -> "firmware" - -Trivial fix to spelling mistakes in dev_dbg message. - -Signed-off-by: Colin Ian King -Signed-off-by: Jes Sorensen -Signed-off-by: Kalle Valo ---- - drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c | 4 ++-- - 1 file changed, 2 insertions(+), 2 deletions(-) - ---- a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c -+++ b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c -@@ -3921,11 +3921,11 @@ static int rtl8xxxu_init_device(struct i - rtl8xxxu_write16(priv, REG_TRXFF_BNDY + 2, priv->fops->trxff_boundary); - - ret = rtl8xxxu_download_firmware(priv); -- dev_dbg(dev, "%s: download_fiwmare %i\n", __func__, ret); -+ dev_dbg(dev, "%s: download_firmware %i\n", __func__, ret); - if (ret) - goto exit; - ret = rtl8xxxu_start_firmware(priv); -- dev_dbg(dev, "%s: start_fiwmare %i\n", __func__, ret); -+ dev_dbg(dev, "%s: start_firmware %i\n", __func__, ret); - if (ret) - goto exit; - diff --git a/package/kernel/mac80211/patches/655-rtl8xxxu-Implement-8192e-specific-power-down-sequenc.patch b/package/kernel/mac80211/patches/655-rtl8xxxu-Implement-8192e-specific-power-down-sequenc.patch deleted file mode 100644 index 8dcced6cb2..0000000000 --- a/package/kernel/mac80211/patches/655-rtl8xxxu-Implement-8192e-specific-power-down-sequenc.patch +++ /dev/null @@ -1,192 +0,0 @@ -From f1785fbf7c0bc17211c299a647ebc38968a42181 Mon Sep 17 00:00:00 2001 -From: Jes Sorensen -Date: Tue, 13 Sep 2016 15:03:15 -0400 -Subject: [PATCH] rtl8xxxu: Implement 8192e specific power down sequence - -This powers down the 8192e correctly, or at least to the point where -the firmware will load again, when reloading the driver module. - -Signed-off-by: Jes Sorensen -Signed-off-by: Kalle Valo ---- - .../net/wireless/realtek/rtl8xxxu/rtl8xxxu_8192e.c | 144 ++++++++++++++++++++- - .../net/wireless/realtek/rtl8xxxu/rtl8xxxu_regs.h | 1 + - 2 files changed, 144 insertions(+), 1 deletion(-) - ---- a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_8192e.c -+++ b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_8192e.c -@@ -1396,6 +1396,114 @@ exit: - return ret; - } - -+static int rtl8192eu_active_to_lps(struct rtl8xxxu_priv *priv) -+{ -+ struct device *dev = &priv->udev->dev; -+ u8 val8; -+ u16 val16; -+ u32 val32; -+ int retry, retval; -+ -+ rtl8xxxu_write8(priv, REG_TXPAUSE, 0xff); -+ -+ retry = 100; -+ retval = -EBUSY; -+ /* -+ * Poll 32 bit wide 0x05f8 for 0x00000000 to ensure no TX is pending. -+ */ -+ do { -+ val32 = rtl8xxxu_read32(priv, REG_SCH_TX_CMD); -+ if (!val32) { -+ retval = 0; -+ break; -+ } -+ } while (retry--); -+ -+ if (!retry) { -+ dev_warn(dev, "Failed to flush TX queue\n"); -+ retval = -EBUSY; -+ goto out; -+ } -+ -+ /* Disable CCK and OFDM, clock gated */ -+ val8 = rtl8xxxu_read8(priv, REG_SYS_FUNC); -+ val8 &= ~SYS_FUNC_BBRSTB; -+ rtl8xxxu_write8(priv, REG_SYS_FUNC, val8); -+ -+ udelay(2); -+ -+ /* Reset whole BB */ -+ val8 = rtl8xxxu_read8(priv, REG_SYS_FUNC); -+ val8 &= ~SYS_FUNC_BB_GLB_RSTN; -+ rtl8xxxu_write8(priv, REG_SYS_FUNC, val8); -+ -+ /* Reset MAC TRX */ -+ val16 = rtl8xxxu_read16(priv, REG_CR); -+ val16 &= 0xff00; -+ val16 |= (CR_HCI_TXDMA_ENABLE | CR_HCI_RXDMA_ENABLE); -+ rtl8xxxu_write16(priv, REG_CR, val16); -+ -+ val16 = rtl8xxxu_read16(priv, REG_CR); -+ val16 &= ~CR_SECURITY_ENABLE; -+ rtl8xxxu_write16(priv, REG_CR, val16); -+ -+ val8 = rtl8xxxu_read8(priv, REG_DUAL_TSF_RST); -+ val8 |= DUAL_TSF_TX_OK; -+ rtl8xxxu_write8(priv, REG_DUAL_TSF_RST, val8); -+ -+out: -+ return retval; -+} -+ -+static int rtl8192eu_active_to_emu(struct rtl8xxxu_priv *priv) -+{ -+ u8 val8; -+ int count, ret = 0; -+ -+ /* Turn off RF */ -+ rtl8xxxu_write8(priv, REG_RF_CTRL, 0); -+ -+ /* Switch DPDT_SEL_P output from register 0x65[2] */ -+ val8 = rtl8xxxu_read8(priv, REG_LEDCFG2); -+ val8 &= ~LEDCFG2_DPDT_SELECT; -+ rtl8xxxu_write8(priv, REG_LEDCFG2, val8); -+ -+ /* 0x0005[1] = 1 turn off MAC by HW state machine*/ -+ val8 = rtl8xxxu_read8(priv, REG_APS_FSMCO + 1); -+ val8 |= BIT(1); -+ rtl8xxxu_write8(priv, REG_APS_FSMCO + 1, val8); -+ -+ for (count = RTL8XXXU_MAX_REG_POLL; count; count--) { -+ val8 = rtl8xxxu_read8(priv, REG_APS_FSMCO + 1); -+ if ((val8 & BIT(1)) == 0) -+ break; -+ udelay(10); -+ } -+ -+ if (!count) { -+ dev_warn(&priv->udev->dev, "%s: Disabling MAC timed out\n", -+ __func__); -+ ret = -EBUSY; -+ goto exit; -+ } -+ -+exit: -+ return ret; -+} -+ -+static int rtl8192eu_emu_to_disabled(struct rtl8xxxu_priv *priv) -+{ -+ u8 val8; -+ -+ /* 0x04[12:11] = 01 enable WL suspend */ -+ val8 = rtl8xxxu_read8(priv, REG_APS_FSMCO + 1); -+ val8 &= ~(BIT(3) | BIT(4)); -+ val8 |= BIT(3); -+ rtl8xxxu_write8(priv, REG_APS_FSMCO + 1, val8); -+ -+ return 0; -+} -+ - static int rtl8192eu_power_on(struct rtl8xxxu_priv *priv) - { - u16 val16; -@@ -1446,6 +1554,40 @@ exit: - return ret; - } - -+void rtl8192eu_power_off(struct rtl8xxxu_priv *priv) -+{ -+ u8 val8; -+ u16 val16; -+ -+ rtl8xxxu_flush_fifo(priv); -+ -+ val8 = rtl8xxxu_read8(priv, REG_TX_REPORT_CTRL); -+ val8 &= ~TX_REPORT_CTRL_TIMER_ENABLE; -+ rtl8xxxu_write8(priv, REG_TX_REPORT_CTRL, val8); -+ -+ /* Turn off RF */ -+ rtl8xxxu_write8(priv, REG_RF_CTRL, 0x00); -+ -+ rtl8192eu_active_to_lps(priv); -+ -+ /* Reset Firmware if running in RAM */ -+ if (rtl8xxxu_read8(priv, REG_MCU_FW_DL) & MCU_FW_RAM_SEL) -+ rtl8xxxu_firmware_self_reset(priv); -+ -+ /* Reset MCU */ -+ val16 = rtl8xxxu_read16(priv, REG_SYS_FUNC); -+ val16 &= ~SYS_FUNC_CPU_ENABLE; -+ rtl8xxxu_write16(priv, REG_SYS_FUNC, val16); -+ -+ /* Reset MCU ready status */ -+ rtl8xxxu_write8(priv, REG_MCU_FW_DL, 0x00); -+ -+ rtl8xxxu_reset_8051(priv); -+ -+ rtl8192eu_active_to_emu(priv); -+ rtl8192eu_emu_to_disabled(priv); -+} -+ - static void rtl8192e_enable_rf(struct rtl8xxxu_priv *priv) - { - u32 val32; -@@ -1487,7 +1629,7 @@ struct rtl8xxxu_fileops rtl8192eu_fops = - .parse_efuse = rtl8192eu_parse_efuse, - .load_firmware = rtl8192eu_load_firmware, - .power_on = rtl8192eu_power_on, -- .power_off = rtl8xxxu_power_off, -+ .power_off = rtl8192eu_power_off, - .reset_8051 = rtl8xxxu_reset_8051, - .llt_init = rtl8xxxu_auto_llt_table, - .init_phy_bb = rtl8192eu_init_phy_bb, ---- a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_regs.h -+++ b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_regs.h -@@ -676,6 +676,7 @@ - #define REG_SCH_TXCMD 0x05d0 - - /* define REG_FW_TSF_SYNC_CNT 0x04a0 */ -+#define REG_SCH_TX_CMD 0x05f8 - #define REG_FW_RESET_TSF_CNT_1 0x05fc - #define REG_FW_RESET_TSF_CNT_0 0x05fd - #define REG_FW_BCN_DIS_CNT 0x05fe diff --git a/package/kernel/mac80211/patches/656-0001-rtl8xxxu-Fix-off-by-one-error-calculating-pubq.patch b/package/kernel/mac80211/patches/656-0001-rtl8xxxu-Fix-off-by-one-error-calculating-pubq.patch deleted file mode 100644 index 9db015c099..0000000000 --- a/package/kernel/mac80211/patches/656-0001-rtl8xxxu-Fix-off-by-one-error-calculating-pubq.patch +++ /dev/null @@ -1,25 +0,0 @@ -From 3a589fae4a2cff317c3cabd4f76578ffd2761808 Mon Sep 17 00:00:00 2001 -From: Jes Sorensen -Date: Tue, 20 Sep 2016 21:19:26 -0400 -Subject: [PATCH] rtl8xxxu: Fix off by one error calculating pubq - -This was detected tracing the 8188eu driver, but doesn't seem to make -any difference when using it. - -Signed-off-by: Jes Sorensen -Signed-off-by: Kalle Valo ---- - drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - ---- a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c -+++ b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c -@@ -3869,7 +3869,7 @@ static void rtl8xxxu_init_queue_reserved - val32 = (nq << RQPN_NPQ_SHIFT) | (eq << RQPN_EPQ_SHIFT); - rtl8xxxu_write32(priv, REG_RQPN_NPQ, val32); - -- pubq = fops->total_page_num - hq - lq - nq; -+ pubq = fops->total_page_num - hq - lq - nq - 1; - - val32 = RQPN_LOAD; - val32 |= (hq << RQPN_HI_PQ_SHIFT); diff --git a/package/kernel/mac80211/patches/656-0002-rtl8xxxu-Clean-up-llt_init-API.patch b/package/kernel/mac80211/patches/656-0002-rtl8xxxu-Clean-up-llt_init-API.patch deleted file mode 100644 index 61e509a7b4..0000000000 --- a/package/kernel/mac80211/patches/656-0002-rtl8xxxu-Clean-up-llt_init-API.patch +++ /dev/null @@ -1,80 +0,0 @@ -From c0a99bbb1b7a11605a53f84f5c444be3ef25a8ab Mon Sep 17 00:00:00 2001 -From: Jes Sorensen -Date: Tue, 20 Sep 2016 21:19:27 -0400 -Subject: [PATCH] rtl8xxxu: Clean up llt_init() API - -Remove last_tx_page argument from the llt_init() function. The -rtl8xxxu_fileops structure contains the correct TX_TOTAL_PAGE_NUM -value for the device, and rtl8xxxu_auto_llt_table() doesn't need to -know the value in the first place. - -Signed-off-by: Jes Sorensen -Signed-off-by: Kalle Valo ---- - drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu.h | 6 +++--- - drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c | 9 ++++++--- - 2 files changed, 9 insertions(+), 6 deletions(-) - ---- a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu.h -+++ b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu.h -@@ -1318,7 +1318,7 @@ struct rtl8xxxu_fileops { - int (*power_on) (struct rtl8xxxu_priv *priv); - void (*power_off) (struct rtl8xxxu_priv *priv); - void (*reset_8051) (struct rtl8xxxu_priv *priv); -- int (*llt_init) (struct rtl8xxxu_priv *priv, u8 last_tx_page); -+ int (*llt_init) (struct rtl8xxxu_priv *priv); - void (*init_phy_bb) (struct rtl8xxxu_priv *priv); - int (*init_phy_rf) (struct rtl8xxxu_priv *priv); - void (*phy_init_antenna_selection) (struct rtl8xxxu_priv *priv); -@@ -1400,14 +1400,14 @@ int rtl8xxxu_load_firmware(struct rtl8xx - void rtl8xxxu_firmware_self_reset(struct rtl8xxxu_priv *priv); - void rtl8xxxu_power_off(struct rtl8xxxu_priv *priv); - void rtl8xxxu_reset_8051(struct rtl8xxxu_priv *priv); --int rtl8xxxu_auto_llt_table(struct rtl8xxxu_priv *priv, u8 last_tx_page); -+int rtl8xxxu_auto_llt_table(struct rtl8xxxu_priv *priv); - void rtl8xxxu_gen2_prepare_calibrate(struct rtl8xxxu_priv *priv, u8 start); - int rtl8xxxu_flush_fifo(struct rtl8xxxu_priv *priv); - int rtl8xxxu_gen2_h2c_cmd(struct rtl8xxxu_priv *priv, - struct h2c_cmd *h2c, int len); - int rtl8xxxu_active_to_lps(struct rtl8xxxu_priv *priv); - void rtl8xxxu_disabled_to_emu(struct rtl8xxxu_priv *priv); --int rtl8xxxu_init_llt_table(struct rtl8xxxu_priv *priv, u8 last_tx_page); -+int rtl8xxxu_init_llt_table(struct rtl8xxxu_priv *priv); - void rtl8xxxu_gen1_phy_iq_calibrate(struct rtl8xxxu_priv *priv); - void rtl8xxxu_gen1_init_phy_bb(struct rtl8xxxu_priv *priv); - void rtl8xxxu_gen1_set_tx_power(struct rtl8xxxu_priv *priv, ---- a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c -+++ b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c -@@ -2472,10 +2472,13 @@ static int rtl8xxxu_llt_write(struct rtl - return ret; - } - --int rtl8xxxu_init_llt_table(struct rtl8xxxu_priv *priv, u8 last_tx_page) -+int rtl8xxxu_init_llt_table(struct rtl8xxxu_priv *priv) - { - int ret; - int i; -+ u8 last_tx_page; -+ -+ last_tx_page = priv->fops->total_page_num; - - for (i = 0; i < last_tx_page; i++) { - ret = rtl8xxxu_llt_write(priv, i, i + 1); -@@ -2503,7 +2506,7 @@ exit: - return ret; - } - --int rtl8xxxu_auto_llt_table(struct rtl8xxxu_priv *priv, u8 last_tx_page) -+int rtl8xxxu_auto_llt_table(struct rtl8xxxu_priv *priv) - { - u32 val32; - int ret = 0; -@@ -3988,7 +3991,7 @@ static int rtl8xxxu_init_device(struct i - - dev_dbg(dev, "%s: macpower %i\n", __func__, macpower); - if (!macpower) { -- ret = priv->fops->llt_init(priv, TX_TOTAL_PAGE_NUM); -+ ret = priv->fops->llt_init(priv); - if (ret) { - dev_warn(dev, "%s: LLT table init failed\n", __func__); - goto exit; diff --git a/package/kernel/mac80211/patches/656-0003-rtl8xxxu-Use-a-struct-rtl8xxxu_fileops-in-rtl8xxxu_i.patch b/package/kernel/mac80211/patches/656-0003-rtl8xxxu-Use-a-struct-rtl8xxxu_fileops-in-rtl8xxxu_i.patch deleted file mode 100644 index c423a2c544..0000000000 --- a/package/kernel/mac80211/patches/656-0003-rtl8xxxu-Use-a-struct-rtl8xxxu_fileops-in-rtl8xxxu_i.patch +++ /dev/null @@ -1,150 +0,0 @@ -From 2fc5dd27bf9b75d83a7071d13cca044bc39748fb Mon Sep 17 00:00:00 2001 -From: Jes Sorensen -Date: Tue, 20 Sep 2016 21:19:28 -0400 -Subject: [PATCH] rtl8xxxu: Use a struct rtl8xxxu_fileops * in - rtl8xxxu_init_device() - -This saves some 217, or about, derefences of priv->fops. - -Signed-off-by: Jes Sorensen -Signed-off-by: Kalle Valo ---- - .../net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c | 37 +++++++++++----------- - 1 file changed, 19 insertions(+), 18 deletions(-) - ---- a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c -+++ b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c -@@ -3886,6 +3886,7 @@ static int rtl8xxxu_init_device(struct i - { - struct rtl8xxxu_priv *priv = hw->priv; - struct device *dev = &priv->udev->dev; -+ struct rtl8xxxu_fileops *fops = priv->fops; - bool macpower; - int ret; - u8 val8; -@@ -3904,7 +3905,7 @@ static int rtl8xxxu_init_device(struct i - else - macpower = true; - -- ret = priv->fops->power_on(priv); -+ ret = fops->power_on(priv); - if (ret < 0) { - dev_warn(dev, "%s: Failed power on\n", __func__); - goto exit; -@@ -3921,7 +3922,7 @@ static int rtl8xxxu_init_device(struct i - /* - * Set RX page boundary - */ -- rtl8xxxu_write16(priv, REG_TRXFF_BNDY + 2, priv->fops->trxff_boundary); -+ rtl8xxxu_write16(priv, REG_TRXFF_BNDY + 2, fops->trxff_boundary); - - ret = rtl8xxxu_download_firmware(priv); - dev_dbg(dev, "%s: download_firmware %i\n", __func__, ret); -@@ -3932,8 +3933,8 @@ static int rtl8xxxu_init_device(struct i - if (ret) - goto exit; - -- if (priv->fops->phy_init_antenna_selection) -- priv->fops->phy_init_antenna_selection(priv); -+ if (fops->phy_init_antenna_selection) -+ fops->phy_init_antenna_selection(priv); - - ret = rtl8xxxu_init_mac(priv); - -@@ -3946,7 +3947,7 @@ static int rtl8xxxu_init_device(struct i - if (ret) - goto exit; - -- ret = priv->fops->init_phy_rf(priv); -+ ret = fops->init_phy_rf(priv); - if (ret) - goto exit; - -@@ -3971,7 +3972,7 @@ static int rtl8xxxu_init_device(struct i - /* - * Set TX buffer boundary - */ -- val8 = priv->fops->total_page_num + 1; -+ val8 = fops->total_page_num + 1; - - rtl8xxxu_write8(priv, REG_TXPKTBUF_BCNQ_BDNY, val8); - rtl8xxxu_write8(priv, REG_TXPKTBUF_MGQ_BDNY, val8); -@@ -3984,14 +3985,14 @@ static int rtl8xxxu_init_device(struct i - * The vendor drivers set PBP for all devices, except 8192e. - * There is no explanation for this in any of the sources. - */ -- val8 = (priv->fops->pbp_rx << PBP_PAGE_SIZE_RX_SHIFT) | -- (priv->fops->pbp_tx << PBP_PAGE_SIZE_TX_SHIFT); -+ val8 = (fops->pbp_rx << PBP_PAGE_SIZE_RX_SHIFT) | -+ (fops->pbp_tx << PBP_PAGE_SIZE_TX_SHIFT); - if (priv->rtl_chip != RTL8192E) - rtl8xxxu_write8(priv, REG_PBP, val8); - - dev_dbg(dev, "%s: macpower %i\n", __func__, macpower); - if (!macpower) { -- ret = priv->fops->llt_init(priv); -+ ret = fops->llt_init(priv); - if (ret) { - dev_warn(dev, "%s: LLT table init failed\n", __func__); - goto exit; -@@ -4000,12 +4001,12 @@ static int rtl8xxxu_init_device(struct i - /* - * Chip specific quirks - */ -- priv->fops->usb_quirks(priv); -+ fops->usb_quirks(priv); - - /* - * Enable TX report and TX report timer for 8723bu/8188eu/... - */ -- if (priv->fops->has_tx_report) { -+ if (fops->has_tx_report) { - val8 = rtl8xxxu_read8(priv, REG_TX_REPORT_CTRL); - val8 |= TX_REPORT_CTRL_TIMER_ENABLE; - rtl8xxxu_write8(priv, REG_TX_REPORT_CTRL, val8); -@@ -4140,8 +4141,8 @@ static int rtl8xxxu_init_device(struct i - rtl8xxxu_write8(priv, REG_RSV_CTRL, val8); - } - -- if (priv->fops->init_aggregation) -- priv->fops->init_aggregation(priv); -+ if (fops->init_aggregation) -+ fops->init_aggregation(priv); - - /* - * Enable CCK and OFDM block -@@ -4158,7 +4159,7 @@ static int rtl8xxxu_init_device(struct i - /* - * Start out with default power levels for channel 6, 20MHz - */ -- priv->fops->set_tx_power(priv, 1, false); -+ fops->set_tx_power(priv, 1, false); - - /* Let the 8051 take control of antenna setting */ - if (priv->rtl_chip != RTL8192E) { -@@ -4174,8 +4175,8 @@ static int rtl8xxxu_init_device(struct i - - rtl8xxxu_write16(priv, REG_FAST_EDCA_CTRL, 0); - -- if (priv->fops->init_statistics) -- priv->fops->init_statistics(priv); -+ if (fops->init_statistics) -+ fops->init_statistics(priv); - - if (priv->rtl_chip == RTL8192E) { - /* -@@ -4193,12 +4194,12 @@ static int rtl8xxxu_init_device(struct i - - rtl8723a_phy_lc_calibrate(priv); - -- priv->fops->phy_iq_calibrate(priv); -+ fops->phy_iq_calibrate(priv); - - /* - * This should enable thermal meter - */ -- if (priv->fops->gen2_thermal_meter) -+ if (fops->gen2_thermal_meter) - rtl8xxxu_write_rfreg(priv, - RF_A, RF6052_REG_T_METER_8723B, 0x37cf8); - else diff --git a/package/kernel/mac80211/patches/656-0004-rtl8xxxu-Stop-log-spam-from-each-successful-interrup.patch b/package/kernel/mac80211/patches/656-0004-rtl8xxxu-Stop-log-spam-from-each-successful-interrup.patch deleted file mode 100644 index e8d158ccf1..0000000000 --- a/package/kernel/mac80211/patches/656-0004-rtl8xxxu-Stop-log-spam-from-each-successful-interrup.patch +++ /dev/null @@ -1,43 +0,0 @@ -From b42fbed6b8a5942e9f76ec8c7f9c9fd798a2d3af Mon Sep 17 00:00:00 2001 -From: Larry Finger -Date: Tue, 20 Sep 2016 21:19:29 -0400 -Subject: [PATCH] rtl8xxxu: Stop log spam from each successful interrupt - -As soon as debugging is turned on, the logs are filled with messages -reporting the interrupt status. As this quantity is usually zero, this -output is not needed. In fact, there will be a report if the status is -not zero, thus the debug line in question could probably be deleted. -Rather than taking that action, I have changed it to only be printed -when the newly added RTL8XXXU_DEBUG_INTERRUPT bit is set in the debug -mask. - -Signed-off-by: Larry Finger -Signed-off-by: Jes Sorensen -Signed-off-by: Kalle Valo ---- - drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu.h | 1 + - drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c | 3 ++- - 2 files changed, 3 insertions(+), 1 deletion(-) - ---- a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu.h -+++ b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu.h -@@ -29,6 +29,7 @@ - #define RTL8XXXU_DEBUG_H2C 0x800 - #define RTL8XXXU_DEBUG_ACTION 0x1000 - #define RTL8XXXU_DEBUG_EFUSE 0x2000 -+#define RTL8XXXU_DEBUG_INTERRUPT 0x4000 - - #define RTW_USB_CONTROL_MSG_TIMEOUT 500 - #define RTL8XXXU_MAX_REG_POLL 500 ---- a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c -+++ b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c -@@ -5375,7 +5375,8 @@ static void rtl8xxxu_int_complete(struct - struct device *dev = &priv->udev->dev; - int ret; - -- dev_dbg(dev, "%s: status %i\n", __func__, urb->status); -+ if (rtl8xxxu_debug & RTL8XXXU_DEBUG_INTERRUPT) -+ dev_dbg(dev, "%s: status %i\n", __func__, urb->status); - if (urb->status == 0) { - usb_anchor_urb(urb, &priv->int_anchor); - ret = usb_submit_urb(urb, GFP_ATOMIC); diff --git a/package/kernel/mac80211/patches/657-0001-rtl8xxxu-Fix-memory-leak-in-handling-rxdesc16-packet.patch b/package/kernel/mac80211/patches/657-0001-rtl8xxxu-Fix-memory-leak-in-handling-rxdesc16-packet.patch deleted file mode 100644 index 31604b6264..0000000000 --- a/package/kernel/mac80211/patches/657-0001-rtl8xxxu-Fix-memory-leak-in-handling-rxdesc16-packet.patch +++ /dev/null @@ -1,34 +0,0 @@ -From 51be39337a10a8bf9d8ec65419e78b76bf5adf60 Mon Sep 17 00:00:00 2001 -From: Jes Sorensen -Date: Wed, 28 Sep 2016 14:48:51 -0400 -Subject: [PATCH] rtl8xxxu: Fix memory leak in handling rxdesc16 packets - -A device running without RX package aggregation could return more data -in the USB packet than the actual network packet. In this case the -could would clone the skb but then determine that that there was no -packet to handle and exit without freeing the cloned skb first. - -This has so far only been observed with 8188eu devices, but could -affect others. - -Signed-off-by: Jes Sorensen ---- - drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c | 7 ++++++- - 1 file changed, 6 insertions(+), 1 deletion(-) - ---- a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c -+++ b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c -@@ -5197,7 +5197,12 @@ int rtl8xxxu_parse_rxdesc16(struct rtl8x - pkt_offset = roundup(pkt_len + drvinfo_sz + desc_shift + - sizeof(struct rtl8xxxu_rxdesc16), 128); - -- if (pkt_cnt > 1) -+ /* -+ * Only clone the skb if there's enough data at the end to -+ * at least cover the rx descriptor -+ */ -+ if (pkt_cnt > 1 && -+ urb_len > (pkt_offset + sizeof(struct rtl8xxxu_rxdesc16))) - next_skb = skb_clone(skb, GFP_ATOMIC); - - rx_status = IEEE80211_SKB_RXCB(skb); diff --git a/package/kernel/mac80211/patches/657-0002-rtl8xxxu-Fix-big-endian-problem-reporting-mactime.patch b/package/kernel/mac80211/patches/657-0002-rtl8xxxu-Fix-big-endian-problem-reporting-mactime.patch deleted file mode 100644 index 7531d510b8..0000000000 --- a/package/kernel/mac80211/patches/657-0002-rtl8xxxu-Fix-big-endian-problem-reporting-mactime.patch +++ /dev/null @@ -1,54 +0,0 @@ -From 8d829444c8a860ba69ca8c51b9b609e29eaa4596 Mon Sep 17 00:00:00 2001 -From: Jes Sorensen -Date: Wed, 28 Sep 2016 15:43:42 -0400 -Subject: [PATCH] rtl8xxxu: Fix big-endian problem reporting mactime - -The full RX descriptor is converted so converting tsfl again would -return it to it's original endian value. - -Signed-off-by: Jes Sorensen ---- - drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu.h | 4 ++-- - drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c | 4 ++-- - 2 files changed, 4 insertions(+), 4 deletions(-) - ---- a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu.h -+++ b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu.h -@@ -238,7 +238,7 @@ struct rtl8xxxu_rxdesc16 { - u32 pattern1match:1; - u32 pattern0match:1; - #endif -- __le32 tsfl; -+ u32 tsfl; - #if 0 - u32 bassn:12; - u32 bavld:1; -@@ -368,7 +368,7 @@ struct rtl8xxxu_rxdesc24 { - u32 ldcp:1; - u32 splcp:1; - #endif -- __le32 tsfl; -+ u32 tsfl; - }; - - struct rtl8xxxu_txdesc32 { ---- a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c -+++ b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c -@@ -5220,7 +5220,7 @@ int rtl8xxxu_parse_rxdesc16(struct rtl8x - rtl8xxxu_rx_parse_phystats(priv, rx_status, phy_stats, - rx_desc->rxmcs); - -- rx_status->mactime = le32_to_cpu(rx_desc->tsfl); -+ rx_status->mactime = rx_desc->tsfl; - rx_status->flag |= RX_FLAG_MACTIME_START; - - if (!rx_desc->swdec) -@@ -5290,7 +5290,7 @@ int rtl8xxxu_parse_rxdesc24(struct rtl8x - rtl8xxxu_rx_parse_phystats(priv, rx_status, phy_stats, - rx_desc->rxmcs); - -- rx_status->mactime = le32_to_cpu(rx_desc->tsfl); -+ rx_status->mactime = rx_desc->tsfl; - rx_status->flag |= RX_FLAG_MACTIME_START; - - if (!rx_desc->swdec) diff --git a/package/kernel/mac80211/patches/658-0001-rtl8xxxu-Fix-rtl8723bu-driver-reload-issue.patch b/package/kernel/mac80211/patches/658-0001-rtl8xxxu-Fix-rtl8723bu-driver-reload-issue.patch deleted file mode 100644 index 600317c493..0000000000 --- a/package/kernel/mac80211/patches/658-0001-rtl8xxxu-Fix-rtl8723bu-driver-reload-issue.patch +++ /dev/null @@ -1,30 +0,0 @@ -From ee286f4b57536ec4a7c1b52d0a3476f8e52594d5 Mon Sep 17 00:00:00 2001 -From: Jes Sorensen -Date: Fri, 30 Sep 2016 16:39:39 -0400 -Subject: [PATCH] rtl8xxxu: Fix rtl8723bu driver reload issue - -The generic disable_rf() function clears bits 22 and 23 in -REG_RX_WAIT_CCA, however we did not re-enable them again in -rtl8723b_enable_rf() - -This resolves the problem for me with 8723bu devices not working again -after reloading the driver. - -Signed-off-by: Jes Sorensen ---- - drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_8723b.c | 4 ++++ - 1 file changed, 4 insertions(+) - ---- a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_8723b.c -+++ b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_8723b.c -@@ -1498,6 +1498,10 @@ static void rtl8723b_enable_rf(struct rt - u32 val32; - u8 val8; - -+ val32 = rtl8xxxu_read32(priv, REG_RX_WAIT_CCA); -+ val32 |= (BIT(22) | BIT(23)); -+ rtl8xxxu_write32(priv, REG_RX_WAIT_CCA, val32); -+ - /* - * No indication anywhere as to what 0x0790 does. The 2 antenna - * vendor code preserves bits 6-7 here. diff --git a/package/kernel/mac80211/patches/658-0002-rtl8xxxu-Fix-rtl8192eu-driver-reload-issue.patch b/package/kernel/mac80211/patches/658-0002-rtl8xxxu-Fix-rtl8192eu-driver-reload-issue.patch deleted file mode 100644 index ba7477b3d3..0000000000 --- a/package/kernel/mac80211/patches/658-0002-rtl8xxxu-Fix-rtl8192eu-driver-reload-issue.patch +++ /dev/null @@ -1,46 +0,0 @@ -From 93064d0ae3e9d97c03a3aabd71e6048e1ac82f46 Mon Sep 17 00:00:00 2001 -From: Jes Sorensen -Date: Fri, 30 Sep 2016 19:18:34 -0400 -Subject: [PATCH] rtl8xxxu: Fix rtl8192eu driver reload issue - -The 8192eu suffered from two issues when reloading the driver. - -The same problems as with the 8723bu where REG_RX_WAIT_CCA bits 22 and -23 didn't get set in rtl8192e_enable_rf(). - -In addition it also seems prone to issues when setting REG_RF_CTRL to -0 intead of just disabling the RF_ENABLE bit. Similar to what was -causing issues with the 8188eu. - -With this patch I can successfully reload the driver and reassociate -to an APi with an 8192eu dongle. - -Signed-off-by: Jes Sorensen ---- - drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_8192e.c | 8 +++++++- - 1 file changed, 7 insertions(+), 1 deletion(-) - ---- a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_8192e.c -+++ b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_8192e.c -@@ -1461,7 +1461,9 @@ static int rtl8192eu_active_to_emu(struc - int count, ret = 0; - - /* Turn off RF */ -- rtl8xxxu_write8(priv, REG_RF_CTRL, 0); -+ val8 = rtl8xxxu_read8(priv, REG_RF_CTRL); -+ val8 &= ~RF_ENABLE; -+ rtl8xxxu_write8(priv, REG_RF_CTRL, val8); - - /* Switch DPDT_SEL_P output from register 0x65[2] */ - val8 = rtl8xxxu_read8(priv, REG_LEDCFG2); -@@ -1593,6 +1595,10 @@ static void rtl8192e_enable_rf(struct rt - u32 val32; - u8 val8; - -+ val32 = rtl8xxxu_read32(priv, REG_RX_WAIT_CCA); -+ val32 |= (BIT(22) | BIT(23)); -+ rtl8xxxu_write32(priv, REG_RX_WAIT_CCA, val32); -+ - val8 = rtl8xxxu_read8(priv, REG_GPIO_MUXCFG); - val8 |= BIT(5); - rtl8xxxu_write8(priv, REG_GPIO_MUXCFG, val8); diff --git a/package/kernel/mac80211/patches/659-0001-rtl8xxxu-Obtain-RTS-rates-from-mac80211.patch b/package/kernel/mac80211/patches/659-0001-rtl8xxxu-Obtain-RTS-rates-from-mac80211.patch deleted file mode 100644 index 3ebc685f6a..0000000000 --- a/package/kernel/mac80211/patches/659-0001-rtl8xxxu-Obtain-RTS-rates-from-mac80211.patch +++ /dev/null @@ -1,138 +0,0 @@ -From 3d1d6d96f14881c421860973b4eb4b2fff7cb812 Mon Sep 17 00:00:00 2001 -From: Jes Sorensen -Date: Wed, 5 Oct 2016 16:04:54 -0400 -Subject: [PATCH] rtl8xxxu: Obtain RTS rates from mac80211 - -Use the mac80211 provided rate for RTS rather than the hard coded -24Mbps as suggested by the vendor drivers. - -Reported-by: Andrea Merello -Signed-off-by: Jes Sorensen ---- - drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu.h | 6 +-- - .../net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c | 46 ++++++++++++++-------- - 2 files changed, 32 insertions(+), 20 deletions(-) - ---- a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu.h -+++ b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu.h -@@ -1340,7 +1340,7 @@ struct rtl8xxxu_fileops { - void (*fill_txdesc) (struct ieee80211_hdr *hdr, - struct rtl8xxxu_txdesc32 *tx_desc, u32 rate, - u16 rate_flag, bool sgi, bool short_preamble, -- bool ampdu_enable); -+ bool ampdu_enable, u32 rts_rate); - int writeN_block_size; - int rx_agg_buf_size; - char tx_desc_size; -@@ -1437,11 +1437,11 @@ bool rtl8xxxu_gen2_simularity_compare(st - void rtl8xxxu_fill_txdesc_v1(struct ieee80211_hdr *hdr, - struct rtl8xxxu_txdesc32 *tx_desc, u32 rate, - u16 rate_flag, bool sgi, bool short_preamble, -- bool ampdu_enable); -+ bool ampdu_enable, u32 rts_rate); - void rtl8xxxu_fill_txdesc_v2(struct ieee80211_hdr *hdr, - struct rtl8xxxu_txdesc32 *tx_desc32, u32 rate, - u16 rate_flag, bool sgi, bool short_preamble, -- bool ampdu_enable); -+ bool ampdu_enable, u32 rts_rate); - - extern struct rtl8xxxu_fileops rtl8192cu_fops; - extern struct rtl8xxxu_fileops rtl8192eu_fops; ---- a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c -+++ b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c -@@ -4762,7 +4762,7 @@ void - rtl8xxxu_fill_txdesc_v1(struct ieee80211_hdr *hdr, - struct rtl8xxxu_txdesc32 *tx_desc, u32 rate, - u16 rate_flag, bool sgi, bool short_preamble, -- bool ampdu_enable) -+ bool ampdu_enable, u32 rts_rate) - { - u16 seq_number; - -@@ -4796,15 +4796,16 @@ rtl8xxxu_fill_txdesc_v1(struct ieee80211 - if (sgi) - tx_desc->txdw5 |= cpu_to_le32(TXDESC32_SHORT_GI); - -+ /* -+ * rts_rate is zero if RTS/CTS or CTS to SELF are not enabled -+ */ -+ tx_desc->txdw4 |= cpu_to_le32(rts_rate << TXDESC32_RTS_RATE_SHIFT); - if (rate_flag & IEEE80211_TX_RC_USE_RTS_CTS) { -- /* -- * Use RTS rate 24M - does the mac80211 tell -- * us which to use? -- */ -- tx_desc->txdw4 |= cpu_to_le32(DESC_RATE_24M << -- TXDESC32_RTS_RATE_SHIFT); - tx_desc->txdw4 |= cpu_to_le32(TXDESC32_RTS_CTS_ENABLE); - tx_desc->txdw4 |= cpu_to_le32(TXDESC32_HW_RTS_ENABLE); -+ } else if (rate_flag & IEEE80211_TX_RC_USE_CTS_PROTECT) { -+ tx_desc->txdw4 |= cpu_to_le32(TXDESC32_CTS_SELF_ENABLE); -+ tx_desc->txdw4 |= cpu_to_le32(TXDESC32_HW_RTS_ENABLE); - } - } - -@@ -4816,7 +4817,7 @@ void - rtl8xxxu_fill_txdesc_v2(struct ieee80211_hdr *hdr, - struct rtl8xxxu_txdesc32 *tx_desc32, u32 rate, - u16 rate_flag, bool sgi, bool short_preamble, -- bool ampdu_enable) -+ bool ampdu_enable, u32 rts_rate) - { - struct rtl8xxxu_txdesc40 *tx_desc40; - u16 seq_number; -@@ -4849,15 +4850,19 @@ rtl8xxxu_fill_txdesc_v2(struct ieee80211 - if (short_preamble) - tx_desc40->txdw5 |= cpu_to_le32(TXDESC40_SHORT_PREAMBLE); - -+ tx_desc40->txdw4 |= cpu_to_le32(rts_rate << TXDESC40_RTS_RATE_SHIFT); -+ /* -+ * rts_rate is zero if RTS/CTS or CTS to SELF are not enabled -+ */ - if (rate_flag & IEEE80211_TX_RC_USE_RTS_CTS) { -- /* -- * Use RTS rate 24M - does the mac80211 tell -- * us which to use? -- */ -- tx_desc40->txdw4 |= cpu_to_le32(DESC_RATE_24M << -- TXDESC40_RTS_RATE_SHIFT); - tx_desc40->txdw3 |= cpu_to_le32(TXDESC40_RTS_CTS_ENABLE); - tx_desc40->txdw3 |= cpu_to_le32(TXDESC40_HW_RTS_ENABLE); -+ } else if (rate_flag & IEEE80211_TX_RC_USE_CTS_PROTECT) { -+ /* -+ * For some reason the vendor driver doesn't set -+ * TXDESC40_HW_RTS_ENABLE for CTS to SELF -+ */ -+ tx_desc40->txdw3 |= cpu_to_le32(TXDESC40_CTS_SELF_ENABLE); - } - } - -@@ -4874,7 +4879,7 @@ static void rtl8xxxu_tx(struct ieee80211 - struct ieee80211_sta *sta = NULL; - struct ieee80211_vif *vif = tx_info->control.vif; - struct device *dev = &priv->udev->dev; -- u32 queue, rate; -+ u32 queue, rate, rts_rate; - u16 pktlen = skb->len; - u16 seq_number; - u16 rate_flag = tx_info->control.rates[0].flags; -@@ -4974,10 +4979,17 @@ static void rtl8xxxu_tx(struct ieee80211 - (sta && vif && vif->bss_conf.use_short_preamble)) - short_preamble = true; - -+ if (rate_flag & IEEE80211_TX_RC_USE_RTS_CTS) -+ rts_rate = ieee80211_get_rts_cts_rate(hw, tx_info)->hw_value; -+ else if (rate_flag & IEEE80211_TX_RC_USE_CTS_PROTECT) -+ rts_rate = ieee80211_get_rts_cts_rate(hw, tx_info)->hw_value; -+ else -+ rts_rate = 0; -+ - seq_number = IEEE80211_SEQ_TO_SN(le16_to_cpu(hdr->seq_ctrl)); - -- priv->fops->fill_txdesc(hdr, tx_desc, rate, rate_flag, -- sgi, short_preamble, ampdu_enable); -+ priv->fops->fill_txdesc(hdr, tx_desc, rate, rate_flag, sgi, -+ short_preamble, ampdu_enable, rts_rate); - - rtl8xxxu_calc_tx_desc_csum(tx_desc); - diff --git a/package/kernel/mac80211/patches/659-0002-rtl8xxxu-Pass-tx_info-to-fill_txdesc-in-order-to-hav.patch b/package/kernel/mac80211/patches/659-0002-rtl8xxxu-Pass-tx_info-to-fill_txdesc-in-order-to-hav.patch deleted file mode 100644 index 4b81a9d422..0000000000 --- a/package/kernel/mac80211/patches/659-0002-rtl8xxxu-Pass-tx_info-to-fill_txdesc-in-order-to-hav.patch +++ /dev/null @@ -1,213 +0,0 @@ -From f958b1e0806c045830d78c4287fbcddf9e5fd9d0 Mon Sep 17 00:00:00 2001 -From: Jes Sorensen -Date: Thu, 6 Oct 2016 21:08:53 -0400 -Subject: [PATCH] rtl8xxxu: Pass tx_info to fill_txdesc in order to have access - to retry count - -In order to obtain retry count for a given rate we need to pass the -full struct ieee80211_tx_info to the function setting the rate in he -TX descriptor. - -This uncovered a huge bug where the old code would use struct -ieee80211_rate.flags to test for rate parameters, which is always -zero, instead of the flags value from struct ieee80211_tx_rate. - -Time to find a brown paper bag :( - -Signed-off-by: Jes Sorensen ---- - drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu.h | 27 ++++---- - .../net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c | 71 ++++++++++++++-------- - 2 files changed, 60 insertions(+), 38 deletions(-) - ---- a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu.h -+++ b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu.h -@@ -1337,10 +1337,11 @@ struct rtl8xxxu_fileops { - u32 ramask, int sgi); - void (*report_connect) (struct rtl8xxxu_priv *priv, - u8 macid, bool connect); -- void (*fill_txdesc) (struct ieee80211_hdr *hdr, -- struct rtl8xxxu_txdesc32 *tx_desc, u32 rate, -- u16 rate_flag, bool sgi, bool short_preamble, -- bool ampdu_enable, u32 rts_rate); -+ void (*fill_txdesc) (struct ieee80211_hw *hw, struct ieee80211_hdr *hdr, -+ struct ieee80211_tx_info *tx_info, -+ struct rtl8xxxu_txdesc32 *tx_desc, bool sgi, -+ bool short_preamble, bool ampdu_enable, -+ u32 rts_rate); - int writeN_block_size; - int rx_agg_buf_size; - char tx_desc_size; -@@ -1434,14 +1435,16 @@ int rtl8xxxu_parse_rxdesc24(struct rtl8x - int rtl8xxxu_gen2_channel_to_group(int channel); - bool rtl8xxxu_gen2_simularity_compare(struct rtl8xxxu_priv *priv, - int result[][8], int c1, int c2); --void rtl8xxxu_fill_txdesc_v1(struct ieee80211_hdr *hdr, -- struct rtl8xxxu_txdesc32 *tx_desc, u32 rate, -- u16 rate_flag, bool sgi, bool short_preamble, -- bool ampdu_enable, u32 rts_rate); --void rtl8xxxu_fill_txdesc_v2(struct ieee80211_hdr *hdr, -- struct rtl8xxxu_txdesc32 *tx_desc32, u32 rate, -- u16 rate_flag, bool sgi, bool short_preamble, -- bool ampdu_enable, u32 rts_rate); -+void rtl8xxxu_fill_txdesc_v1(struct ieee80211_hw *hw, struct ieee80211_hdr *hdr, -+ struct ieee80211_tx_info *tx_info, -+ struct rtl8xxxu_txdesc32 *tx_desc, bool sgi, -+ bool short_preamble, bool ampdu_enable, -+ u32 rts_rate); -+void rtl8xxxu_fill_txdesc_v2(struct ieee80211_hw *hw, struct ieee80211_hdr *hdr, -+ struct ieee80211_tx_info *tx_info, -+ struct rtl8xxxu_txdesc32 *tx_desc32, bool sgi, -+ bool short_preamble, bool ampdu_enable, -+ u32 rts_rate); - - extern struct rtl8xxxu_fileops rtl8192cu_fops; - extern struct rtl8xxxu_fileops rtl8192eu_fops; ---- a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c -+++ b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c -@@ -4759,13 +4759,28 @@ static void rtl8xxxu_dump_action(struct - * This format is used on 8188cu/8192cu/8723au - */ - void --rtl8xxxu_fill_txdesc_v1(struct ieee80211_hdr *hdr, -- struct rtl8xxxu_txdesc32 *tx_desc, u32 rate, -- u16 rate_flag, bool sgi, bool short_preamble, -- bool ampdu_enable, u32 rts_rate) -+rtl8xxxu_fill_txdesc_v1(struct ieee80211_hw *hw, struct ieee80211_hdr *hdr, -+ struct ieee80211_tx_info *tx_info, -+ struct rtl8xxxu_txdesc32 *tx_desc, bool sgi, -+ bool short_preamble, bool ampdu_enable, u32 rts_rate) - { -+ struct ieee80211_rate *tx_rate = ieee80211_get_tx_rate(hw, tx_info); -+ struct rtl8xxxu_priv *priv = hw->priv; -+ struct device *dev = &priv->udev->dev; -+ u32 rate; -+ u16 rate_flags = tx_info->control.rates[0].flags; - u16 seq_number; - -+ if (rate_flags & IEEE80211_TX_RC_MCS && -+ !ieee80211_is_mgmt(hdr->frame_control)) -+ rate = tx_info->control.rates[0].idx + DESC_RATE_MCS0; -+ else -+ rate = tx_rate->hw_value; -+ -+ if (rtl8xxxu_debug & RTL8XXXU_DEBUG_TX) -+ dev_info(dev, "%s: TX rate: %d, pkt size %d\n", -+ __func__, rate, cpu_to_le16(tx_desc->pkt_size)); -+ - seq_number = IEEE80211_SEQ_TO_SN(le16_to_cpu(hdr->seq_ctrl)); - - tx_desc->txdw5 = cpu_to_le32(rate); -@@ -4800,10 +4815,10 @@ rtl8xxxu_fill_txdesc_v1(struct ieee80211 - * rts_rate is zero if RTS/CTS or CTS to SELF are not enabled - */ - tx_desc->txdw4 |= cpu_to_le32(rts_rate << TXDESC32_RTS_RATE_SHIFT); -- if (rate_flag & IEEE80211_TX_RC_USE_RTS_CTS) { -+ if (rate_flags & IEEE80211_TX_RC_USE_RTS_CTS) { - tx_desc->txdw4 |= cpu_to_le32(TXDESC32_RTS_CTS_ENABLE); - tx_desc->txdw4 |= cpu_to_le32(TXDESC32_HW_RTS_ENABLE); -- } else if (rate_flag & IEEE80211_TX_RC_USE_CTS_PROTECT) { -+ } else if (rate_flags & IEEE80211_TX_RC_USE_CTS_PROTECT) { - tx_desc->txdw4 |= cpu_to_le32(TXDESC32_CTS_SELF_ENABLE); - tx_desc->txdw4 |= cpu_to_le32(TXDESC32_HW_RTS_ENABLE); - } -@@ -4814,16 +4829,31 @@ rtl8xxxu_fill_txdesc_v1(struct ieee80211 - * This format is used on 8192eu/8723bu - */ - void --rtl8xxxu_fill_txdesc_v2(struct ieee80211_hdr *hdr, -- struct rtl8xxxu_txdesc32 *tx_desc32, u32 rate, -- u16 rate_flag, bool sgi, bool short_preamble, -- bool ampdu_enable, u32 rts_rate) -+rtl8xxxu_fill_txdesc_v2(struct ieee80211_hw *hw, struct ieee80211_hdr *hdr, -+ struct ieee80211_tx_info *tx_info, -+ struct rtl8xxxu_txdesc32 *tx_desc32, bool sgi, -+ bool short_preamble, bool ampdu_enable, u32 rts_rate) - { -+ struct ieee80211_rate *tx_rate = ieee80211_get_tx_rate(hw, tx_info); -+ struct rtl8xxxu_priv *priv = hw->priv; -+ struct device *dev = &priv->udev->dev; - struct rtl8xxxu_txdesc40 *tx_desc40; -+ u32 rate; -+ u16 rate_flags = tx_info->control.rates[0].flags; - u16 seq_number; - - tx_desc40 = (struct rtl8xxxu_txdesc40 *)tx_desc32; - -+ if (rtl8xxxu_debug & RTL8XXXU_DEBUG_TX) -+ dev_info(dev, "%s: TX rate: %d, pkt size %d\n", -+ __func__, rate, cpu_to_le16(tx_desc40->pkt_size)); -+ -+ if (rate_flags & IEEE80211_TX_RC_MCS && -+ !ieee80211_is_mgmt(hdr->frame_control)) -+ rate = tx_info->control.rates[0].idx + DESC_RATE_MCS0; -+ else -+ rate = tx_rate->hw_value; -+ - seq_number = IEEE80211_SEQ_TO_SN(le16_to_cpu(hdr->seq_ctrl)); - - tx_desc40->txdw4 = cpu_to_le32(rate); -@@ -4854,10 +4884,10 @@ rtl8xxxu_fill_txdesc_v2(struct ieee80211 - /* - * rts_rate is zero if RTS/CTS or CTS to SELF are not enabled - */ -- if (rate_flag & IEEE80211_TX_RC_USE_RTS_CTS) { -+ if (rate_flags & IEEE80211_TX_RC_USE_RTS_CTS) { - tx_desc40->txdw3 |= cpu_to_le32(TXDESC40_RTS_CTS_ENABLE); - tx_desc40->txdw3 |= cpu_to_le32(TXDESC40_HW_RTS_ENABLE); -- } else if (rate_flag & IEEE80211_TX_RC_USE_CTS_PROTECT) { -+ } else if (rate_flags & IEEE80211_TX_RC_USE_CTS_PROTECT) { - /* - * For some reason the vendor driver doesn't set - * TXDESC40_HW_RTS_ENABLE for CTS to SELF -@@ -4872,14 +4902,13 @@ static void rtl8xxxu_tx(struct ieee80211 - { - struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)skb->data; - struct ieee80211_tx_info *tx_info = IEEE80211_SKB_CB(skb); -- struct ieee80211_rate *tx_rate = ieee80211_get_tx_rate(hw, tx_info); - struct rtl8xxxu_priv *priv = hw->priv; - struct rtl8xxxu_txdesc32 *tx_desc; - struct rtl8xxxu_tx_urb *tx_urb; - struct ieee80211_sta *sta = NULL; - struct ieee80211_vif *vif = tx_info->control.vif; - struct device *dev = &priv->udev->dev; -- u32 queue, rate, rts_rate; -+ u32 queue, rts_rate; - u16 pktlen = skb->len; - u16 seq_number; - u16 rate_flag = tx_info->control.rates[0].flags; -@@ -4906,10 +4935,6 @@ static void rtl8xxxu_tx(struct ieee80211 - goto error; - } - -- if (rtl8xxxu_debug & RTL8XXXU_DEBUG_TX) -- dev_info(dev, "%s: TX rate: %d (%d), pkt size %d\n", -- __func__, tx_rate->bitrate, tx_rate->hw_value, pktlen); -- - if (ieee80211_is_action(hdr->frame_control)) - rtl8xxxu_dump_action(dev, hdr); - -@@ -4963,12 +4988,6 @@ static void rtl8xxxu_tx(struct ieee80211 - } - } - -- if (rate_flag & IEEE80211_TX_RC_MCS && -- !ieee80211_is_mgmt(hdr->frame_control)) -- rate = tx_info->control.rates[0].idx + DESC_RATE_MCS0; -- else -- rate = tx_rate->hw_value; -- - if (rate_flag & IEEE80211_TX_RC_SHORT_GI || - (ieee80211_is_data_qos(hdr->frame_control) && - sta && sta->ht_cap.cap & -@@ -4988,8 +5007,8 @@ static void rtl8xxxu_tx(struct ieee80211 - - seq_number = IEEE80211_SEQ_TO_SN(le16_to_cpu(hdr->seq_ctrl)); - -- priv->fops->fill_txdesc(hdr, tx_desc, rate, rate_flag, sgi, -- short_preamble, ampdu_enable, rts_rate); -+ priv->fops->fill_txdesc(hw, hdr, tx_info, tx_desc, sgi, short_preamble, -+ ampdu_enable, rts_rate); - - rtl8xxxu_calc_tx_desc_csum(tx_desc); - diff --git a/package/kernel/mac80211/patches/660-0001-rtl8xxxu-Accept-firmware-signature-0x88e0.patch b/package/kernel/mac80211/patches/660-0001-rtl8xxxu-Accept-firmware-signature-0x88e0.patch deleted file mode 100644 index c9b2e13a94..0000000000 --- a/package/kernel/mac80211/patches/660-0001-rtl8xxxu-Accept-firmware-signature-0x88e0.patch +++ /dev/null @@ -1,22 +0,0 @@ -From f15fbdcb03abdf7403e8ebba52791cc596a8a8a6 Mon Sep 17 00:00:00 2001 -From: Jes Sorensen -Date: Mon, 27 Jun 2016 14:08:47 -0400 -Subject: [PATCH] rtl8xxxu: Accept firmware signature 0x88e0 - -rtl8188eu uses firmware signature 0x88e0 - -Signed-off-by: Jes Sorensen ---- - drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c | 1 + - 1 file changed, 1 insertion(+) - ---- a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c -+++ b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c -@@ -2097,6 +2097,7 @@ int rtl8xxxu_load_firmware(struct rtl8xx - switch (signature & 0xfff0) { - case 0x92e0: - case 0x92c0: -+ case 0x88e0: - case 0x88c0: - case 0x5300: - case 0x2300: diff --git a/package/kernel/mac80211/patches/660-0002-rtl8xxxu-Add-initial-code-to-detect-8188eu-devices.patch b/package/kernel/mac80211/patches/660-0002-rtl8xxxu-Add-initial-code-to-detect-8188eu-devices.patch deleted file mode 100644 index ebd35fcb29..0000000000 --- a/package/kernel/mac80211/patches/660-0002-rtl8xxxu-Add-initial-code-to-detect-8188eu-devices.patch +++ /dev/null @@ -1,121 +0,0 @@ -From 6f971392cd52524058f179d7c78464d692fbb018 Mon Sep 17 00:00:00 2001 -From: Jes Sorensen -Date: Mon, 27 Jun 2016 14:23:44 -0400 -Subject: [PATCH] rtl8xxxu: Add initial code to detect 8188eu devices - -So far this just detects the device and tries to load firmware. - -Signed-off-by: Jes Sorensen ---- - drivers/net/wireless/realtek/rtl8xxxu/Makefile | 2 +- - drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu.h | 1 + - .../net/wireless/realtek/rtl8xxxu/rtl8xxxu_8188e.c | 65 ++++++++++++++++++++++ - .../net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c | 3 + - 4 files changed, 70 insertions(+), 1 deletion(-) - create mode 100644 drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_8188e.c - ---- a/drivers/net/wireless/realtek/rtl8xxxu/Makefile -+++ b/drivers/net/wireless/realtek/rtl8xxxu/Makefile -@@ -1,4 +1,4 @@ - obj-$(CPTCFG_RTL8XXXU) += rtl8xxxu.o - - rtl8xxxu-y := rtl8xxxu_core.o rtl8xxxu_8192e.o rtl8xxxu_8723b.o \ -- rtl8xxxu_8723a.o rtl8xxxu_8192c.o -+ rtl8xxxu_8723a.o rtl8xxxu_8192c.o rtl8xxxu_8188e.o ---- a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu.h -+++ b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu.h -@@ -1446,6 +1446,7 @@ void rtl8xxxu_fill_txdesc_v2(struct ieee - bool short_preamble, bool ampdu_enable, - u32 rts_rate); - -+extern struct rtl8xxxu_fileops rtl8188eu_fops; - extern struct rtl8xxxu_fileops rtl8192cu_fops; - extern struct rtl8xxxu_fileops rtl8192eu_fops; - extern struct rtl8xxxu_fileops rtl8723au_fops; ---- /dev/null -+++ b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_8188e.c -@@ -0,0 +1,65 @@ -+/* -+ * RTL8XXXU mac80211 USB driver - 8188e specific subdriver -+ * -+ * Copyright (c) 2014 - 2016 Jes Sorensen -+ * -+ * Portions, notably calibration code: -+ * Copyright(c) 2007 - 2011 Realtek Corporation. All rights reserved. -+ * -+ * This driver was written as a replacement for the vendor provided -+ * rtl8723au driver. As the Realtek 8xxx chips are very similar in -+ * their programming interface, I have started adding support for -+ * additional 8xxx chips like the 8192cu, 8188cus, etc. -+ * -+ * This program is free software; you can redistribute it and/or modify it -+ * under the terms of version 2 of the GNU General Public License as -+ * published by the Free Software Foundation. -+ * -+ * This program is distributed in the hope that it will be useful, but WITHOUT -+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for -+ * more details. -+ */ -+ -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include "rtl8xxxu.h" -+#include "rtl8xxxu_regs.h" -+ -+static int rtl8188eu_parse_efuse(struct rtl8xxxu_priv *priv) -+{ -+ return 0; -+} -+ -+static int rtl8188eu_load_firmware(struct rtl8xxxu_priv *priv) -+{ -+ char *fw_name; -+ int ret; -+ -+ fw_name = "rtlwifi/rtl8188eufw.bin"; -+ -+ ret = rtl8xxxu_load_firmware(priv, fw_name); -+ -+ return -EINVAL; -+ return ret; -+} -+ -+struct rtl8xxxu_fileops rtl8188eu_fops = { -+ .parse_efuse = rtl8188eu_parse_efuse, -+ .load_firmware = rtl8188eu_load_firmware, -+ .reset_8051 = rtl8xxxu_reset_8051, -+}; ---- a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c -+++ b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c -@@ -54,6 +54,7 @@ MODULE_LICENSE("GPL"); - MODULE_FIRMWARE("rtlwifi/rtl8723aufw_A.bin"); - MODULE_FIRMWARE("rtlwifi/rtl8723aufw_B.bin"); - MODULE_FIRMWARE("rtlwifi/rtl8723aufw_B_NoBT.bin"); -+MODULE_FIRMWARE("rtlwifi/rtl8188eufw.bin"); - MODULE_FIRMWARE("rtlwifi/rtl8192cufw_A.bin"); - MODULE_FIRMWARE("rtlwifi/rtl8192cufw_B.bin"); - MODULE_FIRMWARE("rtlwifi/rtl8192cufw_TMSC.bin"); -@@ -6195,6 +6196,8 @@ static struct usb_device_id dev_table[] - {USB_DEVICE_AND_INTERFACE_INFO(USB_VENDOR_ID_REALTEK, 0xb720, 0xff, 0xff, 0xff), - .driver_info = (unsigned long)&rtl8723bu_fops}, - #ifdef CPTCFG_RTL8XXXU_UNTESTED -+{USB_DEVICE_AND_INTERFACE_INFO(USB_VENDOR_ID_REALTEK, 0x8179, 0xff, 0xff, 0xff), -+ .driver_info = (unsigned long)&rtl8188eu_fops}, - /* Still supported by rtlwifi */ - {USB_DEVICE_AND_INTERFACE_INFO(USB_VENDOR_ID_REALTEK, 0x8176, 0xff, 0xff, 0xff), - .driver_info = (unsigned long)&rtl8192cu_fops}, diff --git a/package/kernel/mac80211/patches/660-0003-rtl8xxxu-Add-initial-code-to-parse-8188eu-efuse.patch b/package/kernel/mac80211/patches/660-0003-rtl8xxxu-Add-initial-code-to-parse-8188eu-efuse.patch deleted file mode 100644 index 1905899e76..0000000000 --- a/package/kernel/mac80211/patches/660-0003-rtl8xxxu-Add-initial-code-to-parse-8188eu-efuse.patch +++ /dev/null @@ -1,113 +0,0 @@ -From 6d5b4ef30046d74efe773613767d13d9ab95ed3d Mon Sep 17 00:00:00 2001 -From: Jes Sorensen -Date: Mon, 27 Jun 2016 15:19:04 -0400 -Subject: [PATCH] rtl8xxxu: Add initial code to parse 8188eu efuse - -This obtains the MAC address, but work is still needed to handle TX -power settings. - -Signed-off-by: Jes Sorensen ---- - drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu.h | 40 ++++++++++++++++++++++ - .../net/wireless/realtek/rtl8xxxu/rtl8xxxu_8188e.c | 34 ++++++++++++++++++ - 2 files changed, 74 insertions(+) - ---- a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu.h -+++ b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu.h -@@ -872,6 +872,45 @@ struct rtl8192eu_efuse { - u8 res14[0xc3]; - }; - -+struct rtl8188eu_efuse { -+ __le16 rtl_id; -+ u8 res0[0x0e]; -+ u8 cck_tx_power_index_A[3]; /* 0x10 */ -+ u8 cck_tx_power_index_B[3]; -+ u8 ht40_1s_tx_power_index_A[3]; /* 0x16 */ -+ u8 ht40_1s_tx_power_index_B[3]; -+ u8 res1[0x9c]; -+ u8 channel_plan; /* 0xb8 */ -+ u8 xtal_k; -+ u8 thermal_meter; -+ u8 iqk_lck; -+ u8 res2[5]; -+ u8 rf_board_option; -+ u8 rf_feature_option; -+ u8 rf_bt_setting; -+ u8 eeprom_version; -+ u8 eeprom_customer_id; -+ u8 res3[3]; -+ u8 rf_antenna_option; /* 0xc9 */ -+ u8 res4[6]; -+ u8 vid; /* 0xd0 */ -+ u8 res5[1]; -+ u8 pid; /* 0xd2 */ -+ u8 res6[1]; -+ u8 usb_optional_function; -+ u8 res7[2]; -+ u8 mac_addr[ETH_ALEN]; /* 0xd7 */ -+ u8 res8[2]; -+ u8 vendor_name[7]; -+ u8 res9[2]; -+ u8 device_name[0x0b]; /* 0xe8 */ -+ u8 res10[2]; -+ u8 serial[0x0b]; /* 0xf5 */ -+ u8 res11[0x30]; -+ u8 unknown[0x0d]; /* 0x130 */ -+ u8 res12[0xc3]; -+}; -+ - struct rtl8xxxu_reg8val { - u16 reg; - u8 val; -@@ -1290,6 +1329,7 @@ struct rtl8xxxu_priv { - struct rtl8723bu_efuse efuse8723bu; - struct rtl8192cu_efuse efuse8192; - struct rtl8192eu_efuse efuse8192eu; -+ struct rtl8188eu_efuse efuse8188eu; - } efuse_wifi; - u32 adda_backup[RTL8XXXU_ADDA_REGS]; - u32 mac_backup[RTL8XXXU_MAC_REGS]; ---- a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_8188e.c -+++ b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_8188e.c -@@ -42,6 +42,40 @@ - - static int rtl8188eu_parse_efuse(struct rtl8xxxu_priv *priv) - { -+ struct rtl8188eu_efuse *efuse = &priv->efuse_wifi.efuse8188eu; -+ int i; -+ -+ if (efuse->rtl_id != cpu_to_le16(0x8129)) -+ return -EINVAL; -+ -+ ether_addr_copy(priv->mac_addr, efuse->mac_addr); -+ -+ memcpy(priv->cck_tx_power_index_A, efuse->cck_tx_power_index_A, -+ sizeof(efuse->cck_tx_power_index_A)); -+ memcpy(priv->cck_tx_power_index_B, efuse->cck_tx_power_index_B, -+ sizeof(efuse->cck_tx_power_index_B)); -+ -+ memcpy(priv->ht40_1s_tx_power_index_A, -+ priv->efuse_wifi.efuse8188eu.ht40_1s_tx_power_index_A, -+ sizeof(priv->ht40_1s_tx_power_index_A)); -+ memcpy(priv->ht40_1s_tx_power_index_B, -+ priv->efuse_wifi.efuse8188eu.ht40_1s_tx_power_index_B, -+ sizeof(priv->ht40_1s_tx_power_index_B)); -+ -+ dev_info(&priv->udev->dev, "Vendor: %.7s\n", efuse->vendor_name); -+ dev_info(&priv->udev->dev, "Product: %.11s\n", efuse->device_name); -+ dev_info(&priv->udev->dev, "Serial: %.11s\n", efuse->serial); -+ -+ if (rtl8xxxu_debug & RTL8XXXU_DEBUG_EFUSE) { -+ unsigned char *raw = priv->efuse_wifi.raw; -+ -+ dev_info(&priv->udev->dev, -+ "%s: dumping efuse (0x%02zx bytes):\n", -+ __func__, sizeof(struct rtl8188eu_efuse)); -+ for (i = 0; i < sizeof(struct rtl8188eu_efuse); i += 8) -+ dev_info(&priv->udev->dev, "%02x: %8ph\n", i, &raw[i]); -+ } -+ - return 0; - } - diff --git a/package/kernel/mac80211/patches/660-0004-rtl8xxxu-Detect-8188eu-parts-correctly.patch b/package/kernel/mac80211/patches/660-0004-rtl8xxxu-Detect-8188eu-parts-correctly.patch deleted file mode 100644 index 83220e88f6..0000000000 --- a/package/kernel/mac80211/patches/660-0004-rtl8xxxu-Detect-8188eu-parts-correctly.patch +++ /dev/null @@ -1,43 +0,0 @@ -From ac5a363d61caee80e7b4464e55ab012a4450ef5d Mon Sep 17 00:00:00 2001 -From: Jes Sorensen -Date: Mon, 27 Jun 2016 15:34:00 -0400 -Subject: [PATCH] rtl8xxxu: Detect 8188eu parts correctly - -8188 parts with chip_cut >= 2 are assumed to be 8188eu. - -Signed-off-by: Jes Sorensen ---- - .../net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c | 22 +++++++++++++++------- - 1 file changed, 15 insertions(+), 7 deletions(-) - ---- a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c -+++ b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c -@@ -1683,13 +1683,21 @@ static int rtl8xxxu_identify_chip(struct - } - priv->has_wifi = 1; - } else { -- sprintf(priv->chip_name, "8188CU"); -- priv->rf_paths = 1; -- priv->rx_paths = 1; -- priv->tx_paths = 1; -- priv->rtl_chip = RTL8188C; -- priv->usb_interrupts = 1; -- priv->has_wifi = 1; -+ if (priv->chip_cut >= 2) { -+ sprintf(priv->chip_name, "8188EU"); -+ priv->rf_paths = 1; -+ priv->rx_paths = 1; -+ priv->tx_paths = 1; -+ priv->rtl_chip = RTL8188E; -+ } else { -+ sprintf(priv->chip_name, "8188CU"); -+ priv->rf_paths = 1; -+ priv->rx_paths = 1; -+ priv->tx_paths = 1; -+ priv->rtl_chip = RTL8188C; -+ priv->usb_interrupts = 1; -+ priv->has_wifi = 1; -+ } - } - - switch (priv->rtl_chip) { diff --git a/package/kernel/mac80211/patches/660-0005-rtl8xxxu-First-stab-at-rtl8188e_power_on.patch b/package/kernel/mac80211/patches/660-0005-rtl8xxxu-First-stab-at-rtl8188e_power_on.patch deleted file mode 100644 index dbba85b4b9..0000000000 --- a/package/kernel/mac80211/patches/660-0005-rtl8xxxu-First-stab-at-rtl8188e_power_on.patch +++ /dev/null @@ -1,105 +0,0 @@ -From a7c3d46915bce6d84e61e684e76564b034bdc1a9 Mon Sep 17 00:00:00 2001 -From: Jes Sorensen -Date: Mon, 27 Jun 2016 17:08:30 -0400 -Subject: [PATCH] rtl8xxxu: First stab at rtl8188e_power_on() - -Code based on code from Andrea Merello. - -Signed-off-by: Jes Sorensen ---- - .../net/wireless/realtek/rtl8xxxu/rtl8xxxu_8188e.c | 82 ++++++++++++++++++++++ - 1 file changed, 82 insertions(+) - ---- a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_8188e.c -+++ b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_8188e.c -@@ -92,8 +92,90 @@ static int rtl8188eu_load_firmware(struc - return ret; - } - -+static int rtl8188e_emu_to_active(struct rtl8xxxu_priv *priv) -+{ -+ u8 val8; -+ u32 val32; -+ u16 val16; -+ int count, ret = 0; -+ -+ /* wait till 0x04[17] = 1 power ready*/ -+ for (count = RTL8XXXU_MAX_REG_POLL; count; count--) { -+ val32 = rtl8xxxu_read32(priv, REG_APS_FSMCO); -+ if (val32 & BIT(17)) -+ break; -+ -+ udelay(10); -+ } -+ -+ if (!count) { -+ ret = -EBUSY; -+ goto exit; -+ } -+ -+ /* reset baseband */ -+ val8 = rtl8xxxu_read8(priv, REG_SYS_FUNC); -+ val8 &= ~(SYS_FUNC_BBRSTB | SYS_FUNC_BB_GLB_RSTN); -+ rtl8xxxu_write8(priv, REG_SYS_FUNC, val8); -+ -+ /*0x24[23] = 2b'01 schmit trigger */ -+ val32 = rtl8xxxu_read32(priv, REG_AFE_XTAL_CTRL); -+ val32 |= BIT(23); -+ rtl8xxxu_write32(priv, REG_AFE_XTAL_CTRL, val32); -+ -+ /* 0x04[15] = 0 disable HWPDN (control by DRV)*/ -+ val16 = rtl8xxxu_read16(priv, REG_APS_FSMCO); -+ val16 &= ~APS_FSMCO_HW_POWERDOWN; -+ rtl8xxxu_write16(priv, REG_APS_FSMCO, val16); -+ -+ /*0x04[12:11] = 2b'00 disable WL suspend*/ -+ val16 = rtl8xxxu_read16(priv, REG_APS_FSMCO); -+ val16 &= ~(APS_FSMCO_HW_SUSPEND | APS_FSMCO_PCIE); -+ rtl8xxxu_write16(priv, REG_APS_FSMCO, val16); -+ -+ /* set, then poll until 0 */ -+ val32 = rtl8xxxu_read32(priv, REG_APS_FSMCO); -+ val32 |= APS_FSMCO_MAC_ENABLE; -+ rtl8xxxu_write32(priv, REG_APS_FSMCO, val32); -+ -+ for (count = RTL8XXXU_MAX_REG_POLL; count; count--) { -+ val32 = rtl8xxxu_read32(priv, REG_APS_FSMCO); -+ if ((val32 & APS_FSMCO_MAC_ENABLE) == 0) { -+ ret = 0; -+ break; -+ } -+ udelay(10); -+ } -+ -+ if (!count) { -+ ret = -EBUSY; -+ goto exit; -+ } -+ -+ /* LDO normal mode*/ -+ val8 = rtl8xxxu_read8(priv, REG_LPLDO_CTRL); -+ val8 &= ~BIT(4); -+ rtl8xxxu_write8(priv, REG_LPLDO_CTRL, val8); -+ -+exit: -+ return ret; -+} -+ -+static int rtl8188eu_power_on(struct rtl8xxxu_priv *priv) -+{ -+ int ret; -+ -+ ret = rtl8188e_emu_to_active(priv); -+ if (ret) -+ goto exit; -+ -+exit: -+ return ret; -+} -+ - struct rtl8xxxu_fileops rtl8188eu_fops = { - .parse_efuse = rtl8188eu_parse_efuse, - .load_firmware = rtl8188eu_load_firmware, -+ .power_on = rtl8188eu_power_on, - .reset_8051 = rtl8xxxu_reset_8051, - }; diff --git a/package/kernel/mac80211/patches/660-0006-rtl8xxxu-Add-rtl8188e_disabled_to_emu.patch b/package/kernel/mac80211/patches/660-0006-rtl8xxxu-Add-rtl8188e_disabled_to_emu.patch deleted file mode 100644 index 066f2fe241..0000000000 --- a/package/kernel/mac80211/patches/660-0006-rtl8xxxu-Add-rtl8188e_disabled_to_emu.patch +++ /dev/null @@ -1,40 +0,0 @@ -From b7335df2dc1b4c6c69ac6b95910d09a7dd5295a7 Mon Sep 17 00:00:00 2001 -From: Jes Sorensen -Date: Wed, 29 Jun 2016 10:38:52 -0400 -Subject: [PATCH] rtl8xxxu: Add rtl8188e_disabled_to_emu() - -This sequence is found in the vendor driver, but never actually -called. It's unclear if we need it. - -Signed-off-by: Jes Sorensen ---- - drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_8188e.c | 11 +++++++++++ - 1 file changed, 11 insertions(+) - ---- a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_8188e.c -+++ b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_8188e.c -@@ -92,6 +92,15 @@ static int rtl8188eu_load_firmware(struc - return ret; - } - -+static void rtl8188e_disabled_to_emu(struct rtl8xxxu_priv *priv) -+{ -+ u16 val16; -+ -+ val16 = rtl8xxxu_read16(priv, REG_APS_FSMCO); -+ val16 &= ~(APS_FSMCO_PFM_WOWL | APS_FSMCO_ENABLE_POWERDOWN); -+ rtl8xxxu_write16(priv, REG_APS_FSMCO, val16); -+} -+ - static int rtl8188e_emu_to_active(struct rtl8xxxu_priv *priv) - { - u8 val8; -@@ -165,6 +174,8 @@ static int rtl8188eu_power_on(struct rtl - { - int ret; - -+ rtl8188e_disabled_to_emu(priv); -+ - ret = rtl8188e_emu_to_active(priv); - if (ret) - goto exit; diff --git a/package/kernel/mac80211/patches/660-0007-rtl8xxxu-8188e-Enable-scheduler.patch b/package/kernel/mac80211/patches/660-0007-rtl8xxxu-8188e-Enable-scheduler.patch deleted file mode 100644 index 99f9152cac..0000000000 --- a/package/kernel/mac80211/patches/660-0007-rtl8xxxu-8188e-Enable-scheduler.patch +++ /dev/null @@ -1,45 +0,0 @@ -From 682ffd261c494581b8fdbc81f42035a53c67f5c4 Mon Sep 17 00:00:00 2001 -From: Jes Sorensen -Date: Wed, 29 Jun 2016 11:07:13 -0400 -Subject: [PATCH] rtl8xxxu: 8188e: Enable scheduler - -This enables the schduler, DMA, etc, except for MAC RX/TX which has to -be set after REG_TRXFF_BNDY due to a hardware bug in the 8188e - -Signed-off-by: Jes Sorensen ---- - drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_8188e.c | 16 ++++++++++++++++ - 1 file changed, 16 insertions(+) - ---- a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_8188e.c -+++ b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_8188e.c -@@ -172,6 +172,7 @@ exit: - - static int rtl8188eu_power_on(struct rtl8xxxu_priv *priv) - { -+ u16 val16; - int ret; - - rtl8188e_disabled_to_emu(priv); -@@ -180,6 +181,21 @@ static int rtl8188eu_power_on(struct rtl - if (ret) - goto exit; - -+ /* -+ * Enable MAC DMA/WMAC/SCHEDULE/SEC block -+ * Set CR bit10 to enable 32k calibration. -+ * We do not set CR_MAC_TX_ENABLE | CR_MAC_RX_ENABLE here -+ * due to a hardware bug in the 88E, requiring those to be -+ * set after REG_TRXFF_BNDY is set. If not the RXFF bundary -+ * will get set to a larger buffer size than the real buffer -+ * size. -+ */ -+ val16 = (CR_HCI_TXDMA_ENABLE | CR_HCI_RXDMA_ENABLE | -+ CR_TXDMA_ENABLE | CR_RXDMA_ENABLE | -+ CR_PROTOCOL_ENABLE | CR_SCHEDULE_ENABLE | -+ CR_SECURITY_ENABLE | CR_CALTIMER_ENABLE); -+ rtl8xxxu_write16(priv, REG_CR, val16); -+ - exit: - return ret; - } diff --git a/package/kernel/mac80211/patches/660-0008-rtl8xxxu-Add-rtl8188e_usb_quirk-for-enabling-MAC-TX-.patch b/package/kernel/mac80211/patches/660-0008-rtl8xxxu-Add-rtl8188e_usb_quirk-for-enabling-MAC-TX-.patch deleted file mode 100644 index fa62d6d9b1..0000000000 --- a/package/kernel/mac80211/patches/660-0008-rtl8xxxu-Add-rtl8188e_usb_quirk-for-enabling-MAC-TX-.patch +++ /dev/null @@ -1,40 +0,0 @@ -From 58edb5e9811879e0a8e87f90057f12f615eab2d1 Mon Sep 17 00:00:00 2001 -From: Jes Sorensen -Date: Wed, 29 Jun 2016 11:47:10 -0400 -Subject: [PATCH] rtl8xxxu: Add rtl8188e_usb_quirk() for enabling MAC TX/RX - -Due to a bug in the 8188e chips, this has to be done after setting -REG_TRXFF_BNDY. - -Signed-off-by: Jes Sorensen ---- - drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_8188e.c | 15 +++++++++++++++ - 1 file changed, 15 insertions(+) - ---- a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_8188e.c -+++ b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_8188e.c -@@ -200,9 +200,24 @@ exit: - return ret; - } - -+static void rtl8188e_usb_quirks(struct rtl8xxxu_priv *priv) -+{ -+ u16 val16; -+ -+ /* -+ * Technically this is not a USB quirk, but a chip quirk. -+ * This has to be done after REG_TRXFF_BNDY is set, see -+ * rtl8188eu_power_on() for details. -+ */ -+ val16 = rtl8xxxu_read16(priv, REG_CR); -+ val16 |= (CR_MAC_TX_ENABLE | CR_MAC_RX_ENABLE); -+ rtl8xxxu_write16(priv, REG_CR, val16); -+} -+ - struct rtl8xxxu_fileops rtl8188eu_fops = { - .parse_efuse = rtl8188eu_parse_efuse, - .load_firmware = rtl8188eu_load_firmware, - .power_on = rtl8188eu_power_on, - .reset_8051 = rtl8xxxu_reset_8051, -+ .usb_quirks = rtl8188e_usb_quirks, - }; diff --git a/package/kernel/mac80211/patches/660-0009-rtl8xxxu-8188e-add-REG_TXDMA_OFFSET_CHK-quirk.patch b/package/kernel/mac80211/patches/660-0009-rtl8xxxu-8188e-add-REG_TXDMA_OFFSET_CHK-quirk.patch deleted file mode 100644 index 8a2821640c..0000000000 --- a/package/kernel/mac80211/patches/660-0009-rtl8xxxu-8188e-add-REG_TXDMA_OFFSET_CHK-quirk.patch +++ /dev/null @@ -1,34 +0,0 @@ -From 3ab047939db70fcae2a7c5993a8feaf3ac413e35 Mon Sep 17 00:00:00 2001 -From: Jes Sorensen -Date: Wed, 29 Jun 2016 11:53:31 -0400 -Subject: [PATCH] rtl8xxxu: 8188e add REG_TXDMA_OFFSET_CHK quirk - -Enable quirk allowing TX DMA to drop redundant data of packet. This is -the same quirk enabled on gen2 parts. - -Signed-off-by: Jes Sorensen ---- - drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_8188e.c | 5 +++++ - 1 file changed, 5 insertions(+) - ---- a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_8188e.c -+++ b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_8188e.c -@@ -203,6 +203,7 @@ exit: - static void rtl8188e_usb_quirks(struct rtl8xxxu_priv *priv) - { - u16 val16; -+ u32 val32; - - /* - * Technically this is not a USB quirk, but a chip quirk. -@@ -212,6 +213,10 @@ static void rtl8188e_usb_quirks(struct r - val16 = rtl8xxxu_read16(priv, REG_CR); - val16 |= (CR_MAC_TX_ENABLE | CR_MAC_RX_ENABLE); - rtl8xxxu_write16(priv, REG_CR, val16); -+ -+ val32 = rtl8xxxu_read32(priv, REG_TXDMA_OFFSET_CHK); -+ val32 |= TXDMA_OFFSET_DROP_DATA_EN; -+ rtl8xxxu_write32(priv, REG_TXDMA_OFFSET_CHK, val32); - } - - struct rtl8xxxu_fileops rtl8188eu_fops = { diff --git a/package/kernel/mac80211/patches/660-0010-rtl8xxxu-Add-reserved-page-init-parameters-for-8188e.patch b/package/kernel/mac80211/patches/660-0010-rtl8xxxu-Add-reserved-page-init-parameters-for-8188e.patch deleted file mode 100644 index 424b3b313a..0000000000 --- a/package/kernel/mac80211/patches/660-0010-rtl8xxxu-Add-reserved-page-init-parameters-for-8188e.patch +++ /dev/null @@ -1,45 +0,0 @@ -From 2bfba2657e3f99c6693ea30b60af4eb1d3e3950c Mon Sep 17 00:00:00 2001 -From: Jes Sorensen -Date: Wed, 29 Jun 2016 12:02:18 -0400 -Subject: [PATCH] rtl8xxxu: Add reserved page init parameters for 8188e - -Signed-off-by: Andrea Merello -Signed-off-by: Jes Sorensen ---- - drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu.h | 6 ++++++ - drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_8188e.c | 4 ++++ - 2 files changed, 10 insertions(+) - ---- a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu.h -+++ b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu.h -@@ -43,6 +43,7 @@ - #define REALTEK_USB_CMD_IDX 0x00 - - #define TX_TOTAL_PAGE_NUM 0xf8 -+#define TX_TOTAL_PAGE_NUM_8188E 0xa8 - #define TX_TOTAL_PAGE_NUM_8192E 0xf3 - #define TX_TOTAL_PAGE_NUM_8723B 0xf7 - /* (HPQ + LPQ + NPQ + PUBQ) = TX_TOTAL_PAGE_NUM */ -@@ -51,6 +52,11 @@ - #define TX_PAGE_NUM_LO_PQ 0x02 - #define TX_PAGE_NUM_NORM_PQ 0x02 - -+#define TX_PAGE_NUM_PUBQ_8188E 0x47 -+#define TX_PAGE_NUM_HI_PQ_8188E 0x29 -+#define TX_PAGE_NUM_LO_PQ_8188E 0x1c -+#define TX_PAGE_NUM_NORM_PQ_8188E 0x1c -+ - #define TX_PAGE_NUM_PUBQ_8192E 0xe7 - #define TX_PAGE_NUM_HI_PQ_8192E 0x08 - #define TX_PAGE_NUM_LO_PQ_8192E 0x0c ---- a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_8188e.c -+++ b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_8188e.c -@@ -225,4 +225,8 @@ struct rtl8xxxu_fileops rtl8188eu_fops = - .power_on = rtl8188eu_power_on, - .reset_8051 = rtl8xxxu_reset_8051, - .usb_quirks = rtl8188e_usb_quirks, -+ .total_page_num = TX_TOTAL_PAGE_NUM_8188E, -+ .page_num_hi = TX_PAGE_NUM_HI_PQ_8188E, -+ .page_num_lo = TX_PAGE_NUM_LO_PQ_8188E, -+ .page_num_norm = TX_PAGE_NUM_NORM_PQ_8188E, - }; diff --git a/package/kernel/mac80211/patches/660-0011-rtl8xxxu-Correct-TX_TOTAL_PAGE_NUM-for-8188eu.patch b/package/kernel/mac80211/patches/660-0011-rtl8xxxu-Correct-TX_TOTAL_PAGE_NUM-for-8188eu.patch deleted file mode 100644 index 5318f32ae4..0000000000 --- a/package/kernel/mac80211/patches/660-0011-rtl8xxxu-Correct-TX_TOTAL_PAGE_NUM-for-8188eu.patch +++ /dev/null @@ -1,24 +0,0 @@ -From ed4c1c87b4c2653f1528c886591bbddbb68216a1 Mon Sep 17 00:00:00 2001 -From: Jes Sorensen -Date: Mon, 8 Aug 2016 15:04:36 -0400 -Subject: [PATCH] rtl8xxxu: Correct TX_TOTAL_PAGE_NUM for 8188eu - -For some reason I had gotten this off-by-one when pulling them number -from the vendor driver. - -Signed-off-by: Jes Sorensen ---- - drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu.h | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - ---- a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu.h -+++ b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu.h -@@ -43,7 +43,7 @@ - #define REALTEK_USB_CMD_IDX 0x00 - - #define TX_TOTAL_PAGE_NUM 0xf8 --#define TX_TOTAL_PAGE_NUM_8188E 0xa8 -+#define TX_TOTAL_PAGE_NUM_8188E 0xa9 - #define TX_TOTAL_PAGE_NUM_8192E 0xf3 - #define TX_TOTAL_PAGE_NUM_8723B 0xf7 - /* (HPQ + LPQ + NPQ + PUBQ) = TX_TOTAL_PAGE_NUM */ diff --git a/package/kernel/mac80211/patches/660-0012-rtl8xxxu-Add-trxff_boundary-for-8188e.patch b/package/kernel/mac80211/patches/660-0012-rtl8xxxu-Add-trxff_boundary-for-8188e.patch deleted file mode 100644 index 828799ae4a..0000000000 --- a/package/kernel/mac80211/patches/660-0012-rtl8xxxu-Add-trxff_boundary-for-8188e.patch +++ /dev/null @@ -1,28 +0,0 @@ -From bc55b854b404de79353547013a8f1ae31855f7c5 Mon Sep 17 00:00:00 2001 -From: Jes Sorensen -Date: Wed, 29 Jun 2016 12:08:31 -0400 -Subject: [PATCH] rtl8xxxu: Add trxff_boundary for 8188e - -The 8188e presumably has a 10K buffer, but leave space for TX report -or WOL pattern. - -Signed-off-by: Andrea Merello -Signed-off-by: Jes Sorensen ---- - drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_8188e.c | 5 +++++ - 1 file changed, 5 insertions(+) - ---- a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_8188e.c -+++ b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_8188e.c -@@ -225,6 +225,11 @@ struct rtl8xxxu_fileops rtl8188eu_fops = - .power_on = rtl8188eu_power_on, - .reset_8051 = rtl8xxxu_reset_8051, - .usb_quirks = rtl8188e_usb_quirks, -+ /* -+ * Use 9K for 8188e normal chip -+ * Max RX buffer = 10K - max(TxReportSize(64*8), WOLPattern(16*24)) -+ */ -+ .trxff_boundary = 0x23ff, - .total_page_num = TX_TOTAL_PAGE_NUM_8188E, - .page_num_hi = TX_PAGE_NUM_HI_PQ_8188E, - .page_num_lo = TX_PAGE_NUM_LO_PQ_8188E, diff --git a/package/kernel/mac80211/patches/660-0013-rtl8xxxu-8188eu-specify-firmware-block-size-and-set-.patch b/package/kernel/mac80211/patches/660-0013-rtl8xxxu-8188eu-specify-firmware-block-size-and-set-.patch deleted file mode 100644 index 5076307a92..0000000000 --- a/package/kernel/mac80211/patches/660-0013-rtl8xxxu-8188eu-specify-firmware-block-size-and-set-.patch +++ /dev/null @@ -1,26 +0,0 @@ -From 29311af488cc1c1790a9b53c8073442548edd4bf Mon Sep 17 00:00:00 2001 -From: Jes Sorensen -Date: Wed, 29 Jun 2016 15:03:54 -0400 -Subject: [PATCH] rtl8xxxu: 8188eu specify firmware block size and set - power_off function - -This uses a conservative firmware block size for now. - -Signed-off-by: Jes Sorensen ---- - drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_8188e.c | 2 ++ - 1 file changed, 2 insertions(+) - ---- a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_8188e.c -+++ b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_8188e.c -@@ -223,8 +223,10 @@ struct rtl8xxxu_fileops rtl8188eu_fops = - .parse_efuse = rtl8188eu_parse_efuse, - .load_firmware = rtl8188eu_load_firmware, - .power_on = rtl8188eu_power_on, -+ .power_off = rtl8xxxu_power_off, - .reset_8051 = rtl8xxxu_reset_8051, - .usb_quirks = rtl8188e_usb_quirks, -+ .writeN_block_size = 128, - /* - * Use 9K for 8188e normal chip - * Max RX buffer = 10K - max(TxReportSize(64*8), WOLPattern(16*24)) diff --git a/package/kernel/mac80211/patches/660-0014-rtl8xxxu-Add-8188e-mac-init-table.patch b/package/kernel/mac80211/patches/660-0014-rtl8xxxu-Add-8188e-mac-init-table.patch deleted file mode 100644 index 5360f5928f..0000000000 --- a/package/kernel/mac80211/patches/660-0014-rtl8xxxu-Add-8188e-mac-init-table.patch +++ /dev/null @@ -1,57 +0,0 @@ -From 96cb7475c4c5750e8dac3dc85638f8438b9bce4e Mon Sep 17 00:00:00 2001 -From: Jes Sorensen -Date: Tue, 19 Jul 2016 15:04:24 -0400 -Subject: [PATCH] rtl8xxxu: Add 8188e mac init table - -This table was pulled from the vendor driver. - -Signed-off-by: Andrea Merello -Signed-off-by: Jes Sorensen ---- - .../net/wireless/realtek/rtl8xxxu/rtl8xxxu_8188e.c | 28 ++++++++++++++++++++++ - 1 file changed, 28 insertions(+) - ---- a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_8188e.c -+++ b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_8188e.c -@@ -40,6 +40,33 @@ - #include "rtl8xxxu.h" - #include "rtl8xxxu_regs.h" - -+static struct rtl8xxxu_reg8val rtl8188e_mac_init_table[] = { -+ {0x026, 0x41}, {0x027, 0x35}, {0x428, 0x0a}, {0x429, 0x10}, -+ {0x430, 0x00}, {0x431, 0x01}, {0x432, 0x02}, {0x433, 0x04}, -+ {0x434, 0x05}, {0x435, 0x06}, {0x436, 0x07}, {0x437, 0x08}, -+ {0x438, 0x00}, {0x439, 0x00}, {0x43a, 0x01}, {0x43b, 0x02}, -+ {0x43c, 0x04}, {0x43d, 0x05}, {0x43e, 0x06}, {0x43f, 0x07}, -+ {0x440, 0x5d}, {0x441, 0x01}, {0x442, 0x00}, {0x444, 0x15}, -+ {0x445, 0xf0}, {0x446, 0x0f}, {0x447, 0x00}, {0x458, 0x41}, -+ {0x459, 0xa8}, {0x45a, 0x72}, {0x45b, 0xb9}, {0x460, 0x66}, -+ {0x461, 0x66}, {0x480, 0x08}, {0x4c8, 0xff}, {0x4c9, 0x08}, -+ {0x4cc, 0xff}, {0x4cd, 0xff}, {0x4ce, 0x01}, {0x4d3, 0x01}, -+ {0x500, 0x26}, {0x501, 0xa2}, {0x502, 0x2f}, {0x503, 0x00}, -+ {0x504, 0x28}, {0x505, 0xa3}, {0x506, 0x5e}, {0x507, 0x00}, -+ {0x508, 0x2b}, {0x509, 0xa4}, {0x50a, 0x5e}, {0x50b, 0x00}, -+ {0x50c, 0x4f}, {0x50d, 0xa4}, {0x50e, 0x00}, {0x50f, 0x00}, -+ {0x512, 0x1c}, {0x514, 0x0a}, {0x516, 0x0a}, {0x525, 0x4f}, -+ {0x550, 0x10}, {0x551, 0x10}, {0x559, 0x02}, {0x55d, 0xff}, -+ {0x605, 0x30}, {0x608, 0x0e}, {0x609, 0x2a}, {0x620, 0xff}, -+ {0x621, 0xff}, {0x622, 0xff}, {0x623, 0xff}, {0x624, 0xff}, -+ {0x625, 0xff}, {0x626, 0xff}, {0x627, 0xff}, {0x652, 0x20}, -+ {0x63c, 0x0a}, {0x63d, 0x0a}, {0x63e, 0x0e}, {0x63f, 0x0e}, -+ {0x640, 0x40}, {0x66e, 0x05}, {0x700, 0x21}, {0x701, 0x43}, -+ {0x702, 0x65}, {0x703, 0x87}, {0x708, 0x21}, {0x709, 0x43}, -+ {0x70a, 0x65}, {0x70b, 0x87}, -+ {0xffff, 0xff}, -+}; -+ - static int rtl8188eu_parse_efuse(struct rtl8xxxu_priv *priv) - { - struct rtl8188eu_efuse *efuse = &priv->efuse_wifi.efuse8188eu; -@@ -232,6 +259,7 @@ struct rtl8xxxu_fileops rtl8188eu_fops = - * Max RX buffer = 10K - max(TxReportSize(64*8), WOLPattern(16*24)) - */ - .trxff_boundary = 0x23ff, -+ .mactable = rtl8188e_mac_init_table, - .total_page_num = TX_TOTAL_PAGE_NUM_8188E, - .page_num_hi = TX_PAGE_NUM_HI_PQ_8188E, - .page_num_lo = TX_PAGE_NUM_LO_PQ_8188E, diff --git a/package/kernel/mac80211/patches/660-0015-rtl8xxxu-Implement-rtl8188eu_init_phy_bb.patch b/package/kernel/mac80211/patches/660-0015-rtl8xxxu-Implement-rtl8188eu_init_phy_bb.patch deleted file mode 100644 index e7c5b7b651..0000000000 --- a/package/kernel/mac80211/patches/660-0015-rtl8xxxu-Implement-rtl8188eu_init_phy_bb.patch +++ /dev/null @@ -1,245 +0,0 @@ -From b6770f88fd208978bd84e7217fee9fedd9b3fa9f Mon Sep 17 00:00:00 2001 -From: Jes Sorensen -Date: Tue, 19 Jul 2016 16:19:30 -0400 -Subject: [PATCH] rtl8xxxu: Implement rtl8188eu_init_phy_bb() - -This includes adding rtl8188eu_phy_init_table rtl8188e_agc_table, both -extracted from the vendor driver. - -Signed-off-by: Jes Sorensen ---- - .../net/wireless/realtek/rtl8xxxu/rtl8xxxu_8188e.c | 202 +++++++++++++++++++++ - 1 file changed, 202 insertions(+) - ---- a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_8188e.c -+++ b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_8188e.c -@@ -67,6 +67,174 @@ static struct rtl8xxxu_reg8val rtl8188e_ - {0xffff, 0xff}, - }; - -+static struct rtl8xxxu_reg32val rtl8188eu_phy_init_table[] = { -+ {0x800, 0x80040000}, {0x804, 0x00000003}, -+ {0x808, 0x0000fc00}, {0x80c, 0x0000000a}, -+ {0x810, 0x10001331}, {0x814, 0x020c3d10}, -+ {0x818, 0x02200385}, {0x81c, 0x00000000}, -+ {0x820, 0x01000100}, {0x824, 0x00390204}, -+ {0x828, 0x00000000}, {0x82c, 0x00000000}, -+ {0x830, 0x00000000}, {0x834, 0x00000000}, -+ {0x838, 0x00000000}, {0x83c, 0x00000000}, -+ {0x840, 0x00010000}, {0x844, 0x00000000}, -+ {0x848, 0x00000000}, {0x84c, 0x00000000}, -+ {0x850, 0x00000000}, {0x854, 0x00000000}, -+ {0x858, 0x569a11a9}, {0x85c, 0x01000014}, -+ {0x860, 0x66f60110}, {0x864, 0x061f0649}, -+ {0x868, 0x00000000}, {0x86c, 0x27272700}, -+ {0x870, 0x07000760}, {0x874, 0x25004000}, -+ {0x878, 0x00000808}, {0x87c, 0x00000000}, -+ {0x880, 0xb0000c1c}, {0x884, 0x00000001}, -+ {0x888, 0x00000000}, {0x88c, 0xccc000c0}, -+ {0x890, 0x00000800}, {0x894, 0xfffffffe}, -+ {0x898, 0x40302010}, {0x89c, 0x00706050}, -+ {0x900, 0x00000000}, {0x904, 0x00000023}, -+ {0x908, 0x00000000}, {0x90c, 0x81121111}, -+ {0x910, 0x00000002}, {0x914, 0x00000201}, -+ {0xa00, 0x00d047c8}, {0xa04, 0x80ff000c}, -+ {0xa08, 0x8c838300}, {0xa0c, 0x2e7f120f}, -+ {0xa10, 0x9500bb78}, {0xa14, 0x1114d028}, -+ {0xa18, 0x00881117}, {0xa1c, 0x89140f00}, -+ {0xa20, 0x1a1b0000}, {0xa24, 0x090e1317}, -+ {0xa28, 0x00000204}, {0xa2c, 0x00d30000}, -+ {0xa70, 0x101fbf00}, {0xa74, 0x00000007}, -+ {0xa78, 0x00000900}, {0xa7c, 0x225b0606}, -+ {0xa80, 0x218075b1}, {0xb2c, 0x80000000}, -+ {0xc00, 0x48071d40}, {0xc04, 0x03a05611}, -+ {0xc08, 0x000000e4}, {0xc0c, 0x6c6c6c6c}, -+ {0xc10, 0x08800000}, {0xc14, 0x40000100}, -+ {0xc18, 0x08800000}, {0xc1c, 0x40000100}, -+ {0xc20, 0x00000000}, {0xc24, 0x00000000}, -+ {0xc28, 0x00000000}, {0xc2c, 0x00000000}, -+ {0xc30, 0x69e9ac47}, {0xc34, 0x469652af}, -+ {0xc38, 0x49795994}, {0xc3c, 0x0a97971c}, -+ {0xc40, 0x1f7c403f}, {0xc44, 0x000100b7}, -+ {0xc48, 0xec020107}, {0xc4c, 0x007f037f}, -+ {0xc50, 0x69553420}, {0xc54, 0x43bc0094}, -+ {0xc58, 0x00013169}, {0xc5c, 0x00250492}, -+ {0xc60, 0x00000000}, {0xc64, 0x7112848b}, -+ {0xc68, 0x47c00bff}, {0xc6c, 0x00000036}, -+ {0xc70, 0x2c7f000d}, {0xc74, 0x020610db}, -+ {0xc78, 0x0000001f}, {0xc7c, 0x00b91612}, -+ {0xc80, 0x390000e4}, {0xc84, 0x20f60000}, -+ {0xc88, 0x40000100}, {0xc8c, 0x20200000}, -+ {0xc90, 0x00091521}, {0xc94, 0x00000000}, -+ {0xc98, 0x00121820}, {0xc9c, 0x00007f7f}, -+ {0xca0, 0x00000000}, {0xca4, 0x000300a0}, -+ {0xca8, 0x00000000}, {0xcac, 0x00000000}, -+ {0xcb0, 0x00000000}, {0xcb4, 0x00000000}, -+ {0xcb8, 0x00000000}, {0xcbc, 0x28000000}, -+ {0xcc0, 0x00000000}, {0xcc4, 0x00000000}, -+ {0xcc8, 0x00000000}, {0xccc, 0x00000000}, -+ {0xcd0, 0x00000000}, {0xcd4, 0x00000000}, -+ {0xcd8, 0x64b22427}, {0xcdc, 0x00766932}, -+ {0xce0, 0x00222222}, {0xce4, 0x00000000}, -+ {0xce8, 0x37644302}, {0xcec, 0x2f97d40c}, -+ {0xd00, 0x00000740}, {0xd04, 0x00020401}, -+ {0xd08, 0x0000907f}, {0xd0c, 0x20010201}, -+ {0xd10, 0xa0633333}, {0xd14, 0x3333bc43}, -+ {0xd18, 0x7a8f5b6f}, {0xd2c, 0xcc979975}, -+ {0xd30, 0x00000000}, {0xd34, 0x80608000}, -+ {0xd38, 0x00000000}, {0xd3c, 0x00127353}, -+ {0xd40, 0x00000000}, {0xd44, 0x00000000}, -+ {0xd48, 0x00000000}, {0xd4c, 0x00000000}, -+ {0xd50, 0x6437140a}, {0xd54, 0x00000000}, -+ {0xd58, 0x00000282}, {0xd5c, 0x30032064}, -+ {0xd60, 0x4653de68}, {0xd64, 0x04518a3c}, -+ {0xd68, 0x00002101}, {0xd6c, 0x2a201c16}, -+ {0xd70, 0x1812362e}, {0xd74, 0x322c2220}, -+ {0xd78, 0x000e3c24}, {0xe00, 0x2d2d2d2d}, -+ {0xe04, 0x2d2d2d2d}, {0xe08, 0x0390272d}, -+ {0xe10, 0x2d2d2d2d}, {0xe14, 0x2d2d2d2d}, -+ {0xe18, 0x2d2d2d2d}, {0xe1c, 0x2d2d2d2d}, -+ {0xe28, 0x00000000}, {0xe30, 0x1000dc1f}, -+ {0xe34, 0x10008c1f}, {0xe38, 0x02140102}, -+ {0xe3c, 0x681604c2}, {0xe40, 0x01007c00}, -+ {0xe44, 0x01004800}, {0xe48, 0xfb000000}, -+ {0xe4c, 0x000028d1}, {0xe50, 0x1000dc1f}, -+ {0xe54, 0x10008c1f}, {0xe58, 0x02140102}, -+ {0xe5c, 0x28160d05}, {0xe60, 0x00000008}, -+ {0xe68, 0x001b25a4}, {0xe6c, 0x00c00014}, -+ {0xe70, 0x00c00014}, {0xe74, 0x01000014}, -+ {0xe78, 0x01000014}, {0xe7c, 0x01000014}, -+ {0xe80, 0x01000014}, {0xe84, 0x00c00014}, -+ {0xe88, 0x01000014}, {0xe8c, 0x00c00014}, -+ {0xed0, 0x00c00014}, {0xed4, 0x00c00014}, -+ {0xed8, 0x00c00014}, {0xedc, 0x00000014}, -+ {0xee0, 0x00000014}, {0xeec, 0x01c00014}, -+ {0xf14, 0x00000003}, {0xf4c, 0x00000000}, -+ {0xf00, 0x00000300}, -+ {0xffff, 0xffffffff}, -+}; -+ -+static struct rtl8xxxu_reg32val rtl8188e_agc_table[] = { -+ {0xc78, 0xfb000001}, {0xc78, 0xfb010001}, -+ {0xc78, 0xfb020001}, {0xc78, 0xfb030001}, -+ {0xc78, 0xfb040001}, {0xc78, 0xfb050001}, -+ {0xc78, 0xfa060001}, {0xc78, 0xf9070001}, -+ {0xc78, 0xf8080001}, {0xc78, 0xf7090001}, -+ {0xc78, 0xf60a0001}, {0xc78, 0xf50b0001}, -+ {0xc78, 0xf40c0001}, {0xc78, 0xf30d0001}, -+ {0xc78, 0xf20e0001}, {0xc78, 0xf10f0001}, -+ {0xc78, 0xf0100001}, {0xc78, 0xef110001}, -+ {0xc78, 0xee120001}, {0xc78, 0xed130001}, -+ {0xc78, 0xec140001}, {0xc78, 0xeb150001}, -+ {0xc78, 0xea160001}, {0xc78, 0xe9170001}, -+ {0xc78, 0xe8180001}, {0xc78, 0xe7190001}, -+ {0xc78, 0xe61a0001}, {0xc78, 0xe51b0001}, -+ {0xc78, 0xe41c0001}, {0xc78, 0xe31d0001}, -+ {0xc78, 0xe21e0001}, {0xc78, 0xe11f0001}, -+ {0xc78, 0x8a200001}, {0xc78, 0x89210001}, -+ {0xc78, 0x88220001}, {0xc78, 0x87230001}, -+ {0xc78, 0x86240001}, {0xc78, 0x85250001}, -+ {0xc78, 0x84260001}, {0xc78, 0x83270001}, -+ {0xc78, 0x82280001}, {0xc78, 0x6b290001}, -+ {0xc78, 0x6a2a0001}, {0xc78, 0x692b0001}, -+ {0xc78, 0x682c0001}, {0xc78, 0x672d0001}, -+ {0xc78, 0x662e0001}, {0xc78, 0x652f0001}, -+ {0xc78, 0x64300001}, {0xc78, 0x63310001}, -+ {0xc78, 0x62320001}, {0xc78, 0x61330001}, -+ {0xc78, 0x46340001}, {0xc78, 0x45350001}, -+ {0xc78, 0x44360001}, {0xc78, 0x43370001}, -+ {0xc78, 0x42380001}, {0xc78, 0x41390001}, -+ {0xc78, 0x403a0001}, {0xc78, 0x403b0001}, -+ {0xc78, 0x403c0001}, {0xc78, 0x403d0001}, -+ {0xc78, 0x403e0001}, {0xc78, 0x403f0001}, -+ {0xc78, 0xfb400001}, {0xc78, 0xfb410001}, -+ {0xc78, 0xfb420001}, {0xc78, 0xfb430001}, -+ {0xc78, 0xfb440001}, {0xc78, 0xfb450001}, -+ {0xc78, 0xfb460001}, {0xc78, 0xfb470001}, -+ {0xc78, 0xfb480001}, {0xc78, 0xfa490001}, -+ {0xc78, 0xf94a0001}, {0xc78, 0xf84b0001}, -+ {0xc78, 0xf74c0001}, {0xc78, 0xf64d0001}, -+ {0xc78, 0xf54e0001}, {0xc78, 0xf44f0001}, -+ {0xc78, 0xf3500001}, {0xc78, 0xf2510001}, -+ {0xc78, 0xf1520001}, {0xc78, 0xf0530001}, -+ {0xc78, 0xef540001}, {0xc78, 0xee550001}, -+ {0xc78, 0xed560001}, {0xc78, 0xec570001}, -+ {0xc78, 0xeb580001}, {0xc78, 0xea590001}, -+ {0xc78, 0xe95a0001}, {0xc78, 0xe85b0001}, -+ {0xc78, 0xe75c0001}, {0xc78, 0xe65d0001}, -+ {0xc78, 0xe55e0001}, {0xc78, 0xe45f0001}, -+ {0xc78, 0xe3600001}, {0xc78, 0xe2610001}, -+ {0xc78, 0xc3620001}, {0xc78, 0xc2630001}, -+ {0xc78, 0xc1640001}, {0xc78, 0x8b650001}, -+ {0xc78, 0x8a660001}, {0xc78, 0x89670001}, -+ {0xc78, 0x88680001}, {0xc78, 0x87690001}, -+ {0xc78, 0x866a0001}, {0xc78, 0x856b0001}, -+ {0xc78, 0x846c0001}, {0xc78, 0x676d0001}, -+ {0xc78, 0x666e0001}, {0xc78, 0x656f0001}, -+ {0xc78, 0x64700001}, {0xc78, 0x63710001}, -+ {0xc78, 0x62720001}, {0xc78, 0x61730001}, -+ {0xc78, 0x60740001}, {0xc78, 0x46750001}, -+ {0xc78, 0x45760001}, {0xc78, 0x44770001}, -+ {0xc78, 0x43780001}, {0xc78, 0x42790001}, -+ {0xc78, 0x417a0001}, {0xc78, 0x407b0001}, -+ {0xc78, 0x407c0001}, {0xc78, 0x407d0001}, -+ {0xc78, 0x407e0001}, {0xc78, 0x407f0001}, -+ {0xffff, 0xffffffff} -+}; -+ - static int rtl8188eu_parse_efuse(struct rtl8xxxu_priv *priv) - { - struct rtl8188eu_efuse *efuse = &priv->efuse_wifi.efuse8188eu; -@@ -89,6 +257,8 @@ static int rtl8188eu_parse_efuse(struct - priv->efuse_wifi.efuse8188eu.ht40_1s_tx_power_index_B, - sizeof(priv->ht40_1s_tx_power_index_B)); - -+ priv->xtalk = priv->efuse_wifi.efuse8188eu.xtal_k & 0x3f; -+ - dev_info(&priv->udev->dev, "Vendor: %.7s\n", efuse->vendor_name); - dev_info(&priv->udev->dev, "Product: %.11s\n", efuse->device_name); - dev_info(&priv->udev->dev, "Serial: %.11s\n", efuse->serial); -@@ -119,6 +289,37 @@ static int rtl8188eu_load_firmware(struc - return ret; - } - -+static void rtl8188eu_init_phy_bb(struct rtl8xxxu_priv *priv) -+{ -+ u8 val8; -+ u16 val16; -+ u32 val32; -+ -+ val16 = rtl8xxxu_read16(priv, REG_SYS_FUNC); -+ val16 |= SYS_FUNC_BB_GLB_RSTN | SYS_FUNC_BBRSTB | SYS_FUNC_DIO_RF; -+ rtl8xxxu_write16(priv, REG_SYS_FUNC, val16); -+ -+ /* -+ * Per vendor driver, run power sequence before init of RF -+ */ -+ val8 = RF_ENABLE | RF_RSTB | RF_SDMRSTB; -+ rtl8xxxu_write8(priv, REG_RF_CTRL, val8); -+ -+ val16 = rtl8xxxu_read16(priv, REG_SYS_FUNC); -+ val16 |= (SYS_FUNC_USBA | SYS_FUNC_USBD | -+ SYS_FUNC_BB_GLB_RSTN | SYS_FUNC_BBRSTB); -+ rtl8xxxu_write16(priv, REG_SYS_FUNC, val16); -+ -+ rtl8xxxu_init_phy_regs(priv, rtl8188eu_phy_init_table); -+ rtl8xxxu_init_phy_regs(priv, rtl8188e_agc_table); -+ -+ val32 = rtl8xxxu_read32(priv, REG_AFE_XTAL_CTRL); -+ val8 = priv->xtalk; -+ val32 &= 0xff8007ff; -+ val32 |= ((val8 | (val8 << 6)) << 11); -+ rtl8xxxu_write32(priv, REG_AFE_XTAL_CTRL, val32); -+} -+ - static void rtl8188e_disabled_to_emu(struct rtl8xxxu_priv *priv) - { - u16 val16; -@@ -252,6 +453,7 @@ struct rtl8xxxu_fileops rtl8188eu_fops = - .power_on = rtl8188eu_power_on, - .power_off = rtl8xxxu_power_off, - .reset_8051 = rtl8xxxu_reset_8051, -+ .init_phy_bb = rtl8188eu_init_phy_bb, - .usb_quirks = rtl8188e_usb_quirks, - .writeN_block_size = 128, - /* diff --git a/package/kernel/mac80211/patches/660-0016-rtl8xxxu-Implement-rtl8188eu_init_phy_rf.patch b/package/kernel/mac80211/patches/660-0016-rtl8xxxu-Implement-rtl8188eu_init_phy_rf.patch deleted file mode 100644 index 89e481cdcd..0000000000 --- a/package/kernel/mac80211/patches/660-0016-rtl8xxxu-Implement-rtl8188eu_init_phy_rf.patch +++ /dev/null @@ -1,103 +0,0 @@ -From 0c6fa292a9c6d7f1b870c42ed9166674463206f1 Mon Sep 17 00:00:00 2001 -From: Jes Sorensen -Date: Tue, 19 Jul 2016 17:12:42 -0400 -Subject: [PATCH] rtl8xxxu: Implement rtl8188eu_init_phy_rf() - -Include the table rtl8188eu_radioa_init_table derived from vendor -driver. The vendor table relies on a hack setting RF6052_REG_RCK1 + -RF6052_REG_RCK2 with delays. This workaround is open coded here -instead of modifying the table parsing code. - -Signed-off-by: Jes Sorensen ---- - .../net/wireless/realtek/rtl8xxxu/rtl8xxxu_8188e.c | 65 ++++++++++++++++++++++ - 1 file changed, 65 insertions(+) - ---- a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_8188e.c -+++ b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_8188e.c -@@ -235,6 +235,54 @@ static struct rtl8xxxu_reg32val rtl8188e - {0xffff, 0xffffffff} - }; - -+static struct rtl8xxxu_rfregval rtl8188eu_radioa_init_table[] = { -+ {0x00, 0x00030000}, {0x08, 0x00084000}, -+ {0x18, 0x00000407}, {0x19, 0x00000012}, -+ {0x1e, 0x00080009}, {0x1f, 0x00000880}, -+ {0x2f, 0x0001a060}, {0x3f, 0x00000000}, -+ {0x42, 0x000060c0}, {0x57, 0x000d0000}, -+ {0x58, 0x000be180}, {0x67, 0x00001552}, -+ {0x83, 0x00000000}, {0xb0, 0x000ff8fc}, -+ {0xb1, 0x00054400}, {0xb2, 0x000ccc19}, -+ {0xb4, 0x00043003}, {0xb6, 0x0004953e}, -+ {0xb7, 0x0001c718}, {0xb8, 0x000060ff}, -+ {0xb9, 0x00080001}, {0xba, 0x00040000}, -+ {0xbb, 0x00000400}, {0xbf, 0x000c0000}, -+ {0xc2, 0x00002400}, {0xc3, 0x00000009}, -+ {0xc4, 0x00040c91}, {0xc5, 0x00099999}, -+ {0xc6, 0x000000a3}, {0xc7, 0x00088820}, -+ {0xc8, 0x00076c06}, {0xc9, 0x00000000}, -+ {0xca, 0x00080000}, {0xdf, 0x00000180}, -+ {0xef, 0x000001a0}, {0x51, 0x0006b27d}, -+ {0x52, 0x0007e49d}, /* Set to 0x0007e4dd for SDIO */ -+ {0x53, 0x00000073}, {0x56, 0x00051ff3}, -+ {0x35, 0x00000086}, {0x35, 0x00000186}, -+ {0x35, 0x00000286}, {0x36, 0x00001c25}, -+ {0x36, 0x00009c25}, {0x36, 0x00011c25}, -+ {0x36, 0x00019c25}, {0xb6, 0x00048538}, -+ {0x18, 0x00000c07}, {0x5a, 0x0004bd00}, -+ {0x19, 0x000739d0}, {0x34, 0x0000adf3}, -+ {0x34, 0x00009df0}, {0x34, 0x00008ded}, -+ {0x34, 0x00007dea}, {0x34, 0x00006de7}, -+ {0x34, 0x000054ee}, {0x34, 0x000044eb}, -+ {0x34, 0x000034e8}, {0x34, 0x0000246b}, -+ {0x34, 0x00001468}, {0x34, 0x0000006d}, -+ {0x00, 0x00030159}, {0x84, 0x00068200}, -+ {0x86, 0x000000ce}, {0x87, 0x00048a00}, -+ {0x8e, 0x00065540}, {0x8f, 0x00088000}, -+ {0xef, 0x000020a0}, {0x3b, 0x000f02b0}, -+ {0x3b, 0x000ef7b0}, {0x3b, 0x000d4fb0}, -+ {0x3b, 0x000cf060}, {0x3b, 0x000b0090}, -+ {0x3b, 0x000a0080}, {0x3b, 0x00090080}, -+ {0x3b, 0x0008f780}, {0x3b, 0x000722b0}, -+ {0x3b, 0x0006f7b0}, {0x3b, 0x00054fb0}, -+ {0x3b, 0x0004f060}, {0x3b, 0x00030090}, -+ {0x3b, 0x00020080}, {0x3b, 0x00010080}, -+ {0x3b, 0x0000f780}, {0xef, 0x000000a0}, -+ {0x00, 0x00010159}, {0x18, 0x0000f407}, -+ {0xff, 0xffffffff} -+}; -+ - static int rtl8188eu_parse_efuse(struct rtl8xxxu_priv *priv) - { - struct rtl8188eu_efuse *efuse = &priv->efuse_wifi.efuse8188eu; -@@ -320,6 +368,22 @@ static void rtl8188eu_init_phy_bb(struct - rtl8xxxu_write32(priv, REG_AFE_XTAL_CTRL, val32); - } - -+static int rtl8188eu_init_phy_rf(struct rtl8xxxu_priv *priv) -+{ -+ int ret; -+ -+ ret = rtl8xxxu_init_phy_rf(priv, rtl8188eu_radioa_init_table, RF_A); -+ -+ msleep(100); -+ rtl8xxxu_write_rfreg(priv, RF_A, RF6052_REG_RCK2, 0x80003); -+ msleep(100); -+ rtl8xxxu_write_rfreg(priv, RF_A, RF6052_REG_RCK1, 0x00001); -+ rtl8xxxu_write_rfreg(priv, RF_A, RF6052_REG_RCK2, 0x80000); -+ rtl8xxxu_write_rfreg(priv, RF_A, RF6052_REG_AC, 0x33e60); -+ -+ return ret; -+} -+ - static void rtl8188e_disabled_to_emu(struct rtl8xxxu_priv *priv) - { - u16 val16; -@@ -454,6 +518,7 @@ struct rtl8xxxu_fileops rtl8188eu_fops = - .power_off = rtl8xxxu_power_off, - .reset_8051 = rtl8xxxu_reset_8051, - .init_phy_bb = rtl8188eu_init_phy_bb, -+ .init_phy_rf = rtl8188eu_init_phy_rf, - .usb_quirks = rtl8188e_usb_quirks, - .writeN_block_size = 128, - /* diff --git a/package/kernel/mac80211/patches/660-0017-rtl8xxxu-Use-auto-LLT-init-for-8188e.patch b/package/kernel/mac80211/patches/660-0017-rtl8xxxu-Use-auto-LLT-init-for-8188e.patch deleted file mode 100644 index da306deb11..0000000000 --- a/package/kernel/mac80211/patches/660-0017-rtl8xxxu-Use-auto-LLT-init-for-8188e.patch +++ /dev/null @@ -1,24 +0,0 @@ -From 86d5a5f8e59e46c51a76a303f37ad6ce9c97b73e Mon Sep 17 00:00:00 2001 -From: Jes Sorensen -Date: Tue, 19 Jul 2016 17:27:48 -0400 -Subject: [PATCH] rtl8xxxu: Use auto LLT init for 8188e - -The vendor driver uses IOL to init the LLT table for 8188e. Since we -are trying to avoid dealing with IOL for now, gamble that auto LLT -will work. - -Signed-off-by: Jes Sorensen ---- - drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_8188e.c | 1 + - 1 file changed, 1 insertion(+) - ---- a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_8188e.c -+++ b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_8188e.c -@@ -517,6 +517,7 @@ struct rtl8xxxu_fileops rtl8188eu_fops = - .power_on = rtl8188eu_power_on, - .power_off = rtl8xxxu_power_off, - .reset_8051 = rtl8xxxu_reset_8051, -+ .llt_init = rtl8xxxu_auto_llt_table, - .init_phy_bb = rtl8188eu_init_phy_bb, - .init_phy_rf = rtl8188eu_init_phy_rf, - .usb_quirks = rtl8188e_usb_quirks, diff --git a/package/kernel/mac80211/patches/660-0018-rtl8xxxu-Do-not-set-REG_FPGA0_TX_INFO-on-8188eu.patch b/package/kernel/mac80211/patches/660-0018-rtl8xxxu-Do-not-set-REG_FPGA0_TX_INFO-on-8188eu.patch deleted file mode 100644 index 7d150eb31f..0000000000 --- a/package/kernel/mac80211/patches/660-0018-rtl8xxxu-Do-not-set-REG_FPGA0_TX_INFO-on-8188eu.patch +++ /dev/null @@ -1,25 +0,0 @@ -From 519d0047f84cdd1050418bb86dd34a0c6df1206a Mon Sep 17 00:00:00 2001 -From: Jes Sorensen -Date: Wed, 20 Jul 2016 14:32:46 -0400 -Subject: [PATCH] rtl8xxxu: Do not set REG_FPGA0_TX_INFO on 8188eu - -The vendor driver doesn't set this for 8188eu either. It is unclear if -this is only relevant for gen1 parts. - -Signed-off-by: Jes Sorensen ---- - drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c | 3 ++- - 1 file changed, 2 insertions(+), 1 deletion(-) - ---- a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c -+++ b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c -@@ -3962,7 +3962,8 @@ static int rtl8xxxu_init_device(struct i - goto exit; - - /* RFSW Control - clear bit 14 ?? */ -- if (priv->rtl_chip != RTL8723B && priv->rtl_chip != RTL8192E) -+ if (priv->rtl_chip != RTL8723B && priv->rtl_chip != RTL8192E && -+ priv->rtl_chip != RTL8188E) - rtl8xxxu_write32(priv, REG_FPGA0_TX_INFO, 0x00000003); - - val32 = FPGA0_RF_TRSW | FPGA0_RF_TRSWB | FPGA0_RF_ANTSW | diff --git a/package/kernel/mac80211/patches/660-0019-rtl8xxxu-Do-not-mess-with-REG_FPGA0_XA_RF_INT_OE-eit.patch b/package/kernel/mac80211/patches/660-0019-rtl8xxxu-Do-not-mess-with-REG_FPGA0_XA_RF_INT_OE-eit.patch deleted file mode 100644 index 0a3bab0524..0000000000 --- a/package/kernel/mac80211/patches/660-0019-rtl8xxxu-Do-not-mess-with-REG_FPGA0_XA_RF_INT_OE-eit.patch +++ /dev/null @@ -1,27 +0,0 @@ -From a4234121f383eed37e0a5ea8aed56bb75027305c Mon Sep 17 00:00:00 2001 -From: Jes Sorensen -Date: Wed, 20 Jul 2016 14:38:23 -0400 -Subject: [PATCH] rtl8xxxu: Do not mess with REG_FPGA0_XA_RF_INT_OE either on - 8188eu - -On older devices the vendor driver hard codes a value into -REG_FPGA0_XA_RF_INT_OE for antenna selection. This probably shouldn't -be done in the first place, but more investigation needs to be done to -figure out how this really works. - -Signed-off-by: Jes Sorensen ---- - drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - ---- a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c -+++ b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c -@@ -3976,7 +3976,7 @@ static int rtl8xxxu_init_device(struct i - rtl8xxxu_write32(priv, REG_FPGA0_XAB_RF_SW_CTRL, val32); - - /* 0x860[6:5]= 00 - why? - this sets antenna B */ -- if (priv->rtl_chip != RTL8192E) -+ if (priv->rtl_chip != RTL8192E && priv->rtl_chip != RTL8188E) - rtl8xxxu_write32(priv, REG_FPGA0_XA_RF_INT_OE, 0x66f60210); - - if (!macpower) { diff --git a/package/kernel/mac80211/patches/660-0020-rtl8xxxu-Set-transfer-page-size-for-8188eu.patch b/package/kernel/mac80211/patches/660-0020-rtl8xxxu-Set-transfer-page-size-for-8188eu.patch deleted file mode 100644 index 595d1430ff..0000000000 --- a/package/kernel/mac80211/patches/660-0020-rtl8xxxu-Set-transfer-page-size-for-8188eu.patch +++ /dev/null @@ -1,21 +0,0 @@ -From 497b244578992c6353d214140f026154e4f4f710 Mon Sep 17 00:00:00 2001 -From: Jes Sorensen -Date: Wed, 20 Jul 2016 15:59:31 -0400 -Subject: [PATCH] rtl8xxxu: Set transfer page size for 8188eu - -Signed-off-by: Jes Sorensen ---- - drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_8188e.c | 2 ++ - 1 file changed, 2 insertions(+) - ---- a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_8188e.c -+++ b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_8188e.c -@@ -527,6 +527,8 @@ struct rtl8xxxu_fileops rtl8188eu_fops = - * Max RX buffer = 10K - max(TxReportSize(64*8), WOLPattern(16*24)) - */ - .trxff_boundary = 0x23ff, -+ .pbp_rx = PBP_PAGE_SIZE_128, -+ .pbp_tx = PBP_PAGE_SIZE_128, - .mactable = rtl8188e_mac_init_table, - .total_page_num = TX_TOTAL_PAGE_NUM_8188E, - .page_num_hi = TX_PAGE_NUM_HI_PQ_8188E, diff --git a/package/kernel/mac80211/patches/660-0021-rtl8xxxu-Enable-TX-report-timer-on-8188eu.patch b/package/kernel/mac80211/patches/660-0021-rtl8xxxu-Enable-TX-report-timer-on-8188eu.patch deleted file mode 100644 index c1bc3fa683..0000000000 --- a/package/kernel/mac80211/patches/660-0021-rtl8xxxu-Enable-TX-report-timer-on-8188eu.patch +++ /dev/null @@ -1,22 +0,0 @@ -From a57a3fbb1a22544ce96e4dbe423694e982d54700 Mon Sep 17 00:00:00 2001 -From: Jes Sorensen -Date: Wed, 20 Jul 2016 16:13:06 -0400 -Subject: [PATCH] rtl8xxxu: Enable TX report timer on 8188eu - -The 8188eu uses the same TX report timer as found on the 8723b. - -Signed-off-by: Jes Sorensen ---- - drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_8188e.c | 1 + - 1 file changed, 1 insertion(+) - ---- a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_8188e.c -+++ b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_8188e.c -@@ -522,6 +522,7 @@ struct rtl8xxxu_fileops rtl8188eu_fops = - .init_phy_rf = rtl8188eu_init_phy_rf, - .usb_quirks = rtl8188e_usb_quirks, - .writeN_block_size = 128, -+ .has_tx_report = 1, - /* - * Use 9K for 8188e normal chip - * Max RX buffer = 10K - max(TxReportSize(64*8), WOLPattern(16*24)) diff --git a/package/kernel/mac80211/patches/660-0022-rtl8xxxu-Setup-interrupts-for-8188eu.patch b/package/kernel/mac80211/patches/660-0022-rtl8xxxu-Setup-interrupts-for-8188eu.patch deleted file mode 100644 index 774b2a2bdd..0000000000 --- a/package/kernel/mac80211/patches/660-0022-rtl8xxxu-Setup-interrupts-for-8188eu.patch +++ /dev/null @@ -1,31 +0,0 @@ -From 4c85a1704e555aa04d72e31a4a90b9c4bf01d83b Mon Sep 17 00:00:00 2001 -From: Jes Sorensen -Date: Wed, 20 Jul 2016 16:59:18 -0400 -Subject: [PATCH] rtl8xxxu: Setup interrupts for 8188eu - -This sets up interrupts for 8188eu, but per vendor driver, it's not -obvious this is really needed for USB devices. - -Signed-off-by: Jes Sorensen ---- - drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c | 9 +++++++++ - 1 file changed, 9 insertions(+) - ---- a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c -+++ b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c -@@ -4041,6 +4041,15 @@ static int rtl8xxxu_init_device(struct i - if (priv->rtl_chip == RTL8192E) { - rtl8xxxu_write32(priv, REG_HIMR0, 0x00); - rtl8xxxu_write32(priv, REG_HIMR1, 0x00); -+ } else if (priv->rtl_chip == RTL8188E) { -+ rtl8xxxu_write32(priv, REG_HISR0, 0xffffffff); -+ val32 = IMR0_PSTIMEOUT | IMR0_TBDER | IMR0_CPWM | IMR0_CPWM2; -+ rtl8xxxu_write32(priv, REG_HIMR0, val32); -+ val32 = IMR1_TXERR | IMR1_RXERR | IMR1_TXFOVW | IMR1_RXFOVW; -+ rtl8xxxu_write32(priv, REG_HIMR1, val32); -+ val8 = rtl8xxxu_read8(priv, REG_USB_SPECIAL_OPTION); -+ val8 |= USB_SPEC_INT_BULK_SELECT; -+ rtl8xxxu_write8(priv, REG_USB_SPECIAL_OPTION, val8); - } else { - /* - * Enable all interrupts - not obvious USB needs to do this diff --git a/package/kernel/mac80211/patches/660-0023-rtl8xxxu-Use-rxdesc16-and-32-byte-tx-descriptors-for.patch b/package/kernel/mac80211/patches/660-0023-rtl8xxxu-Use-rxdesc16-and-32-byte-tx-descriptors-for.patch deleted file mode 100644 index c46522ecbb..0000000000 --- a/package/kernel/mac80211/patches/660-0023-rtl8xxxu-Use-rxdesc16-and-32-byte-tx-descriptors-for.patch +++ /dev/null @@ -1,30 +0,0 @@ -From 444b8212457b611f482ee6a5f52e8a14e6881f6e Mon Sep 17 00:00:00 2001 -From: Jes Sorensen -Date: Thu, 21 Jul 2016 14:52:49 -0400 -Subject: [PATCH] rtl8xxxu: Use rxdesc16 and 32 byte tx descriptors for 8188eu - -The RX descriptor format looks like the gen1 RX descriptor format, so -use that for now. - -The TX descriptor format is different and looks to be some bizarre -hybrid of the gen1 and gen2 formats. - -Signed-off-by: Jes Sorensen ---- - drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_8188e.c | 3 +++ - 1 file changed, 3 insertions(+) - ---- a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_8188e.c -+++ b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_8188e.c -@@ -520,8 +520,11 @@ struct rtl8xxxu_fileops rtl8188eu_fops = - .llt_init = rtl8xxxu_auto_llt_table, - .init_phy_bb = rtl8188eu_init_phy_bb, - .init_phy_rf = rtl8188eu_init_phy_rf, -+ .parse_rx_desc = rtl8xxxu_parse_rxdesc16, - .usb_quirks = rtl8188e_usb_quirks, - .writeN_block_size = 128, -+ .rx_desc_size = sizeof(struct rtl8xxxu_rxdesc16), -+ .tx_desc_size = sizeof(struct rtl8xxxu_txdesc32), - .has_tx_report = 1, - /* - * Use 9K for 8188e normal chip diff --git a/package/kernel/mac80211/patches/660-0024-rtl8xxxu-8188eu-use-same-ADDA-on-parameters-as-8723a.patch b/package/kernel/mac80211/patches/660-0024-rtl8xxxu-8188eu-use-same-ADDA-on-parameters-as-8723a.patch deleted file mode 100644 index 3177ee35fc..0000000000 --- a/package/kernel/mac80211/patches/660-0024-rtl8xxxu-8188eu-use-same-ADDA-on-parameters-as-8723a.patch +++ /dev/null @@ -1,25 +0,0 @@ -From 399409ff2196eb6d3f758579b63a1091fff93870 Mon Sep 17 00:00:00 2001 -From: Jes Sorensen -Date: Thu, 21 Jul 2016 15:23:16 -0400 -Subject: [PATCH] rtl8xxxu: 8188eu use same ADDA on parameters as 8723au/8192cu - -For ADDA setup the 8188eu looks to match the gen1 parts. - -Signed-off-by: Jes Sorensen ---- - drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_8188e.c | 4 ++++ - 1 file changed, 4 insertions(+) - ---- a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_8188e.c -+++ b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_8188e.c -@@ -526,6 +526,10 @@ struct rtl8xxxu_fileops rtl8188eu_fops = - .rx_desc_size = sizeof(struct rtl8xxxu_rxdesc16), - .tx_desc_size = sizeof(struct rtl8xxxu_txdesc32), - .has_tx_report = 1, -+ .adda_1t_init = 0x0b1b25a0, -+ .adda_1t_path_on = 0x0bdb25a0, -+ .adda_2t_path_on_a = 0x04db25a4, -+ .adda_2t_path_on_b = 0x0b1b25a4, - /* - * Use 9K for 8188e normal chip - * Max RX buffer = 10K - max(TxReportSize(64*8), WOLPattern(16*24)) diff --git a/package/kernel/mac80211/patches/660-0025-rtl8xxxu-Add-PHY-IQ-calibration-code-for-8188eu.patch b/package/kernel/mac80211/patches/660-0025-rtl8xxxu-Add-PHY-IQ-calibration-code-for-8188eu.patch deleted file mode 100644 index ce76a67d9e..0000000000 --- a/package/kernel/mac80211/patches/660-0025-rtl8xxxu-Add-PHY-IQ-calibration-code-for-8188eu.patch +++ /dev/null @@ -1,521 +0,0 @@ -From 9a3c53da5228607375ab69d6e3cbc375f18a4f82 Mon Sep 17 00:00:00 2001 -From: Jes Sorensen -Date: Thu, 21 Jul 2016 17:25:56 -0400 -Subject: [PATCH] rtl8xxxu: Add PHY IQ calibration code for 8188eu - -The vendor driver for 8188eu is a bizarre modern style code for path A -and old-style code for path B. Most likely because the 8188eu is a -1T1R part which never gets to the path B code. - -Eventually we should look into unifying all the IQ calibration code. - -Signed-off-by: Jes Sorensen ---- - .../net/wireless/realtek/rtl8xxxu/rtl8xxxu_8188e.c | 489 +++++++++++++++++++++ - 1 file changed, 489 insertions(+) - ---- a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_8188e.c -+++ b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_8188e.c -@@ -384,6 +384,494 @@ static int rtl8188eu_init_phy_rf(struct - return ret; - } - -+static int rtl8188eu_iqk_path_a(struct rtl8xxxu_priv *priv) -+{ -+ u32 reg_eac, reg_e94, reg_e9c; -+ int result = 0; -+ -+ /* Path A IQK setting */ -+ rtl8xxxu_write32(priv, REG_TX_IQK_TONE_A, 0x10008c1c); -+ rtl8xxxu_write32(priv, REG_RX_IQK_TONE_A, 0x30008c1c); -+ -+ rtl8xxxu_write32(priv, REG_TX_IQK_PI_A, 0x8214032a); -+ rtl8xxxu_write32(priv, REG_RX_IQK_PI_A, 0x28160000); -+ -+ /* LO calibration setting */ -+ rtl8xxxu_write32(priv, REG_IQK_AGC_RSP, 0x00462911); -+ -+ /* One shot, path A LOK & IQK */ -+ rtl8xxxu_write32(priv, REG_IQK_AGC_PTS, 0xf9000000); -+ rtl8xxxu_write32(priv, REG_IQK_AGC_PTS, 0xf8000000); -+ -+ mdelay(10); -+ -+ /* Check failed */ -+ reg_eac = rtl8xxxu_read32(priv, REG_RX_POWER_AFTER_IQK_A_2); -+ reg_e94 = rtl8xxxu_read32(priv, REG_TX_POWER_BEFORE_IQK_A); -+ reg_e9c = rtl8xxxu_read32(priv, REG_TX_POWER_AFTER_IQK_A); -+ -+ if (!(reg_eac & BIT(28)) && -+ ((reg_e94 & 0x03ff0000) != 0x01420000) && -+ ((reg_e9c & 0x03ff0000) != 0x00420000)) -+ result |= 0x01; -+ -+ return result; -+} -+ -+static int rtl8188eu_rx_iqk_path_a(struct rtl8xxxu_priv *priv) -+{ -+ u32 reg_ea4, reg_eac, reg_e94, reg_e9c, val32; -+ int result = 0; -+ -+ /* Leave IQK mode */ -+ rtl8xxxu_write32(priv, REG_FPGA0_IQK, 0x00); -+ -+ /* Enable path A PA in TX IQK mode */ -+ rtl8xxxu_write_rfreg(priv, RF_A, RF6052_REG_WE_LUT, 0x800a0); -+ rtl8xxxu_write_rfreg(priv, RF_A, RF6052_REG_RCK_OS, 0x30000); -+ rtl8xxxu_write_rfreg(priv, RF_A, RF6052_REG_TXPA_G1, 0x0000f); -+ rtl8xxxu_write_rfreg(priv, RF_A, RF6052_REG_TXPA_G2, 0xf117b); -+ -+ /* PA/PAD control by 0x56, and set = 0x0 */ -+ rtl8xxxu_write_rfreg(priv, RF_A, RF6052_REG_UNKNOWN_DF, 0x00980); -+ rtl8xxxu_write_rfreg(priv, RF_A, RF6052_REG_UNKNOWN_56, 0x51000); -+ -+ /* Enter IQK mode */ -+ rtl8xxxu_write32(priv, REG_FPGA0_IQK, 0x80800000); -+ -+ /* TX IQK setting */ -+ rtl8xxxu_write32(priv, REG_TX_IQK, 0x01007c00); -+ rtl8xxxu_write32(priv, REG_RX_IQK, 0x81004800); -+ -+ /* path-A IQK setting */ -+ rtl8xxxu_write32(priv, REG_TX_IQK_TONE_A, 0x10008c1c); -+ rtl8xxxu_write32(priv, REG_RX_IQK_TONE_A, 0x30008c1c); -+ -+ rtl8xxxu_write32(priv, REG_TX_IQK_PI_A, 0x82160c1f); -+ rtl8xxxu_write32(priv, REG_RX_IQK_PI_A, 0x28160000); -+ -+ /* LO calibration setting */ -+ rtl8xxxu_write32(priv, REG_IQK_AGC_RSP, 0x0046a911); -+ -+ /* One shot, path A LOK & IQK */ -+ rtl8xxxu_write32(priv, REG_IQK_AGC_PTS, 0xf9000000); -+ rtl8xxxu_write32(priv, REG_IQK_AGC_PTS, 0xf8000000); -+ -+ mdelay(10); -+ -+ /* Check failed */ -+ reg_eac = rtl8xxxu_read32(priv, REG_RX_POWER_AFTER_IQK_A_2); -+ reg_e94 = rtl8xxxu_read32(priv, REG_TX_POWER_BEFORE_IQK_A); -+ reg_e9c = rtl8xxxu_read32(priv, REG_TX_POWER_AFTER_IQK_A); -+ -+ if (!(reg_eac & BIT(28)) && -+ ((reg_e94 & 0x03ff0000) != 0x01420000) && -+ ((reg_e9c & 0x03ff0000) != 0x00420000)) { -+ result |= 0x01; -+ } else { -+ /* PA/PAD controlled by 0x0 */ -+ rtl8xxxu_write32(priv, REG_FPGA0_IQK, 0x00000000); -+ rtl8xxxu_write_rfreg(priv, RF_A, RF6052_REG_UNKNOWN_DF, 0x180); -+ goto out; -+ } -+ -+ val32 = 0x80007c00 | -+ (reg_e94 & 0x03ff0000) | ((reg_e9c >> 16) & 0x03ff); -+ rtl8xxxu_write32(priv, REG_TX_IQK, val32); -+ -+ /* Modify RX IQK mode table */ -+ rtl8xxxu_write32(priv, REG_FPGA0_IQK, 0x00000000); -+ -+ rtl8xxxu_write_rfreg(priv, RF_A, RF6052_REG_WE_LUT, 0x800a0); -+ rtl8xxxu_write_rfreg(priv, RF_A, RF6052_REG_RCK_OS, 0x30000); -+ rtl8xxxu_write_rfreg(priv, RF_A, RF6052_REG_TXPA_G1, 0x0000f); -+ rtl8xxxu_write_rfreg(priv, RF_A, RF6052_REG_TXPA_G2, 0xf7ffa); -+ -+ /* Enter IQK mode */ -+ rtl8xxxu_write32(priv, REG_FPGA0_IQK, 0x80800000); -+ -+ /* IQK setting */ -+ rtl8xxxu_write32(priv, REG_RX_IQK, 0x01004800); -+ -+ /* Path A IQK setting */ -+ rtl8xxxu_write32(priv, REG_TX_IQK_TONE_A, 0x38008c1c); -+ rtl8xxxu_write32(priv, REG_RX_IQK_TONE_A, 0x18008c1c); -+ -+ rtl8xxxu_write32(priv, REG_TX_IQK_PI_A, 0x82160c05); -+ rtl8xxxu_write32(priv, REG_RX_IQK_PI_A, 0x28160c1f); -+ -+ /* LO calibration setting */ -+ rtl8xxxu_write32(priv, REG_IQK_AGC_RSP, 0x0046a911); -+ -+ /* One shot, path A LOK & IQK */ -+ rtl8xxxu_write32(priv, REG_IQK_AGC_PTS, 0xf9000000); -+ rtl8xxxu_write32(priv, REG_IQK_AGC_PTS, 0xf8000000); -+ -+ mdelay(10); -+ -+ reg_eac = rtl8xxxu_read32(priv, REG_RX_POWER_AFTER_IQK_A_2); -+ reg_ea4 = rtl8xxxu_read32(priv, REG_RX_POWER_BEFORE_IQK_A_2); -+ -+ rtl8xxxu_write32(priv, REG_FPGA0_IQK, 0x00000000); -+ rtl8xxxu_write_rfreg(priv, RF_A, RF6052_REG_UNKNOWN_DF, 0x180); -+ -+ if (!(reg_eac & BIT(27)) && -+ ((reg_ea4 & 0x03ff0000) != 0x01320000) && -+ ((reg_eac & 0x03ff0000) != 0x00360000)) -+ result |= 0x02; -+ else -+ dev_warn(&priv->udev->dev, "%s: Path A RX IQK failed!\n", -+ __func__); -+ -+out: -+ return result; -+} -+ -+static int rtl8188eu_iqk_path_b(struct rtl8xxxu_priv *priv) -+{ -+ u32 reg_eac, reg_eb4, reg_ebc, reg_ec4, reg_ecc; -+ int result = 0; -+ -+ rtl8xxxu_write32(priv, REG_IQK_AGC_CONT, 0x00000002); -+ rtl8xxxu_write32(priv, REG_IQK_AGC_CONT, 0x00000000); -+ -+ mdelay(1); -+ -+ /* Check failed */ -+ reg_eac = rtl8xxxu_read32(priv, REG_RX_POWER_AFTER_IQK_A_2); -+ reg_eb4 = rtl8xxxu_read32(priv, REG_TX_POWER_BEFORE_IQK_B); -+ reg_ebc = rtl8xxxu_read32(priv, REG_TX_POWER_AFTER_IQK_B); -+ reg_ec4 = rtl8xxxu_read32(priv, REG_RX_POWER_BEFORE_IQK_B_2); -+ reg_ecc = rtl8xxxu_read32(priv, REG_RX_POWER_AFTER_IQK_B_2); -+ -+ if (!(reg_eac & BIT(31)) && -+ ((reg_eb4 & 0x03ff0000) != 0x01420000) && -+ ((reg_ebc & 0x03ff0000) != 0x00420000)) -+ result |= 0x01; -+ else -+ dev_warn(&priv->udev->dev, "%s: Path B IQK failed!\n", -+ __func__); -+ -+ if (!(reg_eac & BIT(30)) && -+ ((reg_ec4 & 0x03ff0000) != 0x01320000) && -+ ((reg_ecc & 0x03ff0000) != 0x00360000)) -+ result |= 0x01; -+ else -+ dev_warn(&priv->udev->dev, "%s: Path B RX IQK failed!\n", -+ __func__); -+ -+ return result; -+} -+ -+static void rtl8188eu_phy_iqcalibrate(struct rtl8xxxu_priv *priv, -+ int result[][8], int t) -+{ -+ struct device *dev = &priv->udev->dev; -+ u32 i, val32; -+ int path_a_ok, path_b_ok; -+ int retry = 2; -+ const u32 adda_regs[RTL8XXXU_ADDA_REGS] = { -+ REG_FPGA0_XCD_SWITCH_CTRL, REG_BLUETOOTH, -+ REG_RX_WAIT_CCA, REG_TX_CCK_RFON, -+ REG_TX_CCK_BBON, REG_TX_OFDM_RFON, -+ REG_TX_OFDM_BBON, REG_TX_TO_RX, -+ REG_TX_TO_TX, REG_RX_CCK, -+ REG_RX_OFDM, REG_RX_WAIT_RIFS, -+ REG_RX_TO_RX, REG_STANDBY, -+ REG_SLEEP, REG_PMPD_ANAEN -+ }; -+ const u32 iqk_mac_regs[RTL8XXXU_MAC_REGS] = { -+ REG_TXPAUSE, REG_BEACON_CTRL, -+ REG_BEACON_CTRL_1, REG_GPIO_MUXCFG -+ }; -+ const u32 iqk_bb_regs[RTL8XXXU_BB_REGS] = { -+ REG_OFDM0_TRX_PATH_ENABLE, REG_OFDM0_TR_MUX_PAR, -+ REG_FPGA0_XCD_RF_SW_CTRL, REG_CONFIG_ANT_A, REG_CONFIG_ANT_B, -+ REG_FPGA0_XAB_RF_SW_CTRL, REG_FPGA0_XA_RF_INT_OE, -+ REG_FPGA0_XB_RF_INT_OE, REG_FPGA0_RF_MODE -+ }; -+ -+ /* -+ * Note: IQ calibration must be performed after loading -+ * PHY_REG.txt , and radio_a, radio_b.txt -+ */ -+ -+ if (t == 0) { -+ /* Save ADDA parameters, turn Path A ADDA on */ -+ rtl8xxxu_save_regs(priv, adda_regs, priv->adda_backup, -+ RTL8XXXU_ADDA_REGS); -+ rtl8xxxu_save_mac_regs(priv, iqk_mac_regs, priv->mac_backup); -+ rtl8xxxu_save_regs(priv, iqk_bb_regs, -+ priv->bb_backup, RTL8XXXU_BB_REGS); -+ } -+ -+ rtl8xxxu_path_adda_on(priv, adda_regs, true); -+ -+ if (t == 0) { -+ val32 = rtl8xxxu_read32(priv, REG_FPGA0_XA_HSSI_PARM1); -+ if (val32 & FPGA0_HSSI_PARM1_PI) -+ priv->pi_enabled = 1; -+ } -+ -+ if (!priv->pi_enabled) { -+ /* Switch BB to PI mode to do IQ Calibration. */ -+ rtl8xxxu_write32(priv, REG_FPGA0_XA_HSSI_PARM1, 0x01000100); -+ rtl8xxxu_write32(priv, REG_FPGA0_XB_HSSI_PARM1, 0x01000100); -+ } -+ -+ val32 = rtl8xxxu_read32(priv, REG_FPGA0_RF_MODE); -+ val32 &= ~FPGA_RF_MODE_CCK; -+ rtl8xxxu_write32(priv, REG_FPGA0_RF_MODE, val32); -+ -+ rtl8xxxu_write32(priv, REG_OFDM0_TRX_PATH_ENABLE, 0x03a05600); -+ rtl8xxxu_write32(priv, REG_OFDM0_TR_MUX_PAR, 0x000800e4); -+ rtl8xxxu_write32(priv, REG_FPGA0_XCD_RF_SW_CTRL, 0x22204000); -+ -+ if (!priv->no_pape) { -+ val32 = rtl8xxxu_read32(priv, REG_FPGA0_XAB_RF_SW_CTRL); -+ val32 |= (FPGA0_RF_PAPE | -+ (FPGA0_RF_PAPE << FPGA0_RF_BD_CTRL_SHIFT)); -+ rtl8xxxu_write32(priv, REG_FPGA0_XAB_RF_SW_CTRL, val32); -+ } -+ -+ val32 = rtl8xxxu_read32(priv, REG_FPGA0_XA_RF_INT_OE); -+ val32 &= ~BIT(10); -+ rtl8xxxu_write32(priv, REG_FPGA0_XA_RF_INT_OE, val32); -+ val32 = rtl8xxxu_read32(priv, REG_FPGA0_XB_RF_INT_OE); -+ val32 &= ~BIT(10); -+ rtl8xxxu_write32(priv, REG_FPGA0_XB_RF_INT_OE, val32); -+ -+ if (priv->tx_paths > 1) { -+ rtl8xxxu_write32(priv, REG_FPGA0_XA_LSSI_PARM, 0x00010000); -+ rtl8xxxu_write32(priv, REG_FPGA0_XB_LSSI_PARM, 0x00010000); -+ } -+ -+ /* MAC settings */ -+ rtl8xxxu_mac_calibration(priv, iqk_mac_regs, priv->mac_backup); -+ -+ /* Page B init */ -+ rtl8xxxu_write32(priv, REG_CONFIG_ANT_A, 0x0f600000); -+ -+ if (priv->tx_paths > 1) -+ rtl8xxxu_write32(priv, REG_CONFIG_ANT_B, 0x0f600000); -+ -+ /* IQ calibration setting */ -+ rtl8xxxu_write32(priv, REG_FPGA0_IQK, 0x80800000); -+ rtl8xxxu_write32(priv, REG_TX_IQK, 0x01007c00); -+ rtl8xxxu_write32(priv, REG_RX_IQK, 0x81004800); -+ -+ for (i = 0; i < retry; i++) { -+ path_a_ok = rtl8188eu_iqk_path_a(priv); -+ if (path_a_ok == 0x01) { -+ val32 = rtl8xxxu_read32(priv, -+ REG_TX_POWER_BEFORE_IQK_A); -+ result[t][0] = (val32 >> 16) & 0x3ff; -+ val32 = rtl8xxxu_read32(priv, -+ REG_TX_POWER_AFTER_IQK_A); -+ result[t][1] = (val32 >> 16) & 0x3ff; -+ break; -+ } -+ } -+ -+ if (!path_a_ok) -+ dev_dbg(dev, "%s: Path A TX IQK failed!\n", __func__); -+ -+ for (i = 0; i < retry; i++) { -+ path_a_ok = rtl8188eu_rx_iqk_path_a(priv); -+ if (path_a_ok == 0x03) { -+ val32 = rtl8xxxu_read32(priv, -+ REG_RX_POWER_BEFORE_IQK_A_2); -+ result[t][2] = (val32 >> 16) & 0x3ff; -+ val32 = rtl8xxxu_read32(priv, -+ REG_RX_POWER_AFTER_IQK_A_2); -+ result[t][3] = (val32 >> 16) & 0x3ff; -+ -+ break; -+ } -+ } -+ -+ if (!path_a_ok) -+ dev_dbg(dev, "%s: Path A RX IQK failed!\n", __func__); -+ -+ /* -+ * Path B calibration code in the vendor driver seems to be -+ * old style and not updated for the 8188eu since it's a 1T1R -+ * part. Keeping the code here in sync with the vendor code -+ * to not divert unncessarily, but probably would be good to -+ * look into modernizing all the code including that for the -+ * old gen1 devices -+ */ -+ if (priv->tx_paths > 1) { -+ /* -+ * Path A into standby -+ */ -+ rtl8xxxu_write32(priv, REG_FPGA0_IQK, 0x0); -+ rtl8xxxu_write32(priv, REG_FPGA0_XA_LSSI_PARM, 0x00010000); -+ rtl8xxxu_write32(priv, REG_FPGA0_IQK, 0x80800000); -+ -+ /* Turn Path B ADDA on */ -+ rtl8xxxu_path_adda_on(priv, adda_regs, false); -+ -+ for (i = 0; i < retry; i++) { -+ path_b_ok = rtl8188eu_iqk_path_b(priv); -+ if (path_b_ok == 0x03) { -+ val32 = rtl8xxxu_read32(priv, REG_TX_POWER_BEFORE_IQK_B); -+ result[t][4] = (val32 >> 16) & 0x3ff; -+ val32 = rtl8xxxu_read32(priv, REG_TX_POWER_AFTER_IQK_B); -+ result[t][5] = (val32 >> 16) & 0x3ff; -+ val32 = rtl8xxxu_read32(priv, REG_RX_POWER_BEFORE_IQK_B_2); -+ result[t][6] = (val32 >> 16) & 0x3ff; -+ val32 = rtl8xxxu_read32(priv, REG_RX_POWER_AFTER_IQK_B_2); -+ result[t][7] = (val32 >> 16) & 0x3ff; -+ break; -+ } else if (i == (retry - 1) && path_b_ok == 0x01) { -+ /* TX IQK OK */ -+ val32 = rtl8xxxu_read32(priv, REG_TX_POWER_BEFORE_IQK_B); -+ result[t][4] = (val32 >> 16) & 0x3ff; -+ val32 = rtl8xxxu_read32(priv, REG_TX_POWER_AFTER_IQK_B); -+ result[t][5] = (val32 >> 16) & 0x3ff; -+ } -+ } -+ -+ if (!path_b_ok) -+ dev_dbg(dev, "%s: Path B IQK failed!\n", __func__); -+ } -+ -+ /* Back to BB mode, load original value */ -+ rtl8xxxu_write32(priv, REG_FPGA0_IQK, 0); -+ -+ if (t) { -+ if (!priv->pi_enabled) { -+ /* -+ * Switch back BB to SI mode after finishing -+ * IQ Calibration -+ */ -+ val32 = 0x01000000; -+ rtl8xxxu_write32(priv, REG_FPGA0_XA_HSSI_PARM1, val32); -+ rtl8xxxu_write32(priv, REG_FPGA0_XB_HSSI_PARM1, val32); -+ } -+ -+ /* Reload ADDA power saving parameters */ -+ rtl8xxxu_restore_regs(priv, adda_regs, priv->adda_backup, -+ RTL8XXXU_ADDA_REGS); -+ -+ /* Reload MAC parameters */ -+ rtl8xxxu_restore_mac_regs(priv, iqk_mac_regs, priv->mac_backup); -+ -+ /* Reload BB parameters */ -+ rtl8xxxu_restore_regs(priv, iqk_bb_regs, -+ priv->bb_backup, RTL8XXXU_BB_REGS); -+ -+ /* Restore RX initial gain */ -+ rtl8xxxu_write32(priv, REG_FPGA0_XA_LSSI_PARM, 0x00032ed3); -+ -+ if (priv->tx_paths > 1) { -+ rtl8xxxu_write32(priv, REG_FPGA0_XB_LSSI_PARM, -+ 0x00032ed3); -+ } -+ -+ /* Load 0xe30 IQC default value */ -+ rtl8xxxu_write32(priv, REG_TX_IQK_TONE_A, 0x01008c00); -+ rtl8xxxu_write32(priv, REG_RX_IQK_TONE_A, 0x01008c00); -+ } -+} -+ -+static void rtl8188eu_phy_iq_calibrate(struct rtl8xxxu_priv *priv) -+{ -+ struct device *dev = &priv->udev->dev; -+ int result[4][8]; /* last is final result */ -+ int i, candidate; -+ bool path_a_ok, path_b_ok; -+ u32 reg_e94, reg_e9c, reg_ea4, reg_eac; -+ u32 reg_eb4, reg_ebc, reg_ec4, reg_ecc; -+ bool simu; -+ -+ memset(result, 0, sizeof(result)); -+ result[3][0] = 0x100; -+ result[3][2] = 0x100; -+ result[3][4] = 0x100; -+ result[3][6] = 0x100; -+ -+ candidate = -1; -+ -+ path_a_ok = false; -+ path_b_ok = false; -+ -+ for (i = 0; i < 3; i++) { -+ rtl8188eu_phy_iqcalibrate(priv, result, i); -+ -+ if (i == 1) { -+ simu = rtl8xxxu_gen2_simularity_compare(priv, -+ result, 0, 1); -+ if (simu) { -+ candidate = 0; -+ break; -+ } -+ } -+ -+ if (i == 2) { -+ simu = rtl8xxxu_gen2_simularity_compare(priv, -+ result, 0, 2); -+ if (simu) { -+ candidate = 0; -+ break; -+ } -+ -+ simu = rtl8xxxu_gen2_simularity_compare(priv, -+ result, 1, 2); -+ if (simu) -+ candidate = 1; -+ else -+ candidate = 3; -+ } -+ } -+ -+ for (i = 0; i < 4; i++) { -+ reg_e94 = result[i][0]; -+ reg_e9c = result[i][1]; -+ reg_ea4 = result[i][2]; -+ reg_eb4 = result[i][4]; -+ reg_ebc = result[i][5]; -+ reg_ec4 = result[i][6]; -+ } -+ -+ if (candidate >= 0) { -+ reg_e94 = result[candidate][0]; -+ priv->rege94 = reg_e94; -+ reg_e9c = result[candidate][1]; -+ priv->rege9c = reg_e9c; -+ reg_ea4 = result[candidate][2]; -+ reg_eac = result[candidate][3]; -+ reg_eb4 = result[candidate][4]; -+ priv->regeb4 = reg_eb4; -+ reg_ebc = result[candidate][5]; -+ priv->regebc = reg_ebc; -+ reg_ec4 = result[candidate][6]; -+ reg_ecc = result[candidate][7]; -+ dev_dbg(dev, "%s: candidate is %x\n", __func__, candidate); -+ dev_dbg(dev, -+ "%s: e94 =%x e9c=%x ea4=%x eac=%x eb4=%x ebc=%x ec4=%x " -+ "ecc=%x\n ", __func__, reg_e94, reg_e9c, -+ reg_ea4, reg_eac, reg_eb4, reg_ebc, reg_ec4, reg_ecc); -+ path_a_ok = true; -+ path_b_ok = true; -+ } else { -+ reg_e94 = reg_eb4 = priv->rege94 = priv->regeb4 = 0x100; -+ reg_e9c = reg_ebc = priv->rege9c = priv->regebc = 0x0; -+ } -+ -+ if (reg_e94 && candidate >= 0) -+ rtl8xxxu_fill_iqk_matrix_a(priv, path_a_ok, result, -+ candidate, (reg_ea4 == 0)); -+ -+ if (priv->rf_paths > 1 && reg_eb4) -+ rtl8xxxu_fill_iqk_matrix_b(priv, path_b_ok, result, -+ candidate, (reg_ec4 == 0)); -+ -+ rtl8xxxu_save_regs(priv, rtl8xxxu_iqk_phy_iq_bb_reg, -+ priv->bb_recovery_backup, RTL8XXXU_BB_REGS); -+} -+ - static void rtl8188e_disabled_to_emu(struct rtl8xxxu_priv *priv) - { - u16 val16; -@@ -520,6 +1008,7 @@ struct rtl8xxxu_fileops rtl8188eu_fops = - .llt_init = rtl8xxxu_auto_llt_table, - .init_phy_bb = rtl8188eu_init_phy_bb, - .init_phy_rf = rtl8188eu_init_phy_rf, -+ .phy_iq_calibrate = rtl8188eu_phy_iq_calibrate, - .parse_rx_desc = rtl8xxxu_parse_rxdesc16, - .usb_quirks = rtl8188e_usb_quirks, - .writeN_block_size = 128, diff --git a/package/kernel/mac80211/patches/660-0026-rtl8xxxu-8188eu-uses-the-gen2-thermal-meter.patch b/package/kernel/mac80211/patches/660-0026-rtl8xxxu-8188eu-uses-the-gen2-thermal-meter.patch deleted file mode 100644 index 81b1d848a3..0000000000 --- a/package/kernel/mac80211/patches/660-0026-rtl8xxxu-8188eu-uses-the-gen2-thermal-meter.patch +++ /dev/null @@ -1,23 +0,0 @@ -From e33fed77d7493ef16c3afd32eb0d7c99fc95bfad Mon Sep 17 00:00:00 2001 -From: Jes Sorensen -Date: Fri, 22 Jul 2016 11:20:00 -0400 -Subject: [PATCH] rtl8xxxu: 8188eu uses the gen2 thermal meter - -Vendor driver writes thermal meter setup to RF register 0x42, hence -the gen2 setup. However the driver doesn't do much with it. - -Signed-off-by: Jes Sorensen ---- - drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_8188e.c | 1 + - 1 file changed, 1 insertion(+) - ---- a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_8188e.c -+++ b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_8188e.c -@@ -1015,6 +1015,7 @@ struct rtl8xxxu_fileops rtl8188eu_fops = - .rx_desc_size = sizeof(struct rtl8xxxu_rxdesc16), - .tx_desc_size = sizeof(struct rtl8xxxu_txdesc32), - .has_tx_report = 1, -+ .gen2_thermal_meter = 1, - .adda_1t_init = 0x0b1b25a0, - .adda_1t_path_on = 0x0bdb25a0, - .adda_2t_path_on_a = 0x04db25a4, diff --git a/package/kernel/mac80211/patches/660-0027-rtl8xxxu-Set-REG_USB_HRPWM-to-0-for-8188eu.patch b/package/kernel/mac80211/patches/660-0027-rtl8xxxu-Set-REG_USB_HRPWM-to-0-for-8188eu.patch deleted file mode 100644 index 4c242453b8..0000000000 --- a/package/kernel/mac80211/patches/660-0027-rtl8xxxu-Set-REG_USB_HRPWM-to-0-for-8188eu.patch +++ /dev/null @@ -1,23 +0,0 @@ -From 42808faad1b2cf0366a39074c08dbd181fa51b07 Mon Sep 17 00:00:00 2001 -From: Jes Sorensen -Date: Fri, 22 Jul 2016 11:33:29 -0400 -Subject: [PATCH] rtl8xxxu: Set REG_USB_HRPWM to 0 for 8188eu - -This matches what 8192eu does - -Signed-off-by: Jes Sorensen ---- - drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - ---- a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c -+++ b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c -@@ -4240,7 +4240,7 @@ static int rtl8xxxu_init_device(struct i - val32 |= FPGA_RF_MODE_CCK; - rtl8xxxu_write32(priv, REG_FPGA0_RF_MODE, val32); - } -- } else if (priv->rtl_chip == RTL8192E) { -+ } else if (priv->rtl_chip == RTL8192E || priv->rtl_chip == RTL8188E) { - rtl8xxxu_write8(priv, REG_USB_HRPWM, 0x00); - } - diff --git a/package/kernel/mac80211/patches/660-0028-rtl8xxxu-Implement-rtl8188eu_config_channel.patch b/package/kernel/mac80211/patches/660-0028-rtl8xxxu-Implement-rtl8188eu_config_channel.patch deleted file mode 100644 index a397125e8c..0000000000 --- a/package/kernel/mac80211/patches/660-0028-rtl8xxxu-Implement-rtl8188eu_config_channel.patch +++ /dev/null @@ -1,146 +0,0 @@ -From 9796f3807764567ecde6e3787a66e4b4edbc35df Mon Sep 17 00:00:00 2001 -From: Jes Sorensen -Date: Fri, 22 Jul 2016 11:40:13 -0400 -Subject: [PATCH] rtl8xxxu: Implement rtl8188eu_config_channel() - -The 8188eu doesn't seem to have REG_FPGA0_ANALOG2, so implement it's -own specific version. - -Signed-off-by: Jes Sorensen ---- - .../net/wireless/realtek/rtl8xxxu/rtl8xxxu_8188e.c | 117 +++++++++++++++++++++ - 1 file changed, 117 insertions(+) - ---- a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_8188e.c -+++ b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_8188e.c -@@ -283,6 +283,122 @@ static struct rtl8xxxu_rfregval rtl8188e - {0xff, 0xffffffff} - }; - -+void rtl8188eu_config_channel(struct ieee80211_hw *hw) -+{ -+ struct rtl8xxxu_priv *priv = hw->priv; -+ u32 val32, rsr; -+ u8 val8, opmode; -+ bool ht = true; -+ int sec_ch_above, channel; -+ int i; -+ -+ opmode = rtl8xxxu_read8(priv, REG_BW_OPMODE); -+ rsr = rtl8xxxu_read32(priv, REG_RESPONSE_RATE_SET); -+ channel = hw->conf.chandef.chan->hw_value; -+ -+ switch (hw->conf.chandef.width) { -+ case NL80211_CHAN_WIDTH_20_NOHT: -+ ht = false; -+ case NL80211_CHAN_WIDTH_20: -+ opmode |= BW_OPMODE_20MHZ; -+ rtl8xxxu_write8(priv, REG_BW_OPMODE, opmode); -+ -+ val32 = rtl8xxxu_read32(priv, REG_FPGA0_RF_MODE); -+ val32 &= ~FPGA_RF_MODE; -+ rtl8xxxu_write32(priv, REG_FPGA0_RF_MODE, val32); -+ -+ val32 = rtl8xxxu_read32(priv, REG_FPGA1_RF_MODE); -+ val32 &= ~FPGA_RF_MODE; -+ rtl8xxxu_write32(priv, REG_FPGA1_RF_MODE, val32); -+ break; -+ case NL80211_CHAN_WIDTH_40: -+ if (hw->conf.chandef.center_freq1 > -+ hw->conf.chandef.chan->center_freq) { -+ sec_ch_above = 1; -+ channel += 2; -+ } else { -+ sec_ch_above = 0; -+ channel -= 2; -+ } -+ -+ opmode &= ~BW_OPMODE_20MHZ; -+ rtl8xxxu_write8(priv, REG_BW_OPMODE, opmode); -+ rsr &= ~RSR_RSC_BANDWIDTH_40M; -+ if (sec_ch_above) -+ rsr |= RSR_RSC_UPPER_SUB_CHANNEL; -+ else -+ rsr |= RSR_RSC_LOWER_SUB_CHANNEL; -+ rtl8xxxu_write32(priv, REG_RESPONSE_RATE_SET, rsr); -+ -+ val32 = rtl8xxxu_read32(priv, REG_FPGA0_RF_MODE); -+ val32 |= FPGA_RF_MODE; -+ rtl8xxxu_write32(priv, REG_FPGA0_RF_MODE, val32); -+ -+ val32 = rtl8xxxu_read32(priv, REG_FPGA1_RF_MODE); -+ val32 |= FPGA_RF_MODE; -+ rtl8xxxu_write32(priv, REG_FPGA1_RF_MODE, val32); -+ -+ /* -+ * Set Control channel to upper or lower. These settings -+ * are required only for 40MHz -+ */ -+ val32 = rtl8xxxu_read32(priv, REG_CCK0_SYSTEM); -+ val32 &= ~CCK0_SIDEBAND; -+ if (!sec_ch_above) -+ val32 |= CCK0_SIDEBAND; -+ rtl8xxxu_write32(priv, REG_CCK0_SYSTEM, val32); -+ -+ val32 = rtl8xxxu_read32(priv, REG_OFDM1_LSTF); -+ val32 &= ~OFDM_LSTF_PRIME_CH_MASK; /* 0xc00 */ -+ if (sec_ch_above) -+ val32 |= OFDM_LSTF_PRIME_CH_LOW; -+ else -+ val32 |= OFDM_LSTF_PRIME_CH_HIGH; -+ rtl8xxxu_write32(priv, REG_OFDM1_LSTF, val32); -+ -+ val32 = rtl8xxxu_read32(priv, REG_FPGA0_POWER_SAVE); -+ val32 &= ~(FPGA0_PS_LOWER_CHANNEL | FPGA0_PS_UPPER_CHANNEL); -+ if (sec_ch_above) -+ val32 |= FPGA0_PS_UPPER_CHANNEL; -+ else -+ val32 |= FPGA0_PS_LOWER_CHANNEL; -+ rtl8xxxu_write32(priv, REG_FPGA0_POWER_SAVE, val32); -+ break; -+ -+ default: -+ break; -+ } -+ -+ for (i = RF_A; i < priv->rf_paths; i++) { -+ val32 = rtl8xxxu_read_rfreg(priv, i, RF6052_REG_MODE_AG); -+ val32 &= ~MODE_AG_CHANNEL_MASK; -+ val32 |= channel; -+ rtl8xxxu_write_rfreg(priv, i, RF6052_REG_MODE_AG, val32); -+ } -+ -+ if (ht) -+ val8 = 0x0e; -+ else -+ val8 = 0x0a; -+ -+#if 0 -+ rtl8xxxu_write8(priv, REG_SIFS_CCK + 1, val8); -+ rtl8xxxu_write8(priv, REG_SIFS_OFDM + 1, val8); -+ -+ rtl8xxxu_write16(priv, REG_R2T_SIFS, 0x0808); -+ rtl8xxxu_write16(priv, REG_T2T_SIFS, 0x0a0a); -+#endif -+ -+ for (i = RF_A; i < priv->rf_paths; i++) { -+ val32 = rtl8xxxu_read_rfreg(priv, i, RF6052_REG_MODE_AG); -+ if (hw->conf.chandef.width == NL80211_CHAN_WIDTH_40) -+ val32 &= ~MODE_AG_CHANNEL_20MHZ; -+ else -+ val32 |= MODE_AG_CHANNEL_20MHZ; -+ rtl8xxxu_write_rfreg(priv, i, RF6052_REG_MODE_AG, val32); -+ } -+} -+ - static int rtl8188eu_parse_efuse(struct rtl8xxxu_priv *priv) - { - struct rtl8188eu_efuse *efuse = &priv->efuse_wifi.efuse8188eu; -@@ -1009,6 +1125,7 @@ struct rtl8xxxu_fileops rtl8188eu_fops = - .init_phy_bb = rtl8188eu_init_phy_bb, - .init_phy_rf = rtl8188eu_init_phy_rf, - .phy_iq_calibrate = rtl8188eu_phy_iq_calibrate, -+ .config_channel = rtl8188eu_config_channel, - .parse_rx_desc = rtl8xxxu_parse_rxdesc16, - .usb_quirks = rtl8188e_usb_quirks, - .writeN_block_size = 128, diff --git a/package/kernel/mac80211/patches/660-0029-rtl8xxxu-Use-gen2-H2C-commands-for-8188eu.patch b/package/kernel/mac80211/patches/660-0029-rtl8xxxu-Use-gen2-H2C-commands-for-8188eu.patch deleted file mode 100644 index cf3cde70b0..0000000000 --- a/package/kernel/mac80211/patches/660-0029-rtl8xxxu-Use-gen2-H2C-commands-for-8188eu.patch +++ /dev/null @@ -1,25 +0,0 @@ -From 4ec1cada65cc1876277f5325b78019667f6e18c4 Mon Sep 17 00:00:00 2001 -From: Jes Sorensen -Date: Fri, 22 Jul 2016 11:44:12 -0400 -Subject: [PATCH] rtl8xxxu: Use gen2 H2C commands for 8188eu - -The 8188eu is a weird hybrid between the old gen1 and newer gen2 -APIs. It uses the newer API for H2C commands, hence use -rtl8xxxu_gen2_update_rate_mask() and rtl8xxxu_gen2_report_connect(). - -Signed-off-by: Jes Sorensen ---- - drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_8188e.c | 2 ++ - 1 file changed, 2 insertions(+) - ---- a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_8188e.c -+++ b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_8188e.c -@@ -1128,6 +1128,8 @@ struct rtl8xxxu_fileops rtl8188eu_fops = - .config_channel = rtl8188eu_config_channel, - .parse_rx_desc = rtl8xxxu_parse_rxdesc16, - .usb_quirks = rtl8188e_usb_quirks, -+ .update_rate_mask = rtl8xxxu_gen2_update_rate_mask, -+ .report_connect = rtl8xxxu_gen2_report_connect, - .writeN_block_size = 128, - .rx_desc_size = sizeof(struct rtl8xxxu_rxdesc16), - .tx_desc_size = sizeof(struct rtl8xxxu_txdesc32), diff --git a/package/kernel/mac80211/patches/660-0030-rtl8xxxu-Initialize-GPIO-settings-for-8188eu.patch b/package/kernel/mac80211/patches/660-0030-rtl8xxxu-Initialize-GPIO-settings-for-8188eu.patch deleted file mode 100644 index 2a5bb00b40..0000000000 --- a/package/kernel/mac80211/patches/660-0030-rtl8xxxu-Initialize-GPIO-settings-for-8188eu.patch +++ /dev/null @@ -1,40 +0,0 @@ -From 061838d68d2c20acb5a57fbd92e3ed0ae906142e Mon Sep 17 00:00:00 2001 -From: Jes Sorensen -Date: Fri, 22 Jul 2016 12:56:30 -0400 -Subject: [PATCH] rtl8xxxu: Initialize GPIO settings for 8188eu - -This matches what the vendor driver does, but is actually opposite of -what it does for 8192eu. - -Signed-off-by: Jes Sorensen ---- - drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c | 7 +++++++ - drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_regs.h | 1 + - 2 files changed, 8 insertions(+) - ---- a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c -+++ b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c -@@ -4210,6 +4210,13 @@ static int rtl8xxxu_init_device(struct i - * Reset USB mode switch setting - */ - rtl8xxxu_write8(priv, REG_ACLK_MON, 0x00); -+ } else if (priv->rtl_chip == RTL8188E) { -+ /* -+ * Init GPIO settings for 8188e -+ */ -+ val8 = rtl8xxxu_read8(priv, REG_GPIO_MUXCFG); -+ val8 &= ~GPIO_MUXCFG_IO_SEL_ENBT; -+ rtl8xxxu_write8(priv, REG_GPIO_MUXCFG, val8); - } - - rtl8723a_phy_lc_calibrate(priv); ---- a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_regs.h -+++ b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_regs.h -@@ -143,6 +143,7 @@ - #define REG_CAL_TIMER 0x003c - #define REG_ACLK_MON 0x003e - #define REG_GPIO_MUXCFG 0x0040 -+#define GPIO_MUXCFG_IO_SEL_ENBT BIT(5) - #define REG_GPIO_IO_SEL 0x0042 - #define REG_MAC_PINMUX_CFG 0x0043 - #define REG_GPIO_PIN_CTRL 0x0044 diff --git a/package/kernel/mac80211/patches/660-0031-rtl8xxxu-Add-simple-rtl8188eu_rf_on-routine.patch b/package/kernel/mac80211/patches/660-0031-rtl8xxxu-Add-simple-rtl8188eu_rf_on-routine.patch deleted file mode 100644 index 2803b9747a..0000000000 --- a/package/kernel/mac80211/patches/660-0031-rtl8xxxu-Add-simple-rtl8188eu_rf_on-routine.patch +++ /dev/null @@ -1,34 +0,0 @@ -From 2024562ed45d905bee00aea923c218c493c09d27 Mon Sep 17 00:00:00 2001 -From: Jes Sorensen -Date: Fri, 22 Jul 2016 13:10:02 -0400 -Subject: [PATCH] rtl8xxxu: Add simple rtl8188eu_rf_on() routine - -It is not obvious from the vendor driver if we need more than this. - -Signed-off-by: Jes Sorensen ---- - drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_8188e.c | 6 ++++++ - 1 file changed, 6 insertions(+) - ---- a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_8188e.c -+++ b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_8188e.c -@@ -1096,6 +1096,11 @@ exit: - return ret; - } - -+static void rtl8188e_enable_rf(struct rtl8xxxu_priv *priv) -+{ -+ rtl8xxxu_write8(priv, REG_TXPAUSE, 0x00); -+} -+ - static void rtl8188e_usb_quirks(struct rtl8xxxu_priv *priv) - { - u16 val16; -@@ -1127,6 +1132,7 @@ struct rtl8xxxu_fileops rtl8188eu_fops = - .phy_iq_calibrate = rtl8188eu_phy_iq_calibrate, - .config_channel = rtl8188eu_config_channel, - .parse_rx_desc = rtl8xxxu_parse_rxdesc16, -+ .enable_rf = rtl8188e_enable_rf, - .usb_quirks = rtl8188e_usb_quirks, - .update_rate_mask = rtl8xxxu_gen2_update_rate_mask, - .report_connect = rtl8xxxu_gen2_report_connect, diff --git a/package/kernel/mac80211/patches/660-0032-rtl8xxxu-Implement-rtl8188e_disable_rf.patch b/package/kernel/mac80211/patches/660-0032-rtl8xxxu-Implement-rtl8188e_disable_rf.patch deleted file mode 100644 index 1778b1636b..0000000000 --- a/package/kernel/mac80211/patches/660-0032-rtl8xxxu-Implement-rtl8188e_disable_rf.patch +++ /dev/null @@ -1,44 +0,0 @@ -From f26f81e233f7a9b1bf21aa0de16a8db733c317ec Mon Sep 17 00:00:00 2001 -From: Jes Sorensen -Date: Fri, 22 Jul 2016 13:17:36 -0400 -Subject: [PATCH] rtl8xxxu: Implement rtl8188e_disable_rf() - -This is partly guessware as there is no straight forward disable RF -routine in the vendor driver. - -Signed-off-by: Jes Sorensen ---- - drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_8188e.c | 15 +++++++++++++++ - 1 file changed, 15 insertions(+) - ---- a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_8188e.c -+++ b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_8188e.c -@@ -1101,6 +1101,20 @@ static void rtl8188e_enable_rf(struct rt - rtl8xxxu_write8(priv, REG_TXPAUSE, 0x00); - } - -+static void rtl8188e_disable_rf(struct rtl8xxxu_priv *priv) -+{ -+ u32 val32; -+ -+ val32 = rtl8xxxu_read32(priv, REG_OFDM0_TRX_PATH_ENABLE); -+ val32 &= ~OFDM_RF_PATH_TX_MASK; -+ rtl8xxxu_write32(priv, REG_OFDM0_TRX_PATH_ENABLE, val32); -+ -+ /* Power down RF module */ -+ rtl8xxxu_write_rfreg(priv, RF_A, RF6052_REG_AC, 0); -+ if (priv->rf_paths == 2) -+ rtl8xxxu_write_rfreg(priv, RF_B, RF6052_REG_AC, 0); -+} -+ - static void rtl8188e_usb_quirks(struct rtl8xxxu_priv *priv) - { - u16 val16; -@@ -1133,6 +1147,7 @@ struct rtl8xxxu_fileops rtl8188eu_fops = - .config_channel = rtl8188eu_config_channel, - .parse_rx_desc = rtl8xxxu_parse_rxdesc16, - .enable_rf = rtl8188e_enable_rf, -+ .disable_rf = rtl8188e_disable_rf, - .usb_quirks = rtl8188e_usb_quirks, - .update_rate_mask = rtl8xxxu_gen2_update_rate_mask, - .report_connect = rtl8xxxu_gen2_report_connect, diff --git a/package/kernel/mac80211/patches/660-0033-rtl8xxxu-Update-8188e-efuse-definition-for-power-val.patch b/package/kernel/mac80211/patches/660-0033-rtl8xxxu-Update-8188e-efuse-definition-for-power-val.patch deleted file mode 100644 index c6d3d62351..0000000000 --- a/package/kernel/mac80211/patches/660-0033-rtl8xxxu-Update-8188e-efuse-definition-for-power-val.patch +++ /dev/null @@ -1,62 +0,0 @@ -From 9067e08ea9ba380340388c3ad4ab85bd54ff4e8d Mon Sep 17 00:00:00 2001 -From: Jes Sorensen -Date: Fri, 22 Jul 2016 16:46:11 -0400 -Subject: [PATCH] rtl8xxxu: Update 8188e efuse definition for power values - -The 8188e uses a similar layout as the 8192e, however it does not have -values for path B. Update struct rtl8188eu_efuse to reflect this and -copy over path A values for path B. - -Signed-off-by: Jes Sorensen ---- - drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu.h | 7 ++----- - .../net/wireless/realtek/rtl8xxxu/rtl8xxxu_8188e.c | 19 +++++++++++-------- - 2 files changed, 13 insertions(+), 13 deletions(-) - ---- a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu.h -+++ b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu.h -@@ -881,11 +881,8 @@ struct rtl8192eu_efuse { - struct rtl8188eu_efuse { - __le16 rtl_id; - u8 res0[0x0e]; -- u8 cck_tx_power_index_A[3]; /* 0x10 */ -- u8 cck_tx_power_index_B[3]; -- u8 ht40_1s_tx_power_index_A[3]; /* 0x16 */ -- u8 ht40_1s_tx_power_index_B[3]; -- u8 res1[0x9c]; -+ struct rtl8192eu_efuse_tx_power tx_power_index_A; /* 0x10 */ -+ u8 res1[0x7e]; /* 0x3a */ - u8 channel_plan; /* 0xb8 */ - u8 xtal_k; - u8 thermal_meter; ---- a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_8188e.c -+++ b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_8188e.c -@@ -409,17 +409,20 @@ static int rtl8188eu_parse_efuse(struct - - ether_addr_copy(priv->mac_addr, efuse->mac_addr); - -- memcpy(priv->cck_tx_power_index_A, efuse->cck_tx_power_index_A, -- sizeof(efuse->cck_tx_power_index_A)); -- memcpy(priv->cck_tx_power_index_B, efuse->cck_tx_power_index_B, -- sizeof(efuse->cck_tx_power_index_B)); -+ memcpy(priv->cck_tx_power_index_A, efuse->tx_power_index_A.cck_base, -+ sizeof(efuse->tx_power_index_A.cck_base)); -+ /* -+ * Efuse is empty for path B, so copy in values from path A -+ */ -+ memcpy(priv->cck_tx_power_index_B, efuse->tx_power_index_A.cck_base, -+ sizeof(efuse->tx_power_index_A.cck_base)); - - memcpy(priv->ht40_1s_tx_power_index_A, -- priv->efuse_wifi.efuse8188eu.ht40_1s_tx_power_index_A, -- sizeof(priv->ht40_1s_tx_power_index_A)); -+ efuse->tx_power_index_A.ht40_base, -+ sizeof(efuse->tx_power_index_A.ht40_base)); - memcpy(priv->ht40_1s_tx_power_index_B, -- priv->efuse_wifi.efuse8188eu.ht40_1s_tx_power_index_B, -- sizeof(priv->ht40_1s_tx_power_index_B)); -+ efuse->tx_power_index_A.ht40_base, -+ sizeof(efuse->tx_power_index_A.ht40_base)); - - priv->xtalk = priv->efuse_wifi.efuse8188eu.xtal_k & 0x3f; - diff --git a/package/kernel/mac80211/patches/660-0034-rtl8xxxu-Implement-rtl8188e_set_tx_power.patch b/package/kernel/mac80211/patches/660-0034-rtl8xxxu-Implement-rtl8188e_set_tx_power.patch deleted file mode 100644 index 7cc0c1b76b..0000000000 --- a/package/kernel/mac80211/patches/660-0034-rtl8xxxu-Implement-rtl8188e_set_tx_power.patch +++ /dev/null @@ -1,94 +0,0 @@ -From cd4a93d1532b2f0ffe508f7fb5d464ec49634dcd Mon Sep 17 00:00:00 2001 -From: Jes Sorensen -Date: Fri, 22 Jul 2016 13:55:24 -0400 -Subject: [PATCH] rtl8xxxu: Implement rtl8188e_set_tx_power() - -This matches the code used to set TX power on 8192eu, except it only -handles path A. - -We should be able to consolidate this code. - -Signed-off-by: Jes Sorensen ---- - .../net/wireless/realtek/rtl8xxxu/rtl8xxxu_8188e.c | 63 ++++++++++++++++++++++ - 1 file changed, 63 insertions(+) - ---- a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_8188e.c -+++ b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_8188e.c -@@ -283,6 +283,68 @@ static struct rtl8xxxu_rfregval rtl8188e - {0xff, 0xffffffff} - }; - -+int rtl8xxxu_8188e_channel_to_group(int channel) -+{ -+ int group; -+ -+ if (channel < 3) -+ group = 0; -+ else if (channel < 6) -+ group = 1; -+ else if (channel < 9) -+ group = 2; -+ else if (channel < 12) -+ group = 3; -+ else if (channel < 14) -+ group = 4; -+ else -+ group = 5; -+ -+ return group; -+} -+ -+static void -+rtl8188e_set_tx_power(struct rtl8xxxu_priv *priv, int channel, bool ht40) -+{ -+ u32 val32, ofdm, mcs; -+ u8 cck, ofdmbase, mcsbase; -+ int group, tx_idx; -+ -+ tx_idx = 0; -+ group = rtl8xxxu_8188e_channel_to_group(channel); -+ -+ cck = priv->cck_tx_power_index_A[group]; -+ -+ val32 = rtl8xxxu_read32(priv, REG_TX_AGC_A_CCK1_MCS32); -+ val32 &= 0xffff00ff; -+ val32 |= (cck << 8); -+ rtl8xxxu_write32(priv, REG_TX_AGC_A_CCK1_MCS32, val32); -+ -+ val32 = rtl8xxxu_read32(priv, REG_TX_AGC_B_CCK11_A_CCK2_11); -+ val32 &= 0xff; -+ val32 |= ((cck << 8) | (cck << 16) | (cck << 24)); -+ rtl8xxxu_write32(priv, REG_TX_AGC_B_CCK11_A_CCK2_11, val32); -+ -+ ofdmbase = priv->ht40_1s_tx_power_index_A[group]; -+ ofdmbase += priv->ofdm_tx_power_diff[tx_idx].a; -+ ofdm = ofdmbase | ofdmbase << 8 | ofdmbase << 16 | ofdmbase << 24; -+ -+ rtl8xxxu_write32(priv, REG_TX_AGC_A_RATE18_06, ofdm); -+ rtl8xxxu_write32(priv, REG_TX_AGC_A_RATE54_24, ofdm); -+ -+ mcsbase = priv->ht40_1s_tx_power_index_A[group]; -+ if (ht40) -+ mcsbase += priv->ht40_tx_power_diff[tx_idx++].a; -+ else -+ mcsbase += priv->ht20_tx_power_diff[tx_idx++].a; -+ mcs = mcsbase | mcsbase << 8 | mcsbase << 16 | mcsbase << 24; -+ -+ rtl8xxxu_write32(priv, REG_TX_AGC_A_MCS03_MCS00, mcs); -+ rtl8xxxu_write32(priv, REG_TX_AGC_A_MCS07_MCS04, mcs); -+ rtl8xxxu_write32(priv, REG_TX_AGC_A_MCS11_MCS08, mcs); -+ rtl8xxxu_write32(priv, REG_TX_AGC_A_MCS15_MCS12, mcs); -+} -+ - void rtl8188eu_config_channel(struct ieee80211_hw *hw) - { - struct rtl8xxxu_priv *priv = hw->priv; -@@ -1152,6 +1214,7 @@ struct rtl8xxxu_fileops rtl8188eu_fops = - .enable_rf = rtl8188e_enable_rf, - .disable_rf = rtl8188e_disable_rf, - .usb_quirks = rtl8188e_usb_quirks, -+ .set_tx_power = rtl8188e_set_tx_power, - .update_rate_mask = rtl8xxxu_gen2_update_rate_mask, - .report_connect = rtl8xxxu_gen2_report_connect, - .writeN_block_size = 128, diff --git a/package/kernel/mac80211/patches/660-0035-rtl8xxxu-Implement-rtl8xxxu_fill_txdesc_v3-for-8188e.patch b/package/kernel/mac80211/patches/660-0035-rtl8xxxu-Implement-rtl8xxxu_fill_txdesc_v3-for-8188e.patch deleted file mode 100644 index 8ad4c70109..0000000000 --- a/package/kernel/mac80211/patches/660-0035-rtl8xxxu-Implement-rtl8xxxu_fill_txdesc_v3-for-8188e.patch +++ /dev/null @@ -1,145 +0,0 @@ -From 3c50918b180d091a49e412742a4f7aa1a89802b1 Mon Sep 17 00:00:00 2001 -From: Jes Sorensen -Date: Tue, 26 Jul 2016 14:01:14 -0400 -Subject: [PATCH] rtl8xxxu: Implement rtl8xxxu_fill_txdesc_v3() for 8188eu - -Getting closer but still no cigar. - -Signed-off-by: Jes Sorensen ---- - drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu.h | 11 +++ - .../net/wireless/realtek/rtl8xxxu/rtl8xxxu_8188e.c | 1 + - .../net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c | 78 ++++++++++++++++++++++ - 3 files changed, 90 insertions(+) - ---- a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu.h -+++ b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu.h -@@ -510,6 +510,8 @@ struct rtl8xxxu_txdesc40 { - #define TXDESC_AMPDU_DENSITY_SHIFT 20 - #define TXDESC40_BT_INT BIT(23) - #define TXDESC40_GID_SHIFT 24 -+#define TXDESC_ANTENNA_SELECT_A BIT(24) -+#define TXDESC_ANTENNA_SELECT_B BIT(25) - - /* Word 3 */ - #define TXDESC40_USE_DRIVER_RATE BIT(8) -@@ -554,6 +556,10 @@ struct rtl8xxxu_txdesc40 { - - /* Word 6 */ - #define TXDESC_MAX_AGG_SHIFT 11 -+#define TXDESC_USB_TX_AGG_SHIT 24 -+ -+/* Word 7 */ -+#define TXDESC_ANTENNA_SELECT_C BIT(29) - - /* Word 8 */ - #define TXDESC40_HW_SEQ_ENABLE BIT(15) -@@ -1487,6 +1493,11 @@ void rtl8xxxu_fill_txdesc_v2(struct ieee - struct ieee80211_tx_info *tx_info, - struct rtl8xxxu_txdesc32 *tx_desc32, bool sgi, - bool short_preamble, bool ampdu_enable, -+ u32 rts_rate); -+void rtl8xxxu_fill_txdesc_v3(struct ieee80211_hw *hw, struct ieee80211_hdr *hdr, -+ struct ieee80211_tx_info *tx_info, -+ struct rtl8xxxu_txdesc32 *tx_desc32, bool sgi, -+ bool short_preamble, bool ampdu_enable, - u32 rts_rate); - - extern struct rtl8xxxu_fileops rtl8188eu_fops; ---- a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_8188e.c -+++ b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_8188e.c -@@ -1217,6 +1217,7 @@ struct rtl8xxxu_fileops rtl8188eu_fops = - .set_tx_power = rtl8188e_set_tx_power, - .update_rate_mask = rtl8xxxu_gen2_update_rate_mask, - .report_connect = rtl8xxxu_gen2_report_connect, -+ .fill_txdesc = rtl8xxxu_fill_txdesc_v3, - .writeN_block_size = 128, - .rx_desc_size = sizeof(struct rtl8xxxu_rxdesc16), - .tx_desc_size = sizeof(struct rtl8xxxu_txdesc32), ---- a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c -+++ b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c -@@ -4923,6 +4923,84 @@ rtl8xxxu_fill_txdesc_v2(struct ieee80211 - } - } - -+/* -+ * Fill in v3 (gen1) specific TX descriptor bits. -+ * This format is a hybrid between the v1 and v2 formats, only seen -+ * on 8188eu devices so far. -+ */ -+void -+rtl8xxxu_fill_txdesc_v3(struct ieee80211_hw *hw, struct ieee80211_hdr *hdr, -+ struct ieee80211_tx_info *tx_info, -+ struct rtl8xxxu_txdesc32 *tx_desc, bool sgi, -+ bool short_preamble, bool ampdu_enable, u32 rts_rate) -+{ -+ struct ieee80211_rate *tx_rate = ieee80211_get_tx_rate(hw, tx_info); -+ struct rtl8xxxu_priv *priv = hw->priv; -+ struct device *dev = &priv->udev->dev; -+ u32 rate; -+ u16 rate_flags = tx_info->control.rates[0].flags; -+ u16 seq_number; -+ -+ if (rate_flags & IEEE80211_TX_RC_MCS && -+ !ieee80211_is_mgmt(hdr->frame_control)) -+ rate = tx_info->control.rates[0].idx + DESC_RATE_MCS0; -+ else -+ rate = tx_rate->hw_value; -+ -+ if (rtl8xxxu_debug & RTL8XXXU_DEBUG_TX) -+ dev_info(dev, "%s: TX rate: %d, pkt size %d\n", -+ __func__, rate, cpu_to_le16(tx_desc->pkt_size)); -+ -+ seq_number = IEEE80211_SEQ_TO_SN(le16_to_cpu(hdr->seq_ctrl)); -+ -+ tx_desc->txdw5 = cpu_to_le32(rate); -+ -+ /* -+ * Data/RTS rate FB limit -+ */ -+ if (ieee80211_is_data(hdr->frame_control)) -+ tx_desc->txdw5 |= cpu_to_le32(0x0001ff00); -+ -+ tx_desc->txdw3 = cpu_to_le32((u32)seq_number << TXDESC32_SEQ_SHIFT); -+ -+ if (ampdu_enable) -+ tx_desc->txdw2 |= cpu_to_le32(TXDESC40_AGG_ENABLE); -+ else -+ tx_desc->txdw2 |= cpu_to_le32(TXDESC40_AGG_BREAK); -+ -+ if (ieee80211_is_mgmt(hdr->frame_control)) { -+ tx_desc->txdw5 = cpu_to_le32(rate); -+ tx_desc->txdw4 |= cpu_to_le32(TXDESC32_USE_DRIVER_RATE); -+ tx_desc->txdw5 |= cpu_to_le32(6 << TXDESC32_RETRY_LIMIT_SHIFT); -+ tx_desc->txdw5 |= cpu_to_le32(TXDESC32_RETRY_LIMIT_ENABLE); -+ } -+ -+ if (ieee80211_is_data_qos(hdr->frame_control)) -+ tx_desc->txdw4 |= cpu_to_le32(TXDESC32_QOS); -+ -+ if (short_preamble) -+ tx_desc->txdw4 |= cpu_to_le32(TXDESC32_SHORT_PREAMBLE); -+ -+ if (sgi) -+ tx_desc->txdw5 |= cpu_to_le32(TXDESC32_SHORT_GI); -+ -+ /* -+ * rts_rate is zero if RTS/CTS or CTS to SELF are not enabled -+ */ -+ tx_desc->txdw4 |= cpu_to_le32(rts_rate << TXDESC32_RTS_RATE_SHIFT); -+ if (rate_flags & IEEE80211_TX_RC_USE_RTS_CTS) { -+ tx_desc->txdw4 |= cpu_to_le32(TXDESC32_RTS_CTS_ENABLE); -+ tx_desc->txdw4 |= cpu_to_le32(TXDESC32_HW_RTS_ENABLE); -+ } else if (rate_flags & IEEE80211_TX_RC_USE_CTS_PROTECT) { -+ tx_desc->txdw4 |= cpu_to_le32(TXDESC32_CTS_SELF_ENABLE); -+ tx_desc->txdw4 |= cpu_to_le32(TXDESC32_HW_RTS_ENABLE); -+ } -+ -+ tx_desc->txdw2 |= cpu_to_le32(TXDESC_ANTENNA_SELECT_A | -+ TXDESC_ANTENNA_SELECT_B); -+ tx_desc->txdw7 |= cpu_to_le32(TXDESC_ANTENNA_SELECT_C); -+} -+ - static void rtl8xxxu_tx(struct ieee80211_hw *hw, - struct ieee80211_tx_control *control, - struct sk_buff *skb) diff --git a/package/kernel/mac80211/patches/660-0036-rtl8xxxu-Add-some-8188eu-registers-and-update-CCK0_A.patch b/package/kernel/mac80211/patches/660-0036-rtl8xxxu-Add-some-8188eu-registers-and-update-CCK0_A.patch deleted file mode 100644 index e7f97a5b9d..0000000000 --- a/package/kernel/mac80211/patches/660-0036-rtl8xxxu-Add-some-8188eu-registers-and-update-CCK0_A.patch +++ /dev/null @@ -1,87 +0,0 @@ -From a9f5a167be625cf0cd157aa38f3635b2b1f0cc0f Mon Sep 17 00:00:00 2001 -From: Jes Sorensen -Date: Fri, 29 Jul 2016 15:25:34 -0400 -Subject: [PATCH] rtl8xxxu: Add some 8188eu registers and update - CCK0_AFE_SETTING bit defines - -CCK0_AFE_SETTING is particular, it has the notion of primary RX antenna -and optional RX antenna. When configuring RX for single antenna, setup -should use the same antenna for default and optional. For AB setup, -use antenna A as default and B as optional. - -In addition add info for 8188eu IOL magic interface used to send -firmware and register init files to the firmware. - -Signed-off-by: Jes Sorensen ---- - .../net/wireless/realtek/rtl8xxxu/rtl8xxxu_regs.h | 30 ++++++++++++++++++++-- - 1 file changed, 28 insertions(+), 2 deletions(-) - ---- a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_regs.h -+++ b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_regs.h -@@ -378,6 +378,11 @@ - #define PBP_PAGE_SIZE_512 0x3 - #define PBP_PAGE_SIZE_1024 0x4 - -+/* 8188eu IOL magic */ -+#define REG_PKT_BUF_ACCESS_CTRL 0x0106 -+#define PKT_BUF_ACCESS_CTRL_TX 0x69 -+#define PKT_BUF_ACCESS_CTRL_RX 0xa5 -+ - #define REG_TRXDMA_CTRL 0x010c - #define TRXDMA_CTRL_RXDMA_AGG_EN BIT(2) - #define TRXDMA_CTRL_VOQ_SHIFT 4 -@@ -449,6 +454,7 @@ - - #define REG_FIFOPAGE 0x0204 - #define REG_TDECTRL 0x0208 -+ - #define REG_TXDMA_OFFSET_CHK 0x020c - #define TXDMA_OFFSET_DROP_DATA_EN BIT(9) - #define REG_TXDMA_STATUS 0x0210 -@@ -938,6 +944,7 @@ - #define REG_FPGA1_RF_MODE 0x0900 - - #define REG_FPGA1_TX_INFO 0x090c -+#define REG_ANT_MAPPING1 0x0914 - #define REG_DPDT_CTRL 0x092c /* 8723BU */ - #define REG_RFE_CTRL_ANTA_SRC 0x0930 /* 8723BU */ - #define REG_RFE_PATH_SELECT 0x0940 /* 8723BU */ -@@ -949,9 +956,25 @@ - - #define REG_CCK0_AFE_SETTING 0x0a04 - #define CCK0_AFE_RX_MASK 0x0f000000 --#define CCK0_AFE_RX_ANT_AB BIT(24) -+#define CCK0_AFE_TX_MASK 0xf0000000 - #define CCK0_AFE_RX_ANT_A 0 --#define CCK0_AFE_RX_ANT_B (BIT(24) | BIT(26)) -+#define CCK0_AFE_RX_ANT_B BIT(26) -+#define CCK0_AFE_RX_ANT_C BIT(27) -+#define CCK0_AFE_RX_ANT_D (BIT(26) | BIT(27)) -+#define CCK0_AFE_RX_ANT_OPTION_A 0 -+#define CCK0_AFE_RX_ANT_OPTION_B BIT(24) -+#define CCK0_AFE_RX_ANT_OPTION_C BIT(25) -+#define CCK0_AFE_RX_ANT_OPTION_D (BIT(24) | BIT(25)) -+#define CCK0_AFE_TX_ANT_A BIT(31) -+#define CCK0_AFE_TX_ANT_B BIT(30) -+ -+#define REG_CCK_ANTDIV_PARA2 0x0a04 -+#define REG_BB_POWER_SAVE4 0x0a74 -+ -+/* 8188eu */ -+#define REG_LNA_SWITCH 0x0b2c -+#define LNA_SWITCH_DISABLE_CSCG BIT(22) -+#define LNA_SWITCH_OUTPUT_CG BIT(31) - - #define REG_CONFIG_ANT_A 0x0b68 - #define REG_CONFIG_ANT_B 0x0b6c -@@ -1004,6 +1027,9 @@ - - #define REG_OFDM0_RX_IQ_EXT_ANTA 0x0ca0 - -+/* 8188eu */ -+#define REG_ANTDIV_PARA1 0x0ca4 -+ - /* 8723bu */ - #define REG_OFDM0_TX_PSDO_NOISE_WEIGHT 0x0ce4 - diff --git a/package/kernel/mac80211/patches/660-0037-rtl8xxxu-Improve-register-description-for-REG_FPGA1_.patch b/package/kernel/mac80211/patches/660-0037-rtl8xxxu-Improve-register-description-for-REG_FPGA1_.patch deleted file mode 100644 index bb940db3c8..0000000000 --- a/package/kernel/mac80211/patches/660-0037-rtl8xxxu-Improve-register-description-for-REG_FPGA1_.patch +++ /dev/null @@ -1,30 +0,0 @@ -From 5731f8a7485120836c42e0dfae61644588ffd119 Mon Sep 17 00:00:00 2001 -From: Jes Sorensen -Date: Fri, 29 Jul 2016 15:57:19 -0400 -Subject: [PATCH] rtl8xxxu: Improve register description for REG_FPGA1_TX_INFO - -This is based on Hal_SetAntenna() from the 8188eu driver - -Signed-off-by: Jes Sorensen ---- - drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_regs.h | 9 +++++++++ - 1 file changed, 9 insertions(+) - ---- a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_regs.h -+++ b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_regs.h -@@ -944,6 +944,15 @@ - #define REG_FPGA1_RF_MODE 0x0900 - - #define REG_FPGA1_TX_INFO 0x090c -+#define FPGA1_TX_ANT_MASK 0x0000000f -+#define FPGA1_TX_ANT_L_MASK 0x000000f0 -+#define FPGA1_TX_ANT_NON_HT_MASK 0x00000f00 -+#define FPGA1_TX_ANT_HT1_MASK 0x0000f000 -+#define FPGA1_TX_ANT_HT2_MASK 0x000f0000 -+#define FPGA1_TX_ANT_HT_S1_MASK 0x00f00000 -+#define FPGA1_TX_ANT_NON_HT_S1_MASK 0x0f000000 -+#define FPGA1_TX_OFDM_TXSC_MASK 0x30000000 -+ - #define REG_ANT_MAPPING1 0x0914 - #define REG_DPDT_CTRL 0x092c /* 8723BU */ - #define REG_RFE_CTRL_ANTA_SRC 0x0930 /* 8723BU */ diff --git a/package/kernel/mac80211/patches/660-0038-rtl8xxxu-properly-detect-RTL8188EU-devices.patch b/package/kernel/mac80211/patches/660-0038-rtl8xxxu-properly-detect-RTL8188EU-devices.patch deleted file mode 100644 index ed3a27be40..0000000000 --- a/package/kernel/mac80211/patches/660-0038-rtl8xxxu-properly-detect-RTL8188EU-devices.patch +++ /dev/null @@ -1,29 +0,0 @@ -From 36c071e30dc5759be3e53ac93459c24fb64d41c3 Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?=C3=81lvaro=20Fern=C3=A1ndez=20Rojas?= -Date: Fri, 29 Jul 2016 18:22:37 +0200 -Subject: [PATCH] rtl8xxxu: properly detect RTL8188EU devices -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -The assumption that all RTL8188EU have chip cut >= C is wrong. -However, RTL8188EU devices can be easily differentiated from RTL8188CU devices -relying on TX report capbility. - -Signed-off-by: Álvaro Fernández Rojas -Signed-off-by: Jes Sorensen ---- - drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - ---- a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c -+++ b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c -@@ -1683,7 +1683,7 @@ static int rtl8xxxu_identify_chip(struct - } - priv->has_wifi = 1; - } else { -- if (priv->chip_cut >= 2) { -+ if (priv->fops->has_tx_report) { - sprintf(priv->chip_name, "8188EU"); - priv->rf_paths = 1; - priv->rx_paths = 1; diff --git a/package/kernel/mac80211/patches/660-0039-rtl8xxxu-Implement-8188eu-specific-8051-reset-functi.patch b/package/kernel/mac80211/patches/660-0039-rtl8xxxu-Implement-8188eu-specific-8051-reset-functi.patch deleted file mode 100644 index 65bab0deee..0000000000 --- a/package/kernel/mac80211/patches/660-0039-rtl8xxxu-Implement-8188eu-specific-8051-reset-functi.patch +++ /dev/null @@ -1,43 +0,0 @@ -From 660a287a0a32ce9f8be9b3ad625c597ad1ed38a2 Mon Sep 17 00:00:00 2001 -From: Jes Sorensen -Date: Wed, 10 Aug 2016 15:40:30 -0400 -Subject: [PATCH] rtl8xxxu: Implement 8188eu specific 8051 reset function - -The 8188eu doesn't seem to require the additional hacks used on some -other chips. - -Signed-off-by: Jes Sorensen ---- - drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_8188e.c | 14 +++++++++++++- - 1 file changed, 13 insertions(+), 1 deletion(-) - ---- a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_8188e.c -+++ b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_8188e.c -@@ -505,6 +505,18 @@ static int rtl8188eu_parse_efuse(struct - return 0; - } - -+void rtl8188eu_reset_8051(struct rtl8xxxu_priv *priv) -+{ -+ u16 sys_func; -+ -+ sys_func = rtl8xxxu_read16(priv, REG_SYS_FUNC); -+ sys_func &= ~SYS_FUNC_CPU_ENABLE; -+ rtl8xxxu_write16(priv, REG_SYS_FUNC, sys_func); -+ -+ sys_func |= SYS_FUNC_CPU_ENABLE; -+ rtl8xxxu_write16(priv, REG_SYS_FUNC, sys_func); -+} -+ - static int rtl8188eu_load_firmware(struct rtl8xxxu_priv *priv) - { - char *fw_name; -@@ -1204,7 +1216,7 @@ struct rtl8xxxu_fileops rtl8188eu_fops = - .load_firmware = rtl8188eu_load_firmware, - .power_on = rtl8188eu_power_on, - .power_off = rtl8xxxu_power_off, -- .reset_8051 = rtl8xxxu_reset_8051, -+ .reset_8051 = rtl8188eu_reset_8051, - .llt_init = rtl8xxxu_auto_llt_table, - .init_phy_bb = rtl8188eu_init_phy_bb, - .init_phy_rf = rtl8188eu_init_phy_rf, diff --git a/package/kernel/mac80211/patches/660-0040-rtl8xxxu-Disable-packet-DMA-aggregation-on-8188eu.patch b/package/kernel/mac80211/patches/660-0040-rtl8xxxu-Disable-packet-DMA-aggregation-on-8188eu.patch deleted file mode 100644 index ada4f2df52..0000000000 --- a/package/kernel/mac80211/patches/660-0040-rtl8xxxu-Disable-packet-DMA-aggregation-on-8188eu.patch +++ /dev/null @@ -1,43 +0,0 @@ -From f435337a2fc97c97476d833700e4a8fd17d99007 Mon Sep 17 00:00:00 2001 -From: Jes Sorensen -Date: Wed, 10 Aug 2016 15:41:13 -0400 -Subject: [PATCH] rtl8xxxu: Disable packet DMA aggregation on 8188eu - -For now disable packet DMA aggregation on the 8188eu, rather then -risking the feature being left on by the init tables. - -Signed-off-by: Jes Sorensen ---- - drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_8188e.c | 14 ++++++++++++++ - 1 file changed, 14 insertions(+) - ---- a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_8188e.c -+++ b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_8188e.c -@@ -461,6 +461,19 @@ void rtl8188eu_config_channel(struct iee - } - } - -+void rtl8188eu_init_aggregation(struct rtl8xxxu_priv *priv) -+{ -+ u8 agg_ctrl, usb_spec; -+ -+ usb_spec = rtl8xxxu_read8(priv, REG_USB_SPECIAL_OPTION); -+ usb_spec &= ~USB_SPEC_USB_AGG_ENABLE; -+ rtl8xxxu_write8(priv, REG_USB_SPECIAL_OPTION, usb_spec); -+ -+ agg_ctrl = rtl8xxxu_read8(priv, REG_TRXDMA_CTRL); -+ agg_ctrl &= ~TRXDMA_CTRL_RXDMA_AGG_EN; -+ rtl8xxxu_write8(priv, REG_TRXDMA_CTRL, agg_ctrl); -+} -+ - static int rtl8188eu_parse_efuse(struct rtl8xxxu_priv *priv) - { - struct rtl8188eu_efuse *efuse = &priv->efuse_wifi.efuse8188eu; -@@ -1223,6 +1236,7 @@ struct rtl8xxxu_fileops rtl8188eu_fops = - .phy_iq_calibrate = rtl8188eu_phy_iq_calibrate, - .config_channel = rtl8188eu_config_channel, - .parse_rx_desc = rtl8xxxu_parse_rxdesc16, -+ .init_aggregation = rtl8188eu_init_aggregation, - .enable_rf = rtl8188e_enable_rf, - .disable_rf = rtl8188e_disable_rf, - .usb_quirks = rtl8188e_usb_quirks, diff --git a/package/kernel/mac80211/patches/660-0041-rtl8xxxu-8188eu-set-REG_OFDM0_XA_AGC_CORE1-to-match-.patch b/package/kernel/mac80211/patches/660-0041-rtl8xxxu-8188eu-set-REG_OFDM0_XA_AGC_CORE1-to-match-.patch deleted file mode 100644 index 0370693e46..0000000000 --- a/package/kernel/mac80211/patches/660-0041-rtl8xxxu-8188eu-set-REG_OFDM0_XA_AGC_CORE1-to-match-.patch +++ /dev/null @@ -1,28 +0,0 @@ -From 4aecb21cdc491804c936a71e98192ba144757ea3 Mon Sep 17 00:00:00 2001 -From: Jes Sorensen -Date: Wed, 10 Aug 2016 16:06:37 -0400 -Subject: [PATCH] rtl8xxxu: 8188eu set REG_OFDM0_XA_AGC_CORE1 to match vendor - driver - -We have no description of this register, so not sure why this differs -from say 8723au. - -Signed-off-by: Jes Sorensen ---- - drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c | 5 ++++- - 1 file changed, 4 insertions(+), 1 deletion(-) - ---- a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c -+++ b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c -@@ -5937,7 +5937,10 @@ exit: - rtl8xxxu_write16(priv, REG_RXFLTMAP2, 0xffff); - rtl8xxxu_write16(priv, REG_RXFLTMAP0, 0xffff); - -- rtl8xxxu_write32(priv, REG_OFDM0_XA_AGC_CORE1, 0x6954341e); -+ if (priv->rtl_chip == RTL8188E) -+ rtl8xxxu_write32(priv, REG_OFDM0_XA_AGC_CORE1, 0x6955341e); -+ else -+ rtl8xxxu_write32(priv, REG_OFDM0_XA_AGC_CORE1, 0x6954341e); - - return ret; - diff --git a/package/kernel/mac80211/patches/660-0042-rtl8xxxu-Fix-rtl8188eu-connection-fail.patch b/package/kernel/mac80211/patches/660-0042-rtl8xxxu-Fix-rtl8188eu-connection-fail.patch deleted file mode 100644 index 1a39cc461a..0000000000 --- a/package/kernel/mac80211/patches/660-0042-rtl8xxxu-Fix-rtl8188eu-connection-fail.patch +++ /dev/null @@ -1,27 +0,0 @@ -From ef6a147ea381e76fa02358aa5b65816121d57a4c Mon Sep 17 00:00:00 2001 -From: Taehee Yoo -Date: Sun, 21 Aug 2016 20:38:22 +0900 -Subject: [PATCH] rtl8xxxu: Fix rtl8188eu connection fail - -rtl8188eu vendor driver's LLT init routine is similar -rtl8xxxu_init_llt_table() than rtl8xxxu_auto_llt_table(). - -So now, rtl8188eu can connect to AP. - -Signed-off-by: Taehee Yoo -Signed-off-by: Jes Sorensen ---- - drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_8188e.c | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - ---- a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_8188e.c -+++ b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_8188e.c -@@ -1230,7 +1230,7 @@ struct rtl8xxxu_fileops rtl8188eu_fops = - .power_on = rtl8188eu_power_on, - .power_off = rtl8xxxu_power_off, - .reset_8051 = rtl8188eu_reset_8051, -- .llt_init = rtl8xxxu_auto_llt_table, -+ .llt_init = rtl8xxxu_init_llt_table, - .init_phy_bb = rtl8188eu_init_phy_bb, - .init_phy_rf = rtl8188eu_init_phy_rf, - .phy_iq_calibrate = rtl8188eu_phy_iq_calibrate, diff --git a/package/kernel/mac80211/patches/660-0043-rtl8xxxu-Do-not-set-auto-rate-fallback-on-8188eu.patch b/package/kernel/mac80211/patches/660-0043-rtl8xxxu-Do-not-set-auto-rate-fallback-on-8188eu.patch deleted file mode 100644 index c69de5b0a7..0000000000 --- a/package/kernel/mac80211/patches/660-0043-rtl8xxxu-Do-not-set-auto-rate-fallback-on-8188eu.patch +++ /dev/null @@ -1,93 +0,0 @@ -From 738832d9e91098f5b3ddb4e71fe8e666575c6bdb Mon Sep 17 00:00:00 2001 -From: Jes Sorensen -Date: Wed, 24 Aug 2016 13:54:00 -0400 -Subject: [PATCH] rtl8xxxu: Do not set auto rate fallback on 8188eu - -Introduce a fileops flag to indicate whether the device has this -feature. - -Reported-by: Taehee Yoo -Signed-off-by: Jes Sorensen ---- - drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu.h | 1 + - drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_8192c.c | 1 + - drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_8192e.c | 1 + - drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_8723a.c | 1 + - drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_8723b.c | 1 + - drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c | 15 ++++++++++----- - 6 files changed, 15 insertions(+), 5 deletions(-) - ---- a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu.h -+++ b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu.h -@@ -1398,6 +1398,7 @@ struct rtl8xxxu_fileops { - u8 has_s0s1:1; - u8 has_tx_report:1; - u8 gen2_thermal_meter:1; -+ u8 has_darfrc:1; - u32 adda_1t_init; - u32 adda_1t_path_on; - u32 adda_2t_path_on_a; ---- a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_8192c.c -+++ b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_8192c.c -@@ -572,6 +572,7 @@ struct rtl8xxxu_fileops rtl8192cu_fops = - .rx_agg_buf_size = 16000, - .tx_desc_size = sizeof(struct rtl8xxxu_txdesc32), - .rx_desc_size = sizeof(struct rtl8xxxu_rxdesc16), -+ .has_darfrc = 1, - .adda_1t_init = 0x0b1b25a0, - .adda_1t_path_on = 0x0bdb25a0, - .adda_2t_path_on_a = 0x04db25a4, ---- a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_8192e.c -+++ b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_8192e.c -@@ -1655,6 +1655,7 @@ struct rtl8xxxu_fileops rtl8192eu_fops = - .rx_desc_size = sizeof(struct rtl8xxxu_rxdesc24), - .has_s0s1 = 0, - .gen2_thermal_meter = 1, -+ .has_darfrc = 1, - .adda_1t_init = 0x0fc01616, - .adda_1t_path_on = 0x0fc01616, - .adda_2t_path_on_a = 0x0fc01616, ---- a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_8723a.c -+++ b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_8723a.c -@@ -389,6 +389,7 @@ struct rtl8xxxu_fileops rtl8723au_fops = - .rx_agg_buf_size = 16000, - .tx_desc_size = sizeof(struct rtl8xxxu_txdesc32), - .rx_desc_size = sizeof(struct rtl8xxxu_rxdesc16), -+ .has_darfrc = 1, - .adda_1t_init = 0x0b1b25a0, - .adda_1t_path_on = 0x0bdb25a0, - .adda_2t_path_on_a = 0x04db25a4, ---- a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_8723b.c -+++ b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_8723b.c -@@ -1673,6 +1673,7 @@ struct rtl8xxxu_fileops rtl8723bu_fops = - .has_s0s1 = 1, - .has_tx_report = 1, - .gen2_thermal_meter = 1, -+ .has_darfrc = 1, - .adda_1t_init = 0x01c00014, - .adda_1t_path_on = 0x01c00014, - .adda_2t_path_on_a = 0x01c00014, ---- a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c -+++ b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c -@@ -4105,11 +4105,16 @@ static int rtl8xxxu_init_device(struct i - rtl8xxxu_write32(priv, REG_EDCA_VI_PARAM, 0x005ea324); - rtl8xxxu_write32(priv, REG_EDCA_VO_PARAM, 0x002fa226); - -- /* Set data auto rate fallback retry count */ -- rtl8xxxu_write32(priv, REG_DARFRC, 0x00000000); -- rtl8xxxu_write32(priv, REG_DARFRC + 4, 0x10080404); -- rtl8xxxu_write32(priv, REG_RARFRC, 0x04030201); -- rtl8xxxu_write32(priv, REG_RARFRC + 4, 0x08070605); -+ /* -+ * Set data auto rate fallback retry count. -+ * Notably the 8188eu doesn't seem to use this -+ */ -+ if (fops->has_darfrc) { -+ rtl8xxxu_write32(priv, REG_DARFRC, 0x00000000); -+ rtl8xxxu_write32(priv, REG_DARFRC + 4, 0x10080404); -+ rtl8xxxu_write32(priv, REG_RARFRC, 0x04030201); -+ rtl8xxxu_write32(priv, REG_RARFRC + 4, 0x08070605); -+ } - - val8 = rtl8xxxu_read8(priv, REG_FWHW_TXQ_CTRL); - val8 |= FWHW_TXQ_CTRL_AMPDU_RETRY; diff --git a/package/kernel/mac80211/patches/660-0044-rtl8xxxu-Enable-8188eu-driver.patch b/package/kernel/mac80211/patches/660-0044-rtl8xxxu-Enable-8188eu-driver.patch deleted file mode 100644 index 49aba984b5..0000000000 --- a/package/kernel/mac80211/patches/660-0044-rtl8xxxu-Enable-8188eu-driver.patch +++ /dev/null @@ -1,22 +0,0 @@ -From b7aed472c6639e2a523d0ef90dba61246d7bd9b4 Mon Sep 17 00:00:00 2001 -From: Jes Sorensen -Date: Mon, 25 Jul 2016 12:32:02 -0400 -Subject: [PATCH] rtl8xxxu: Enable 8188eu driver - -This enables the 8188eu driver - this should work by now. - -Signed-off-by: Jes Sorensen ---- - drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_8188e.c | 1 - - 1 file changed, 1 deletion(-) - ---- a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_8188e.c -+++ b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_8188e.c -@@ -539,7 +539,6 @@ static int rtl8188eu_load_firmware(struc - - ret = rtl8xxxu_load_firmware(priv, fw_name); - -- return -EINVAL; - return ret; - } - diff --git a/package/kernel/mac80211/patches/660-0045-rtl8xxxu-Add-rtl8188etv-to-USB-device-list.patch b/package/kernel/mac80211/patches/660-0045-rtl8xxxu-Add-rtl8188etv-to-USB-device-list.patch deleted file mode 100644 index 6bc507797c..0000000000 --- a/package/kernel/mac80211/patches/660-0045-rtl8xxxu-Add-rtl8188etv-to-USB-device-list.patch +++ /dev/null @@ -1,25 +0,0 @@ -From 13d8b1bb62307242615f1bebd67d165a91b9f7d5 Mon Sep 17 00:00:00 2001 -From: Jes Sorensen -Date: Fri, 26 Aug 2016 10:28:45 -0400 -Subject: [PATCH] rtl8xxxu: Add rtl8188etv to USB device list - -Hans de Goede reported this works for him with two different tablets. - -Reported-by: Hans de Goede -Signed-off-by: Jes Sorensen ---- - drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c | 3 +++ - 1 file changed, 3 insertions(+) - ---- a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c -+++ b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c -@@ -6309,6 +6309,9 @@ static struct usb_device_id dev_table[] - #ifdef CPTCFG_RTL8XXXU_UNTESTED - {USB_DEVICE_AND_INTERFACE_INFO(USB_VENDOR_ID_REALTEK, 0x8179, 0xff, 0xff, 0xff), - .driver_info = (unsigned long)&rtl8188eu_fops}, -+/* Tested by Hans de Goede - rtl8188etv */ -+{USB_DEVICE_AND_INTERFACE_INFO(USB_VENDOR_ID_REALTEK, 0x0179, 0xff, 0xff, 0xff), -+ .driver_info = (unsigned long)&rtl8188eu_fops}, - /* Still supported by rtlwifi */ - {USB_DEVICE_AND_INTERFACE_INFO(USB_VENDOR_ID_REALTEK, 0x8176, 0xff, 0xff, 0xff), - .driver_info = (unsigned long)&rtl8192cu_fops}, diff --git a/package/kernel/mac80211/patches/660-0046-rtl8xxxu-Add-sitecom-dongle-to-USB-device-list.patch b/package/kernel/mac80211/patches/660-0046-rtl8xxxu-Add-sitecom-dongle-to-USB-device-list.patch deleted file mode 100644 index 3797206359..0000000000 --- a/package/kernel/mac80211/patches/660-0046-rtl8xxxu-Add-sitecom-dongle-to-USB-device-list.patch +++ /dev/null @@ -1,23 +0,0 @@ -From e7be61a187c902ae296acf70981a899e9e34a885 Mon Sep 17 00:00:00 2001 -From: Andrea Merello -Date: Fri, 26 Aug 2016 19:18:17 +0200 -Subject: [PATCH] rtl8xxxu: Add sitecom dongle to USB device list - -Signed-off-by: Andrea Merello -Signed-off-by: Jes Sorensen ---- - drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c | 3 +++ - 1 file changed, 3 insertions(+) - ---- a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c -+++ b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c -@@ -6312,6 +6312,9 @@ static struct usb_device_id dev_table[] - /* Tested by Hans de Goede - rtl8188etv */ - {USB_DEVICE_AND_INTERFACE_INFO(USB_VENDOR_ID_REALTEK, 0x0179, 0xff, 0xff, 0xff), - .driver_info = (unsigned long)&rtl8188eu_fops}, -+/* Sitecom rtl8188eus */ -+{USB_DEVICE_AND_INTERFACE_INFO(0x0df6, 0x0076, 0xff, 0xff, 0xff), -+ .driver_info = (unsigned long)&rtl8188eu_fops}, - /* Still supported by rtlwifi */ - {USB_DEVICE_AND_INTERFACE_INFO(USB_VENDOR_ID_REALTEK, 0x8176, 0xff, 0xff, 0xff), - .driver_info = (unsigned long)&rtl8192cu_fops}, diff --git a/package/kernel/mac80211/patches/660-0047-rtl8xxxu-Implement-rtl8188eu_active_to_emu.patch b/package/kernel/mac80211/patches/660-0047-rtl8xxxu-Implement-rtl8188eu_active_to_emu.patch deleted file mode 100644 index 853f2f9ec4..0000000000 --- a/package/kernel/mac80211/patches/660-0047-rtl8xxxu-Implement-rtl8188eu_active_to_emu.patch +++ /dev/null @@ -1,68 +0,0 @@ -From b3edeceb7c8c3b0eb70b26e3237afa5086afe8ed Mon Sep 17 00:00:00 2001 -From: Jes Sorensen -Date: Fri, 26 Aug 2016 15:16:32 -0400 -Subject: [PATCH] rtl8xxxu: Implement rtl8188eu_active_to_emu() - -Per the vendor driver's sequence table, this seems to be the correct -way to disable RF on the 8188eu, even if the driver doesn't actually -call the sequence by itself. - -Signed-off-by: Jes Sorensen ---- - .../net/wireless/realtek/rtl8xxxu/rtl8xxxu_8188e.c | 38 ++++++++++++++++++++++ - 1 file changed, 38 insertions(+) - ---- a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_8188e.c -+++ b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_8188e.c -@@ -1155,6 +1155,42 @@ exit: - return ret; - } - -+static int rtl8188eu_active_to_emu(struct rtl8xxxu_priv *priv) -+{ -+ u8 val8; -+ int count, ret = 0; -+ -+ /* Turn off RF */ -+ rtl8xxxu_write8(priv, REG_RF_CTRL, 0); -+ -+ /* LDO Sleep mode */ -+ val8 = rtl8xxxu_read8(priv, REG_LPLDO_CTRL); -+ val8 |= BIT(4); -+ rtl8xxxu_write8(priv, REG_LPLDO_CTRL, val8); -+ -+ /* 0x0005[1] = 1 turn off MAC by HW state machine*/ -+ val8 = rtl8xxxu_read8(priv, REG_APS_FSMCO + 1); -+ val8 |= BIT(1); -+ rtl8xxxu_write8(priv, REG_APS_FSMCO + 1, val8); -+ -+ for (count = RTL8XXXU_MAX_REG_POLL; count; count--) { -+ val8 = rtl8xxxu_read8(priv, REG_APS_FSMCO + 1); -+ if ((val8 & BIT(1)) == 0) -+ break; -+ udelay(10); -+ } -+ -+ if (!count) { -+ dev_warn(&priv->udev->dev, "%s: Disabling MAC timed out\n", -+ __func__); -+ ret = -EBUSY; -+ goto exit; -+ } -+ -+exit: -+ return ret; -+} -+ - static int rtl8188eu_power_on(struct rtl8xxxu_priv *priv) - { - u16 val16; -@@ -1202,6 +1238,8 @@ static void rtl8188e_disable_rf(struct r - rtl8xxxu_write_rfreg(priv, RF_A, RF6052_REG_AC, 0); - if (priv->rf_paths == 2) - rtl8xxxu_write_rfreg(priv, RF_B, RF6052_REG_AC, 0); -+ -+ rtl8188eu_active_to_emu(priv); - } - - static void rtl8188e_usb_quirks(struct rtl8xxxu_priv *priv) diff --git a/package/kernel/mac80211/patches/660-0048-rtl8xxxu-Implement-rtl8188eu_power_off.patch b/package/kernel/mac80211/patches/660-0048-rtl8xxxu-Implement-rtl8188eu_power_off.patch deleted file mode 100644 index 69b0f02852..0000000000 --- a/package/kernel/mac80211/patches/660-0048-rtl8xxxu-Implement-rtl8188eu_power_off.patch +++ /dev/null @@ -1,185 +0,0 @@ -From 34e65b6f310234cf3e3629bd3d896a4f84df71f4 Mon Sep 17 00:00:00 2001 -From: Jes Sorensen -Date: Fri, 26 Aug 2016 16:09:00 -0400 -Subject: [PATCH] rtl8xxxu: Implement rtl8188eu_power_off() - -This makes the driver match the poweroff sequence of the vendor driver -and allows the firmware to reload correctly upon rmmod/insmod. -However the device still doesn't receive data upon reloading. - -Signed-off-by: Jes Sorensen ---- - .../net/wireless/realtek/rtl8xxxu/rtl8xxxu_8188e.c | 136 ++++++++++++++++++++- - .../net/wireless/realtek/rtl8xxxu/rtl8xxxu_regs.h | 2 + - 2 files changed, 137 insertions(+), 1 deletion(-) - ---- a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_8188e.c -+++ b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_8188e.c -@@ -1191,6 +1191,71 @@ exit: - return ret; - } - -+static int rtl8188eu_emu_to_disabled(struct rtl8xxxu_priv *priv) -+{ -+ u8 val8; -+ -+ /* 0x04[12:11] = 01 enable WL suspend */ -+ val8 = rtl8xxxu_read8(priv, REG_APS_FSMCO + 2); -+ val8 &= ~BIT(0); -+ rtl8xxxu_write8(priv, REG_APS_FSMCO + 2, val8); -+ -+ val8 = rtl8xxxu_read8(priv, REG_APS_FSMCO + 1); -+ val8 |= BIT(7); -+ rtl8xxxu_write8(priv, REG_APS_FSMCO + 1, val8); -+ -+ return 0; -+} -+ -+static int rtl8188eu_active_to_lps(struct rtl8xxxu_priv *priv) -+{ -+ struct device *dev = &priv->udev->dev; -+ u8 val8; -+ u16 val16; -+ u32 val32; -+ int retry, retval; -+ -+ rtl8xxxu_write8(priv, REG_TXPAUSE, 0x7f); -+ -+ retry = 100; -+ retval = -EBUSY; -+ /* -+ * Poll 32 bit wide 0x05f8 for 0x00000000 to ensure no TX is pending. -+ */ -+ do { -+ val32 = rtl8xxxu_read32(priv, 0x05f8); -+ if (!val32) { -+ retval = 0; -+ break; -+ } -+ } while (retry--); -+ -+ if (!retry) { -+ dev_warn(dev, "Failed to flush TX queue\n"); -+ retval = -EBUSY; -+ goto out; -+ } -+ -+ /* Disable CCK and OFDM, clock gated */ -+ val8 = rtl8xxxu_read8(priv, REG_SYS_FUNC); -+ val8 &= ~SYS_FUNC_BBRSTB; -+ rtl8xxxu_write8(priv, REG_SYS_FUNC, val8); -+ -+ udelay(2); -+ -+ /* Reset MAC TRX */ -+ val16 = rtl8xxxu_read16(priv, REG_CR); -+ val16 &= ~(CR_MAC_TX_ENABLE | CR_MAC_RX_ENABLE | CR_SECURITY_ENABLE); -+ rtl8xxxu_write16(priv, REG_CR, val16); -+ -+ val8 = rtl8xxxu_read8(priv, REG_DUAL_TSF_RST); -+ val8 |= DUAL_TSF_TX_OK; -+ rtl8xxxu_write8(priv, REG_DUAL_TSF_RST, val8); -+ -+out: -+ return retval; -+} -+ - static int rtl8188eu_power_on(struct rtl8xxxu_priv *priv) - { - u16 val16; -@@ -1221,6 +1286,75 @@ exit: - return ret; - } - -+void rtl8188eu_power_off(struct rtl8xxxu_priv *priv) -+{ -+ u8 val8; -+ u16 val16; -+ -+ rtl8xxxu_flush_fifo(priv); -+ -+ val8 = rtl8xxxu_read8(priv, REG_TX_REPORT_CTRL); -+ val8 &= ~TX_REPORT_CTRL_TIMER_ENABLE; -+ rtl8xxxu_write8(priv, REG_TX_REPORT_CTRL, val8); -+ -+ /* Turn off RF */ -+ rtl8xxxu_write8(priv, REG_RF_CTRL, 0x00); -+ -+ rtl8188eu_active_to_lps(priv); -+ -+ /* Reset Firmware if running in RAM */ -+ if (rtl8xxxu_read8(priv, REG_MCU_FW_DL) & MCU_FW_RAM_SEL) -+ rtl8xxxu_firmware_self_reset(priv); -+ -+ /* Reset MCU */ -+ val16 = rtl8xxxu_read16(priv, REG_SYS_FUNC); -+ val16 &= ~SYS_FUNC_CPU_ENABLE; -+ rtl8xxxu_write16(priv, REG_SYS_FUNC, val16); -+ -+ /* Reset MCU ready status */ -+ rtl8xxxu_write8(priv, REG_MCU_FW_DL, 0x00); -+ -+ /* 32K_CTRL looks to be very 8188e specific */ -+ val8 = rtl8xxxu_read8(priv, REG_32K_CTRL); -+ val8 &= ~BIT(0); -+ rtl8xxxu_write8(priv, REG_32K_CTRL, val8); -+ -+ rtl8188eu_active_to_emu(priv); -+ rtl8188eu_emu_to_disabled(priv); -+ -+ /* Reset MCU IO Wrapper */ -+ val8 = rtl8xxxu_read8(priv, REG_RSV_CTRL + 1); -+ val8 &= ~BIT(3); -+ rtl8xxxu_write8(priv, REG_RSV_CTRL + 1, val8); -+ -+ val8 = rtl8xxxu_read8(priv, REG_RSV_CTRL + 1); -+ val8 |= BIT(3); -+ rtl8xxxu_write8(priv, REG_RSV_CTRL + 1, val8); -+ -+ /* Vendor driver refers to GPIO_IN */ -+ val8 = rtl8xxxu_read8(priv, REG_GPIO_PIN_CTRL); -+ /* Vendor driver refers to GPIO_OUT */ -+ rtl8xxxu_write8(priv, REG_GPIO_PIN_CTRL + 1, val8); -+ rtl8xxxu_write8(priv, REG_GPIO_PIN_CTRL + 2, 0xff); -+ -+ val8 = rtl8xxxu_read8(priv, REG_GPIO_IO_SEL); -+ rtl8xxxu_write8(priv, REG_GPIO_IO_SEL + 1, val8 << 4); -+ val8 = rtl8xxxu_read8(priv, REG_GPIO_IO_SEL + 1); -+ rtl8xxxu_write8(priv, REG_GPIO_IO_SEL + 1, val8 | 0x0f); -+ -+ /* -+ * Set LNA, TRSW, EX_PA Pin to output mode -+ * Referred to as REG_BB_PAD_CTRL in 8188eu vendor driver -+ */ -+ rtl8xxxu_write32(priv, REG_PAD_CTRL1, 0x00080808); -+ -+ rtl8xxxu_write8(priv, REG_RSV_CTRL, 0x00); -+ -+ val16 = rtl8xxxu_read16(priv, REG_APS_FSMCO); -+ val16 |= APS_FSMCO_ENABLE_POWERDOWN | APS_FSMCO_HW_POWERDOWN; -+ rtl8xxxu_write16(priv, REG_APS_FSMCO, val16); -+} -+ - static void rtl8188e_enable_rf(struct rtl8xxxu_priv *priv) - { - rtl8xxxu_write8(priv, REG_TXPAUSE, 0x00); -@@ -1265,7 +1399,7 @@ struct rtl8xxxu_fileops rtl8188eu_fops = - .parse_efuse = rtl8188eu_parse_efuse, - .load_firmware = rtl8188eu_load_firmware, - .power_on = rtl8188eu_power_on, -- .power_off = rtl8xxxu_power_off, -+ .power_off = rtl8188eu_power_off, - .reset_8051 = rtl8188eu_reset_8051, - .llt_init = rtl8xxxu_init_llt_table, - .init_phy_bb = rtl8188eu_init_phy_bb, ---- a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_regs.h -+++ b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_regs.h -@@ -418,6 +418,8 @@ - #define REG_MBIST_START 0x0174 - #define REG_MBIST_DONE 0x0178 - #define REG_MBIST_FAIL 0x017c -+/* 8188EU */ -+#define REG_32K_CTRL 0x0194 - #define REG_C2HEVT_MSG_NORMAL 0x01a0 - /* 8192EU/8723BU/8812 */ - #define REG_C2HEVT_CMD_ID_8723B 0x01ae diff --git a/package/kernel/mac80211/patches/660-0049-rtl8xxxu-Add-rtl8188eu-USB-ID-for-D-Link-USB-GO-N150.patch b/package/kernel/mac80211/patches/660-0049-rtl8xxxu-Add-rtl8188eu-USB-ID-for-D-Link-USB-GO-N150.patch deleted file mode 100644 index 1c3df95796..0000000000 --- a/package/kernel/mac80211/patches/660-0049-rtl8xxxu-Add-rtl8188eu-USB-ID-for-D-Link-USB-GO-N150.patch +++ /dev/null @@ -1,25 +0,0 @@ -From 5cd16e6a4660c07f01753e460eafdb805e71b9e9 Mon Sep 17 00:00:00 2001 -From: Jes Sorensen -Date: Mon, 29 Aug 2016 12:55:37 -0400 -Subject: [PATCH] rtl8xxxu: Add rtl8188eu USB ID for D-Link USB-GO-N150 - -Received one in the mail yesterday, seems to work like all the other -8188eu dongles I have. - -Signed-off-by: Jes Sorensen ---- - drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c | 3 +++ - 1 file changed, 3 insertions(+) - ---- a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c -+++ b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c -@@ -6315,6 +6315,9 @@ static struct usb_device_id dev_table[] - /* Sitecom rtl8188eus */ - {USB_DEVICE_AND_INTERFACE_INFO(0x0df6, 0x0076, 0xff, 0xff, 0xff), - .driver_info = (unsigned long)&rtl8188eu_fops}, -+/* D-Link USB-GO-N150 */ -+{USB_DEVICE_AND_INTERFACE_INFO(0x2001, 0x3311, 0xff, 0xff, 0xff), -+ .driver_info = (unsigned long)&rtl8188eu_fops}, - /* Still supported by rtlwifi */ - {USB_DEVICE_AND_INTERFACE_INFO(USB_VENDOR_ID_REALTEK, 0x8176, 0xff, 0xff, 0xff), - .driver_info = (unsigned long)&rtl8192cu_fops}, diff --git a/package/kernel/mac80211/patches/660-0050-rtl8xxxu-Clear-SYS_FUNC_UPLL-during-power-up-on-8188.patch b/package/kernel/mac80211/patches/660-0050-rtl8xxxu-Clear-SYS_FUNC_UPLL-during-power-up-on-8188.patch deleted file mode 100644 index 2c7413e35b..0000000000 --- a/package/kernel/mac80211/patches/660-0050-rtl8xxxu-Clear-SYS_FUNC_UPLL-during-power-up-on-8188.patch +++ /dev/null @@ -1,23 +0,0 @@ -From 59a94447d4a98ab56cefe0b277251c660a333ce0 Mon Sep 17 00:00:00 2001 -From: Jes Sorensen -Date: Tue, 30 Aug 2016 14:33:18 -0400 -Subject: [PATCH] rtl8xxxu: Clear SYS_FUNC_UPLL during power up on 8188eu - -The vendor driver doesn't set this bit during BB config, so avoid -setting it here too. - -Signed-off-by: Jes Sorensen ---- - drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_8188e.c | 1 + - 1 file changed, 1 insertion(+) - ---- a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_8188e.c -+++ b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_8188e.c -@@ -561,6 +561,7 @@ static void rtl8188eu_init_phy_bb(struct - val16 = rtl8xxxu_read16(priv, REG_SYS_FUNC); - val16 |= (SYS_FUNC_USBA | SYS_FUNC_USBD | - SYS_FUNC_BB_GLB_RSTN | SYS_FUNC_BBRSTB); -+ val16 &= ~SYS_FUNC_UPLL; - rtl8xxxu_write16(priv, REG_SYS_FUNC, val16); - - rtl8xxxu_init_phy_regs(priv, rtl8188eu_phy_init_table); diff --git a/package/kernel/mac80211/patches/660-0051-rtl8xxxu-Early-enable-of-WEP-TKIP-security-on-8188eu.patch b/package/kernel/mac80211/patches/660-0051-rtl8xxxu-Early-enable-of-WEP-TKIP-security-on-8188eu.patch deleted file mode 100644 index 56be43a599..0000000000 --- a/package/kernel/mac80211/patches/660-0051-rtl8xxxu-Early-enable-of-WEP-TKIP-security-on-8188eu.patch +++ /dev/null @@ -1,25 +0,0 @@ -From 845f14c57fd50ec7e94f59bb1b5ad0cd1ecdbdd1 Mon Sep 17 00:00:00 2001 -From: Jes Sorensen -Date: Tue, 30 Aug 2016 15:47:05 -0400 -Subject: [PATCH] rtl8xxxu: Early enable of WEP/TKIP security on 8188eu - -This matches action taken in the vendor driver, however it is unclear -why this is done. - -Signed-off-by: Jes Sorensen ---- - drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_8188e.c | 3 +++ - 1 file changed, 3 insertions(+) - ---- a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_8188e.c -+++ b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_8188e.c -@@ -1394,6 +1394,9 @@ static void rtl8188e_usb_quirks(struct r - val32 = rtl8xxxu_read32(priv, REG_TXDMA_OFFSET_CHK); - val32 |= TXDMA_OFFSET_DROP_DATA_EN; - rtl8xxxu_write32(priv, REG_TXDMA_OFFSET_CHK, val32); -+ -+ /* Pre-TX enable WEP/TKIP security */ -+ rtl8xxxu_write8(priv, REG_EARLY_MODE_CONTROL_8188E + 3, 0x01); - } - - struct rtl8xxxu_fileops rtl8188eu_fops = { diff --git a/package/kernel/mac80211/patches/660-0052-rtl8xxxu-Correct-power-down-sequence-for-8188eu.patch b/package/kernel/mac80211/patches/660-0052-rtl8xxxu-Correct-power-down-sequence-for-8188eu.patch deleted file mode 100644 index 603785b5d2..0000000000 --- a/package/kernel/mac80211/patches/660-0052-rtl8xxxu-Correct-power-down-sequence-for-8188eu.patch +++ /dev/null @@ -1,65 +0,0 @@ -From 2764703c3c896d427731391aa978c536aaf4cb91 Mon Sep 17 00:00:00 2001 -From: Jes Sorensen -Date: Tue, 30 Aug 2016 17:23:35 -0400 -Subject: [PATCH] rtl8xxxu: Correct power down sequence for 8188eu - -This matches the vendor driver more correctly - -Signed-off-by: Jes Sorensen ---- - .../net/wireless/realtek/rtl8xxxu/rtl8xxxu_8188e.c | 26 ++++++++++++++++------ - 1 file changed, 19 insertions(+), 7 deletions(-) - ---- a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_8188e.c -+++ b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_8188e.c -@@ -1083,7 +1083,8 @@ static void rtl8188e_disabled_to_emu(str - u16 val16; - - val16 = rtl8xxxu_read16(priv, REG_APS_FSMCO); -- val16 &= ~(APS_FSMCO_PFM_WOWL | APS_FSMCO_ENABLE_POWERDOWN); -+ val16 &= ~(APS_FSMCO_PFM_WOWL | APS_FSMCO_ENABLE_POWERDOWN | -+ APS_FSMCO_HW_POWERDOWN); - rtl8xxxu_write16(priv, REG_APS_FSMCO, val16); - } - -@@ -1196,15 +1197,26 @@ static int rtl8188eu_emu_to_disabled(str - { - u8 val8; - -- /* 0x04[12:11] = 01 enable WL suspend */ -- val8 = rtl8xxxu_read8(priv, REG_APS_FSMCO + 2); -- val8 &= ~BIT(0); -- rtl8xxxu_write8(priv, REG_APS_FSMCO + 2, val8); -+ val8 = rtl8xxxu_read8(priv, REG_AFE_XTAL_CTRL + 2); -+ val8 |= BIT(7); -+ rtl8xxxu_write8(priv, REG_AFE_XTAL_CTRL + 2, val8); - - val8 = rtl8xxxu_read8(priv, REG_APS_FSMCO + 1); -- val8 |= BIT(7); -+ val8 &= ~(BIT(3) | BIT(4)); -+ val8 |= BIT(3); - rtl8xxxu_write8(priv, REG_APS_FSMCO + 1, val8); - -+ rtl8xxxu_write8(priv, REG_APS_FSMCO + 3, 0x00); -+ -+ val8 = rtl8xxxu_read8(priv, REG_GPIO_MUXCFG + 1); -+ val8 &= ~BIT(4); -+ rtl8xxxu_write8(priv, REG_GPIO_MUXCFG + 1, val8); -+ -+ /* Set USB suspend enable local register 0xfe10[4]=1 */ -+ val8 = rtl8xxxu_read8(priv, 0xfe10); -+ val8 |= BIT(4); -+ rtl8xxxu_write8(priv, 0xfe10, val8); -+ - return 0; - } - -@@ -1339,7 +1351,7 @@ void rtl8188eu_power_off(struct rtl8xxxu - rtl8xxxu_write8(priv, REG_GPIO_PIN_CTRL + 2, 0xff); - - val8 = rtl8xxxu_read8(priv, REG_GPIO_IO_SEL); -- rtl8xxxu_write8(priv, REG_GPIO_IO_SEL + 1, val8 << 4); -+ rtl8xxxu_write8(priv, REG_GPIO_IO_SEL, val8 << 4); - val8 = rtl8xxxu_read8(priv, REG_GPIO_IO_SEL + 1); - rtl8xxxu_write8(priv, REG_GPIO_IO_SEL + 1, val8 | 0x0f); - diff --git a/package/kernel/mac80211/patches/660-0053-rtl8xxxu-Reset-8188eu-REG_GPIO_MUXCFG-on-power-off.patch b/package/kernel/mac80211/patches/660-0053-rtl8xxxu-Reset-8188eu-REG_GPIO_MUXCFG-on-power-off.patch deleted file mode 100644 index 9da901f93b..0000000000 --- a/package/kernel/mac80211/patches/660-0053-rtl8xxxu-Reset-8188eu-REG_GPIO_MUXCFG-on-power-off.patch +++ /dev/null @@ -1,21 +0,0 @@ -From 89bc2e59923ffc65b4b4fc123ef152c1a9a49639 Mon Sep 17 00:00:00 2001 -From: Jes Sorensen -Date: Tue, 30 Aug 2016 17:30:14 -0400 -Subject: [PATCH] rtl8xxxu: Reset 8188eu REG_GPIO_MUXCFG on power off - -Signed-off-by: Jes Sorensen ---- - drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_8188e.c | 2 ++ - 1 file changed, 2 insertions(+) - ---- a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_8188e.c -+++ b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_8188e.c -@@ -1363,6 +1363,8 @@ void rtl8188eu_power_off(struct rtl8xxxu - - rtl8xxxu_write8(priv, REG_RSV_CTRL, 0x00); - -+ rtl8xxxu_write32(priv, REG_GPIO_MUXCFG, 0x00000000); -+ - val16 = rtl8xxxu_read16(priv, REG_APS_FSMCO); - val16 |= APS_FSMCO_ENABLE_POWERDOWN | APS_FSMCO_HW_POWERDOWN; - rtl8xxxu_write16(priv, REG_APS_FSMCO, val16); diff --git a/package/kernel/mac80211/patches/660-0054-rtl8xxxu-Handle-devices-with-a-smaller-LLT-buffer.patch b/package/kernel/mac80211/patches/660-0054-rtl8xxxu-Handle-devices-with-a-smaller-LLT-buffer.patch deleted file mode 100644 index 49a9f8bd8a..0000000000 --- a/package/kernel/mac80211/patches/660-0054-rtl8xxxu-Handle-devices-with-a-smaller-LLT-buffer.patch +++ /dev/null @@ -1,70 +0,0 @@ -From 5dd3f1799baf4683c0161f7e49d65bee17f3e35d Mon Sep 17 00:00:00 2001 -From: Jes Sorensen -Date: Wed, 31 Aug 2016 16:31:38 -0400 -Subject: [PATCH] rtl8xxxu: Handle devices with a smaller LLT buffer - -The 8188e (except for I cut parts) seem to have a smaller LLT buffer -than all other known devices. - -Signed-off-by: Jes Sorensen ---- - drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu.h | 1 + - drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_8188e.c | 1 + - drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c | 11 ++++++++--- - 3 files changed, 10 insertions(+), 3 deletions(-) - ---- a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu.h -+++ b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu.h -@@ -1411,6 +1411,7 @@ struct rtl8xxxu_fileops { - u8 page_num_hi; - u8 page_num_lo; - u8 page_num_norm; -+ u8 last_llt_entry; - }; - - extern int rtl8xxxu_debug; ---- a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_8188e.c -+++ b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_8188e.c -@@ -1454,4 +1454,5 @@ struct rtl8xxxu_fileops rtl8188eu_fops = - .page_num_hi = TX_PAGE_NUM_HI_PQ_8188E, - .page_num_lo = TX_PAGE_NUM_LO_PQ_8188E, - .page_num_norm = TX_PAGE_NUM_NORM_PQ_8188E, -+ .last_llt_entry = 176, - }; ---- a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c -+++ b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c -@@ -2485,11 +2485,16 @@ static int rtl8xxxu_llt_write(struct rtl - int rtl8xxxu_init_llt_table(struct rtl8xxxu_priv *priv) - { - int ret; -- int i; -+ int i, last_entry; - u8 last_tx_page; - - last_tx_page = priv->fops->total_page_num; - -+ if (priv->fops->last_llt_entry) -+ last_entry = priv->fops->last_llt_entry; -+ else -+ last_entry = 255; -+ - for (i = 0; i < last_tx_page; i++) { - ret = rtl8xxxu_llt_write(priv, i, i + 1); - if (ret) -@@ -2501,14 +2506,14 @@ int rtl8xxxu_init_llt_table(struct rtl8x - goto exit; - - /* Mark remaining pages as a ring buffer */ -- for (i = last_tx_page + 1; i < 0xff; i++) { -+ for (i = last_tx_page + 1; i < last_entry; i++) { - ret = rtl8xxxu_llt_write(priv, i, (i + 1)); - if (ret) - goto exit; - } - - /* Let last entry point to the start entry of ring buffer */ -- ret = rtl8xxxu_llt_write(priv, 0xff, last_tx_page + 1); -+ ret = rtl8xxxu_llt_write(priv, last_entry, last_tx_page + 1); - if (ret) - goto exit; - diff --git a/package/kernel/mac80211/patches/660-0055-rtl8xxxu-Fix-reloading-of-driver-for-8188eu-devices.patch b/package/kernel/mac80211/patches/660-0055-rtl8xxxu-Fix-reloading-of-driver-for-8188eu-devices.patch deleted file mode 100644 index dc0b19161e..0000000000 --- a/package/kernel/mac80211/patches/660-0055-rtl8xxxu-Fix-reloading-of-driver-for-8188eu-devices.patch +++ /dev/null @@ -1,72 +0,0 @@ -From 7b4161933d0a409023f5ef70cdc9296ab1cf5430 Mon Sep 17 00:00:00 2001 -From: Jes Sorensen -Date: Wed, 14 Sep 2016 14:10:42 -0400 -Subject: [PATCH] rtl8xxxu: Fix reloading of driver for 8188eu devices - -For 8188eu, once the MAC is asked to power down by setting -APS_FSMCO_MAC_OFF, there seems to be no way to bring it back to life. - -In addition, only disable RF_ENABLE in RF_CTRL rather than all bits. - -This was spotted by Andrea Merello who noticed that if we dropped the -call to rtl8188eu_active_to_emu() reloading started working. - -Reported-by: Andrea Merello -Signed-off-by: Jes Sorensen ---- - .../net/wireless/realtek/rtl8xxxu/rtl8xxxu_8188e.c | 29 +++++----------------- - 1 file changed, 6 insertions(+), 23 deletions(-) - ---- a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_8188e.c -+++ b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_8188e.c -@@ -1160,37 +1160,18 @@ exit: - static int rtl8188eu_active_to_emu(struct rtl8xxxu_priv *priv) - { - u8 val8; -- int count, ret = 0; - - /* Turn off RF */ -- rtl8xxxu_write8(priv, REG_RF_CTRL, 0); -+ val8 = rtl8xxxu_read8(priv, REG_RF_CTRL); -+ val8 &= ~RF_ENABLE; -+ rtl8xxxu_write8(priv, REG_RF_CTRL, val8); - - /* LDO Sleep mode */ - val8 = rtl8xxxu_read8(priv, REG_LPLDO_CTRL); - val8 |= BIT(4); - rtl8xxxu_write8(priv, REG_LPLDO_CTRL, val8); - -- /* 0x0005[1] = 1 turn off MAC by HW state machine*/ -- val8 = rtl8xxxu_read8(priv, REG_APS_FSMCO + 1); -- val8 |= BIT(1); -- rtl8xxxu_write8(priv, REG_APS_FSMCO + 1, val8); -- -- for (count = RTL8XXXU_MAX_REG_POLL; count; count--) { -- val8 = rtl8xxxu_read8(priv, REG_APS_FSMCO + 1); -- if ((val8 & BIT(1)) == 0) -- break; -- udelay(10); -- } -- -- if (!count) { -- dev_warn(&priv->udev->dev, "%s: Disabling MAC timed out\n", -- __func__); -- ret = -EBUSY; -- goto exit; -- } -- --exit: -- return ret; -+ return 0; - } - - static int rtl8188eu_emu_to_disabled(struct rtl8xxxu_priv *priv) -@@ -1372,6 +1353,8 @@ void rtl8188eu_power_off(struct rtl8xxxu - - static void rtl8188e_enable_rf(struct rtl8xxxu_priv *priv) - { -+ rtl8xxxu_write8(priv, REG_RF_CTRL, RF_ENABLE | RF_RSTB | RF_SDMRSTB); -+ - rtl8xxxu_write8(priv, REG_TXPAUSE, 0x00); - } - diff --git a/package/kernel/mac80211/patches/660-0056-rtl8xxxu-Make-sure-to-enable-OFDM-paths-for-8188eu-i.patch b/package/kernel/mac80211/patches/660-0056-rtl8xxxu-Make-sure-to-enable-OFDM-paths-for-8188eu-i.patch deleted file mode 100644 index b5c98ddbde..0000000000 --- a/package/kernel/mac80211/patches/660-0056-rtl8xxxu-Make-sure-to-enable-OFDM-paths-for-8188eu-i.patch +++ /dev/null @@ -1,39 +0,0 @@ -From ba518f046cc1ce63b6984948b19b4d3903c5c30b Mon Sep 17 00:00:00 2001 -From: Jes Sorensen -Date: Mon, 3 Oct 2016 11:46:37 -0400 -Subject: [PATCH] rtl8xxxu: Make sure to enable OFDM paths for 8188eu in - rtl8188e_enable_rf() - -Failure to re-enable OFDM paths results in the dongle only receiving -CCK packets which isn't overly exciting. - -Signed-off-by: Jes Sorensen ---- - drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_8188e.c | 14 ++++++++++++++ - 1 file changed, 14 insertions(+) - ---- a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_8188e.c -+++ b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_8188e.c -@@ -1353,8 +1353,22 @@ void rtl8188eu_power_off(struct rtl8xxxu - - static void rtl8188e_enable_rf(struct rtl8xxxu_priv *priv) - { -+ u32 val32; -+ - rtl8xxxu_write8(priv, REG_RF_CTRL, RF_ENABLE | RF_RSTB | RF_SDMRSTB); - -+ val32 = rtl8xxxu_read32(priv, REG_OFDM0_TRX_PATH_ENABLE); -+ val32 &= ~(OFDM_RF_PATH_RX_MASK | OFDM_RF_PATH_TX_MASK); -+ if (priv->rx_paths == 2) -+ val32 |= OFDM_RF_PATH_RX_A | OFDM_RF_PATH_RX_B; -+ else -+ val32 |= OFDM_RF_PATH_RX_A; -+ if (priv->tx_paths == 2) -+ val32 |= OFDM_RF_PATH_TX_A | OFDM_RF_PATH_TX_B; -+ else -+ val32 |= OFDM_RF_PATH_TX_A; -+ rtl8xxxu_write32(priv, REG_OFDM0_TRX_PATH_ENABLE, val32); -+ - rtl8xxxu_write8(priv, REG_TXPAUSE, 0x00); - } - diff --git a/package/kernel/mac80211/patches/660-0057-rtl8xxxu-Add-rpt_sel-entry-to-struct-rtl8xxxu_rxdesc.patch b/package/kernel/mac80211/patches/660-0057-rtl8xxxu-Add-rpt_sel-entry-to-struct-rtl8xxxu_rxdesc.patch deleted file mode 100644 index 620783a89d..0000000000 --- a/package/kernel/mac80211/patches/660-0057-rtl8xxxu-Add-rpt_sel-entry-to-struct-rtl8xxxu_rxdesc.patch +++ /dev/null @@ -1,35 +0,0 @@ -From f670de32e58c1623ee30d7511e62e7b7e2164684 Mon Sep 17 00:00:00 2001 -From: Jes Sorensen -Date: Tue, 4 Oct 2016 12:40:22 -0400 -Subject: [PATCH] rtl8xxxu: Add rpt_sel entry to struct rtl8xxxu_rxdesc16 - -The 8188e supports TX reports which will show up as an RX packet, -similar to how the gen2 parts handle it. - -Signed-off-by: Jes Sorensen ---- - drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu.h | 6 ++++-- - 1 file changed, 4 insertions(+), 2 deletions(-) - ---- a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu.h -+++ b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu.h -@@ -161,7 +161,8 @@ struct rtl8xxxu_rxdesc16 { - u32 htc:1; - u32 eosp:1; - u32 bssidfit:2; -- u32 reserved1:16; -+ u32 rpt_sel:2; /* 8188e */ -+ u32 reserved1:14; - u32 unicastwake:1; - u32 magicwake:1; - -@@ -219,7 +220,8 @@ struct rtl8xxxu_rxdesc16 { - - u32 magicwake:1; - u32 unicastwake:1; -- u32 reserved1:16; -+ u32 reserved1:14; -+ u32 rpt_sel:2; /* 8188e */ - u32 bssidfit:2; - u32 eosp:1; - u32 htc:1; diff --git a/package/kernel/mac80211/patches/801-libertas-configure-sysfs-links.patch b/package/kernel/mac80211/patches/801-libertas-configure-sysfs-links.patch index 02f3053b2f..40e1f9f30c 100644 --- a/package/kernel/mac80211/patches/801-libertas-configure-sysfs-links.patch +++ b/package/kernel/mac80211/patches/801-libertas-configure-sysfs-links.patch @@ -1,6 +1,6 @@ --- a/drivers/net/wireless/marvell/libertas/cfg.c +++ b/drivers/net/wireless/marvell/libertas/cfg.c -@@ -2122,6 +2122,8 @@ struct wireless_dev *lbs_cfg_alloc(struc +@@ -2127,6 +2127,8 @@ struct wireless_dev *lbs_cfg_alloc(struc goto err_wiphy_new; } diff --git a/package/kernel/mac80211/patches/802-libertas-set-wireless-macaddr.patch b/package/kernel/mac80211/patches/802-libertas-set-wireless-macaddr.patch index ad306083da..04b4954d29 100644 --- a/package/kernel/mac80211/patches/802-libertas-set-wireless-macaddr.patch +++ b/package/kernel/mac80211/patches/802-libertas-set-wireless-macaddr.patch @@ -1,6 +1,6 @@ --- a/drivers/net/wireless/marvell/libertas/cfg.c +++ b/drivers/net/wireless/marvell/libertas/cfg.c -@@ -2212,6 +2212,8 @@ int lbs_cfg_register(struct lbs_private +@@ -2217,6 +2217,8 @@ int lbs_cfg_register(struct lbs_private wdev->wiphy->n_cipher_suites = ARRAY_SIZE(cipher_suites); wdev->wiphy->reg_notifier = lbs_reg_notifier; diff --git a/package/kernel/mac80211/patches/862-brcmfmac-Disable-power-management.patch b/package/kernel/mac80211/patches/862-brcmfmac-Disable-power-management.patch index 26ef5c7426..6df1236222 100644 --- a/package/kernel/mac80211/patches/862-brcmfmac-Disable-power-management.patch +++ b/package/kernel/mac80211/patches/862-brcmfmac-Disable-power-management.patch @@ -14,7 +14,7 @@ Signed-off-by: Phil Elwell --- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c +++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c -@@ -2780,6 +2780,10 @@ brcmf_cfg80211_set_power_mgmt(struct wip +@@ -2784,6 +2784,10 @@ brcmf_cfg80211_set_power_mgmt(struct wip * preference in cfg struct to apply this to * FW later while initializing the dongle */ diff --git a/package/kernel/mac80211/patches/921-ath10k_init_devices_synchronously.patch b/package/kernel/mac80211/patches/921-ath10k_init_devices_synchronously.patch index e842d612b7..e417eb8ffa 100644 --- a/package/kernel/mac80211/patches/921-ath10k_init_devices_synchronously.patch +++ b/package/kernel/mac80211/patches/921-ath10k_init_devices_synchronously.patch @@ -14,7 +14,7 @@ Signed-off-by: Sven Eckelmann --- a/drivers/net/wireless/ath/ath10k/core.c +++ b/drivers/net/wireless/ath/ath10k/core.c -@@ -2107,6 +2107,16 @@ int ath10k_core_register(struct ath10k * +@@ -2220,6 +2220,16 @@ int ath10k_core_register(struct ath10k * ar->chip_id = chip_id; queue_work(ar->workqueue, &ar->register_work); diff --git a/package/kernel/mac80211/patches/930-ath10k_add_tpt_led_trigger.patch b/package/kernel/mac80211/patches/930-ath10k_add_tpt_led_trigger.patch index a501b998d0..3177c812fb 100644 --- a/package/kernel/mac80211/patches/930-ath10k_add_tpt_led_trigger.patch +++ b/package/kernel/mac80211/patches/930-ath10k_add_tpt_led_trigger.patch @@ -1,6 +1,6 @@ --- a/drivers/net/wireless/ath/ath10k/mac.c +++ b/drivers/net/wireless/ath/ath10k/mac.c -@@ -7742,6 +7742,21 @@ struct ath10k_vif *ath10k_get_arvif(stru +@@ -7815,6 +7815,21 @@ struct ath10k_vif *ath10k_get_arvif(stru return arvif_iter.arvif; } @@ -22,7 +22,7 @@ int ath10k_mac_register(struct ath10k *ar) { static const u32 cipher_suites[] = { -@@ -7975,6 +7990,12 @@ int ath10k_mac_register(struct ath10k *a +@@ -8048,6 +8063,12 @@ int ath10k_mac_register(struct ath10k *a ar->hw->wiphy->cipher_suites = cipher_suites; ar->hw->wiphy->n_cipher_suites = ARRAY_SIZE(cipher_suites); diff --git a/package/kernel/mac80211/patches/936-ath10k_skip_otp_check.patch b/package/kernel/mac80211/patches/936-ath10k_skip_otp_check.patch index 596ef98639..fbda8d5ac1 100644 --- a/package/kernel/mac80211/patches/936-ath10k_skip_otp_check.patch +++ b/package/kernel/mac80211/patches/936-ath10k_skip_otp_check.patch @@ -1,6 +1,6 @@ --- a/drivers/net/wireless/ath/ath10k/core.c +++ b/drivers/net/wireless/ath/ath10k/core.c -@@ -1243,9 +1243,6 @@ static int ath10k_core_fetch_firmware_fi +@@ -1282,9 +1282,6 @@ static int ath10k_core_fetch_firmware_fi { int ret; @@ -10,7 +10,7 @@ ar->fw_api = 5; ath10k_dbg(ar, ATH10K_DBG_BOOT, "trying fw api %d\n", ar->fw_api); -@@ -1944,7 +1941,7 @@ EXPORT_SYMBOL(ath10k_core_stop); +@@ -2054,7 +2051,7 @@ EXPORT_SYMBOL(ath10k_core_stop); static int ath10k_core_probe_fw(struct ath10k *ar) { struct bmi_target_info target_info; @@ -19,7 +19,7 @@ ret = ath10k_hif_power_up(ar); if (ret) { -@@ -1968,6 +1965,9 @@ static int ath10k_core_probe_fw(struct a +@@ -2078,6 +2075,9 @@ static int ath10k_core_probe_fw(struct a goto err_power_down; } @@ -29,7 +29,7 @@ ret = ath10k_core_fetch_firmware_files(ar); if (ret) { ath10k_err(ar, "could not fetch firmware files (%d)\n", ret); -@@ -1990,11 +1990,14 @@ static int ath10k_core_probe_fw(struct a +@@ -2100,11 +2100,14 @@ static int ath10k_core_probe_fw(struct a "could not load pre cal data: %d\n", ret); }