aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFelix Fietkau <nbd@openwrt.org>2010-12-04 01:32:04 +0000
committerFelix Fietkau <nbd@openwrt.org>2010-12-04 01:32:04 +0000
commit2a55832f5884d0512556d772b5532aa5737f39ad (patch)
tree001d013871bb58416622c40e93c6dee2979966fc
parentb599f7dc42e33e6c04523deefabc316501e92baf (diff)
downloadupstream-2a55832f5884d0512556d772b5532aa5737f39ad.tar.gz
upstream-2a55832f5884d0512556d772b5532aa5737f39ad.tar.bz2
upstream-2a55832f5884d0512556d772b5532aa5737f39ad.zip
mac80211: update to wireless-testing 2010-11-30
SVN-Revision: 24235
-rw-r--r--package/mac80211/Makefile6
-rw-r--r--package/mac80211/patches/001-disable_b44.patch2
-rw-r--r--package/mac80211/patches/002-disable_rfkill.patch2
-rw-r--r--package/mac80211/patches/005-disable_ssb_build.patch20
-rw-r--r--package/mac80211/patches/007-remove_misc_drivers.patch10
-rw-r--r--package/mac80211/patches/008-led_default.patch10
-rw-r--r--package/mac80211/patches/011-no_sdio.patch2
-rw-r--r--package/mac80211/patches/015-remove-rt2x00-options.patch12
-rw-r--r--package/mac80211/patches/110-disable_usb_compat.patch2
-rw-r--r--package/mac80211/patches/120-pr_fmt_warnings.patch100
-rw-r--r--package/mac80211/patches/201-ath5k-WAR-for-AR71xx-PCI-bug.patch40
-rw-r--r--package/mac80211/patches/300-ath9k_gpio_settings.patch6
-rw-r--r--package/mac80211/patches/310-pending_cfg80211_fixes.patch178
-rw-r--r--package/mac80211/patches/310-pending_endian_fixes.patch (renamed from package/mac80211/patches/510-ath9k_ctl_bitfields.patch)161
-rw-r--r--package/mac80211/patches/311-pending_work.patch273
-rw-r--r--package/mac80211/patches/320-pending_work.patch2139
-rw-r--r--package/mac80211/patches/402-ath9k_blink_default.patch2
-rw-r--r--package/mac80211/patches/403-ath9k-fix-invalid-mac-address-handling.patch2
-rw-r--r--package/mac80211/patches/407-ath9k-override-mac-address-from-platform-data.patch8
-rw-r--r--package/mac80211/patches/409-ath9k_platform_settings.patch6
-rw-r--r--package/mac80211/patches/451-add-platform-eeprom-support-to-ath5k.patch6
-rw-r--r--package/mac80211/patches/510-ath9k_led_cleanup.patch (renamed from package/mac80211/patches/563-ath9k_cleanup_led_blink.patch)10
-rw-r--r--package/mac80211/patches/520-ath9k_endian_fixes.patch58
-rw-r--r--package/mac80211/patches/520-ath9k_pci_error_fix.patch (renamed from package/mac80211/patches/570-ath9k_fix_module_reload.patch)0
-rw-r--r--package/mac80211/patches/530-ath9k_ar9300_keysearch_fix.patch23
-rw-r--r--package/mac80211/patches/540-ath9k_htc_fix_eeprom.patch10
-rw-r--r--package/mac80211/patches/550-cfg80211_validate_mcast_rate.patch157
-rw-r--r--package/mac80211/patches/560-led_blink_backport.patch207
-rw-r--r--package/mac80211/patches/561-led_trigger_names.patch146
-rw-r--r--package/mac80211/patches/562-throughput_trigger.patch388
-rw-r--r--package/mac80211/patches/580-ath9k_fix_aggr_retries.patch16
-rw-r--r--package/mac80211/patches/590-ath9k-use-per-device-struct-for-pm_qos_-operations.patch92
32 files changed, 2422 insertions, 1672 deletions
diff --git a/package/mac80211/Makefile b/package/mac80211/Makefile
index 91e9cdd4ee..2d3d836224 100644
--- a/package/mac80211/Makefile
+++ b/package/mac80211/Makefile
@@ -10,12 +10,12 @@ include $(INCLUDE_DIR)/kernel.mk
PKG_NAME:=mac80211
-PKG_VERSION:=2010-11-20
-PKG_RELEASE:=2
+PKG_VERSION:=2010-11-30
+PKG_RELEASE:=1
PKG_SOURCE_URL:=http://mirror2.openwrt.org/sources
# http://www.orbit-lab.org/kernel/compat-wireless-2.6/2010/11 \
# http://wireless.kernel.org/download/compat-wireless-2.6
-PKG_MD5SUM:=2c9ca2ff2d8c20dca33e72d271219c3c
+PKG_MD5SUM:=09148efb8ba838bb409bc9e20775d530
PKG_SOURCE:=compat-wireless-$(PKG_VERSION).tar.bz2
PKG_BUILD_DIR:=$(KERNEL_BUILD_DIR)/compat-wireless-$(PKG_VERSION)
diff --git a/package/mac80211/patches/001-disable_b44.patch b/package/mac80211/patches/001-disable_b44.patch
index d93857bf3c..a7ce135559 100644
--- a/package/mac80211/patches/001-disable_b44.patch
+++ b/package/mac80211/patches/001-disable_b44.patch
@@ -1,6 +1,6 @@
--- a/config.mk
+++ b/config.mk
-@@ -300,8 +300,8 @@ endif #CONFIG_SSB
+@@ -299,8 +299,8 @@ endif #CONFIG_SSB
CONFIG_P54_PCI=m
diff --git a/package/mac80211/patches/002-disable_rfkill.patch b/package/mac80211/patches/002-disable_rfkill.patch
index 7e4274f176..3386316108 100644
--- a/package/mac80211/patches/002-disable_rfkill.patch
+++ b/package/mac80211/patches/002-disable_rfkill.patch
@@ -9,7 +9,7 @@
ifeq ($(CONFIG_MAC80211),y)
$(error "ERROR: you have MAC80211 compiled into the kernel, CONFIG_MAC80211=y, as such you cannot replace its mac80211 driver. You need this set to CONFIG_MAC80211=m. If you are using Fedora upgrade your kernel as later version should this set as modular. For further information on Fedora see https://bugzilla.redhat.com/show_bug.cgi?id=470143. If you are using your own kernel recompile it and make mac80211 modular")
-@@ -587,8 +587,8 @@ endif #CONFIG_COMPAT_KERNEL_27
+@@ -588,8 +588,8 @@ endif #CONFIG_COMPAT_KERNEL_27
# We need the backported rfkill module on kernel < 2.6.31.
# In more recent kernel versions use the in kernel rfkill module.
ifdef CONFIG_COMPAT_KERNEL_31
diff --git a/package/mac80211/patches/005-disable_ssb_build.patch b/package/mac80211/patches/005-disable_ssb_build.patch
index fd2907ffe3..49be7b4f6b 100644
--- a/package/mac80211/patches/005-disable_ssb_build.patch
+++ b/package/mac80211/patches/005-disable_ssb_build.patch
@@ -19,14 +19,13 @@
else
include $(KLIB_BUILD)/.config
endif
-@@ -283,21 +282,6 @@ CONFIG_IPW2200_QOS=y
+@@ -283,19 +282,18 @@ CONFIG_IPW2200_QOS=y
# % echo 1 > /sys/bus/pci/drivers/ipw2200/*/rtap_iface
endif #CONFIG_WIRELESS_EXT
-ifdef CONFIG_SSB
-# Sonics Silicon Backplane
-CONFIG_SSB_SPROM=y
--# CONFIG_SSB_DEBUG=y
-
-CONFIG_SSB_BLOCKIO=y
-CONFIG_SSB_PCIHOST=y
@@ -37,11 +36,22 @@
-# CONFIG_SSB_DEBUG=y
-CONFIG_SSB_DRIVER_PCICORE=y
-endif #CONFIG_SSB
--
++# ifdef CONFIG_SSB
++# # Sonics Silicon Backplane
++# CONFIG_SSB_SPROM=y
++# CONFIG_SSB_BLOCKIO=y
++# CONFIG_SSB_PCIHOST=y
++# CONFIG_SSB_B43_PCI_BRIDGE=y
++# ifdef CONFIG_PCMCIA
++# CONFIG_SSB_PCMCIAHOST=y
++# endif #CONFIG_PCMCIA
++# # CONFIG_SSB_DEBUG=y
++# CONFIG_SSB_DRIVER_PCICORE=y
++# endif #CONFIG_SSB
+
CONFIG_P54_PCI=m
- # CONFIG_B44=m
-@@ -485,7 +469,6 @@ endif #CONFIG_SPI_MASTER end of SPI driv
+@@ -484,7 +482,6 @@ endif #CONFIG_SPI_MASTER end of SPI driv
ifdef CONFIG_MMC
diff --git a/package/mac80211/patches/007-remove_misc_drivers.patch b/package/mac80211/patches/007-remove_misc_drivers.patch
index 39bef1868a..61acec5bec 100644
--- a/package/mac80211/patches/007-remove_misc_drivers.patch
+++ b/package/mac80211/patches/007-remove_misc_drivers.patch
@@ -9,7 +9,7 @@
endif
# mac80211 test driver
-@@ -314,13 +314,13 @@ endif #CONFIG_CRC_ITU_T
+@@ -324,13 +324,13 @@ endif #CONFIG_CRC_ITU_T
CONFIG_MWL8K=m
# Ethernet drivers go here
@@ -28,7 +28,7 @@
endif #CONFIG_COMPAT_KERNEL_27
ifdef CONFIG_WIRELESS_EXT
-@@ -371,17 +371,17 @@ CONFIG_ZD1211RW=m
+@@ -381,21 +381,21 @@ CONFIG_ZD1211RW=m
# Note: this depends on CONFIG_USB_NET_RNDIS_HOST and CONFIG_USB_NET_CDCETHER
# it also requires new RNDIS_HOST and CDC_ETHER modules which we add
ifdef CONFIG_COMPAT_KERNEL_29
@@ -49,6 +49,12 @@
+# CONFIG_USB_NET_COMPAT_RNDIS_HOST=m
+# CONFIG_USB_NET_COMPAT_RNDIS_WLAN=m
endif #CONFIG_USB_NET_CDCETHER
+ ifdef CONFIG_USB_NET_CDCETHER_MODULE
+-CONFIG_USB_NET_COMPAT_RNDIS_HOST=m
+-CONFIG_USB_NET_COMPAT_RNDIS_WLAN=m
++# CONFIG_USB_NET_COMPAT_RNDIS_HOST=m
++# CONFIG_USB_NET_COMPAT_RNDIS_WLAN=m
+ endif #CONFIG_USB_NET_CDCETHER
-CONFIG_USB_NET_COMPAT_CDCETHER=m
+# CONFIG_USB_NET_COMPAT_CDCETHER=m
endif #CONFIG_COMPAT_KERNEL_29
diff --git a/package/mac80211/patches/008-led_default.patch b/package/mac80211/patches/008-led_default.patch
index 164be5bac9..af7633c594 100644
--- a/package/mac80211/patches/008-led_default.patch
+++ b/package/mac80211/patches/008-led_default.patch
@@ -27,7 +27,7 @@
# CONFIG_B43LEGACY_DEBUG=y
CONFIG_B43LEGACY_DMA=y
CONFIG_B43LEGACY_PIO=y
-@@ -544,7 +544,7 @@ endif
+@@ -559,7 +559,7 @@ endif
# p54
CONFIG_P54_COMMON=m
@@ -38,7 +38,7 @@
CONFIG_ATH_COMMON=m
--- a/drivers/net/wireless/ath/ath9k/htc_drv_main.c
+++ b/drivers/net/wireless/ath/ath9k/htc_drv_main.c
-@@ -822,6 +822,7 @@ static void ath9k_led_brightness_work(st
+@@ -863,6 +863,7 @@ static void ath9k_led_brightness_work(st
}
}
@@ -46,7 +46,7 @@
static void ath9k_led_brightness(struct led_classdev *led_cdev,
enum led_brightness brightness)
{
-@@ -833,6 +834,7 @@ static void ath9k_led_brightness(struct
+@@ -874,6 +875,7 @@ static void ath9k_led_brightness(struct
ieee80211_queue_delayed_work(priv->hw,
&led->brightness_work, 0);
}
@@ -54,7 +54,7 @@
static void ath9k_led_stop_brightness(struct ath9k_htc_priv *priv)
{
-@@ -845,6 +847,7 @@ static void ath9k_led_stop_brightness(st
+@@ -886,6 +888,7 @@ static void ath9k_led_stop_brightness(st
static int ath9k_register_led(struct ath9k_htc_priv *priv, struct ath_led *led,
char *trigger)
{
@@ -62,7 +62,7 @@
int ret;
led->priv = priv;
-@@ -862,14 +865,19 @@ static int ath9k_register_led(struct ath
+@@ -903,14 +906,19 @@ static int ath9k_register_led(struct ath
INIT_DELAYED_WORK(&led->brightness_work, ath9k_led_brightness_work);
return ret;
diff --git a/package/mac80211/patches/011-no_sdio.patch b/package/mac80211/patches/011-no_sdio.patch
index ff50c97345..0634a6a23c 100644
--- a/package/mac80211/patches/011-no_sdio.patch
+++ b/package/mac80211/patches/011-no_sdio.patch
@@ -1,6 +1,6 @@
--- a/config.mk
+++ b/config.mk
-@@ -452,7 +452,7 @@ endif #CONFIG_SPI_MASTER end of SPI driv
+@@ -465,7 +465,7 @@ endif #CONFIG_SPI_MASTER end of SPI driv
ifdef CONFIG_MMC
diff --git a/package/mac80211/patches/015-remove-rt2x00-options.patch b/package/mac80211/patches/015-remove-rt2x00-options.patch
index 5353261185..e785f3e5f8 100644
--- a/package/mac80211/patches/015-remove-rt2x00-options.patch
+++ b/package/mac80211/patches/015-remove-rt2x00-options.patch
@@ -1,6 +1,6 @@
--- a/config.mk
+++ b/config.mk
-@@ -274,12 +274,12 @@ CONFIG_RTL8180=m
+@@ -287,7 +287,7 @@ CONFIG_RTL8180=m
CONFIG_ADM8211=m
@@ -9,14 +9,8 @@
CONFIG_RT2400PCI=m
CONFIG_RT2500PCI=m
ifdef CONFIG_CRC_CCITT
- CONFIG_RT2800PCI=m
--CONFIG_RT2800PCI_PCI=y
-+# CONFIG_RT2800PCI_PCI=y
- # CONFIG_RT2800PCI_RT30XX=y
- # CONFIG_RT2800PCI_RT35XX=y
- # CONFIG_RT2800PCI_SOC=y
-@@ -402,7 +402,7 @@ CONFIG_RT2800USB_RT30XX=y
- CONFIG_RT2800USB_RT35XX=y
+@@ -416,7 +416,7 @@ CONFIG_RT2800USB=m
+ # CONFIG_RT2800USB_RT35XX=y
CONFIG_RT2800USB_UNKNOWN=y
endif #CONFIG_CRC_CCITT
-CONFIG_RT2X00_LIB_USB=m
diff --git a/package/mac80211/patches/110-disable_usb_compat.patch b/package/mac80211/patches/110-disable_usb_compat.patch
index a07e978bd5..303d428a5b 100644
--- a/package/mac80211/patches/110-disable_usb_compat.patch
+++ b/package/mac80211/patches/110-disable_usb_compat.patch
@@ -33,7 +33,7 @@
#endif
--- a/config.mk
+++ b/config.mk
-@@ -389,7 +389,7 @@ endif #CONFIG_COMPAT_KERNEL_29
+@@ -403,7 +403,7 @@ endif #CONFIG_COMPAT_KERNEL_29
# This activates a threading fix for usb urb.
# this is mainline commit: b3e670443b7fb8a2d29831b62b44a039c283e351
# This fix will be included in some stable releases.
diff --git a/package/mac80211/patches/120-pr_fmt_warnings.patch b/package/mac80211/patches/120-pr_fmt_warnings.patch
new file mode 100644
index 0000000000..4679499248
--- /dev/null
+++ b/package/mac80211/patches/120-pr_fmt_warnings.patch
@@ -0,0 +1,100 @@
+--- a/drivers/net/wireless/iwlwifi/iwl-agn.c
++++ b/drivers/net/wireless/iwlwifi/iwl-agn.c
+@@ -27,6 +27,7 @@
+ *
+ *****************************************************************************/
+
++#undef pr_fmt
+ #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
+
+ #include <linux/kernel.h>
+--- a/drivers/net/wireless/iwlwifi/iwl3945-base.c
++++ b/drivers/net/wireless/iwlwifi/iwl3945-base.c
+@@ -27,6 +27,7 @@
+ *
+ *****************************************************************************/
+
++#undef pr_fmt
+ #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
+
+ #include <linux/kernel.h>
+--- a/drivers/net/wireless/libertas_tf/cmd.c
++++ b/drivers/net/wireless/libertas_tf/cmd.c
+@@ -7,6 +7,7 @@
+ * the Free Software Foundation; either version 2 of the License, or (at
+ * your option) any later version.
+ */
++#undef pr_fmt
+ #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
+
+ #include <linux/slab.h>
+--- a/drivers/net/wireless/libertas_tf/if_usb.c
++++ b/drivers/net/wireless/libertas_tf/if_usb.c
+@@ -9,6 +9,7 @@
+ */
+ #define DRV_NAME "lbtf_usb"
+
++#undef pr_fmt
+ #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
+
+ #include "libertas_tf.h"
+--- a/drivers/net/wireless/libertas_tf/main.c
++++ b/drivers/net/wireless/libertas_tf/main.c
+@@ -7,6 +7,7 @@
+ * the Free Software Foundation; either version 2 of the License, or (at
+ * your option) any later version.
+ */
++#undef pr_fmt
+ #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
+
+ #include <linux/slab.h>
+--- a/net/wireless/core.c
++++ b/net/wireless/core.c
+@@ -4,6 +4,7 @@
+ * Copyright 2006-2010 Johannes Berg <johannes@sipsolutions.net>
+ */
+
++#undef pr_fmt
+ #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
+
+ #include <linux/if.h>
+--- a/net/wireless/core.c.orig
++++ b/net/wireless/core.c.orig
+@@ -4,6 +4,7 @@
+ * Copyright 2006-2010 Johannes Berg <johannes@sipsolutions.net>
+ */
+
++#undef pr_fmt
+ #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
+
+ #include <linux/if.h>
+--- a/net/wireless/lib80211.c
++++ b/net/wireless/lib80211.c
+@@ -13,6 +13,7 @@
+ *
+ */
+
++#undef pr_fmt
+ #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
+
+ #include <linux/module.h>
+--- a/net/wireless/lib80211_crypt_tkip.c
++++ b/net/wireless/lib80211_crypt_tkip.c
+@@ -10,6 +10,7 @@
+ * more details.
+ */
+
++#undef pr_fmt
+ #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
+
+ #include <linux/err.h>
+--- a/net/wireless/reg.c
++++ b/net/wireless/reg.c
+@@ -33,6 +33,7 @@
+ *
+ */
+
++#undef pr_fmt
+ #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
+
+ #include <linux/kernel.h>
diff --git a/package/mac80211/patches/201-ath5k-WAR-for-AR71xx-PCI-bug.patch b/package/mac80211/patches/201-ath5k-WAR-for-AR71xx-PCI-bug.patch
index 38f56edf4b..b216b9dbeb 100644
--- a/package/mac80211/patches/201-ath5k-WAR-for-AR71xx-PCI-bug.patch
+++ b/package/mac80211/patches/201-ath5k-WAR-for-AR71xx-PCI-bug.patch
@@ -1,6 +1,23 @@
---- a/drivers/net/wireless/ath/ath5k/reset.c
-+++ b/drivers/net/wireless/ath/ath5k/reset.c
-@@ -1334,10 +1334,18 @@ int ath5k_hw_reset(struct ath5k_hw *ah,
+--- a/drivers/net/wireless/ath/ath5k/initvals.c
++++ b/drivers/net/wireless/ath/ath5k/initvals.c
+@@ -58,8 +58,14 @@ static const struct ath5k_ini ar5210_ini
+ { AR5K_IMR, 0 },
+ { AR5K_IER, AR5K_IER_DISABLE },
+ { AR5K_BSR, 0, AR5K_INI_READ },
++#ifndef CONFIG_ATHEROS_AR71XX
+ { AR5K_TXCFG, AR5K_DMASIZE_128B },
+ { AR5K_RXCFG, AR5K_DMASIZE_128B },
++#else
++ /* WAR for AR71xx PCI bug */
++ { AR5K_TXCFG, AR5K_DMASIZE_4B },
++ { AR5K_RXCFG, AR5K_DMASIZE_4B },
++#endif
+ { AR5K_CFG, AR5K_INIT_CFG },
+ { AR5K_TOPS, 8 },
+ { AR5K_RXNOFRM, 8 },
+--- a/drivers/net/wireless/ath/ath5k/dma.c
++++ b/drivers/net/wireless/ath/ath5k/dma.c
+@@ -787,10 +787,18 @@ void ath5k_hw_dma_init(struct ath5k_hw *
* guess we can tweak it and see how it goes ;-)
*/
if (ah->ah_version != AR5K_AR5210) {
@@ -19,20 +36,3 @@
}
/* Pre-enable interrupts on 5211/5212*/
---- a/drivers/net/wireless/ath/ath5k/initvals.c
-+++ b/drivers/net/wireless/ath/ath5k/initvals.c
-@@ -58,8 +58,14 @@ static const struct ath5k_ini ar5210_ini
- { AR5K_IMR, 0 },
- { AR5K_IER, AR5K_IER_DISABLE },
- { AR5K_BSR, 0, AR5K_INI_READ },
-+#ifndef CONFIG_ATHEROS_AR71XX
- { AR5K_TXCFG, AR5K_DMASIZE_128B },
- { AR5K_RXCFG, AR5K_DMASIZE_128B },
-+#else
-+ /* WAR for AR71xx PCI bug */
-+ { AR5K_TXCFG, AR5K_DMASIZE_4B },
-+ { AR5K_RXCFG, AR5K_DMASIZE_4B },
-+#endif
- { AR5K_CFG, AR5K_INIT_CFG },
- { AR5K_TOPS, 8 },
- { AR5K_RXNOFRM, 8 },
diff --git a/package/mac80211/patches/300-ath9k_gpio_settings.patch b/package/mac80211/patches/300-ath9k_gpio_settings.patch
index a7cf49a29f..a42b71f8af 100644
--- a/package/mac80211/patches/300-ath9k_gpio_settings.patch
+++ b/package/mac80211/patches/300-ath9k_gpio_settings.patch
@@ -15,7 +15,7 @@
err:
--- a/drivers/net/wireless/ath/ath9k/hw.h
+++ b/drivers/net/wireless/ath/ath9k/hw.h
-@@ -789,6 +789,8 @@ struct ath_hw {
+@@ -790,6 +790,8 @@ struct ath_hw {
int initPDADC;
int PDADCdelta;
u8 led_pin;
@@ -26,7 +26,7 @@
struct ar5416IniArray iniCommon;
--- a/drivers/net/wireless/ath/ath9k/hw.c
+++ b/drivers/net/wireless/ath/ath9k/hw.c
-@@ -1178,6 +1178,20 @@ static bool ath9k_hw_channel_change(stru
+@@ -1177,6 +1177,20 @@ static bool ath9k_hw_channel_change(stru
return true;
}
@@ -47,7 +47,7 @@
bool ath9k_hw_check_alive(struct ath_hw *ah)
{
int count = 50;
-@@ -1464,6 +1478,8 @@ int ath9k_hw_reset(struct ath_hw *ah, st
+@@ -1463,6 +1477,8 @@ int ath9k_hw_reset(struct ath_hw *ah, st
if (AR_SREV_9300_20_OR_LATER(ah))
ar9003_hw_bb_watchdog_config(ah);
diff --git a/package/mac80211/patches/310-pending_cfg80211_fixes.patch b/package/mac80211/patches/310-pending_cfg80211_fixes.patch
deleted file mode 100644
index f8334b447e..0000000000
--- a/package/mac80211/patches/310-pending_cfg80211_fixes.patch
+++ /dev/null
@@ -1,178 +0,0 @@
---- a/include/net/regulatory.h
-+++ b/include/net/regulatory.h
-@@ -43,6 +43,12 @@ enum environment_cap {
- * @intersect: indicates whether the wireless core should intersect
- * the requested regulatory domain with the presently set regulatory
- * domain.
-+ * @processed: indicates whether or not this requests has already been
-+ * processed. When the last request is processed it means that the
-+ * currently regulatory domain set on cfg80211 is updated from
-+ * CRDA and can be used by other regulatory requests. When a
-+ * the last request is not yet processed we must yield until it
-+ * is processed before processing any new requests.
- * @country_ie_checksum: checksum of the last processed and accepted
- * country IE
- * @country_ie_env: lets us know if the AP is telling us we are outdoor,
-@@ -54,6 +60,7 @@ struct regulatory_request {
- enum nl80211_reg_initiator initiator;
- char alpha2[2];
- bool intersect;
-+ bool processed;
- enum environment_cap country_ie_env;
- struct list_head list;
- };
---- a/net/wireless/reg.c
-+++ b/net/wireless/reg.c
-@@ -96,6 +96,9 @@ struct reg_beacon {
- struct ieee80211_channel chan;
- };
-
-+static void reg_todo(struct work_struct *work);
-+static DECLARE_WORK(reg_work, reg_todo);
-+
- /* We keep a static world regulatory domain in case of the absence of CRDA */
- static const struct ieee80211_regdomain world_regdom = {
- .n_reg_rules = 5,
-@@ -1317,6 +1320,21 @@ static int ignore_request(struct wiphy *
- return -EINVAL;
- }
-
-+static void reg_set_request_processed(void)
-+{
-+ bool need_more_processing = false;
-+
-+ last_request->processed = true;
-+
-+ spin_lock(&reg_requests_lock);
-+ if (!list_empty(&reg_requests_list))
-+ need_more_processing = true;
-+ spin_unlock(&reg_requests_lock);
-+
-+ if (need_more_processing)
-+ schedule_work(&reg_work);
-+}
-+
- /**
- * __regulatory_hint - hint to the wireless core a regulatory domain
- * @wiphy: if the hint comes from country information from an AP, this
-@@ -1392,8 +1410,10 @@ new_request:
- * have applied the requested regulatory domain before we just
- * inform userspace we have processed the request
- */
-- if (r == -EALREADY)
-+ if (r == -EALREADY) {
- nl80211_send_reg_change_event(last_request);
-+ reg_set_request_processed();
-+ }
- return r;
- }
-
-@@ -1409,16 +1429,13 @@ static void reg_process_hint(struct regu
-
- BUG_ON(!reg_request->alpha2);
-
-- mutex_lock(&cfg80211_mutex);
-- mutex_lock(&reg_mutex);
--
- if (wiphy_idx_valid(reg_request->wiphy_idx))
- wiphy = wiphy_idx_to_wiphy(reg_request->wiphy_idx);
-
- if (reg_request->initiator == NL80211_REGDOM_SET_BY_DRIVER &&
- !wiphy) {
- kfree(reg_request);
-- goto out;
-+ return;
- }
-
- r = __regulatory_hint(wiphy, reg_request);
-@@ -1426,28 +1443,46 @@ static void reg_process_hint(struct regu
- if (r == -EALREADY && wiphy &&
- wiphy->flags & WIPHY_FLAG_STRICT_REGULATORY)
- wiphy_update_regulatory(wiphy, initiator);
--out:
-- mutex_unlock(&reg_mutex);
-- mutex_unlock(&cfg80211_mutex);
- }
-
--/* Processes regulatory hints, this is all the NL80211_REGDOM_SET_BY_* */
-+/*
-+ * Processes regulatory hints, this is all the NL80211_REGDOM_SET_BY_*
-+ * Regulatory hints come on a first come first serve basis and we
-+ * must process each one atomically.
-+ */
- static void reg_process_pending_hints(void)
-- {
-+{
- struct regulatory_request *reg_request;
-
-+ mutex_lock(&cfg80211_mutex);
-+ mutex_lock(&reg_mutex);
-+
-+ /* When last_request->processed becomes true this will be rescheduled */
-+ if (last_request && !last_request->processed) {
-+ REG_DBG_PRINT("Pending regulatory request, waiting "
-+ "for it to be processed...");
-+ goto out;
-+ }
-+
- spin_lock(&reg_requests_lock);
-- while (!list_empty(&reg_requests_list)) {
-- reg_request = list_first_entry(&reg_requests_list,
-- struct regulatory_request,
-- list);
-- list_del_init(&reg_request->list);
-
-+ if (list_empty(&reg_requests_list)) {
- spin_unlock(&reg_requests_lock);
-- reg_process_hint(reg_request);
-- spin_lock(&reg_requests_lock);
-+ goto out;
- }
-+
-+ reg_request = list_first_entry(&reg_requests_list,
-+ struct regulatory_request,
-+ list);
-+ list_del_init(&reg_request->list);
-+
- spin_unlock(&reg_requests_lock);
-+
-+ reg_process_hint(reg_request);
-+
-+out:
-+ mutex_unlock(&reg_mutex);
-+ mutex_unlock(&cfg80211_mutex);
- }
-
- /* Processes beacon hints -- this has nothing to do with country IEs */
-@@ -1494,8 +1529,6 @@ static void reg_todo(struct work_struct
- reg_process_pending_beacon_hints();
- }
-
--static DECLARE_WORK(reg_work, reg_todo);
--
- static void queue_regulatory_request(struct regulatory_request *request)
- {
- if (isalpha(request->alpha2[0]))
-@@ -1530,12 +1563,7 @@ static int regulatory_hint_core(const ch
- request->alpha2[1] = alpha2[1];
- request->initiator = NL80211_REGDOM_SET_BY_CORE;
-
-- /*
-- * This ensures last_request is populated once modules
-- * come swinging in and calling regulatory hints and
-- * wiphy_apply_custom_regulatory().
-- */
-- reg_process_hint(request);
-+ queue_regulatory_request(request);
-
- return 0;
- }
-@@ -2061,6 +2089,8 @@ int set_regdom(const struct ieee80211_re
-
- nl80211_send_reg_change_event(last_request);
-
-+ reg_set_request_processed();
-+
- mutex_unlock(&reg_mutex);
-
- return r;
diff --git a/package/mac80211/patches/510-ath9k_ctl_bitfields.patch b/package/mac80211/patches/310-pending_endian_fixes.patch
index 6485a1b344..7f27965d01 100644
--- a/package/mac80211/patches/510-ath9k_ctl_bitfields.patch
+++ b/package/mac80211/patches/310-pending_endian_fixes.patch
@@ -1,57 +1,3 @@
---- a/drivers/net/wireless/ath/ath9k/eeprom.c
-+++ b/drivers/net/wireless/ath/ath9k/eeprom.c
-@@ -240,16 +240,16 @@ u16 ath9k_hw_get_max_edge_power(u16 freq
- for (i = 0; (i < num_band_edges) &&
- (pRdEdgesPower[i].bChannel != AR5416_BCHAN_UNUSED); i++) {
- if (freq == ath9k_hw_fbin2freq(pRdEdgesPower[i].bChannel, is2GHz)) {
-- twiceMaxEdgePower = pRdEdgesPower[i].tPower;
-+ twiceMaxEdgePower = CTL_EDGE_TPOWER(pRdEdgesPower[i].ctl);
- break;
- } else if ((i > 0) &&
- (freq < ath9k_hw_fbin2freq(pRdEdgesPower[i].bChannel,
- is2GHz))) {
- if (ath9k_hw_fbin2freq(pRdEdgesPower[i - 1].bChannel,
- is2GHz) < freq &&
-- pRdEdgesPower[i - 1].flag) {
-+ CTL_EDGE_FLAGS(pRdEdgesPower[i - 1].ctl)) {
- twiceMaxEdgePower =
-- pRdEdgesPower[i - 1].tPower;
-+ CTL_EDGE_TPOWER(pRdEdgesPower[i - 1].ctl);
- }
- break;
- }
---- a/drivers/net/wireless/ath/ath9k/eeprom.h
-+++ b/drivers/net/wireless/ath/ath9k/eeprom.h
-@@ -233,6 +233,9 @@
-
- #define AR9287_CHECKSUM_LOCATION (AR9287_EEP_START_LOC + 1)
-
-+#define CTL_EDGE_TPOWER(_ctl) ((_ctl) & 0x3f)
-+#define CTL_EDGE_FLAGS(_ctl) (((_ctl) >> 6) & 0x03)
-+
- enum eeprom_param {
- EEP_NFTHRESH_5,
- EEP_NFTHRESH_2,
-@@ -535,18 +538,10 @@ struct cal_target_power_ht {
- u8 tPow2x[8];
- } __packed;
-
--
--#ifdef __BIG_ENDIAN_BITFIELD
--struct cal_ctl_edges {
-- u8 bChannel;
-- u8 flag:2, tPower:6;
--} __packed;
--#else
- struct cal_ctl_edges {
- u8 bChannel;
-- u8 tPower:6, flag:2;
-+ u8 ctl;
- } __packed;
--#endif
-
- struct cal_data_op_loop_ar9287 {
- u8 pwrPdg[2][5];
--- a/drivers/net/wireless/ath/ath9k/ar9003_eeprom.c
+++ b/drivers/net/wireless/ath/ath9k/ar9003_eeprom.c
@@ -57,6 +57,8 @@
@@ -623,7 +569,7 @@
}
},
}
-@@ -4363,9 +4365,9 @@ static u16 ar9003_hw_get_direct_edge_pow
+@@ -4365,9 +4367,9 @@ static u16 ar9003_hw_get_direct_edge_pow
struct cal_ctl_data_5g *ctl_5g = eep->ctlPowerData_5G;
if (is2GHz)
@@ -635,7 +581,7 @@
}
static u16 ar9003_hw_get_indirect_edge_power(struct ar9300_eeprom *eep,
-@@ -4383,12 +4385,12 @@ static u16 ar9003_hw_get_indirect_edge_p
+@@ -4385,12 +4387,12 @@ static u16 ar9003_hw_get_indirect_edge_p
if (is2GHz) {
if (ath9k_hw_fbin2freq(ctl_freqbin[edge - 1], 1) < freq &&
@@ -674,3 +620,106 @@
} __packed;
struct ar9300_BaseExtension_1 {
+--- a/drivers/net/wireless/ath/ath9k/eeprom.c
++++ b/drivers/net/wireless/ath/ath9k/eeprom.c
+@@ -240,16 +240,16 @@ u16 ath9k_hw_get_max_edge_power(u16 freq
+ for (i = 0; (i < num_band_edges) &&
+ (pRdEdgesPower[i].bChannel != AR5416_BCHAN_UNUSED); i++) {
+ if (freq == ath9k_hw_fbin2freq(pRdEdgesPower[i].bChannel, is2GHz)) {
+- twiceMaxEdgePower = pRdEdgesPower[i].tPower;
++ twiceMaxEdgePower = CTL_EDGE_TPOWER(pRdEdgesPower[i].ctl);
+ break;
+ } else if ((i > 0) &&
+ (freq < ath9k_hw_fbin2freq(pRdEdgesPower[i].bChannel,
+ is2GHz))) {
+ if (ath9k_hw_fbin2freq(pRdEdgesPower[i - 1].bChannel,
+ is2GHz) < freq &&
+- pRdEdgesPower[i - 1].flag) {
++ CTL_EDGE_FLAGS(pRdEdgesPower[i - 1].ctl)) {
+ twiceMaxEdgePower =
+- pRdEdgesPower[i - 1].tPower;
++ CTL_EDGE_TPOWER(pRdEdgesPower[i - 1].ctl);
+ }
+ break;
+ }
+--- a/drivers/net/wireless/ath/ath9k/eeprom.h
++++ b/drivers/net/wireless/ath/ath9k/eeprom.h
+@@ -233,6 +233,18 @@
+
+ #define AR9287_CHECKSUM_LOCATION (AR9287_EEP_START_LOC + 1)
+
++#define CTL_EDGE_TPOWER(_ctl) ((_ctl) & 0x3f)
++#define CTL_EDGE_FLAGS(_ctl) (((_ctl) >> 6) & 0x03)
++
++#define LNA_CTL_BUF_MODE BIT(0)
++#define LNA_CTL_ISEL_LO BIT(1)
++#define LNA_CTL_ISEL_HI BIT(2)
++#define LNA_CTL_BUF_IN BIT(3)
++#define LNA_CTL_FEM_BAND BIT(4)
++#define LNA_CTL_LOCAL_BIAS BIT(5)
++#define LNA_CTL_FORCE_XPA BIT(6)
++#define LNA_CTL_USE_ANT1 BIT(7)
++
+ enum eeprom_param {
+ EEP_NFTHRESH_5,
+ EEP_NFTHRESH_2,
+@@ -379,10 +391,7 @@ struct modal_eep_header {
+ u8 xatten2Margin[AR5416_MAX_CHAINS];
+ u8 ob_ch1;
+ u8 db_ch1;
+- u8 useAnt1:1,
+- force_xpaon:1,
+- local_bias:1,
+- femBandSelectUsed:1, xlnabufin:1, xlnaisel:2, xlnabufmode:1;
++ u8 lna_ctl;
+ u8 miscBits;
+ u16 xpaBiasLvlFreq[3];
+ u8 futureModal[6];
+@@ -536,18 +545,10 @@ struct cal_target_power_ht {
+ u8 tPow2x[8];
+ } __packed;
+
+-
+-#ifdef __BIG_ENDIAN_BITFIELD
+ struct cal_ctl_edges {
+ u8 bChannel;
+- u8 flag:2, tPower:6;
++ u8 ctl;
+ } __packed;
+-#else
+-struct cal_ctl_edges {
+- u8 bChannel;
+- u8 tPower:6, flag:2;
+-} __packed;
+-#endif
+
+ struct cal_data_op_loop_ar9287 {
+ u8 pwrPdg[2][5];
+--- a/drivers/net/wireless/ath/ath9k/eeprom_def.c
++++ b/drivers/net/wireless/ath/ath9k/eeprom_def.c
+@@ -451,9 +451,10 @@ static void ath9k_hw_def_set_board_value
+ ath9k_hw_analog_shift_rmw(ah, AR_AN_TOP2,
+ AR_AN_TOP2_LOCALBIAS,
+ AR_AN_TOP2_LOCALBIAS_S,
+- pModal->local_bias);
++ !!(pModal->lna_ctl &
++ LNA_CTL_LOCAL_BIAS));
+ REG_RMW_FIELD(ah, AR_PHY_XPA_CFG, AR_PHY_FORCE_XPA_CFG,
+- pModal->force_xpaon);
++ !!(pModal->lna_ctl & LNA_CTL_FORCE_XPA));
+ }
+
+ REG_RMW_FIELD(ah, AR_PHY_SETTLING, AR_PHY_SETTLING_SWITCH,
+@@ -1435,9 +1436,9 @@ static u8 ath9k_hw_def_get_num_ant_confi
+
+ num_ant_config = 1;
+
+- if (pBase->version >= 0x0E0D)
+- if (pModal->useAnt1)
+- num_ant_config += 1;
++ if (pBase->version >= 0x0E0D &&
++ (pModal->lna_ctl & LNA_CTL_USE_ANT1))
++ num_ant_config += 1;
+
+ return num_ant_config;
+ }
diff --git a/package/mac80211/patches/311-pending_work.patch b/package/mac80211/patches/311-pending_work.patch
deleted file mode 100644
index 827f677b13..0000000000
--- a/package/mac80211/patches/311-pending_work.patch
+++ /dev/null
@@ -1,273 +0,0 @@
---- a/drivers/net/wireless/ath/ath9k/mac.c
-+++ b/drivers/net/wireless/ath/ath9k/mac.c
-@@ -766,14 +766,6 @@ void ath9k_hw_startpcureceive(struct ath
- }
- EXPORT_SYMBOL(ath9k_hw_startpcureceive);
-
--void ath9k_hw_stoppcurecv(struct ath_hw *ah)
--{
-- REG_SET_BIT(ah, AR_DIAG_SW, AR_DIAG_RX_DIS);
--
-- ath9k_hw_disable_mib_counters(ah);
--}
--EXPORT_SYMBOL(ath9k_hw_stoppcurecv);
--
- void ath9k_hw_abortpcurecv(struct ath_hw *ah)
- {
- REG_SET_BIT(ah, AR_DIAG_SW, AR_DIAG_RX_ABORT | AR_DIAG_RX_DIS);
---- a/drivers/net/wireless/ath/ath9k/mac.h
-+++ b/drivers/net/wireless/ath/ath9k/mac.h
-@@ -691,7 +691,6 @@ void ath9k_hw_setuprxdesc(struct ath_hw
- bool ath9k_hw_setrxabort(struct ath_hw *ah, bool set);
- void ath9k_hw_putrxbuf(struct ath_hw *ah, u32 rxdp);
- void ath9k_hw_startpcureceive(struct ath_hw *ah, bool is_scanning);
--void ath9k_hw_stoppcurecv(struct ath_hw *ah);
- void ath9k_hw_abortpcurecv(struct ath_hw *ah);
- bool ath9k_hw_stopdmarecv(struct ath_hw *ah);
- int ath9k_hw_beaconq_setup(struct ath_hw *ah);
---- a/drivers/net/wireless/ath/ath9k/recv.c
-+++ b/drivers/net/wireless/ath/ath9k/recv.c
-@@ -518,7 +518,7 @@ bool ath_stoprecv(struct ath_softc *sc)
- bool stopped;
-
- spin_lock_bh(&sc->rx.rxbuflock);
-- ath9k_hw_stoppcurecv(ah);
-+ ath9k_hw_abortpcurecv(ah);
- ath9k_hw_setrxfilter(ah, 0);
- stopped = ath9k_hw_stopdmarecv(ah);
-
---- a/drivers/net/wireless/ath/ath9k/xmit.c
-+++ b/drivers/net/wireless/ath/ath9k/xmit.c
-@@ -163,6 +163,7 @@ static void ath_tx_flush_tid(struct ath_
- bf = list_first_entry(&tid->buf_q, struct ath_buf, list);
- list_move_tail(&bf->list, &bf_head);
-
-+ spin_unlock_bh(&txq->axq_lock);
- fi = get_frame_info(bf->bf_mpdu);
- if (fi->retries) {
- ath_tx_update_baw(sc, tid, fi->seqno);
-@@ -170,6 +171,7 @@ static void ath_tx_flush_tid(struct ath_
- } else {
- ath_tx_send_normal(sc, txq, tid, &bf_head);
- }
-+ spin_lock_bh(&txq->axq_lock);
- }
-
- spin_unlock_bh(&txq->axq_lock);
---- a/net/mac80211/ieee80211_i.h
-+++ b/net/mac80211/ieee80211_i.h
-@@ -349,6 +349,7 @@ struct ieee80211_if_managed {
- struct work_struct chswitch_work;
- struct work_struct beacon_connection_loss_work;
-
-+ unsigned long beacon_timeout;
- unsigned long probe_timeout;
- int probe_send_count;
-
-@@ -1269,6 +1270,8 @@ void ieee80211_send_nullfunc(struct ieee
- int powersave);
- void ieee80211_sta_rx_notify(struct ieee80211_sub_if_data *sdata,
- struct ieee80211_hdr *hdr);
-+void ieee80211_sta_tx_notify(struct ieee80211_sub_if_data *sdata,
-+ struct ieee80211_hdr *hdr);
- void ieee80211_beacon_connection_loss_work(struct work_struct *work);
-
- void ieee80211_wake_queues_by_reason(struct ieee80211_hw *hw,
---- a/net/mac80211/mlme.c
-+++ b/net/mac80211/mlme.c
-@@ -28,13 +28,19 @@
- #include "rate.h"
- #include "led.h"
-
-+#define IEEE80211_MAX_NULLFUNC_TRIES 2
- #define IEEE80211_MAX_PROBE_TRIES 5
-
- /*
-- * beacon loss detection timeout
-- * XXX: should depend on beacon interval
-+ * Beacon loss timeout is calculated as N frames times the
-+ * advertised beacon interval. This may need to be somewhat
-+ * higher than what hardware might detect to account for
-+ * delays in the host processing frames. But since we also
-+ * probe on beacon miss before declaring the connection lost
-+ * default to what we want.
- */
--#define IEEE80211_BEACON_LOSS_TIME (2 * HZ)
-+#define IEEE80211_BEACON_LOSS_COUNT 7
-+
- /*
- * Time the connection can be idle before we probe
- * it to see if we can still talk to the AP.
-@@ -121,7 +127,7 @@ void ieee80211_sta_reset_beacon_monitor(
- return;
-
- mod_timer(&sdata->u.mgd.bcn_mon_timer,
-- round_jiffies_up(jiffies + IEEE80211_BEACON_LOSS_TIME));
-+ round_jiffies_up(jiffies + sdata->u.mgd.beacon_timeout));
- }
-
- void ieee80211_sta_reset_conn_monitor(struct ieee80211_sub_if_data *sdata)
-@@ -871,6 +877,9 @@ static void ieee80211_set_associated(str
- bss_info_changed |= ieee80211_handle_bss_capability(sdata,
- cbss->capability, bss->has_erp_value, bss->erp_value);
-
-+ sdata->u.mgd.beacon_timeout = usecs_to_jiffies(ieee80211_tu_to_usec(
-+ IEEE80211_BEACON_LOSS_COUNT * bss_conf->beacon_int));
-+
- sdata->u.mgd.associated = cbss;
- memcpy(sdata->u.mgd.bssid, cbss->bssid, ETH_ALEN);
-
-@@ -1026,6 +1035,51 @@ void ieee80211_sta_rx_notify(struct ieee
- ieee80211_sta_reset_conn_monitor(sdata);
- }
-
-+static void ieee80211_reset_ap_probe(struct ieee80211_sub_if_data *sdata)
-+{
-+ struct ieee80211_if_managed *ifmgd = &sdata->u.mgd;
-+
-+ if (!(ifmgd->flags & (IEEE80211_STA_BEACON_POLL |
-+ IEEE80211_STA_CONNECTION_POLL)))
-+ return;
-+
-+ ifmgd->flags &= ~(IEEE80211_STA_CONNECTION_POLL |
-+ IEEE80211_STA_BEACON_POLL);
-+ mutex_lock(&sdata->local->iflist_mtx);
-+ ieee80211_recalc_ps(sdata->local, -1);
-+ mutex_unlock(&sdata->local->iflist_mtx);
-+
-+ if (sdata->local->hw.flags & IEEE80211_HW_CONNECTION_MONITOR)
-+ return;
-+
-+ /*
-+ * We've received a probe response, but are not sure whether
-+ * we have or will be receiving any beacons or data, so let's
-+ * schedule the timers again, just in case.
-+ */
-+ ieee80211_sta_reset_beacon_monitor(sdata);
-+
-+ mod_timer(&ifmgd->conn_mon_timer,
-+ round_jiffies_up(jiffies +
-+ IEEE80211_CONNECTION_IDLE_TIME));
-+}
-+
-+void ieee80211_sta_tx_notify(struct ieee80211_sub_if_data *sdata,
-+ struct ieee80211_hdr *hdr)
-+{
-+ if (!ieee80211_is_data(hdr->frame_control) &&
-+ !ieee80211_is_nullfunc(hdr->frame_control))
-+ return;
-+
-+ ieee80211_sta_reset_conn_monitor(sdata);
-+
-+ if (ieee80211_is_nullfunc(hdr->frame_control) &&
-+ sdata->u.mgd.probe_send_count > 0) {
-+ sdata->u.mgd.probe_send_count = 0;
-+ ieee80211_queue_work(&sdata->local->hw, &sdata->work);
-+ }
-+}
-+
- static void ieee80211_mgd_probe_ap_send(struct ieee80211_sub_if_data *sdata)
- {
- struct ieee80211_if_managed *ifmgd = &sdata->u.mgd;
-@@ -1041,8 +1095,19 @@ static void ieee80211_mgd_probe_ap_send(
- if (ifmgd->probe_send_count >= unicast_limit)
- dst = NULL;
-
-- ssid = ieee80211_bss_get_ie(ifmgd->associated, WLAN_EID_SSID);
-- ieee80211_send_probe_req(sdata, dst, ssid + 2, ssid[1], NULL, 0);
-+ /*
-+ * When the hardware reports an accurate Tx ACK status, it's
-+ * better to send a nullfunc frame instead of a probe request,
-+ * as it will kick us off the AP quickly if we aren't associated
-+ * anymore. The timeout will be reset if the frame is ACKed by
-+ * the AP.
-+ */
-+ if (sdata->local->hw.flags & IEEE80211_HW_REPORTS_TX_ACK_STATUS)
-+ ieee80211_send_nullfunc(sdata->local, sdata, 0);
-+ else {
-+ ssid = ieee80211_bss_get_ie(ifmgd->associated, WLAN_EID_SSID);
-+ ieee80211_send_probe_req(sdata, dst, ssid + 2, ssid[1], NULL, 0);
-+ }
-
- ifmgd->probe_send_count++;
- ifmgd->probe_timeout = jiffies + IEEE80211_PROBE_WAIT;
-@@ -1509,29 +1574,8 @@ static void ieee80211_rx_mgmt_probe_resp
- ieee80211_rx_bss_info(sdata, mgmt, len, rx_status, &elems, false);
-
- if (ifmgd->associated &&
-- memcmp(mgmt->bssid, ifmgd->associated->bssid, ETH_ALEN) == 0 &&
-- ifmgd->flags & (IEEE80211_STA_BEACON_POLL |
-- IEEE80211_STA_CONNECTION_POLL)) {
-- ifmgd->flags &= ~(IEEE80211_STA_CONNECTION_POLL |
-- IEEE80211_STA_BEACON_POLL);
-- mutex_lock(&sdata->local->iflist_mtx);
-- ieee80211_recalc_ps(sdata->local, -1);
-- mutex_unlock(&sdata->local->iflist_mtx);
--
-- if (sdata->local->hw.flags & IEEE80211_HW_CONNECTION_MONITOR)
-- return;
--
-- /*
-- * We've received a probe response, but are not sure whether
-- * we have or will be receiving any beacons or data, so let's
-- * schedule the timers again, just in case.
-- */
-- ieee80211_sta_reset_beacon_monitor(sdata);
--
-- mod_timer(&ifmgd->conn_mon_timer,
-- round_jiffies_up(jiffies +
-- IEEE80211_CONNECTION_IDLE_TIME));
-- }
-+ memcmp(mgmt->bssid, ifmgd->associated->bssid, ETH_ALEN) == 0)
-+ ieee80211_reset_ap_probe(sdata);
- }
-
- /*
-@@ -1881,12 +1925,23 @@ void ieee80211_sta_work(struct ieee80211
- IEEE80211_STA_CONNECTION_POLL) &&
- ifmgd->associated) {
- u8 bssid[ETH_ALEN];
-+ int max_tries;
-+
-+ if (local->hw.flags & IEEE80211_HW_REPORTS_TX_ACK_STATUS)
-+ max_tries = IEEE80211_MAX_NULLFUNC_TRIES;
-+ else
-+ max_tries = IEEE80211_MAX_PROBE_TRIES;
-
- memcpy(bssid, ifmgd->associated->bssid, ETH_ALEN);
-- if (time_is_after_jiffies(ifmgd->probe_timeout))
-+
-+ /* ACK received for nullfunc probing frame */
-+ if (!ifmgd->probe_send_count)
-+ ieee80211_reset_ap_probe(sdata);
-+
-+ else if (time_is_after_jiffies(ifmgd->probe_timeout))
- run_again(ifmgd, ifmgd->probe_timeout);
-
-- else if (ifmgd->probe_send_count < IEEE80211_MAX_PROBE_TRIES) {
-+ else if (ifmgd->probe_send_count < max_tries) {
- #ifdef CONFIG_MAC80211_VERBOSE_DEBUG
- wiphy_debug(local->hw.wiphy,
- "%s: No probe response from AP %pM"
-@@ -2012,6 +2067,8 @@ void ieee80211_sta_restart(struct ieee80
- add_timer(&ifmgd->timer);
- if (test_and_clear_bit(TMR_RUNNING_CHANSW, &ifmgd->timers_running))
- add_timer(&ifmgd->chswitch_timer);
-+ ieee80211_sta_reset_beacon_monitor(sdata);
-+ ieee80211_send_nullfunc(sdata->local, sdata, 0);
- }
- #endif
-
---- a/net/mac80211/status.c
-+++ b/net/mac80211/status.c
-@@ -155,6 +155,10 @@ static void ieee80211_frame_acked(struct
-
- ieee80211_queue_work(&local->hw, &local->recalc_smps);
- }
-+
-+ if ((sdata->vif.type == NL80211_IFTYPE_STATION) &&
-+ (local->hw.flags & IEEE80211_HW_REPORTS_TX_ACK_STATUS))
-+ ieee80211_sta_tx_notify(sdata, (void *) skb->data);
- }
-
- void ieee80211_tx_status(struct ieee80211_hw *hw, struct sk_buff *skb)
diff --git a/package/mac80211/patches/320-pending_work.patch b/package/mac80211/patches/320-pending_work.patch
new file mode 100644
index 0000000000..44d8df2e03
--- /dev/null
+++ b/package/mac80211/patches/320-pending_work.patch
@@ -0,0 +1,2139 @@
+--- a/drivers/net/wireless/ath/ath9k/ar9002_hw.c
++++ b/drivers/net/wireless/ath/ath9k/ar9002_hw.c
+@@ -26,24 +26,6 @@ MODULE_PARM_DESC(nohwcrypt, "Force new A
+
+ /* General hardware code for the A5008/AR9001/AR9002 hadware families */
+
+-static bool ar9002_hw_macversion_supported(u32 macversion)
+-{
+- switch (macversion) {
+- case AR_SREV_VERSION_5416_PCI:
+- case AR_SREV_VERSION_5416_PCIE:
+- case AR_SREV_VERSION_9160:
+- case AR_SREV_VERSION_9100:
+- case AR_SREV_VERSION_9280:
+- case AR_SREV_VERSION_9285:
+- case AR_SREV_VERSION_9287:
+- case AR_SREV_VERSION_9271:
+- return true;
+- default:
+- break;
+- }
+- return false;
+-}
+-
+ static void ar9002_hw_init_mode_regs(struct ath_hw *ah)
+ {
+ if (AR_SREV_9271(ah)) {
+@@ -565,7 +547,6 @@ void ar9002_hw_attach_ops(struct ath_hw
+
+ priv_ops->init_mode_regs = ar9002_hw_init_mode_regs;
+ priv_ops->init_mode_gain_regs = ar9002_hw_init_mode_gain_regs;
+- priv_ops->macversion_supported = ar9002_hw_macversion_supported;
+
+ ops->config_pci_powersave = ar9002_hw_configpcipowersave;
+
+--- a/drivers/net/wireless/ath/ath9k/ar9002_mac.c
++++ b/drivers/net/wireless/ath/ath9k/ar9002_mac.c
+@@ -283,7 +283,6 @@ static void ar9002_hw_set11n_txdesc(stru
+ {
+ struct ar5416_desc *ads = AR5416DESC(ds);
+
+- txPower += ah->txpower_indexoffset;
+ if (txPower > 63)
+ txPower = 63;
+
+--- a/drivers/net/wireless/ath/ath9k/ar9003_eeprom.c
++++ b/drivers/net/wireless/ath/ath9k/ar9003_eeprom.c
+@@ -71,7 +71,7 @@ static const struct ar9300_eeprom ar9300
+ .regDmn = { LE16(0), LE16(0x1f) },
+ .txrxMask = 0x77, /* 4 bits tx and 4 bits rx */
+ .opCapFlags = {
+- .opFlags = AR9300_OPFLAGS_11G | AR9300_OPFLAGS_11A,
++ .opFlags = AR5416_OPFLAGS_11G | AR5416_OPFLAGS_11A,
+ .eepMisc = 0,
+ },
+ .rfSilent = 0,
+@@ -648,7 +648,7 @@ static const struct ar9300_eeprom ar9300
+ .regDmn = { LE16(0), LE16(0x1f) },
+ .txrxMask = 0x77, /* 4 bits tx and 4 bits rx */
+ .opCapFlags = {
+- .opFlags = AR9300_OPFLAGS_11G | AR9300_OPFLAGS_11A,
++ .opFlags = AR5416_OPFLAGS_11G | AR5416_OPFLAGS_11A,
+ .eepMisc = 0,
+ },
+ .rfSilent = 0,
+@@ -1226,7 +1226,7 @@ static const struct ar9300_eeprom ar9300
+ .regDmn = { LE16(0), LE16(0x1f) },
+ .txrxMask = 0x77, /* 4 bits tx and 4 bits rx */
+ .opCapFlags = {
+- .opFlags = AR9300_OPFLAGS_11G | AR9300_OPFLAGS_11A,
++ .opFlags = AR5416_OPFLAGS_11G | AR5416_OPFLAGS_11A,
+ .eepMisc = 0,
+ },
+ .rfSilent = 0,
+@@ -1804,7 +1804,7 @@ static const struct ar9300_eeprom ar9300
+ .regDmn = { LE16(0), LE16(0x1f) },
+ .txrxMask = 0x77, /* 4 bits tx and 4 bits rx */
+ .opCapFlags = {
+- .opFlags = AR9300_OPFLAGS_11G | AR9300_OPFLAGS_11A,
++ .opFlags = AR5416_OPFLAGS_11G | AR5416_OPFLAGS_11A,
+ .eepMisc = 0,
+ },
+ .rfSilent = 0,
+@@ -2381,7 +2381,7 @@ static const struct ar9300_eeprom ar9300
+ .regDmn = { LE16(0), LE16(0x1f) },
+ .txrxMask = 0x33, /* 4 bits tx and 4 bits rx */
+ .opCapFlags = {
+- .opFlags = AR9300_OPFLAGS_11G | AR9300_OPFLAGS_11A,
++ .opFlags = AR5416_OPFLAGS_11G | AR5416_OPFLAGS_11A,
+ .eepMisc = 0,
+ },
+ .rfSilent = 0,
+@@ -2973,7 +2973,7 @@ static const struct ar9300_eeprom *ar900
+
+ static u16 ath9k_hw_fbin2freq(u8 fbin, bool is2GHz)
+ {
+- if (fbin == AR9300_BCHAN_UNUSED)
++ if (fbin == AR5416_BCHAN_UNUSED)
+ return fbin;
+
+ return (u16) ((is2GHz) ? (2300 + fbin) : (4800 + 5 * fbin));
+@@ -3422,18 +3422,6 @@ static int ath9k_hw_ar9300_get_eeprom_re
+ return 0;
+ }
+
+-static u8 ath9k_hw_ar9300_get_num_ant_config(struct ath_hw *ah,
+- enum ath9k_hal_freq_band freq_band)
+-{
+- return 1;
+-}
+-
+-static u32 ath9k_hw_ar9300_get_eeprom_antenna_cfg(struct ath_hw *ah,
+- struct ath9k_channel *chan)
+-{
+- return -EINVAL;
+-}
+-
+ static s32 ar9003_hw_xpa_bias_level_get(struct ath_hw *ah, bool is2ghz)
+ {
+ struct ar9300_eeprom *eep = &ah->eeprom.ar9300_eep;
+@@ -4395,7 +4383,7 @@ static u16 ar9003_hw_get_indirect_edge_p
+ return CTL_EDGE_TPOWER(ctl_5g[idx].ctlEdges[edge - 1]);
+ }
+
+- return AR9300_MAX_RATE_POWER;
++ return MAX_RATE_POWER;
+ }
+
+ /*
+@@ -4404,7 +4392,7 @@ static u16 ar9003_hw_get_indirect_edge_p
+ static u16 ar9003_hw_get_max_edge_power(struct ar9300_eeprom *eep,
+ u16 freq, int idx, bool is2GHz)
+ {
+- u16 twiceMaxEdgePower = AR9300_MAX_RATE_POWER;
++ u16 twiceMaxEdgePower = MAX_RATE_POWER;
+ u8 *ctl_freqbin = is2GHz ?
+ &eep->ctl_freqbin_2G[idx][0] :
+ &eep->ctl_freqbin_5G[idx][0];
+@@ -4414,7 +4402,7 @@ static u16 ar9003_hw_get_max_edge_power(
+
+ /* Get the edge power */
+ for (edge = 0;
+- (edge < num_edges) && (ctl_freqbin[edge] != AR9300_BCHAN_UNUSED);
++ (edge < num_edges) && (ctl_freqbin[edge] != AR5416_BCHAN_UNUSED);
+ edge++) {
+ /*
+ * If there's an exact channel match or an inband flag set
+@@ -4452,9 +4440,9 @@ static void ar9003_hw_set_power_per_rate
+ struct ath_regulatory *regulatory = ath9k_hw_regulatory(ah);
+ struct ath_common *common = ath9k_hw_common(ah);
+ struct ar9300_eeprom *pEepData = &ah->eeprom.ar9300_eep;
+- u16 twiceMaxEdgePower = AR9300_MAX_RATE_POWER;
++ u16 twiceMaxEdgePower = MAX_RATE_POWER;
+ static const u16 tpScaleReductionTable[5] = {
+- 0, 3, 6, 9, AR9300_MAX_RATE_POWER
++ 0, 3, 6, 9, MAX_RATE_POWER
+ };
+ int i;
+ int16_t twiceLargestAntenna;
+@@ -4762,8 +4750,6 @@ const struct eeprom_ops eep_ar9300_ops =
+ .fill_eeprom = ath9k_hw_ar9300_fill_eeprom,
+ .get_eeprom_ver = ath9k_hw_ar9300_get_eeprom_ver,
+ .get_eeprom_rev = ath9k_hw_ar9300_get_eeprom_rev,
+- .get_num_ant_config = ath9k_hw_ar9300_get_num_ant_config,
+- .get_eeprom_antenna_cfg = ath9k_hw_ar9300_get_eeprom_antenna_cfg,
+ .set_board_values = ath9k_hw_ar9300_set_board_values,
+ .set_addac = ath9k_hw_ar9300_set_addac,
+ .set_txpower = ath9k_hw_ar9300_set_txpower,
+--- a/drivers/net/wireless/ath/ath9k/ar9003_eeprom.h
++++ b/drivers/net/wireless/ath/ath9k/ar9003_eeprom.h
+@@ -20,48 +20,17 @@
+ /* #define AR9300_NUM_CTLS 21 */
+ #define AR9300_NUM_CTLS_5G 9
+ #define AR9300_NUM_CTLS_2G 12
+-#define AR9300_CTL_MODE_M 0xF
+ #define AR9300_NUM_BAND_EDGES_5G 8
+ #define AR9300_NUM_BAND_EDGES_2G 4
+-#define AR9300_NUM_PD_GAINS 4
+-#define AR9300_PD_GAINS_IN_MASK 4
+-#define AR9300_PD_GAIN_ICEPTS 5
+-#define AR9300_EEPROM_MODAL_SPURS 5
+-#define AR9300_MAX_RATE_POWER 63
+-#define AR9300_NUM_PDADC_VALUES 128
+-#define AR9300_NUM_RATES 16
+-#define AR9300_BCHAN_UNUSED 0xFF
+-#define AR9300_MAX_PWR_RANGE_IN_HALF_DB 64
+-#define AR9300_OPFLAGS_11A 0x01
+-#define AR9300_OPFLAGS_11G 0x02
+-#define AR9300_OPFLAGS_5G_HT40 0x04
+-#define AR9300_OPFLAGS_2G_HT40 0x08
+-#define AR9300_OPFLAGS_5G_HT20 0x10
+-#define AR9300_OPFLAGS_2G_HT20 0x20
+ #define AR9300_EEPMISC_BIG_ENDIAN 0x01
+ #define AR9300_EEPMISC_WOW 0x02
+ #define AR9300_CUSTOMER_DATA_SIZE 20
+
+-#define FREQ2FBIN(x, y) ((y) ? ((x) - 2300) : (((x) - 4800) / 5))
+ #define FBIN2FREQ(x, y) ((y) ? (2300 + x) : (4800 + 5 * x))
+ #define AR9300_MAX_CHAINS 3
+ #define AR9300_ANT_16S 25
+ #define AR9300_FUTURE_MODAL_SZ 6
+
+-#define AR9300_NUM_ANT_CHAIN_FIELDS 7
+-#define AR9300_NUM_ANT_COMMON_FIELDS 4
+-#define AR9300_SIZE_ANT_CHAIN_FIELD 3
+-#define AR9300_SIZE_ANT_COMMON_FIELD 4
+-#define AR9300_ANT_CHAIN_MASK 0x7
+-#define AR9300_ANT_COMMON_MASK 0xf
+-#define AR9300_CHAIN_0_IDX 0
+-#define AR9300_CHAIN_1_IDX 1
+-#define AR9300_CHAIN_2_IDX 2
+-
+-#define AR928X_NUM_ANT_CHAIN_FIELDS 6
+-#define AR928X_SIZE_ANT_CHAIN_FIELD 2
+-#define AR928X_ANT_CHAIN_MASK 0x3
+-
+ /* Delta from which to start power to pdadc table */
+ /* This offset is used in both open loop and closed loop power control
+ * schemes. In open loop power control, it is not really needed, but for
+@@ -71,12 +40,8 @@
+ */
+ #define AR9300_PWR_TABLE_OFFSET 0
+
+-/* enable flags for voltage and temp compensation */
+-#define ENABLE_TEMP_COMPENSATION 0x01
+-#define ENABLE_VOLT_COMPENSATION 0x02
+ /* byte addressable */
+ #define AR9300_EEPROM_SIZE (16*1024)
+-#define FIXED_CCA_THRESHOLD 15
+
+ #define AR9300_BASE_ADDR 0x3ff
+ #define AR9300_BASE_ADDR_512 0x1ff
+@@ -225,7 +190,7 @@ struct ar9300_modal_eep_header {
+ int8_t tempSlope;
+ int8_t voltSlope;
+ /* spur channels in usual fbin coding format */
+- u8 spurChans[AR9300_EEPROM_MODAL_SPURS];
++ u8 spurChans[AR_EEPROM_MODAL_SPURS];
+ /* 3 Check if the register is per chain */
+ int8_t noiseFloorThreshCh[AR9300_MAX_CHAINS];
+ u8 ob[AR9300_MAX_CHAINS];
+--- a/drivers/net/wireless/ath/ath9k/ar9003_hw.c
++++ b/drivers/net/wireless/ath/ath9k/ar9003_hw.c
+@@ -20,17 +20,6 @@
+
+ /* General hardware code for the AR9003 hadware family */
+
+-static bool ar9003_hw_macversion_supported(u32 macversion)
+-{
+- switch (macversion) {
+- case AR_SREV_VERSION_9300:
+- return true;
+- default:
+- break;
+- }
+- return false;
+-}
+-
+ /*
+ * The AR9003 family uses a new INI format (pre, core, post
+ * arrays per subsystem). This provides support for the
+@@ -216,7 +205,6 @@ void ar9003_hw_attach_ops(struct ath_hw
+
+ priv_ops->init_mode_regs = ar9003_hw_init_mode_regs;
+ priv_ops->init_mode_gain_regs = ar9003_hw_init_mode_gain_regs;
+- priv_ops->macversion_supported = ar9003_hw_macversion_supported;
+
+ ops->config_pci_powersave = ar9003_hw_configpcipowersave;
+
+--- a/drivers/net/wireless/ath/ath9k/ar9003_mac.c
++++ b/drivers/net/wireless/ath/ath9k/ar9003_mac.c
+@@ -322,7 +322,6 @@ static void ar9003_hw_set11n_txdesc(stru
+ if (txpower > ah->txpower_limit)
+ txpower = ah->txpower_limit;
+
+- txpower += ah->txpower_indexoffset;
+ if (txpower > 63)
+ txpower = 63;
+
+--- a/drivers/net/wireless/ath/ath9k/eeprom.c
++++ b/drivers/net/wireless/ath/ath9k/eeprom.c
+@@ -234,7 +234,7 @@ void ath9k_hw_get_target_powers(struct a
+ u16 ath9k_hw_get_max_edge_power(u16 freq, struct cal_ctl_edges *pRdEdgesPower,
+ bool is2GHz, int num_band_edges)
+ {
+- u16 twiceMaxEdgePower = AR5416_MAX_RATE_POWER;
++ u16 twiceMaxEdgePower = MAX_RATE_POWER;
+ int i;
+
+ for (i = 0; (i < num_band_edges) &&
+@@ -279,6 +279,219 @@ void ath9k_hw_update_regulatory_maxpower
+ }
+ }
+
++void ath9k_hw_get_gain_boundaries_pdadcs(struct ath_hw *ah,
++ struct ath9k_channel *chan,
++ void *pRawDataSet,
++ u8 *bChans, u16 availPiers,
++ u16 tPdGainOverlap,
++ u16 *pPdGainBoundaries, u8 *pPDADCValues,
++ u16 numXpdGains)
++{
++ int i, j, k;
++ int16_t ss;
++ u16 idxL = 0, idxR = 0, numPiers;
++ static u8 vpdTableL[AR5416_NUM_PD_GAINS]
++ [AR5416_MAX_PWR_RANGE_IN_HALF_DB];
++ static u8 vpdTableR[AR5416_NUM_PD_GAINS]
++ [AR5416_MAX_PWR_RANGE_IN_HALF_DB];
++ static u8 vpdTableI[AR5416_NUM_PD_GAINS]
++ [AR5416_MAX_PWR_RANGE_IN_HALF_DB];
++
++ u8 *pVpdL, *pVpdR, *pPwrL, *pPwrR;
++ u8 minPwrT4[AR5416_NUM_PD_GAINS];
++ u8 maxPwrT4[AR5416_NUM_PD_GAINS];
++ int16_t vpdStep;
++ int16_t tmpVal;
++ u16 sizeCurrVpdTable, maxIndex, tgtIndex;
++ bool match;
++ int16_t minDelta = 0;
++ struct chan_centers centers;
++ int pdgain_boundary_default;
++ struct cal_data_per_freq *data_def = pRawDataSet;
++ struct cal_data_per_freq_4k *data_4k = pRawDataSet;
++ struct cal_data_per_freq_ar9287 *data_9287 = pRawDataSet;
++ bool eeprom_4k = AR_SREV_9285(ah) || AR_SREV_9271(ah);
++ int intercepts;
++
++ if (AR_SREV_9287(ah))
++ intercepts = AR9287_PD_GAIN_ICEPTS;
++ else
++ intercepts = AR5416_PD_GAIN_ICEPTS;
++
++ memset(&minPwrT4, 0, AR5416_NUM_PD_GAINS);
++ ath9k_hw_get_channel_centers(ah, chan, &centers);
++
++ for (numPiers = 0; numPiers < availPiers; numPiers++) {
++ if (bChans[numPiers] == AR5416_BCHAN_UNUSED)
++ break;
++ }
++
++ match = ath9k_hw_get_lower_upper_index((u8)FREQ2FBIN(centers.synth_center,
++ IS_CHAN_2GHZ(chan)),
++ bChans, numPiers, &idxL, &idxR);
++
++ if (match) {
++ if (AR_SREV_9287(ah)) {
++ /* FIXME: array overrun? */
++ for (i = 0; i < numXpdGains; i++) {
++ minPwrT4[i] = data_9287[idxL].pwrPdg[i][0];
++ maxPwrT4[i] = data_9287[idxL].pwrPdg[i][4];
++ ath9k_hw_fill_vpd_table(minPwrT4[i], maxPwrT4[i],
++ data_9287[idxL].pwrPdg[i],
++ data_9287[idxL].vpdPdg[i],
++ intercepts,
++ vpdTableI[i]);
++ }
++ } else if (eeprom_4k) {
++ for (i = 0; i < numXpdGains; i++) {
++ minPwrT4[i] = data_4k[idxL].pwrPdg[i][0];
++ maxPwrT4[i] = data_4k[idxL].pwrPdg[i][4];
++ ath9k_hw_fill_vpd_table(minPwrT4[i], maxPwrT4[i],
++ data_4k[idxL].pwrPdg[i],
++ data_4k[idxL].vpdPdg[i],
++ intercepts,
++ vpdTableI[i]);
++ }
++ } else {
++ for (i = 0; i < numXpdGains; i++) {
++ minPwrT4[i] = data_def[idxL].pwrPdg[i][0];
++ maxPwrT4[i] = data_def[idxL].pwrPdg[i][4];
++ ath9k_hw_fill_vpd_table(minPwrT4[i], maxPwrT4[i],
++ data_def[idxL].pwrPdg[i],
++ data_def[idxL].vpdPdg[i],
++ intercepts,
++ vpdTableI[i]);
++ }
++ }
++ } else {
++ for (i = 0; i < numXpdGains; i++) {
++ if (AR_SREV_9287(ah)) {
++ pVpdL = data_9287[idxL].vpdPdg[i];
++ pPwrL = data_9287[idxL].pwrPdg[i];
++ pVpdR = data_9287[idxR].vpdPdg[i];
++ pPwrR = data_9287[idxR].pwrPdg[i];
++ } else if (eeprom_4k) {
++ pVpdL = data_4k[idxL].vpdPdg[i];
++ pPwrL = data_4k[idxL].pwrPdg[i];
++ pVpdR = data_4k[idxR].vpdPdg[i];
++ pPwrR = data_4k[idxR].pwrPdg[i];
++ } else {
++ pVpdL = data_def[idxL].vpdPdg[i];
++ pPwrL = data_def[idxL].pwrPdg[i];
++ pVpdR = data_def[idxR].vpdPdg[i];
++ pPwrR = data_def[idxR].pwrPdg[i];
++ }
++
++ minPwrT4[i] = max(pPwrL[0], pPwrR[0]);
++
++ maxPwrT4[i] =
++ min(pPwrL[intercepts - 1],
++ pPwrR[intercepts - 1]);
++
++
++ ath9k_hw_fill_vpd_table(minPwrT4[i], maxPwrT4[i],
++ pPwrL, pVpdL,
++ intercepts,
++ vpdTableL[i]);
++ ath9k_hw_fill_vpd_table(minPwrT4[i], maxPwrT4[i],
++ pPwrR, pVpdR,
++ intercepts,
++ vpdTableR[i]);
++
++ for (j = 0; j <= (maxPwrT4[i] - minPwrT4[i]) / 2; j++) {
++ vpdTableI[i][j] =
++ (u8)(ath9k_hw_interpolate((u16)
++ FREQ2FBIN(centers.
++ synth_center,
++ IS_CHAN_2GHZ
++ (chan)),
++ bChans[idxL], bChans[idxR],
++ vpdTableL[i][j], vpdTableR[i][j]));
++ }
++ }
++ }
++
++ k = 0;
++
++ for (i = 0; i < numXpdGains; i++) {
++ if (i == (numXpdGains - 1))
++ pPdGainBoundaries[i] =
++ (u16)(maxPwrT4[i] / 2);
++ else
++ pPdGainBoundaries[i] =
++ (u16)((maxPwrT4[i] + minPwrT4[i + 1]) / 4);
++
++ pPdGainBoundaries[i] =
++ min((u16)MAX_RATE_POWER, pPdGainBoundaries[i]);
++
++ if ((i == 0) && !AR_SREV_5416_20_OR_LATER(ah)) {
++ minDelta = pPdGainBoundaries[0] - 23;
++ pPdGainBoundaries[0] = 23;
++ } else {
++ minDelta = 0;
++ }
++
++ if (i == 0) {
++ if (AR_SREV_9280_20_OR_LATER(ah))
++ ss = (int16_t)(0 - (minPwrT4[i] / 2));
++ else
++ ss = 0;
++ } else {
++ ss = (int16_t)((pPdGainBoundaries[i - 1] -
++ (minPwrT4[i] / 2)) -
++ tPdGainOverlap + 1 + minDelta);
++ }
++ vpdStep = (int16_t)(vpdTableI[i][1] - vpdTableI[i][0]);
++ vpdStep = (int16_t)((vpdStep < 1) ? 1 : vpdStep);
++
++ while ((ss < 0) && (k < (AR5416_NUM_PDADC_VALUES - 1))) {
++ tmpVal = (int16_t)(vpdTableI[i][0] + ss * vpdStep);
++ pPDADCValues[k++] = (u8)((tmpVal < 0) ? 0 : tmpVal);
++ ss++;
++ }
++
++ sizeCurrVpdTable = (u8) ((maxPwrT4[i] - minPwrT4[i]) / 2 + 1);
++ tgtIndex = (u8)(pPdGainBoundaries[i] + tPdGainOverlap -
++ (minPwrT4[i] / 2));
++ maxIndex = (tgtIndex < sizeCurrVpdTable) ?
++ tgtIndex : sizeCurrVpdTable;
++
++ while ((ss < maxIndex) && (k < (AR5416_NUM_PDADC_VALUES - 1))) {
++ pPDADCValues[k++] = vpdTableI[i][ss++];
++ }
++
++ vpdStep = (int16_t)(vpdTableI[i][sizeCurrVpdTable - 1] -
++ vpdTableI[i][sizeCurrVpdTable - 2]);
++ vpdStep = (int16_t)((vpdStep < 1) ? 1 : vpdStep);
++
++ if (tgtIndex >= maxIndex) {
++ while ((ss <= tgtIndex) &&
++ (k < (AR5416_NUM_PDADC_VALUES - 1))) {
++ tmpVal = (int16_t)((vpdTableI[i][sizeCurrVpdTable - 1] +
++ (ss - maxIndex + 1) * vpdStep));
++ pPDADCValues[k++] = (u8)((tmpVal > 255) ?
++ 255 : tmpVal);
++ ss++;
++ }
++ }
++ }
++
++ if (eeprom_4k)
++ pdgain_boundary_default = 58;
++ else
++ pdgain_boundary_default = pPdGainBoundaries[i - 1];
++
++ while (i < AR5416_PD_GAINS_IN_MASK) {
++ pPdGainBoundaries[i] = pdgain_boundary_default;
++ i++;
++ }
++
++ while (k < AR5416_NUM_PDADC_VALUES) {
++ pPDADCValues[k] = pPDADCValues[k - 1];
++ k++;
++ }
++}
++
+ int ath9k_hw_eeprom_init(struct ath_hw *ah)
+ {
+ int status;
+--- a/drivers/net/wireless/ath/ath9k/eeprom.h
++++ b/drivers/net/wireless/ath/ath9k/eeprom.h
+@@ -17,6 +17,8 @@
+ #ifndef EEPROM_H
+ #define EEPROM_H
+
++#define AR_EEPROM_MODAL_SPURS 5
++
+ #include "../ath.h"
+ #include <net/cfg80211.h>
+ #include "ar9003_eeprom.h"
+@@ -149,8 +151,6 @@
+ #define AR5416_NUM_PD_GAINS 4
+ #define AR5416_PD_GAINS_IN_MASK 4
+ #define AR5416_PD_GAIN_ICEPTS 5
+-#define AR5416_EEPROM_MODAL_SPURS 5
+-#define AR5416_MAX_RATE_POWER 63
+ #define AR5416_NUM_PDADC_VALUES 128
+ #define AR5416_BCHAN_UNUSED 0xFF
+ #define AR5416_MAX_PWR_RANGE_IN_HALF_DB 64
+@@ -175,8 +175,6 @@
+ #define AR5416_EEP4K_NUM_CTLS 12
+ #define AR5416_EEP4K_NUM_BAND_EDGES 4
+ #define AR5416_EEP4K_NUM_PD_GAINS 2
+-#define AR5416_EEP4K_PD_GAINS_IN_MASK 4
+-#define AR5416_EEP4K_PD_GAIN_ICEPTS 5
+ #define AR5416_EEP4K_MAX_CHAINS 1
+
+ #define AR9280_TX_GAIN_TABLE_SIZE 22
+@@ -198,35 +196,12 @@
+ #define AR9287_NUM_2G_40_TARGET_POWERS 3
+ #define AR9287_NUM_CTLS 12
+ #define AR9287_NUM_BAND_EDGES 4
+-#define AR9287_NUM_PD_GAINS 4
+-#define AR9287_PD_GAINS_IN_MASK 4
+ #define AR9287_PD_GAIN_ICEPTS 1
+-#define AR9287_EEPROM_MODAL_SPURS 5
+-#define AR9287_MAX_RATE_POWER 63
+-#define AR9287_NUM_PDADC_VALUES 128
+-#define AR9287_NUM_RATES 16
+-#define AR9287_BCHAN_UNUSED 0xFF
+-#define AR9287_MAX_PWR_RANGE_IN_HALF_DB 64
+-#define AR9287_OPFLAGS_11A 0x01
+-#define AR9287_OPFLAGS_11G 0x02
+-#define AR9287_OPFLAGS_2G_HT40 0x08
+-#define AR9287_OPFLAGS_2G_HT20 0x20
+-#define AR9287_OPFLAGS_5G_HT40 0x04
+-#define AR9287_OPFLAGS_5G_HT20 0x10
+ #define AR9287_EEPMISC_BIG_ENDIAN 0x01
+ #define AR9287_EEPMISC_WOW 0x02
+ #define AR9287_MAX_CHAINS 2
+ #define AR9287_ANT_16S 32
+-#define AR9287_custdatasize 20
+
+-#define AR9287_NUM_ANT_CHAIN_FIELDS 6
+-#define AR9287_NUM_ANT_COMMON_FIELDS 4
+-#define AR9287_SIZE_ANT_CHAIN_FIELD 2
+-#define AR9287_SIZE_ANT_COMMON_FIELD 4
+-#define AR9287_ANT_CHAIN_MASK 0x3
+-#define AR9287_ANT_COMMON_MASK 0xf
+-#define AR9287_CHAIN_0_IDX 0
+-#define AR9287_CHAIN_1_IDX 1
+ #define AR9287_DATA_SZ 32
+
+ #define AR9287_PWR_TABLE_OFFSET_DB -5
+@@ -396,7 +371,7 @@ struct modal_eep_header {
+ u16 xpaBiasLvlFreq[3];
+ u8 futureModal[6];
+
+- struct spur_chan spurChans[AR5416_EEPROM_MODAL_SPURS];
++ struct spur_chan spurChans[AR_EEPROM_MODAL_SPURS];
+ } __packed;
+
+ struct calDataPerFreqOpLoop {
+@@ -464,7 +439,7 @@ struct modal_eep_4k_header {
+ u8 db2_4:4, reserved:4;
+ #endif
+ u8 futureModal[4];
+- struct spur_chan spurChans[AR5416_EEPROM_MODAL_SPURS];
++ struct spur_chan spurChans[AR_EEPROM_MODAL_SPURS];
+ } __packed;
+
+ struct base_eep_ar9287_header {
+@@ -522,7 +497,7 @@ struct modal_eep_ar9287_header {
+ u8 ob_qam;
+ u8 ob_pal_off;
+ u8 futureModal[30];
+- struct spur_chan spurChans[AR9287_EEPROM_MODAL_SPURS];
++ struct spur_chan spurChans[AR_EEPROM_MODAL_SPURS];
+ } __packed;
+
+ struct cal_data_per_freq {
+@@ -531,8 +506,8 @@ struct cal_data_per_freq {
+ } __packed;
+
+ struct cal_data_per_freq_4k {
+- u8 pwrPdg[AR5416_EEP4K_NUM_PD_GAINS][AR5416_EEP4K_PD_GAIN_ICEPTS];
+- u8 vpdPdg[AR5416_EEP4K_NUM_PD_GAINS][AR5416_EEP4K_PD_GAIN_ICEPTS];
++ u8 pwrPdg[AR5416_EEP4K_NUM_PD_GAINS][AR5416_PD_GAIN_ICEPTS];
++ u8 vpdPdg[AR5416_EEP4K_NUM_PD_GAINS][AR5416_PD_GAIN_ICEPTS];
+ } __packed;
+
+ struct cal_target_power_leg {
+@@ -558,8 +533,8 @@ struct cal_data_op_loop_ar9287 {
+ } __packed;
+
+ struct cal_data_per_freq_ar9287 {
+- u8 pwrPdg[AR9287_NUM_PD_GAINS][AR9287_PD_GAIN_ICEPTS];
+- u8 vpdPdg[AR9287_NUM_PD_GAINS][AR9287_PD_GAIN_ICEPTS];
++ u8 pwrPdg[AR5416_NUM_PD_GAINS][AR9287_PD_GAIN_ICEPTS];
++ u8 vpdPdg[AR5416_NUM_PD_GAINS][AR9287_PD_GAIN_ICEPTS];
+ } __packed;
+
+ union cal_data_per_freq_ar9287_u {
+@@ -674,10 +649,6 @@ struct eeprom_ops {
+ bool (*fill_eeprom)(struct ath_hw *hw);
+ int (*get_eeprom_ver)(struct ath_hw *hw);
+ int (*get_eeprom_rev)(struct ath_hw *hw);
+- u8 (*get_num_ant_config)(struct ath_hw *hw,
+- enum ath9k_hal_freq_band band);
+- u32 (*get_eeprom_antenna_cfg)(struct ath_hw *hw,
+- struct ath9k_channel *chan);
+ void (*set_board_values)(struct ath_hw *hw, struct ath9k_channel *chan);
+ void (*set_addac)(struct ath_hw *hw, struct ath9k_channel *chan);
+ void (*set_txpower)(struct ath_hw *hw, struct ath9k_channel *chan,
+@@ -716,6 +687,14 @@ u16 ath9k_hw_get_max_edge_power(u16 freq
+ void ath9k_hw_update_regulatory_maxpower(struct ath_hw *ah);
+ int ath9k_hw_eeprom_init(struct ath_hw *ah);
+
++void ath9k_hw_get_gain_boundaries_pdadcs(struct ath_hw *ah,
++ struct ath9k_channel *chan,
++ void *pRawDataSet,
++ u8 *bChans, u16 availPiers,
++ u16 tPdGainOverlap,
++ u16 *pPdGainBoundaries, u8 *pPDADCValues,
++ u16 numXpdGains);
++
+ #define ar5416_get_ntxchains(_txchainmask) \
+ (((_txchainmask >> 2) & 1) + \
+ ((_txchainmask >> 1) & 1) + (_txchainmask & 1))
+--- a/drivers/net/wireless/ath/ath9k/eeprom_4k.c
++++ b/drivers/net/wireless/ath/ath9k/eeprom_4k.c
+@@ -155,7 +155,7 @@ static int ath9k_hw_4k_check_eeprom(stru
+ eep->modalHeader.antCtrlChain[i] = integer;
+ }
+
+- for (i = 0; i < AR5416_EEPROM_MODAL_SPURS; i++) {
++ for (i = 0; i < AR_EEPROM_MODAL_SPURS; i++) {
+ word = swab16(eep->modalHeader.spurChans[i].spurChan);
+ eep->modalHeader.spurChans[i].spurChan = word;
+ }
+@@ -230,173 +230,6 @@ static u32 ath9k_hw_4k_get_eeprom(struct
+ }
+ }
+
+-static void ath9k_hw_get_4k_gain_boundaries_pdadcs(struct ath_hw *ah,
+- struct ath9k_channel *chan,
+- struct cal_data_per_freq_4k *pRawDataSet,
+- u8 *bChans, u16 availPiers,
+- u16 tPdGainOverlap,
+- u16 *pPdGainBoundaries, u8 *pPDADCValues,
+- u16 numXpdGains)
+-{
+-#define TMP_VAL_VPD_TABLE \
+- ((vpdTableI[i][sizeCurrVpdTable - 1] + (ss - maxIndex + 1) * vpdStep));
+- int i, j, k;
+- int16_t ss;
+- u16 idxL = 0, idxR = 0, numPiers;
+- static u8 vpdTableL[AR5416_EEP4K_NUM_PD_GAINS]
+- [AR5416_MAX_PWR_RANGE_IN_HALF_DB];
+- static u8 vpdTableR[AR5416_EEP4K_NUM_PD_GAINS]
+- [AR5416_MAX_PWR_RANGE_IN_HALF_DB];
+- static u8 vpdTableI[AR5416_EEP4K_NUM_PD_GAINS]
+- [AR5416_MAX_PWR_RANGE_IN_HALF_DB];
+-
+- u8 *pVpdL, *pVpdR, *pPwrL, *pPwrR;
+- u8 minPwrT4[AR5416_EEP4K_NUM_PD_GAINS];
+- u8 maxPwrT4[AR5416_EEP4K_NUM_PD_GAINS];
+- int16_t vpdStep;
+- int16_t tmpVal;
+- u16 sizeCurrVpdTable, maxIndex, tgtIndex;
+- bool match;
+- int16_t minDelta = 0;
+- struct chan_centers centers;
+-#define PD_GAIN_BOUNDARY_DEFAULT 58;
+-
+- memset(&minPwrT4, 0, AR9287_NUM_PD_GAINS);
+- ath9k_hw_get_channel_centers(ah, chan, &centers);
+-
+- for (numPiers = 0; numPiers < availPiers; numPiers++) {
+- if (bChans[numPiers] == AR5416_BCHAN_UNUSED)
+- break;
+- }
+-
+- match = ath9k_hw_get_lower_upper_index(
+- (u8)FREQ2FBIN(centers.synth_center,
+- IS_CHAN_2GHZ(chan)), bChans, numPiers,
+- &idxL, &idxR);
+-
+- if (match) {
+- for (i = 0; i < numXpdGains; i++) {
+- minPwrT4[i] = pRawDataSet[idxL].pwrPdg[i][0];
+- maxPwrT4[i] = pRawDataSet[idxL].pwrPdg[i][4];
+- ath9k_hw_fill_vpd_table(minPwrT4[i], maxPwrT4[i],
+- pRawDataSet[idxL].pwrPdg[i],
+- pRawDataSet[idxL].vpdPdg[i],
+- AR5416_EEP4K_PD_GAIN_ICEPTS,
+- vpdTableI[i]);
+- }
+- } else {
+- for (i = 0; i < numXpdGains; i++) {
+- pVpdL = pRawDataSet[idxL].vpdPdg[i];
+- pPwrL = pRawDataSet[idxL].pwrPdg[i];
+- pVpdR = pRawDataSet[idxR].vpdPdg[i];
+- pPwrR = pRawDataSet[idxR].pwrPdg[i];
+-
+- minPwrT4[i] = max(pPwrL[0], pPwrR[0]);
+-
+- maxPwrT4[i] =
+- min(pPwrL[AR5416_EEP4K_PD_GAIN_ICEPTS - 1],
+- pPwrR[AR5416_EEP4K_PD_GAIN_ICEPTS - 1]);
+-
+-
+- ath9k_hw_fill_vpd_table(minPwrT4[i], maxPwrT4[i],
+- pPwrL, pVpdL,
+- AR5416_EEP4K_PD_GAIN_ICEPTS,
+- vpdTableL[i]);
+- ath9k_hw_fill_vpd_table(minPwrT4[i], maxPwrT4[i],
+- pPwrR, pVpdR,
+- AR5416_EEP4K_PD_GAIN_ICEPTS,
+- vpdTableR[i]);
+-
+- for (j = 0; j <= (maxPwrT4[i] - minPwrT4[i]) / 2; j++) {
+- vpdTableI[i][j] =
+- (u8)(ath9k_hw_interpolate((u16)
+- FREQ2FBIN(centers.
+- synth_center,
+- IS_CHAN_2GHZ
+- (chan)),
+- bChans[idxL], bChans[idxR],
+- vpdTableL[i][j], vpdTableR[i][j]));
+- }
+- }
+- }
+-
+- k = 0;
+-
+- for (i = 0; i < numXpdGains; i++) {
+- if (i == (numXpdGains - 1))
+- pPdGainBoundaries[i] =
+- (u16)(maxPwrT4[i] / 2);
+- else
+- pPdGainBoundaries[i] =
+- (u16)((maxPwrT4[i] + minPwrT4[i + 1]) / 4);
+-
+- pPdGainBoundaries[i] =
+- min((u16)AR5416_MAX_RATE_POWER, pPdGainBoundaries[i]);
+-
+- if ((i == 0) && !AR_SREV_5416_20_OR_LATER(ah)) {
+- minDelta = pPdGainBoundaries[0] - 23;
+- pPdGainBoundaries[0] = 23;
+- } else {
+- minDelta = 0;
+- }
+-
+- if (i == 0) {
+- if (AR_SREV_9280_20_OR_LATER(ah))
+- ss = (int16_t)(0 - (minPwrT4[i] / 2));
+- else
+- ss = 0;
+- } else {
+- ss = (int16_t)((pPdGainBoundaries[i - 1] -
+- (minPwrT4[i] / 2)) -
+- tPdGainOverlap + 1 + minDelta);
+- }
+- vpdStep = (int16_t)(vpdTableI[i][1] - vpdTableI[i][0]);
+- vpdStep = (int16_t)((vpdStep < 1) ? 1 : vpdStep);
+-
+- while ((ss < 0) && (k < (AR5416_NUM_PDADC_VALUES - 1))) {
+- tmpVal = (int16_t)(vpdTableI[i][0] + ss * vpdStep);
+- pPDADCValues[k++] = (u8)((tmpVal < 0) ? 0 : tmpVal);
+- ss++;
+- }
+-
+- sizeCurrVpdTable = (u8) ((maxPwrT4[i] - minPwrT4[i]) / 2 + 1);
+- tgtIndex = (u8)(pPdGainBoundaries[i] + tPdGainOverlap -
+- (minPwrT4[i] / 2));
+- maxIndex = (tgtIndex < sizeCurrVpdTable) ?
+- tgtIndex : sizeCurrVpdTable;
+-
+- while ((ss < maxIndex) && (k < (AR5416_NUM_PDADC_VALUES - 1)))
+- pPDADCValues[k++] = vpdTableI[i][ss++];
+-
+- vpdStep = (int16_t)(vpdTableI[i][sizeCurrVpdTable - 1] -
+- vpdTableI[i][sizeCurrVpdTable - 2]);
+- vpdStep = (int16_t)((vpdStep < 1) ? 1 : vpdStep);
+-
+- if (tgtIndex >= maxIndex) {
+- while ((ss <= tgtIndex) &&
+- (k < (AR5416_NUM_PDADC_VALUES - 1))) {
+- tmpVal = (int16_t) TMP_VAL_VPD_TABLE;
+- pPDADCValues[k++] = (u8)((tmpVal > 255) ?
+- 255 : tmpVal);
+- ss++;
+- }
+- }
+- }
+-
+- while (i < AR5416_EEP4K_PD_GAINS_IN_MASK) {
+- pPdGainBoundaries[i] = PD_GAIN_BOUNDARY_DEFAULT;
+- i++;
+- }
+-
+- while (k < AR5416_NUM_PDADC_VALUES) {
+- pPDADCValues[k] = pPDADCValues[k - 1];
+- k++;
+- }
+-
+- return;
+-#undef TMP_VAL_VPD_TABLE
+-}
+-
+ static void ath9k_hw_set_4k_power_cal_table(struct ath_hw *ah,
+ struct ath9k_channel *chan,
+ int16_t *pTxPowerIndexOffset)
+@@ -407,7 +240,7 @@ static void ath9k_hw_set_4k_power_cal_ta
+ u8 *pCalBChans = NULL;
+ u16 pdGainOverlap_t2;
+ static u8 pdadcValues[AR5416_NUM_PDADC_VALUES];
+- u16 gainBoundaries[AR5416_EEP4K_PD_GAINS_IN_MASK];
++ u16 gainBoundaries[AR5416_PD_GAINS_IN_MASK];
+ u16 numPiers, i, j;
+ u16 numXpdGain, xpdMask;
+ u16 xpdGainValues[AR5416_EEP4K_NUM_PD_GAINS] = { 0, 0 };
+@@ -429,12 +262,12 @@ static void ath9k_hw_set_4k_power_cal_ta
+
+ numXpdGain = 0;
+
+- for (i = 1; i <= AR5416_EEP4K_PD_GAINS_IN_MASK; i++) {
+- if ((xpdMask >> (AR5416_EEP4K_PD_GAINS_IN_MASK - i)) & 1) {
++ for (i = 1; i <= AR5416_PD_GAINS_IN_MASK; i++) {
++ if ((xpdMask >> (AR5416_PD_GAINS_IN_MASK - i)) & 1) {
+ if (numXpdGain >= AR5416_EEP4K_NUM_PD_GAINS)
+ break;
+ xpdGainValues[numXpdGain] =
+- (u16)(AR5416_EEP4K_PD_GAINS_IN_MASK - i);
++ (u16)(AR5416_PD_GAINS_IN_MASK - i);
+ numXpdGain++;
+ }
+ }
+@@ -458,7 +291,7 @@ static void ath9k_hw_set_4k_power_cal_ta
+ if (pEepData->baseEepHeader.txMask & (1 << i)) {
+ pRawDataset = pEepData->calPierData2G[i];
+
+- ath9k_hw_get_4k_gain_boundaries_pdadcs(ah, chan,
++ ath9k_hw_get_gain_boundaries_pdadcs(ah, chan,
+ pRawDataset, pCalBChans,
+ numPiers, pdGainOverlap_t2,
+ gainBoundaries,
+@@ -532,7 +365,7 @@ static void ath9k_hw_set_4k_power_per_ra
+ int i;
+ int16_t twiceLargestAntenna;
+ u16 twiceMinEdgePower;
+- u16 twiceMaxEdgePower = AR5416_MAX_RATE_POWER;
++ u16 twiceMaxEdgePower = MAX_RATE_POWER;
+ u16 scaledPower = 0, minCtlPower, maxRegAllowedPower;
+ u16 numCtlModes;
+ const u16 *pCtlMode;
+@@ -541,7 +374,7 @@ static void ath9k_hw_set_4k_power_per_ra
+ struct cal_ctl_data_4k *rep;
+ struct ar5416_eeprom_4k *pEepData = &ah->eeprom.map4k;
+ static const u16 tpScaleReductionTable[5] =
+- { 0, 3, 6, 9, AR5416_MAX_RATE_POWER };
++ { 0, 3, 6, 9, MAX_RATE_POWER };
+ struct cal_target_power_leg targetPowerOfdm, targetPowerCck = {
+ 0, { 0, 0, 0, 0}
+ };
+@@ -617,7 +450,7 @@ static void ath9k_hw_set_4k_power_per_ra
+
+ if (ah->eep_ops->get_eeprom_ver(ah) == 14 &&
+ ah->eep_ops->get_eeprom_rev(ah) <= 2)
+- twiceMaxEdgePower = AR5416_MAX_RATE_POWER;
++ twiceMaxEdgePower = MAX_RATE_POWER;
+
+ for (i = 0; (i < AR5416_EEP4K_NUM_CTLS) &&
+ pEepData->ctlIndex[i]; i++) {
+@@ -756,8 +589,8 @@ static void ath9k_hw_4k_set_txpower(stru
+ regulatory->max_power_level = 0;
+ for (i = 0; i < ARRAY_SIZE(ratesArray); i++) {
+ ratesArray[i] = (int16_t)(txPowerIndexOffset + ratesArray[i]);
+- if (ratesArray[i] > AR5416_MAX_RATE_POWER)
+- ratesArray[i] = AR5416_MAX_RATE_POWER;
++ if (ratesArray[i] > MAX_RATE_POWER)
++ ratesArray[i] = MAX_RATE_POWER;
+
+ if (ratesArray[i] > regulatory->max_power_level)
+ regulatory->max_power_level = ratesArray[i];
+@@ -941,8 +774,7 @@ static void ath9k_hw_4k_set_board_values
+ pModal = &eep->modalHeader;
+ txRxAttenLocal = 23;
+
+- REG_WRITE(ah, AR_PHY_SWITCH_COM,
+- ah->eep_ops->get_eeprom_antenna_cfg(ah, chan));
++ REG_WRITE(ah, AR_PHY_SWITCH_COM, pModal->antCtrlCommon);
+
+ /* Single chain for 4K EEPROM*/
+ ath9k_hw_4k_set_gain(ah, pModal, eep, txRxAttenLocal);
+@@ -1158,21 +990,6 @@ static void ath9k_hw_4k_set_board_values
+ }
+ }
+
+-static u32 ath9k_hw_4k_get_eeprom_antenna_cfg(struct ath_hw *ah,
+- struct ath9k_channel *chan)
+-{
+- struct ar5416_eeprom_4k *eep = &ah->eeprom.map4k;
+- struct modal_eep_4k_header *pModal = &eep->modalHeader;
+-
+- return pModal->antCtrlCommon;
+-}
+-
+-static u8 ath9k_hw_4k_get_num_ant_config(struct ath_hw *ah,
+- enum ath9k_hal_freq_band freq_band)
+-{
+- return 1;
+-}
+-
+ static u16 ath9k_hw_4k_get_spur_channel(struct ath_hw *ah, u16 i, bool is2GHz)
+ {
+ #define EEP_MAP4K_SPURCHAN \
+@@ -1209,8 +1026,6 @@ const struct eeprom_ops eep_4k_ops = {
+ .fill_eeprom = ath9k_hw_4k_fill_eeprom,
+ .get_eeprom_ver = ath9k_hw_4k_get_eeprom_ver,
+ .get_eeprom_rev = ath9k_hw_4k_get_eeprom_rev,
+- .get_num_ant_config = ath9k_hw_4k_get_num_ant_config,
+- .get_eeprom_antenna_cfg = ath9k_hw_4k_get_eeprom_antenna_cfg,
+ .set_board_values = ath9k_hw_4k_set_board_values,
+ .set_addac = ath9k_hw_4k_set_addac,
+ .set_txpower = ath9k_hw_4k_set_txpower,
+--- a/drivers/net/wireless/ath/ath9k/eeprom_9287.c
++++ b/drivers/net/wireless/ath/ath9k/eeprom_9287.c
+@@ -152,7 +152,7 @@ static int ath9k_hw_ar9287_check_eeprom(
+ eep->modalHeader.antCtrlChain[i] = integer;
+ }
+
+- for (i = 0; i < AR9287_EEPROM_MODAL_SPURS; i++) {
++ for (i = 0; i < AR_EEPROM_MODAL_SPURS; i++) {
+ word = swab16(eep->modalHeader.spurChans[i].spurChan);
+ eep->modalHeader.spurChans[i].spurChan = word;
+ }
+@@ -223,163 +223,6 @@ static u32 ath9k_hw_ar9287_get_eeprom(st
+ }
+ }
+
+-static void ath9k_hw_get_ar9287_gain_boundaries_pdadcs(struct ath_hw *ah,
+- struct ath9k_channel *chan,
+- struct cal_data_per_freq_ar9287 *pRawDataSet,
+- u8 *bChans, u16 availPiers,
+- u16 tPdGainOverlap,
+- u16 *pPdGainBoundaries,
+- u8 *pPDADCValues,
+- u16 numXpdGains)
+-{
+-#define TMP_VAL_VPD_TABLE \
+- ((vpdTableI[i][sizeCurrVpdTable - 1] + (ss - maxIndex + 1) * vpdStep));
+-
+- int i, j, k;
+- int16_t ss;
+- u16 idxL = 0, idxR = 0, numPiers;
+- u8 *pVpdL, *pVpdR, *pPwrL, *pPwrR;
+- u8 minPwrT4[AR9287_NUM_PD_GAINS];
+- u8 maxPwrT4[AR9287_NUM_PD_GAINS];
+- int16_t vpdStep;
+- int16_t tmpVal;
+- u16 sizeCurrVpdTable, maxIndex, tgtIndex;
+- bool match;
+- int16_t minDelta = 0;
+- struct chan_centers centers;
+- static u8 vpdTableL[AR5416_EEP4K_NUM_PD_GAINS]
+- [AR5416_MAX_PWR_RANGE_IN_HALF_DB];
+- static u8 vpdTableR[AR5416_EEP4K_NUM_PD_GAINS]
+- [AR5416_MAX_PWR_RANGE_IN_HALF_DB];
+- static u8 vpdTableI[AR5416_EEP4K_NUM_PD_GAINS]
+- [AR5416_MAX_PWR_RANGE_IN_HALF_DB];
+-
+- memset(&minPwrT4, 0, AR9287_NUM_PD_GAINS);
+- ath9k_hw_get_channel_centers(ah, chan, &centers);
+-
+- for (numPiers = 0; numPiers < availPiers; numPiers++) {
+- if (bChans[numPiers] == AR9287_BCHAN_UNUSED)
+- break;
+- }
+-
+- match = ath9k_hw_get_lower_upper_index(
+- (u8)FREQ2FBIN(centers.synth_center, IS_CHAN_2GHZ(chan)),
+- bChans, numPiers, &idxL, &idxR);
+-
+- if (match) {
+- for (i = 0; i < numXpdGains; i++) {
+- minPwrT4[i] = pRawDataSet[idxL].pwrPdg[i][0];
+- maxPwrT4[i] = pRawDataSet[idxL].pwrPdg[i][4];
+- ath9k_hw_fill_vpd_table(minPwrT4[i], maxPwrT4[i],
+- pRawDataSet[idxL].pwrPdg[i],
+- pRawDataSet[idxL].vpdPdg[i],
+- AR9287_PD_GAIN_ICEPTS,
+- vpdTableI[i]);
+- }
+- } else {
+- for (i = 0; i < numXpdGains; i++) {
+- pVpdL = pRawDataSet[idxL].vpdPdg[i];
+- pPwrL = pRawDataSet[idxL].pwrPdg[i];
+- pVpdR = pRawDataSet[idxR].vpdPdg[i];
+- pPwrR = pRawDataSet[idxR].pwrPdg[i];
+-
+- minPwrT4[i] = max(pPwrL[0], pPwrR[0]);
+-
+- maxPwrT4[i] = min(pPwrL[AR9287_PD_GAIN_ICEPTS - 1],
+- pPwrR[AR9287_PD_GAIN_ICEPTS - 1]);
+-
+- ath9k_hw_fill_vpd_table(minPwrT4[i], maxPwrT4[i],
+- pPwrL, pVpdL,
+- AR9287_PD_GAIN_ICEPTS,
+- vpdTableL[i]);
+- ath9k_hw_fill_vpd_table(minPwrT4[i], maxPwrT4[i],
+- pPwrR, pVpdR,
+- AR9287_PD_GAIN_ICEPTS,
+- vpdTableR[i]);
+-
+- for (j = 0; j <= (maxPwrT4[i] - minPwrT4[i]) / 2; j++) {
+- vpdTableI[i][j] = (u8)(ath9k_hw_interpolate(
+- (u16)FREQ2FBIN(centers. synth_center,
+- IS_CHAN_2GHZ(chan)),
+- bChans[idxL], bChans[idxR],
+- vpdTableL[i][j], vpdTableR[i][j]));
+- }
+- }
+- }
+-
+- k = 0;
+-
+- for (i = 0; i < numXpdGains; i++) {
+- if (i == (numXpdGains - 1))
+- pPdGainBoundaries[i] =
+- (u16)(maxPwrT4[i] / 2);
+- else
+- pPdGainBoundaries[i] =
+- (u16)((maxPwrT4[i] + minPwrT4[i+1]) / 4);
+-
+- pPdGainBoundaries[i] = min((u16)AR5416_MAX_RATE_POWER,
+- pPdGainBoundaries[i]);
+-
+-
+- minDelta = 0;
+-
+- if (i == 0) {
+- if (AR_SREV_9280_20_OR_LATER(ah))
+- ss = (int16_t)(0 - (minPwrT4[i] / 2));
+- else
+- ss = 0;
+- } else {
+- ss = (int16_t)((pPdGainBoundaries[i-1] -
+- (minPwrT4[i] / 2)) -
+- tPdGainOverlap + 1 + minDelta);
+- }
+-
+- vpdStep = (int16_t)(vpdTableI[i][1] - vpdTableI[i][0]);
+- vpdStep = (int16_t)((vpdStep < 1) ? 1 : vpdStep);
+-
+- while ((ss < 0) && (k < (AR9287_NUM_PDADC_VALUES - 1))) {
+- tmpVal = (int16_t)(vpdTableI[i][0] + ss * vpdStep);
+- pPDADCValues[k++] = (u8)((tmpVal < 0) ? 0 : tmpVal);
+- ss++;
+- }
+-
+- sizeCurrVpdTable = (u8)((maxPwrT4[i] - minPwrT4[i]) / 2 + 1);
+- tgtIndex = (u8)(pPdGainBoundaries[i] +
+- tPdGainOverlap - (minPwrT4[i] / 2));
+- maxIndex = (tgtIndex < sizeCurrVpdTable) ?
+- tgtIndex : sizeCurrVpdTable;
+-
+- while ((ss < maxIndex) && (k < (AR9287_NUM_PDADC_VALUES - 1)))
+- pPDADCValues[k++] = vpdTableI[i][ss++];
+-
+- vpdStep = (int16_t)(vpdTableI[i][sizeCurrVpdTable - 1] -
+- vpdTableI[i][sizeCurrVpdTable - 2]);
+- vpdStep = (int16_t)((vpdStep < 1) ? 1 : vpdStep);
+-
+- if (tgtIndex > maxIndex) {
+- while ((ss <= tgtIndex) &&
+- (k < (AR9287_NUM_PDADC_VALUES - 1))) {
+- tmpVal = (int16_t) TMP_VAL_VPD_TABLE;
+- pPDADCValues[k++] =
+- (u8)((tmpVal > 255) ? 255 : tmpVal);
+- ss++;
+- }
+- }
+- }
+-
+- while (i < AR9287_PD_GAINS_IN_MASK) {
+- pPdGainBoundaries[i] = pPdGainBoundaries[i-1];
+- i++;
+- }
+-
+- while (k < AR9287_NUM_PDADC_VALUES) {
+- pPDADCValues[k] = pPDADCValues[k-1];
+- k++;
+- }
+-
+-#undef TMP_VAL_VPD_TABLE
+-}
+-
+ static void ar9287_eeprom_get_tx_gain_index(struct ath_hw *ah,
+ struct ath9k_channel *chan,
+ struct cal_data_op_loop_ar9287 *pRawDatasetOpLoop,
+@@ -392,7 +235,7 @@ static void ar9287_eeprom_get_tx_gain_in
+ ath9k_hw_get_channel_centers(ah, chan, &centers);
+
+ for (numPiers = 0; numPiers < availPiers; numPiers++) {
+- if (pCalChans[numPiers] == AR9287_BCHAN_UNUSED)
++ if (pCalChans[numPiers] == AR5416_BCHAN_UNUSED)
+ break;
+ }
+
+@@ -458,11 +301,11 @@ static void ath9k_hw_set_ar9287_power_ca
+ struct cal_data_op_loop_ar9287 *pRawDatasetOpenLoop;
+ u8 *pCalBChans = NULL;
+ u16 pdGainOverlap_t2;
+- u8 pdadcValues[AR9287_NUM_PDADC_VALUES];
+- u16 gainBoundaries[AR9287_PD_GAINS_IN_MASK];
++ u8 pdadcValues[AR5416_NUM_PDADC_VALUES];
++ u16 gainBoundaries[AR5416_PD_GAINS_IN_MASK];
+ u16 numPiers = 0, i, j;
+ u16 numXpdGain, xpdMask;
+- u16 xpdGainValues[AR9287_NUM_PD_GAINS] = {0, 0, 0, 0};
++ u16 xpdGainValues[AR5416_NUM_PD_GAINS] = {0, 0, 0, 0};
+ u32 reg32, regOffset, regChainOffset, regval;
+ int16_t modalIdx, diff = 0;
+ struct ar9287_eeprom *pEepData = &ah->eeprom.map9287;
+@@ -490,12 +333,12 @@ static void ath9k_hw_set_ar9287_power_ca
+ numXpdGain = 0;
+
+ /* Calculate the value of xpdgains from the xpdGain Mask */
+- for (i = 1; i <= AR9287_PD_GAINS_IN_MASK; i++) {
+- if ((xpdMask >> (AR9287_PD_GAINS_IN_MASK - i)) & 1) {
+- if (numXpdGain >= AR9287_NUM_PD_GAINS)
++ for (i = 1; i <= AR5416_PD_GAINS_IN_MASK; i++) {
++ if ((xpdMask >> (AR5416_PD_GAINS_IN_MASK - i)) & 1) {
++ if (numXpdGain >= AR5416_NUM_PD_GAINS)
+ break;
+ xpdGainValues[numXpdGain] =
+- (u16)(AR9287_PD_GAINS_IN_MASK-i);
++ (u16)(AR5416_PD_GAINS_IN_MASK-i);
+ numXpdGain++;
+ }
+ }
+@@ -528,7 +371,7 @@ static void ath9k_hw_set_ar9287_power_ca
+ (struct cal_data_per_freq_ar9287 *)
+ pEepData->calPierData2G[i];
+
+- ath9k_hw_get_ar9287_gain_boundaries_pdadcs(ah, chan,
++ ath9k_hw_get_gain_boundaries_pdadcs(ah, chan,
+ pRawDataset,
+ pCalBChans, numPiers,
+ pdGainOverlap_t2,
+@@ -564,13 +407,13 @@ static void ath9k_hw_set_ar9287_power_ca
+ (int32_t)AR9287_PWR_TABLE_OFFSET_DB);
+ diff *= 2;
+
+- for (j = 0; j < ((u16)AR9287_NUM_PDADC_VALUES-diff); j++)
++ for (j = 0; j < ((u16)AR5416_NUM_PDADC_VALUES-diff); j++)
+ pdadcValues[j] = pdadcValues[j+diff];
+
+- for (j = (u16)(AR9287_NUM_PDADC_VALUES-diff);
+- j < AR9287_NUM_PDADC_VALUES; j++)
++ for (j = (u16)(AR5416_NUM_PDADC_VALUES-diff);
++ j < AR5416_NUM_PDADC_VALUES; j++)
+ pdadcValues[j] =
+- pdadcValues[AR9287_NUM_PDADC_VALUES-diff];
++ pdadcValues[AR5416_NUM_PDADC_VALUES-diff];
+ }
+
+ if (!ath9k_hw_ar9287_get_eeprom(ah, EEP_OL_PWRCTRL)) {
+@@ -613,9 +456,9 @@ static void ath9k_hw_set_ar9287_power_pe
+ #define REDUCE_SCALED_POWER_BY_THREE_CHAIN 10
+
+ struct ath_regulatory *regulatory = ath9k_hw_regulatory(ah);
+- u16 twiceMaxEdgePower = AR5416_MAX_RATE_POWER;
++ u16 twiceMaxEdgePower = MAX_RATE_POWER;
+ static const u16 tpScaleReductionTable[5] =
+- { 0, 3, 6, 9, AR5416_MAX_RATE_POWER };
++ { 0, 3, 6, 9, MAX_RATE_POWER };
+ int i;
+ int16_t twiceLargestAntenna;
+ struct cal_ctl_data_ar9287 *rep;
+@@ -880,8 +723,8 @@ static void ath9k_hw_ar9287_set_txpower(
+ regulatory->max_power_level = 0;
+ for (i = 0; i < ARRAY_SIZE(ratesArray); i++) {
+ ratesArray[i] = (int16_t)(txPowerIndexOffset + ratesArray[i]);
+- if (ratesArray[i] > AR9287_MAX_RATE_POWER)
+- ratesArray[i] = AR9287_MAX_RATE_POWER;
++ if (ratesArray[i] > MAX_RATE_POWER)
++ ratesArray[i] = MAX_RATE_POWER;
+
+ if (ratesArray[i] > regulatory->max_power_level)
+ regulatory->max_power_level = ratesArray[i];
+@@ -1026,8 +869,7 @@ static void ath9k_hw_ar9287_set_board_va
+ antWrites[j++] = (u16)(pModal->antCtrlChain[i] & 0x3);
+ }
+
+- REG_WRITE(ah, AR_PHY_SWITCH_COM,
+- ah->eep_ops->get_eeprom_antenna_cfg(ah, chan));
++ REG_WRITE(ah, AR_PHY_SWITCH_COM, pModal->antCtrlCommon);
+
+ for (i = 0; i < AR9287_MAX_CHAINS; i++) {
+ regChainOffset = i * 0x1000;
+@@ -1128,21 +970,6 @@ static void ath9k_hw_ar9287_set_board_va
+ pModal->xpaBiasLvl);
+ }
+
+-static u8 ath9k_hw_ar9287_get_num_ant_config(struct ath_hw *ah,
+- enum ath9k_hal_freq_band freq_band)
+-{
+- return 1;
+-}
+-
+-static u32 ath9k_hw_ar9287_get_eeprom_antenna_cfg(struct ath_hw *ah,
+- struct ath9k_channel *chan)
+-{
+- struct ar9287_eeprom *eep = &ah->eeprom.map9287;
+- struct modal_eep_ar9287_header *pModal = &eep->modalHeader;
+-
+- return pModal->antCtrlCommon;
+-}
+-
+ static u16 ath9k_hw_ar9287_get_spur_channel(struct ath_hw *ah,
+ u16 i, bool is2GHz)
+ {
+@@ -1180,8 +1007,6 @@ const struct eeprom_ops eep_ar9287_ops =
+ .fill_eeprom = ath9k_hw_ar9287_fill_eeprom,
+ .get_eeprom_ver = ath9k_hw_ar9287_get_eeprom_ver,
+ .get_eeprom_rev = ath9k_hw_ar9287_get_eeprom_rev,
+- .get_num_ant_config = ath9k_hw_ar9287_get_num_ant_config,
+- .get_eeprom_antenna_cfg = ath9k_hw_ar9287_get_eeprom_antenna_cfg,
+ .set_board_values = ath9k_hw_ar9287_set_board_values,
+ .set_addac = ath9k_hw_ar9287_set_addac,
+ .set_txpower = ath9k_hw_ar9287_set_txpower,
+--- a/drivers/net/wireless/ath/ath9k/eeprom_def.c
++++ b/drivers/net/wireless/ath/ath9k/eeprom_def.c
+@@ -207,7 +207,7 @@ static int ath9k_hw_def_check_eeprom(str
+ pModal->antCtrlChain[i] = integer;
+ }
+
+- for (i = 0; i < AR5416_EEPROM_MODAL_SPURS; i++) {
++ for (i = 0; i < AR_EEPROM_MODAL_SPURS; i++) {
+ word = swab16(pModal->spurChans[i].spurChan);
+ pModal->spurChans[i].spurChan = word;
+ }
+@@ -376,8 +376,7 @@ static void ath9k_hw_def_set_board_value
+ pModal = &(eep->modalHeader[IS_CHAN_2GHZ(chan)]);
+ txRxAttenLocal = IS_CHAN_2GHZ(chan) ? 23 : 44;
+
+- REG_WRITE(ah, AR_PHY_SWITCH_COM,
+- ah->eep_ops->get_eeprom_antenna_cfg(ah, chan));
++ REG_WRITE(ah, AR_PHY_SWITCH_COM, pModal->antCtrlCommon & 0xffff);
+
+ for (i = 0; i < AR5416_MAX_CHAINS; i++) {
+ if (AR_SREV_9280(ah)) {
+@@ -590,168 +589,6 @@ static void ath9k_hw_def_set_addac(struc
+ #undef XPA_LVL_FREQ
+ }
+
+-static void ath9k_hw_get_def_gain_boundaries_pdadcs(struct ath_hw *ah,
+- struct ath9k_channel *chan,
+- struct cal_data_per_freq *pRawDataSet,
+- u8 *bChans, u16 availPiers,
+- u16 tPdGainOverlap,
+- u16 *pPdGainBoundaries, u8 *pPDADCValues,
+- u16 numXpdGains)
+-{
+- int i, j, k;
+- int16_t ss;
+- u16 idxL = 0, idxR = 0, numPiers;
+- static u8 vpdTableL[AR5416_NUM_PD_GAINS]
+- [AR5416_MAX_PWR_RANGE_IN_HALF_DB];
+- static u8 vpdTableR[AR5416_NUM_PD_GAINS]
+- [AR5416_MAX_PWR_RANGE_IN_HALF_DB];
+- static u8 vpdTableI[AR5416_NUM_PD_GAINS]
+- [AR5416_MAX_PWR_RANGE_IN_HALF_DB];
+-
+- u8 *pVpdL, *pVpdR, *pPwrL, *pPwrR;
+- u8 minPwrT4[AR5416_NUM_PD_GAINS];
+- u8 maxPwrT4[AR5416_NUM_PD_GAINS];
+- int16_t vpdStep;
+- int16_t tmpVal;
+- u16 sizeCurrVpdTable, maxIndex, tgtIndex;
+- bool match;
+- int16_t minDelta = 0;
+- struct chan_centers centers;
+-
+- memset(&minPwrT4, 0, AR9287_NUM_PD_GAINS);
+- ath9k_hw_get_channel_centers(ah, chan, &centers);
+-
+- for (numPiers = 0; numPiers < availPiers; numPiers++) {
+- if (bChans[numPiers] == AR5416_BCHAN_UNUSED)
+- break;
+- }
+-
+- match = ath9k_hw_get_lower_upper_index((u8)FREQ2FBIN(centers.synth_center,
+- IS_CHAN_2GHZ(chan)),
+- bChans, numPiers, &idxL, &idxR);
+-
+- if (match) {
+- for (i = 0; i < numXpdGains; i++) {
+- minPwrT4[i] = pRawDataSet[idxL].pwrPdg[i][0];
+- maxPwrT4[i] = pRawDataSet[idxL].pwrPdg[i][4];
+- ath9k_hw_fill_vpd_table(minPwrT4[i], maxPwrT4[i],
+- pRawDataSet[idxL].pwrPdg[i],
+- pRawDataSet[idxL].vpdPdg[i],
+- AR5416_PD_GAIN_ICEPTS,
+- vpdTableI[i]);
+- }
+- } else {
+- for (i = 0; i < numXpdGains; i++) {
+- pVpdL = pRawDataSet[idxL].vpdPdg[i];
+- pPwrL = pRawDataSet[idxL].pwrPdg[i];
+- pVpdR = pRawDataSet[idxR].vpdPdg[i];
+- pPwrR = pRawDataSet[idxR].pwrPdg[i];
+-
+- minPwrT4[i] = max(pPwrL[0], pPwrR[0]);
+-
+- maxPwrT4[i] =
+- min(pPwrL[AR5416_PD_GAIN_ICEPTS - 1],
+- pPwrR[AR5416_PD_GAIN_ICEPTS - 1]);
+-
+-
+- ath9k_hw_fill_vpd_table(minPwrT4[i], maxPwrT4[i],
+- pPwrL, pVpdL,
+- AR5416_PD_GAIN_ICEPTS,
+- vpdTableL[i]);
+- ath9k_hw_fill_vpd_table(minPwrT4[i], maxPwrT4[i],
+- pPwrR, pVpdR,
+- AR5416_PD_GAIN_ICEPTS,
+- vpdTableR[i]);
+-
+- for (j = 0; j <= (maxPwrT4[i] - minPwrT4[i]) / 2; j++) {
+- vpdTableI[i][j] =
+- (u8)(ath9k_hw_interpolate((u16)
+- FREQ2FBIN(centers.
+- synth_center,
+- IS_CHAN_2GHZ
+- (chan)),
+- bChans[idxL], bChans[idxR],
+- vpdTableL[i][j], vpdTableR[i][j]));
+- }
+- }
+- }
+-
+- k = 0;
+-
+- for (i = 0; i < numXpdGains; i++) {
+- if (i == (numXpdGains - 1))
+- pPdGainBoundaries[i] =
+- (u16)(maxPwrT4[i] / 2);
+- else
+- pPdGainBoundaries[i] =
+- (u16)((maxPwrT4[i] + minPwrT4[i + 1]) / 4);
+-
+- pPdGainBoundaries[i] =
+- min((u16)AR5416_MAX_RATE_POWER, pPdGainBoundaries[i]);
+-
+- if ((i == 0) && !AR_SREV_5416_20_OR_LATER(ah)) {
+- minDelta = pPdGainBoundaries[0] - 23;
+- pPdGainBoundaries[0] = 23;
+- } else {
+- minDelta = 0;
+- }
+-
+- if (i == 0) {
+- if (AR_SREV_9280_20_OR_LATER(ah))
+- ss = (int16_t)(0 - (minPwrT4[i] / 2));
+- else
+- ss = 0;
+- } else {
+- ss = (int16_t)((pPdGainBoundaries[i - 1] -
+- (minPwrT4[i] / 2)) -
+- tPdGainOverlap + 1 + minDelta);
+- }
+- vpdStep = (int16_t)(vpdTableI[i][1] - vpdTableI[i][0]);
+- vpdStep = (int16_t)((vpdStep < 1) ? 1 : vpdStep);
+-
+- while ((ss < 0) && (k < (AR5416_NUM_PDADC_VALUES - 1))) {
+- tmpVal = (int16_t)(vpdTableI[i][0] + ss * vpdStep);
+- pPDADCValues[k++] = (u8)((tmpVal < 0) ? 0 : tmpVal);
+- ss++;
+- }
+-
+- sizeCurrVpdTable = (u8) ((maxPwrT4[i] - minPwrT4[i]) / 2 + 1);
+- tgtIndex = (u8)(pPdGainBoundaries[i] + tPdGainOverlap -
+- (minPwrT4[i] / 2));
+- maxIndex = (tgtIndex < sizeCurrVpdTable) ?
+- tgtIndex : sizeCurrVpdTable;
+-
+- while ((ss < maxIndex) && (k < (AR5416_NUM_PDADC_VALUES - 1))) {
+- pPDADCValues[k++] = vpdTableI[i][ss++];
+- }
+-
+- vpdStep = (int16_t)(vpdTableI[i][sizeCurrVpdTable - 1] -
+- vpdTableI[i][sizeCurrVpdTable - 2]);
+- vpdStep = (int16_t)((vpdStep < 1) ? 1 : vpdStep);
+-
+- if (tgtIndex >= maxIndex) {
+- while ((ss <= tgtIndex) &&
+- (k < (AR5416_NUM_PDADC_VALUES - 1))) {
+- tmpVal = (int16_t)((vpdTableI[i][sizeCurrVpdTable - 1] +
+- (ss - maxIndex + 1) * vpdStep));
+- pPDADCValues[k++] = (u8)((tmpVal > 255) ?
+- 255 : tmpVal);
+- ss++;
+- }
+- }
+- }
+-
+- while (i < AR5416_PD_GAINS_IN_MASK) {
+- pPdGainBoundaries[i] = pPdGainBoundaries[i - 1];
+- i++;
+- }
+-
+- while (k < AR5416_NUM_PDADC_VALUES) {
+- pPDADCValues[k] = pPDADCValues[k - 1];
+- k++;
+- }
+-}
+-
+ static int16_t ath9k_change_gain_boundary_setting(struct ath_hw *ah,
+ u16 *gb,
+ u16 numXpdGain,
+@@ -784,7 +621,7 @@ static int16_t ath9k_change_gain_boundar
+ /* Because of a hardware limitation, ensure the gain boundary
+ * is not larger than (63 - overlap)
+ */
+- gb_limit = (u16)(AR5416_MAX_RATE_POWER - pdGainOverlap_t2);
++ gb_limit = (u16)(MAX_RATE_POWER - pdGainOverlap_t2);
+
+ for (k = 0; k < numXpdGain; k++)
+ gb[k] = (u16)min(gb_limit, gb[k]);
+@@ -918,7 +755,7 @@ static void ath9k_hw_set_def_power_cal_t
+ ath9k_olc_get_pdadcs(ah, pcdacIdx,
+ txPower/2, pdadcValues);
+ } else {
+- ath9k_hw_get_def_gain_boundaries_pdadcs(ah,
++ ath9k_hw_get_gain_boundaries_pdadcs(ah,
+ chan, pRawDataset,
+ pCalBChans, numPiers,
+ pdGainOverlap_t2,
+@@ -1004,9 +841,9 @@ static void ath9k_hw_set_def_power_per_r
+
+ struct ath_regulatory *regulatory = ath9k_hw_regulatory(ah);
+ struct ar5416_eeprom_def *pEepData = &ah->eeprom.def;
+- u16 twiceMaxEdgePower = AR5416_MAX_RATE_POWER;
++ u16 twiceMaxEdgePower = MAX_RATE_POWER;
+ static const u16 tpScaleReductionTable[5] =
+- { 0, 3, 6, 9, AR5416_MAX_RATE_POWER };
++ { 0, 3, 6, 9, MAX_RATE_POWER };
+
+ int i;
+ int16_t twiceLargestAntenna;
+@@ -1147,7 +984,7 @@ static void ath9k_hw_set_def_power_per_r
+
+ if (ah->eep_ops->get_eeprom_ver(ah) == 14 &&
+ ah->eep_ops->get_eeprom_rev(ah) <= 2)
+- twiceMaxEdgePower = AR5416_MAX_RATE_POWER;
++ twiceMaxEdgePower = MAX_RATE_POWER;
+
+ for (i = 0; (i < AR5416_NUM_CTLS) && pEepData->ctlIndex[i]; i++) {
+ if ((((cfgCtl & ~CTL_MODE_M) |
+@@ -1292,8 +1129,8 @@ static void ath9k_hw_def_set_txpower(str
+ regulatory->max_power_level = 0;
+ for (i = 0; i < ARRAY_SIZE(ratesArray); i++) {
+ ratesArray[i] = (int16_t)(txPowerIndexOffset + ratesArray[i]);
+- if (ratesArray[i] > AR5416_MAX_RATE_POWER)
+- ratesArray[i] = AR5416_MAX_RATE_POWER;
++ if (ratesArray[i] > MAX_RATE_POWER)
++ ratesArray[i] = MAX_RATE_POWER;
+ if (ratesArray[i] > regulatory->max_power_level)
+ regulatory->max_power_level = ratesArray[i];
+ }
+@@ -1425,34 +1262,6 @@ static void ath9k_hw_def_set_txpower(str
+ | ATH9K_POW_SM(pModal->pwrDecreaseFor2Chain, 0));
+ }
+
+-static u8 ath9k_hw_def_get_num_ant_config(struct ath_hw *ah,
+- enum ath9k_hal_freq_band freq_band)
+-{
+- struct ar5416_eeprom_def *eep = &ah->eeprom.def;
+- struct modal_eep_header *pModal =
+- &(eep->modalHeader[freq_band]);
+- struct base_eep_header *pBase = &eep->baseEepHeader;
+- u8 num_ant_config;
+-
+- num_ant_config = 1;
+-
+- if (pBase->version >= 0x0E0D &&
+- (pModal->lna_ctl & LNA_CTL_USE_ANT1))
+- num_ant_config += 1;
+-
+- return num_ant_config;
+-}
+-
+-static u32 ath9k_hw_def_get_eeprom_antenna_cfg(struct ath_hw *ah,
+- struct ath9k_channel *chan)
+-{
+- struct ar5416_eeprom_def *eep = &ah->eeprom.def;
+- struct modal_eep_header *pModal =
+- &(eep->modalHeader[IS_CHAN_2GHZ(chan)]);
+-
+- return pModal->antCtrlCommon;
+-}
+-
+ static u16 ath9k_hw_def_get_spur_channel(struct ath_hw *ah, u16 i, bool is2GHz)
+ {
+ #define EEP_DEF_SPURCHAN \
+@@ -1489,8 +1298,6 @@ const struct eeprom_ops eep_def_ops = {
+ .fill_eeprom = ath9k_hw_def_fill_eeprom,
+ .get_eeprom_ver = ath9k_hw_def_get_eeprom_ver,
+ .get_eeprom_rev = ath9k_hw_def_get_eeprom_rev,
+- .get_num_ant_config = ath9k_hw_def_get_num_ant_config,
+- .get_eeprom_antenna_cfg = ath9k_hw_def_get_eeprom_antenna_cfg,
+ .set_board_values = ath9k_hw_def_set_board_values,
+ .set_addac = ath9k_hw_def_set_addac,
+ .set_txpower = ath9k_hw_def_set_txpower,
+--- a/drivers/net/wireless/ath/ath9k/hw.c
++++ b/drivers/net/wireless/ath/ath9k/hw.c
+@@ -54,13 +54,6 @@ static void ath9k_hw_init_mode_regs(stru
+ ath9k_hw_private_ops(ah)->init_mode_regs(ah);
+ }
+
+-static bool ath9k_hw_macversion_supported(struct ath_hw *ah)
+-{
+- struct ath_hw_private_ops *priv_ops = ath9k_hw_private_ops(ah);
+-
+- return priv_ops->macversion_supported(ah->hw_version.macVersion);
+-}
+-
+ static u32 ath9k_hw_compute_pll_control(struct ath_hw *ah,
+ struct ath9k_channel *chan)
+ {
+@@ -284,11 +277,9 @@ static void ath9k_hw_read_revisions(stru
+
+ static void ath9k_hw_disablepcie(struct ath_hw *ah)
+ {
+- if (AR_SREV_9100(ah))
++ if (!AR_SREV_5416(ah))
+ return;
+
+- ENABLE_REGWRITE_BUFFER(ah);
+-
+ REG_WRITE(ah, AR_PCIE_SERDES, 0x9248fc00);
+ REG_WRITE(ah, AR_PCIE_SERDES, 0x24924924);
+ REG_WRITE(ah, AR_PCIE_SERDES, 0x28000029);
+@@ -300,8 +291,6 @@ static void ath9k_hw_disablepcie(struct
+ REG_WRITE(ah, AR_PCIE_SERDES, 0x000e1007);
+
+ REG_WRITE(ah, AR_PCIE_SERDES2, 0x00000000);
+-
+- REGWRITE_BUFFER_FLUSH(ah);
+ }
+
+ /* This should work for all families including legacy */
+@@ -422,7 +411,6 @@ static void ath9k_hw_init_defaults(struc
+ ah->sta_id1_defaults =
+ AR_STA_ID1_CRPT_MIC_ENABLE |
+ AR_STA_ID1_MCAST_KSRCH;
+- ah->beacon_interval = 100;
+ ah->enable_32kHz_clock = DONT_USE_32KHZ;
+ ah->slottime = (u32) -1;
+ ah->globaltxtimeout = (u32) -1;
+@@ -544,7 +532,18 @@ static int __ath9k_hw_init(struct ath_hw
+ else
+ ah->config.max_txtrig_level = MAX_TX_FIFO_THRESHOLD;
+
+- if (!ath9k_hw_macversion_supported(ah)) {
++ switch (ah->hw_version.macVersion) {
++ case AR_SREV_VERSION_5416_PCI:
++ case AR_SREV_VERSION_5416_PCIE:
++ case AR_SREV_VERSION_9160:
++ case AR_SREV_VERSION_9100:
++ case AR_SREV_VERSION_9280:
++ case AR_SREV_VERSION_9285:
++ case AR_SREV_VERSION_9287:
++ case AR_SREV_VERSION_9271:
++ case AR_SREV_VERSION_9300:
++ break;
++ default:
+ ath_print(common, ATH_DBG_FATAL,
+ "Mac Chip Rev 0x%02x.%x is not supported by "
+ "this driver\n", ah->hw_version.macVersion,
+@@ -1643,8 +1642,6 @@ void ath9k_hw_beaconinit(struct ath_hw *
+ {
+ int flags = 0;
+
+- ah->beacon_interval = beacon_period;
+-
+ ENABLE_REGWRITE_BUFFER(ah);
+
+ switch (ah->opmode) {
+@@ -1936,11 +1933,6 @@ int ath9k_hw_fill_cap_info(struct ath_hw
+ AR_SREV_5416(ah))
+ pCap->reg_cap |= AR_EEPROM_EEREGCAP_EN_FCC_MIDBAND;
+
+- pCap->num_antcfg_5ghz =
+- ah->eep_ops->get_num_ant_config(ah, ATH9K_HAL_FREQ_BAND_5GHZ);
+- pCap->num_antcfg_2ghz =
+- ah->eep_ops->get_num_ant_config(ah, ATH9K_HAL_FREQ_BAND_2GHZ);
+-
+ if (AR_SREV_9280_20_OR_LATER(ah) && common->btcoex_enabled) {
+ btcoex_hw->btactive_gpio = ATH_BTACTIVE_GPIO;
+ btcoex_hw->wlanactive_gpio = ATH_WLANACTIVE_GPIO;
+--- a/drivers/net/wireless/ath/ath9k/hw.h
++++ b/drivers/net/wireless/ath/ath9k/hw.h
+@@ -202,8 +202,6 @@ struct ath9k_hw_capabilities {
+ u16 tx_triglevel_max;
+ u16 reg_cap;
+ u8 num_gpio_pins;
+- u8 num_antcfg_2ghz;
+- u8 num_antcfg_5ghz;
+ u8 rx_hp_qdepth;
+ u8 rx_lp_qdepth;
+ u8 rx_status_len;
+@@ -234,7 +232,6 @@ struct ath9k_ops_config {
+ #define SPUR_DISABLE 0
+ #define SPUR_ENABLE_IOCTL 1
+ #define SPUR_ENABLE_EEPROM 2
+-#define AR_EEPROM_MODAL_SPURS 5
+ #define AR_SPUR_5413_1 1640
+ #define AR_SPUR_5413_2 1200
+ #define AR_NO_SPUR 0x8000
+@@ -530,7 +527,6 @@ struct ath_hw_radar_conf {
+ *
+ * @init_mode_regs: Initializes mode registers
+ * @init_mode_gain_regs: Initialize TX/RX gain registers
+- * @macversion_supported: If this specific mac revision is supported
+ *
+ * @rf_set_freq: change frequency
+ * @spur_mitigate_freq: spur mitigation
+@@ -552,7 +548,6 @@ struct ath_hw_private_ops {
+
+ void (*init_mode_regs)(struct ath_hw *ah);
+ void (*init_mode_gain_regs)(struct ath_hw *ah);
+- bool (*macversion_supported)(u32 macversion);
+ void (*setup_calibration)(struct ath_hw *ah,
+ struct ath9k_cal_list *currCal);
+
+@@ -762,9 +757,7 @@ struct ath_hw {
+ u32 *bank6Temp;
+
+ u8 txpower_limit;
+- int16_t txpower_indexoffset;
+ int coverage_class;
+- u32 beacon_interval;
+ u32 slottime;
+ u32 globaltxtimeout;
+
+--- a/net/mac80211/led.c
++++ b/net/mac80211/led.c
+@@ -54,12 +54,22 @@ void ieee80211_led_radio(struct ieee8021
+ led_trigger_event(local->radio_led, LED_OFF);
+ }
+
++void ieee80211_led_names(struct ieee80211_local *local)
++{
++ snprintf(local->rx_led_name, sizeof(local->rx_led_name),
++ "%srx", wiphy_name(local->hw.wiphy));
++ snprintf(local->tx_led_name, sizeof(local->tx_led_name),
++ "%stx", wiphy_name(local->hw.wiphy));
++ snprintf(local->assoc_led_name, sizeof(local->assoc_led_name),
++ "%sassoc", wiphy_name(local->hw.wiphy));
++ snprintf(local->radio_led_name, sizeof(local->radio_led_name),
++ "%sradio", wiphy_name(local->hw.wiphy));
++}
++
+ void ieee80211_led_init(struct ieee80211_local *local)
+ {
+ local->rx_led = kzalloc(sizeof(struct led_trigger), GFP_KERNEL);
+ if (local->rx_led) {
+- snprintf(local->rx_led_name, sizeof(local->rx_led_name),
+- "%srx", wiphy_name(local->hw.wiphy));
+ local->rx_led->name = local->rx_led_name;
+ if (led_trigger_register(local->rx_led)) {
+ kfree(local->rx_led);
+@@ -69,8 +79,6 @@ void ieee80211_led_init(struct ieee80211
+
+ local->tx_led = kzalloc(sizeof(struct led_trigger), GFP_KERNEL);
+ if (local->tx_led) {
+- snprintf(local->tx_led_name, sizeof(local->tx_led_name),
+- "%stx", wiphy_name(local->hw.wiphy));
+ local->tx_led->name = local->tx_led_name;
+ if (led_trigger_register(local->tx_led)) {
+ kfree(local->tx_led);
+@@ -80,8 +88,6 @@ void ieee80211_led_init(struct ieee80211
+
+ local->assoc_led = kzalloc(sizeof(struct led_trigger), GFP_KERNEL);
+ if (local->assoc_led) {
+- snprintf(local->assoc_led_name, sizeof(local->assoc_led_name),
+- "%sassoc", wiphy_name(local->hw.wiphy));
+ local->assoc_led->name = local->assoc_led_name;
+ if (led_trigger_register(local->assoc_led)) {
+ kfree(local->assoc_led);
+@@ -91,14 +97,19 @@ void ieee80211_led_init(struct ieee80211
+
+ local->radio_led = kzalloc(sizeof(struct led_trigger), GFP_KERNEL);
+ if (local->radio_led) {
+- snprintf(local->radio_led_name, sizeof(local->radio_led_name),
+- "%sradio", wiphy_name(local->hw.wiphy));
+ local->radio_led->name = local->radio_led_name;
+ if (led_trigger_register(local->radio_led)) {
+ kfree(local->radio_led);
+ local->radio_led = NULL;
+ }
+ }
++
++ if (local->tpt_led_trigger) {
++ if (led_trigger_register(&local->tpt_led_trigger->trig)) {
++ kfree(local->tpt_led_trigger);
++ local->tpt_led_trigger = NULL;
++ }
++ }
+ }
+
+ void ieee80211_led_exit(struct ieee80211_local *local)
+@@ -119,15 +130,18 @@ void ieee80211_led_exit(struct ieee80211
+ led_trigger_unregister(local->rx_led);
+ kfree(local->rx_led);
+ }
++
++ if (local->tpt_led_trigger) {
++ led_trigger_unregister(&local->tpt_led_trigger->trig);
++ kfree(local->tpt_led_trigger);
++ }
+ }
+
+ char *__ieee80211_get_radio_led_name(struct ieee80211_hw *hw)
+ {
+ struct ieee80211_local *local = hw_to_local(hw);
+
+- if (local->radio_led)
+- return local->radio_led_name;
+- return NULL;
++ return local->radio_led_name;
+ }
+ EXPORT_SYMBOL(__ieee80211_get_radio_led_name);
+
+@@ -135,9 +149,7 @@ char *__ieee80211_get_assoc_led_name(str
+ {
+ struct ieee80211_local *local = hw_to_local(hw);
+
+- if (local->assoc_led)
+- return local->assoc_led_name;
+- return NULL;
++ return local->assoc_led_name;
+ }
+ EXPORT_SYMBOL(__ieee80211_get_assoc_led_name);
+
+@@ -145,9 +157,7 @@ char *__ieee80211_get_tx_led_name(struct
+ {
+ struct ieee80211_local *local = hw_to_local(hw);
+
+- if (local->tx_led)
+- return local->tx_led_name;
+- return NULL;
++ return local->tx_led_name;
+ }
+ EXPORT_SYMBOL(__ieee80211_get_tx_led_name);
+
+@@ -155,8 +165,115 @@ char *__ieee80211_get_rx_led_name(struct
+ {
+ struct ieee80211_local *local = hw_to_local(hw);
+
+- if (local->rx_led)
+- return local->rx_led_name;
+- return NULL;
++ return local->rx_led_name;
+ }
+ EXPORT_SYMBOL(__ieee80211_get_rx_led_name);
++
++static unsigned long tpt_trig_traffic(struct ieee80211_local *local,
++ struct tpt_led_trigger *tpt_trig)
++{
++ unsigned long traffic, delta;
++
++ traffic = tpt_trig->tx_bytes + tpt_trig->rx_bytes;
++
++ delta = traffic - tpt_trig->prev_traffic;
++ tpt_trig->prev_traffic = traffic;
++ return DIV_ROUND_UP(delta, 1024 / 8);
++}
++
++static void tpt_trig_timer(unsigned long data)
++{
++ struct ieee80211_local *local = (void *)data;
++ struct tpt_led_trigger *tpt_trig = local->tpt_led_trigger;
++ struct led_classdev *led_cdev;
++ unsigned long on, off, tpt;
++ int i;
++
++ if (!tpt_trig->running)
++ return;
++
++ mod_timer(&tpt_trig->timer, round_jiffies(jiffies + HZ));
++
++ tpt = tpt_trig_traffic(local, tpt_trig);
++
++ /* default to just solid on */
++ on = 1;
++ off = 0;
++
++ for (i = tpt_trig->blink_table_len - 1; i >= 0; i--) {
++ if (tpt_trig->blink_table[i].throughput < 0 ||
++ tpt > tpt_trig->blink_table[i].throughput) {
++ off = tpt_trig->blink_table[i].blink_time / 2;
++ on = tpt_trig->blink_table[i].blink_time - off;
++ break;
++ }
++ }
++
++ read_lock(&tpt_trig->trig.leddev_list_lock);
++ list_for_each_entry(led_cdev, &tpt_trig->trig.led_cdevs, trig_list)
++ led_blink_set(led_cdev, &on, &off);
++ read_unlock(&tpt_trig->trig.leddev_list_lock);
++}
++
++extern char *__ieee80211_create_tpt_led_trigger(
++ struct ieee80211_hw *hw,
++ const struct ieee80211_tpt_blink *blink_table,
++ unsigned int blink_table_len)
++{
++ struct ieee80211_local *local = hw_to_local(hw);
++ struct tpt_led_trigger *tpt_trig;
++
++ if (WARN_ON(local->tpt_led_trigger))
++ return NULL;
++
++ tpt_trig = kzalloc(sizeof(struct tpt_led_trigger), GFP_KERNEL);
++ if (!tpt_trig)
++ return NULL;
++
++ snprintf(tpt_trig->name, sizeof(tpt_trig->name),
++ "%stpt", wiphy_name(local->hw.wiphy));
++
++ tpt_trig->trig.name = tpt_trig->name;
++
++ tpt_trig->blink_table = blink_table;
++ tpt_trig->blink_table_len = blink_table_len;
++
++ setup_timer(&tpt_trig->timer, tpt_trig_timer, (unsigned long)local);
++
++ local->tpt_led_trigger = tpt_trig;
++
++ return tpt_trig->name;
++}
++EXPORT_SYMBOL(__ieee80211_create_tpt_led_trigger);
++
++void ieee80211_start_tpt_led_trig(struct ieee80211_local *local)
++{
++ struct tpt_led_trigger *tpt_trig = local->tpt_led_trigger;
++
++ if (!tpt_trig)
++ return;
++
++ /* reset traffic */
++ tpt_trig_traffic(local, tpt_trig);
++ tpt_trig->running = true;
++
++ tpt_trig_timer((unsigned long)local);
++ mod_timer(&tpt_trig->timer, round_jiffies(jiffies + HZ));
++}
++
++void ieee80211_stop_tpt_led_trig(struct ieee80211_local *local)
++{
++ struct tpt_led_trigger *tpt_trig = local->tpt_led_trigger;
++ struct led_classdev *led_cdev;
++
++ if (!tpt_trig)
++ return;
++
++ tpt_trig->running = false;
++ del_timer_sync(&tpt_trig->timer);
++
++ read_lock(&tpt_trig->trig.leddev_list_lock);
++ list_for_each_entry(led_cdev, &tpt_trig->trig.led_cdevs, trig_list)
++ led_brightness_set(led_cdev, LED_OFF);
++ read_unlock(&tpt_trig->trig.leddev_list_lock);
++}
+--- a/net/mac80211/led.h
++++ b/net/mac80211/led.h
+@@ -12,14 +12,17 @@
+ #include "ieee80211_i.h"
+
+ #ifdef CONFIG_MAC80211_LEDS
+-extern void ieee80211_led_rx(struct ieee80211_local *local);
+-extern void ieee80211_led_tx(struct ieee80211_local *local, int q);
+-extern void ieee80211_led_assoc(struct ieee80211_local *local,
+- bool associated);
+-extern void ieee80211_led_radio(struct ieee80211_local *local,
+- bool enabled);
+-extern void ieee80211_led_init(struct ieee80211_local *local);
+-extern void ieee80211_led_exit(struct ieee80211_local *local);
++void ieee80211_led_rx(struct ieee80211_local *local);
++void ieee80211_led_tx(struct ieee80211_local *local, int q);
++void ieee80211_led_assoc(struct ieee80211_local *local,
++ bool associated);
++void ieee80211_led_radio(struct ieee80211_local *local,
++ bool enabled);
++void ieee80211_led_names(struct ieee80211_local *local);
++void ieee80211_led_init(struct ieee80211_local *local);
++void ieee80211_led_exit(struct ieee80211_local *local);
++void ieee80211_start_tpt_led_trig(struct ieee80211_local *local);
++void ieee80211_stop_tpt_led_trig(struct ieee80211_local *local);
+ #else
+ static inline void ieee80211_led_rx(struct ieee80211_local *local)
+ {
+@@ -35,10 +38,37 @@ static inline void ieee80211_led_radio(s
+ bool enabled)
+ {
+ }
++static inline void ieee80211_led_names(struct ieee80211_local *local)
++{
++}
+ static inline void ieee80211_led_init(struct ieee80211_local *local)
+ {
+ }
+ static inline void ieee80211_led_exit(struct ieee80211_local *local)
+ {
+ }
++static inline void ieee80211_start_tpt_led_trig(struct ieee80211_local *local)
++{
++}
++static inline void ieee80211_stop_tpt_led_trig(struct ieee80211_local *local)
++{
++}
++#endif
++
++static inline void
++ieee80211_tpt_led_trig_tx(struct ieee80211_local *local, __le16 fc, int bytes)
++{
++#ifdef CONFIG_MAC80211_LEDS
++ if (local->tpt_led_trigger && ieee80211_is_data(fc))
++ local->tpt_led_trigger->tx_bytes += bytes;
++#endif
++}
++
++static inline void
++ieee80211_tpt_led_trig_rx(struct ieee80211_local *local, __le16 fc, int bytes)
++{
++#ifdef CONFIG_MAC80211_LEDS
++ if (local->tpt_led_trigger && ieee80211_is_data(fc))
++ local->tpt_led_trigger->rx_bytes += bytes;
+ #endif
++}
+--- a/net/mac80211/main.c
++++ b/net/mac80211/main.c
+@@ -599,6 +599,8 @@ struct ieee80211_hw *ieee80211_alloc_hw(
+ /* init dummy netdev for use w/ NAPI */
+ init_dummy_netdev(&local->napi_dev);
+
++ ieee80211_led_names(local);
++
+ return local_to_hw(local);
+ }
+ EXPORT_SYMBOL(ieee80211_alloc_hw);
+--- a/include/net/mac80211.h
++++ b/include/net/mac80211.h
+@@ -1856,11 +1856,26 @@ struct ieee80211_hw *ieee80211_alloc_hw(
+ */
+ int ieee80211_register_hw(struct ieee80211_hw *hw);
+
++/**
++ * struct ieee80211_tpt_blink - throughput blink description
++ * @throughput: throughput in Kbit/sec
++ * @blink_time: blink time in milliseconds
++ * (full cycle, ie. one off + one on period)
++ */
++struct ieee80211_tpt_blink {
++ int throughput;
++ int blink_time;
++};
++
+ #ifdef CONFIG_MAC80211_LEDS
+ extern char *__ieee80211_get_tx_led_name(struct ieee80211_hw *hw);
+ extern char *__ieee80211_get_rx_led_name(struct ieee80211_hw *hw);
+ extern char *__ieee80211_get_assoc_led_name(struct ieee80211_hw *hw);
+ extern char *__ieee80211_get_radio_led_name(struct ieee80211_hw *hw);
++extern char *__ieee80211_create_tpt_led_trigger(
++ struct ieee80211_hw *hw,
++ const struct ieee80211_tpt_blink *blink_table,
++ unsigned int blink_table_len);
+ #endif
+ /**
+ * ieee80211_get_tx_led_name - get name of TX LED
+@@ -1939,6 +1954,29 @@ static inline char *ieee80211_get_radio_
+ }
+
+ /**
++ * ieee80211_create_tpt_led_trigger - create throughput LED trigger
++ * @hw: the hardware to create the trigger for
++ * @blink_table: the blink table -- needs to be ordered by throughput
++ * @blink_table_len: size of the blink table
++ *
++ * This function returns %NULL (in case of error, or if no LED
++ * triggers are configured) or the name of the new trigger.
++ * This function must be called before ieee80211_register_hw().
++ */
++static inline char *
++ieee80211_create_tpt_led_trigger(struct ieee80211_hw *hw,
++ const struct ieee80211_tpt_blink *blink_table,
++ unsigned int blink_table_len)
++{
++#ifdef CONFIG_MAC80211_LEDS
++ return __ieee80211_create_tpt_led_trigger(hw, blink_table,
++ blink_table_len);
++#else
++ return NULL;
++#endif
++}
++
++/**
+ * ieee80211_unregister_hw - Unregister a hardware device
+ *
+ * This function instructs mac80211 to free allocated resources
+--- a/net/mac80211/ieee80211_i.h
++++ b/net/mac80211/ieee80211_i.h
+@@ -23,6 +23,7 @@
+ #include <linux/types.h>
+ #include <linux/spinlock.h>
+ #include <linux/etherdevice.h>
++#include <linux/leds.h>
+ #include <net/ieee80211_radiotap.h>
+ #include <net/cfg80211.h>
+ #include <net/mac80211.h>
+@@ -641,6 +642,17 @@ enum queue_stop_reason {
+ IEEE80211_QUEUE_STOP_REASON_SKB_ADD,
+ };
+
++struct tpt_led_trigger {
++ struct led_trigger trig;
++ char name[32];
++ const struct ieee80211_tpt_blink *blink_table;
++ unsigned int blink_table_len;
++ struct timer_list timer;
++ bool running;
++ unsigned long prev_traffic;
++ unsigned long tx_bytes, rx_bytes;
++};
++
+ /**
+ * mac80211 scan flags - currently active scan mode
+ *
+@@ -854,6 +866,7 @@ struct ieee80211_local {
+ #ifdef CONFIG_MAC80211_LEDS
+ int tx_led_counter, rx_led_counter;
+ struct led_trigger *tx_led, *rx_led, *assoc_led, *radio_led;
++ struct tpt_led_trigger *tpt_led_trigger;
+ char tx_led_name[32], rx_led_name[32],
+ assoc_led_name[32], radio_led_name[32];
+ #endif
+--- a/net/mac80211/iface.c
++++ b/net/mac80211/iface.c
+@@ -225,6 +225,7 @@ static int ieee80211_do_open(struct net_
+ /* we're brought up, everything changes */
+ hw_reconf_flags = ~0;
+ ieee80211_led_radio(local, true);
++ ieee80211_start_tpt_led_trig(local);
+ }
+
+ /*
+--- a/net/mac80211/rx.c
++++ b/net/mac80211/rx.c
+@@ -2887,6 +2887,9 @@ void ieee80211_rx(struct ieee80211_hw *h
+ return;
+ }
+
++ ieee80211_tpt_led_trig_rx(local,
++ ((struct ieee80211_hdr *)skb->data)->frame_control,
++ skb->len);
+ __ieee80211_rx_handle_packet(hw, skb);
+
+ rcu_read_unlock();
+--- a/net/mac80211/tx.c
++++ b/net/mac80211/tx.c
+@@ -1292,6 +1292,7 @@ static int __ieee80211_tx(struct ieee802
+
+ while (skb) {
+ int q = skb_get_queue_mapping(skb);
++ __le16 fc;
+
+ spin_lock_irqsave(&local->queue_stop_reason_lock, flags);
+ ret = IEEE80211_TX_OK;
+@@ -1334,6 +1335,7 @@ static int __ieee80211_tx(struct ieee802
+ else
+ info->control.sta = NULL;
+
++ fc = ((struct ieee80211_hdr *)skb->data)->frame_control;
+ ret = drv_tx(local, skb);
+ if (WARN_ON(ret != NETDEV_TX_OK && skb->len != len)) {
+ dev_kfree_skb(skb);
+@@ -1344,6 +1346,7 @@ static int __ieee80211_tx(struct ieee802
+ return IEEE80211_TX_AGAIN;
+ }
+
++ ieee80211_tpt_led_trig_tx(local, fc, len);
+ *skbp = skb = next;
+ ieee80211_led_tx(local, 1);
+ fragm = true;
+--- a/net/mac80211/util.c
++++ b/net/mac80211/util.c
+@@ -1141,6 +1141,7 @@ u32 ieee80211_sta_get_rates(struct ieee8
+ void ieee80211_stop_device(struct ieee80211_local *local)
+ {
+ ieee80211_led_radio(local, false);
++ ieee80211_stop_tpt_led_trig(local);
+
+ cancel_work_sync(&local->reconfig_filter);
+
+@@ -1175,6 +1176,7 @@ int ieee80211_reconfig(struct ieee80211_
+ }
+
+ ieee80211_led_radio(local, true);
++ ieee80211_start_tpt_led_trig(local);
+ }
+
+ /* add interfaces */
diff --git a/package/mac80211/patches/402-ath9k_blink_default.patch b/package/mac80211/patches/402-ath9k_blink_default.patch
index 8269e61c6b..85fcc63c35 100644
--- a/package/mac80211/patches/402-ath9k_blink_default.patch
+++ b/package/mac80211/patches/402-ath9k_blink_default.patch
@@ -1,6 +1,6 @@
--- a/drivers/net/wireless/ath/ath9k/init.c
+++ b/drivers/net/wireless/ath/ath9k/init.c
-@@ -34,7 +34,7 @@ int modparam_nohwcrypt;
+@@ -33,7 +33,7 @@ int modparam_nohwcrypt;
module_param_named(nohwcrypt, modparam_nohwcrypt, int, 0444);
MODULE_PARM_DESC(nohwcrypt, "Disable hardware encryption");
diff --git a/package/mac80211/patches/403-ath9k-fix-invalid-mac-address-handling.patch b/package/mac80211/patches/403-ath9k-fix-invalid-mac-address-handling.patch
index c9839c1a32..77bbbc7905 100644
--- a/package/mac80211/patches/403-ath9k-fix-invalid-mac-address-handling.patch
+++ b/package/mac80211/patches/403-ath9k-fix-invalid-mac-address-handling.patch
@@ -8,7 +8,7 @@
#include <asm/unaligned.h>
#include "hw.h"
-@@ -445,8 +446,16 @@ static int ath9k_hw_init_macaddr(struct
+@@ -432,8 +433,16 @@ static int ath9k_hw_init_macaddr(struct
common->macaddr[2 * i] = eeval >> 8;
common->macaddr[2 * i + 1] = eeval & 0xff;
}
diff --git a/package/mac80211/patches/407-ath9k-override-mac-address-from-platform-data.patch b/package/mac80211/patches/407-ath9k-override-mac-address-from-platform-data.patch
index 353419417b..d6bc34b1a0 100644
--- a/package/mac80211/patches/407-ath9k-override-mac-address-from-platform-data.patch
+++ b/package/mac80211/patches/407-ath9k-override-mac-address-from-platform-data.patch
@@ -10,15 +10,15 @@
#endif /* _LINUX_ATH9K_PLATFORM_H */
--- a/drivers/net/wireless/ath/ath9k/init.c
+++ b/drivers/net/wireless/ath/ath9k/init.c
-@@ -16,6 +16,7 @@
+@@ -15,6 +15,7 @@
+ */
#include <linux/slab.h>
- #include <linux/pm_qos_params.h>
+#include <linux/ath9k_platform.h>
#include "ath9k.h"
-@@ -520,6 +521,7 @@ static void ath9k_init_misc(struct ath_s
+@@ -521,6 +522,7 @@ static void ath9k_init_misc(struct ath_s
static int ath9k_init_softc(u16 devid, struct ath_softc *sc, u16 subsysid,
const struct ath_bus_ops *bus_ops)
{
@@ -26,7 +26,7 @@
struct ath_hw *ah = NULL;
struct ath_common *common;
int ret = 0, i;
-@@ -565,6 +567,9 @@ static int ath9k_init_softc(u16 devid, s
+@@ -567,6 +569,9 @@ static int ath9k_init_softc(u16 devid, s
if (ret)
goto err_hw;
diff --git a/package/mac80211/patches/409-ath9k_platform_settings.patch b/package/mac80211/patches/409-ath9k_platform_settings.patch
index c0530fd9fe..7f09b05fb8 100644
--- a/package/mac80211/patches/409-ath9k_platform_settings.patch
+++ b/package/mac80211/patches/409-ath9k_platform_settings.patch
@@ -1,6 +1,6 @@
--- a/drivers/net/wireless/ath/ath9k/init.c
+++ b/drivers/net/wireless/ath/ath9k/init.c
-@@ -535,8 +535,15 @@ static int ath9k_init_softc(u16 devid, s
+@@ -536,8 +536,15 @@ static int ath9k_init_softc(u16 devid, s
ah->hw_version.subsysid = subsysid;
sc->sc_ah = ah;
@@ -19,7 +19,7 @@
common->ops = &ath9k_common_ops;
--- a/drivers/net/wireless/ath/ath9k/hw.h
+++ b/drivers/net/wireless/ath/ath9k/hw.h
-@@ -788,7 +788,7 @@ struct ath_hw {
+@@ -782,7 +782,7 @@ struct ath_hw {
u32 originalGain[22];
int initPDADC;
int PDADCdelta;
@@ -30,7 +30,7 @@
--- a/drivers/net/wireless/ath/ath9k/gpio.c
+++ b/drivers/net/wireless/ath/ath9k/gpio.c
-@@ -147,10 +147,12 @@ void ath_init_leds(struct ath_softc *sc)
+@@ -139,10 +139,12 @@ void ath_init_leds(struct ath_softc *sc)
if (AR_SREV_9100(sc->sc_ah))
return;
diff --git a/package/mac80211/patches/451-add-platform-eeprom-support-to-ath5k.patch b/package/mac80211/patches/451-add-platform-eeprom-support-to-ath5k.patch
index a03b599449..51867359a3 100644
--- a/package/mac80211/patches/451-add-platform-eeprom-support-to-ath5k.patch
+++ b/package/mac80211/patches/451-add-platform-eeprom-support-to-ath5k.patch
@@ -9,7 +9,7 @@
#include "ath5k.h"
#include "reg.h"
-@@ -34,6 +36,18 @@
+@@ -71,6 +73,18 @@ static u16 ath5k_eeprom_bin2freq(struct
static int ath5k_hw_eeprom_read(struct ath5k_hw *ah, u32 offset, u16 *data)
{
u32 status, timeout;
@@ -28,7 +28,7 @@
/*
* Initialize EEPROM access
-@@ -1788,7 +1802,7 @@ ath5k_eeprom_init(struct ath5k_hw *ah)
+@@ -1760,7 +1774,7 @@ ath5k_eeprom_read_spur_chans(struct ath5
}
/*
@@ -37,7 +37,7 @@
*/
int ath5k_eeprom_read_mac(struct ath5k_hw *ah, u8 *mac)
{
-@@ -1796,6 +1810,16 @@ int ath5k_eeprom_read_mac(struct ath5k_h
+@@ -1768,6 +1782,16 @@ int ath5k_eeprom_read_mac(struct ath5k_h
u32 total, offset;
u16 data;
int octet, ret;
diff --git a/package/mac80211/patches/563-ath9k_cleanup_led_blink.patch b/package/mac80211/patches/510-ath9k_led_cleanup.patch
index 3c804d2ad8..968804ad3a 100644
--- a/package/mac80211/patches/563-ath9k_cleanup_led_blink.patch
+++ b/package/mac80211/patches/510-ath9k_led_cleanup.patch
@@ -1,6 +1,6 @@
--- a/drivers/net/wireless/ath/ath9k/ath9k.h
+++ b/drivers/net/wireless/ath/ath9k/ath9k.h
-@@ -437,26 +437,20 @@ void ath9k_btcoex_timer_pause(struct ath
+@@ -438,26 +438,20 @@ void ath9k_btcoex_timer_pause(struct ath
#define ATH_LED_PIN_DEF 1
#define ATH_LED_PIN_9287 8
@@ -38,7 +38,7 @@
/* Antenna diversity/combining */
#define ATH_ANT_RX_CURRENT_SHIFT 4
-@@ -606,15 +600,11 @@ struct ath_softc {
+@@ -608,15 +602,11 @@ struct ath_softc {
struct ath_beacon beacon;
struct ieee80211_supported_band sbands[IEEE80211_NUM_BANDS];
@@ -253,7 +253,7 @@
/* Rfkill */
--- a/drivers/net/wireless/ath/ath9k/main.c
+++ b/drivers/net/wireless/ath/ath9k/main.c
-@@ -1276,9 +1276,6 @@ static void ath9k_stop(struct ieee80211_
+@@ -1278,9 +1278,6 @@ static void ath9k_stop(struct ieee80211_
aphy->state = ATH_WIPHY_INACTIVE;
@@ -265,7 +265,7 @@
cancel_work_sync(&sc->hw_check_work);
--- a/drivers/net/wireless/ath/ath9k/init.c
+++ b/drivers/net/wireless/ath/ath9k/init.c
-@@ -136,6 +136,20 @@ static struct ieee80211_rate ath9k_legac
+@@ -139,6 +139,20 @@ static struct ieee80211_rate ath9k_legac
RATE(540, 0x0c, 0),
};
@@ -286,7 +286,7 @@
static void ath9k_deinit_softc(struct ath_softc *sc);
/*
-@@ -746,6 +760,10 @@ int ath9k_init_device(u16 devid, struct
+@@ -750,6 +764,10 @@ int ath9k_init_device(u16 devid, struct
ath9k_init_txpower_limits(sc);
diff --git a/package/mac80211/patches/520-ath9k_endian_fixes.patch b/package/mac80211/patches/520-ath9k_endian_fixes.patch
deleted file mode 100644
index 836cf8fee8..0000000000
--- a/package/mac80211/patches/520-ath9k_endian_fixes.patch
+++ /dev/null
@@ -1,58 +0,0 @@
---- a/drivers/net/wireless/ath/ath9k/eeprom.h
-+++ b/drivers/net/wireless/ath/ath9k/eeprom.h
-@@ -236,6 +236,15 @@
- #define CTL_EDGE_TPOWER(_ctl) ((_ctl) & 0x3f)
- #define CTL_EDGE_FLAGS(_ctl) (((_ctl) >> 6) & 0x03)
-
-+#define LNA_CTL_BUF_MODE BIT(0)
-+#define LNA_CTL_ISEL_LO BIT(1)
-+#define LNA_CTL_ISEL_HI BIT(2)
-+#define LNA_CTL_BUF_IN BIT(3)
-+#define LNA_CTL_FEM_BAND BIT(4)
-+#define LNA_CTL_LOCAL_BIAS BIT(5)
-+#define LNA_CTL_FORCE_XPA BIT(6)
-+#define LNA_CTL_USE_ANT1 BIT(7)
-+
- enum eeprom_param {
- EEP_NFTHRESH_5,
- EEP_NFTHRESH_2,
-@@ -381,10 +390,7 @@ struct modal_eep_header {
- u8 xatten2Margin[AR5416_MAX_CHAINS];
- u8 ob_ch1;
- u8 db_ch1;
-- u8 useAnt1:1,
-- force_xpaon:1,
-- local_bias:1,
-- femBandSelectUsed:1, xlnabufin:1, xlnaisel:2, xlnabufmode:1;
-+ u8 lna_ctl;
- u8 miscBits;
- u16 xpaBiasLvlFreq[3];
- u8 futureModal[6];
---- a/drivers/net/wireless/ath/ath9k/eeprom_def.c
-+++ b/drivers/net/wireless/ath/ath9k/eeprom_def.c
-@@ -451,9 +451,10 @@ static void ath9k_hw_def_set_board_value
- ath9k_hw_analog_shift_rmw(ah, AR_AN_TOP2,
- AR_AN_TOP2_LOCALBIAS,
- AR_AN_TOP2_LOCALBIAS_S,
-- pModal->local_bias);
-+ !!(pModal->lna_ctl &
-+ LNA_CTL_LOCAL_BIAS));
- REG_RMW_FIELD(ah, AR_PHY_XPA_CFG, AR_PHY_FORCE_XPA_CFG,
-- pModal->force_xpaon);
-+ !!(pModal->lna_ctl & LNA_CTL_FORCE_XPA));
- }
-
- REG_RMW_FIELD(ah, AR_PHY_SETTLING, AR_PHY_SETTLING_SWITCH,
-@@ -1432,9 +1433,9 @@ static u8 ath9k_hw_def_get_num_ant_confi
-
- num_ant_config = 1;
-
-- if (pBase->version >= 0x0E0D)
-- if (pModal->useAnt1)
-- num_ant_config += 1;
-+ if (pBase->version >= 0x0E0D &&
-+ (pModal->lna_ctl & LNA_CTL_USE_ANT1))
-+ num_ant_config += 1;
-
- return num_ant_config;
- }
diff --git a/package/mac80211/patches/570-ath9k_fix_module_reload.patch b/package/mac80211/patches/520-ath9k_pci_error_fix.patch
index b8fcc994b6..b8fcc994b6 100644
--- a/package/mac80211/patches/570-ath9k_fix_module_reload.patch
+++ b/package/mac80211/patches/520-ath9k_pci_error_fix.patch
diff --git a/package/mac80211/patches/530-ath9k_ar9300_keysearch_fix.patch b/package/mac80211/patches/530-ath9k_ar9300_keysearch_fix.patch
deleted file mode 100644
index ec13e5b45d..0000000000
--- a/package/mac80211/patches/530-ath9k_ar9300_keysearch_fix.patch
+++ /dev/null
@@ -1,23 +0,0 @@
---- a/drivers/net/wireless/ath/ath9k/hw.c
-+++ b/drivers/net/wireless/ath/ath9k/hw.c
-@@ -1854,6 +1854,10 @@ int ath9k_hw_fill_cap_info(struct ath_hw
-
- ah->misc_mode |= AR_PCU_MIC_NEW_LOC_ENA;
-
-+ /* enable key search for every frame in an aggregate */
-+ if (AR_SREV_9300_20_OR_LATER(ah))
-+ ah->misc_mode |= AR_PCU_ALWAYS_PERFORM_KEYSEARCH;
-+
- pCap->low_2ghz_chan = 2312;
- pCap->high_2ghz_chan = 2732;
-
---- a/drivers/net/wireless/ath/ath9k/reg.h
-+++ b/drivers/net/wireless/ath/ath9k/reg.h
-@@ -1575,6 +1575,7 @@ enum {
- #define AR_PCU_TBTT_PROTECT 0x00200000
- #define AR_PCU_CLEAR_VMF 0x01000000
- #define AR_PCU_CLEAR_BA_VALID 0x04000000
-+#define AR_PCU_ALWAYS_PERFORM_KEYSEARCH 0x10000000
-
- #define AR_PCU_BT_ANT_PREVENT_RX 0x00100000
- #define AR_PCU_BT_ANT_PREVENT_RX_S 20
diff --git a/package/mac80211/patches/540-ath9k_htc_fix_eeprom.patch b/package/mac80211/patches/540-ath9k_htc_fix_eeprom.patch
deleted file mode 100644
index 6dfd130ae3..0000000000
--- a/package/mac80211/patches/540-ath9k_htc_fix_eeprom.patch
+++ /dev/null
@@ -1,10 +0,0 @@
---- a/drivers/net/wireless/ath/ath9k/htc_drv_init.c
-+++ b/drivers/net/wireless/ath/ath9k/htc_drv_init.c
-@@ -641,6 +641,7 @@ static int ath9k_init_priv(struct ath9k_
-
- ah->hw_version.devid = devid;
- ah->hw_version.subsysid = 0; /* FIXME */
-+ ah->ah_flags |= AH_USE_EEPROM;
- priv->ah = ah;
-
- common = ath9k_hw_common(ah);
diff --git a/package/mac80211/patches/550-cfg80211_validate_mcast_rate.patch b/package/mac80211/patches/550-cfg80211_validate_mcast_rate.patch
deleted file mode 100644
index 6d8f62df55..0000000000
--- a/package/mac80211/patches/550-cfg80211_validate_mcast_rate.patch
+++ /dev/null
@@ -1,157 +0,0 @@
---- a/include/net/cfg80211.h
-+++ b/include/net/cfg80211.h
-@@ -924,7 +924,7 @@ struct cfg80211_disassoc_request {
- * @privacy: this is a protected network, keys will be configured
- * after joining
- * @basic_rates: bitmap of basic rates to use when creating the IBSS
-- * @mcast_rate: multicast tx rate (in 100 kbps)
-+ * @mcast_rate: per-band multicast rate index + 1 (0: disabled)
- */
- struct cfg80211_ibss_params {
- u8 *ssid;
-@@ -936,7 +936,7 @@ struct cfg80211_ibss_params {
- u32 basic_rates;
- bool channel_fixed;
- bool privacy;
-- int mcast_rate;
-+ int mcast_rate[IEEE80211_NUM_BANDS];
- };
-
- /**
---- a/include/net/mac80211.h
-+++ b/include/net/mac80211.h
-@@ -219,7 +219,7 @@ enum ieee80211_bss_change {
- * @basic_rates: bitmap of basic rates, each bit stands for an
- * index into the rate table configured by the driver in
- * the current band.
-- * @mcast_rate: multicast rate for AP and Ad-Hoc (in 100 kbps)
-+ * @mcast_rate: per-band multicast rate index + 1 (0: disabled)
- * @bssid: The BSSID for this BSS
- * @enable_beacon: whether beaconing should be enabled or not
- * @channel_type: Channel type for this BSS -- the hardware might be
-@@ -259,7 +259,7 @@ struct ieee80211_bss_conf {
- u16 assoc_capability;
- u64 timestamp;
- u32 basic_rates;
-- u32 mcast_rate;
-+ int mcast_rate[IEEE80211_NUM_BANDS];
- u16 ht_operation_mode;
- s32 cqm_rssi_thold;
- u32 cqm_rssi_hyst;
---- a/net/mac80211/ibss.c
-+++ b/net/mac80211/ibss.c
-@@ -915,7 +915,8 @@ int ieee80211_ibss_join(struct ieee80211
-
- sdata->u.ibss.privacy = params->privacy;
- sdata->u.ibss.basic_rates = params->basic_rates;
-- sdata->vif.bss_conf.mcast_rate = params->mcast_rate;
-+ memcpy(sdata->vif.bss_conf.mcast_rate, params->mcast_rate,
-+ sizeof(params->mcast_rate));
-
- sdata->vif.bss_conf.beacon_int = params->beacon_interval;
-
---- a/net/mac80211/rate.c
-+++ b/net/mac80211/rate.c
-@@ -211,20 +211,11 @@ static bool rc_no_data_or_no_ack(struct
- return (info->flags & IEEE80211_TX_CTL_NO_ACK) || !ieee80211_is_data(fc);
- }
-
--static void rc_send_low_broadcast(s8 *idx, u32 basic_rates, u32 mcast_rate,
-+static void rc_send_low_broadcast(s8 *idx, u32 basic_rates,
- struct ieee80211_supported_band *sband)
- {
- u8 i;
-
-- if (mcast_rate) {
-- for (i = 0; i < sband->n_bitrates; i++) {
-- if (sband->bitrates[i].bitrate == mcast_rate) {
-- *idx = i;
-- return;
-- }
-- }
-- }
--
- if (basic_rates == 0)
- return; /* assume basic rates unknown and accept rate */
- if (*idx < 0)
-@@ -247,17 +238,25 @@ bool rate_control_send_low(struct ieee80
- struct ieee80211_tx_rate_control *txrc)
- {
- struct ieee80211_tx_info *info = IEEE80211_SKB_CB(txrc->skb);
-+ struct ieee80211_supported_band *sband = txrc->sband;
-+ int mcast_rate;
-
- if (!sta || !priv_sta || rc_no_data_or_no_ack(txrc)) {
- info->control.rates[0].idx = rate_lowest_index(txrc->sband, sta);
- info->control.rates[0].count =
- (info->flags & IEEE80211_TX_CTL_NO_ACK) ?
- 1 : txrc->hw->max_rate_tries;
-- if (!sta && txrc->bss)
-+ if (!sta && txrc->bss) {
-+ mcast_rate = txrc->bss_conf->mcast_rate[sband->band];
-+ if (mcast_rate > 0) {
-+ info->control.rates[0].idx = mcast_rate - 1;
-+ return true;
-+ }
-+
- rc_send_low_broadcast(&info->control.rates[0].idx,
- txrc->bss_conf->basic_rates,
-- txrc->bss_conf->mcast_rate,
-- txrc->sband);
-+ sband);
-+ }
- return true;
- }
- return false;
---- a/net/wireless/nl80211.c
-+++ b/net/wireless/nl80211.c
-@@ -3600,6 +3600,34 @@ static int nl80211_disassociate(struct s
- local_state_change);
- }
-
-+static bool
-+nl80211_parse_mcast_rate(struct cfg80211_registered_device *rdev,
-+ int mcast_rate[IEEE80211_NUM_BANDS],
-+ int rateval)
-+{
-+ struct wiphy *wiphy = &rdev->wiphy;
-+ bool found = false;
-+ int band, i;
-+
-+ for (band = 0; band < IEEE80211_NUM_BANDS; band++) {
-+ struct ieee80211_supported_band *sband;
-+
-+ sband = wiphy->bands[band];
-+ if (!sband)
-+ continue;
-+
-+ for (i = 0; i < sband->n_bitrates; i++) {
-+ if (sband->bitrates[i].bitrate == rateval) {
-+ mcast_rate[band] = i + 1;
-+ found = true;
-+ break;
-+ }
-+ }
-+ }
-+
-+ return found;
-+}
-+
- static int nl80211_join_ibss(struct sk_buff *skb, struct genl_info *info)
- {
- struct cfg80211_registered_device *rdev = info->user_ptr[0];
-@@ -3683,9 +3711,11 @@ static int nl80211_join_ibss(struct sk_b
- return -EINVAL;
- }
- }
-- if (info->attrs[NL80211_ATTR_MCAST_RATE])
-- ibss.mcast_rate =
-- nla_get_u32(info->attrs[NL80211_ATTR_MCAST_RATE]);
-+
-+ if (info->attrs[NL80211_ATTR_MCAST_RATE] &&
-+ !nl80211_parse_mcast_rate(rdev, ibss.mcast_rate,
-+ nla_get_u32(info->attrs[NL80211_ATTR_MCAST_RATE])))
-+ return -EINVAL;
-
- if (ibss.privacy && info->attrs[NL80211_ATTR_KEYS]) {
- connkeys = nl80211_parse_connkeys(rdev,
diff --git a/package/mac80211/patches/560-led_blink_backport.patch b/package/mac80211/patches/560-led_blink_backport.patch
deleted file mode 100644
index d22ec95cc1..0000000000
--- a/package/mac80211/patches/560-led_blink_backport.patch
+++ /dev/null
@@ -1,207 +0,0 @@
---- a/compat/compat-2.6.37.c
-+++ b/compat/compat-2.6.37.c
-@@ -152,3 +152,175 @@ int compat_genl_unregister_family(struct
- }
- EXPORT_SYMBOL(compat_genl_unregister_family);
-
-+#ifdef CONFIG_LEDS_CLASS
-+
-+#undef led_brightness_set
-+#undef led_classdev_unregister
-+
-+spinlock_t led_lock;
-+static LIST_HEAD(led_timers);
-+
-+struct led_timer {
-+ struct list_head list;
-+ struct led_classdev *cdev;
-+ struct timer_list blink_timer;
-+ unsigned long blink_delay_on;
-+ unsigned long blink_delay_off;
-+ int blink_brightness;
-+};
-+
-+static void led_brightness_set(struct led_classdev *led_cdev,
-+ enum led_brightness brightness)
-+{
-+ led_cdev->brightness = brightness;
-+ led_cdev->brightness_set(led_cdev, brightness);
-+}
-+
-+static struct led_timer *led_get_timer(struct led_classdev *led_cdev)
-+{
-+ struct led_timer *p;
-+ unsigned long flags;
-+
-+ spin_lock_irqsave(&led_lock, flags);
-+ list_for_each_entry(p, &led_timers, list) {
-+ if (p->cdev == led_cdev)
-+ goto found;
-+ }
-+ p = NULL;
-+found:
-+ spin_unlock_irqrestore(&led_lock, flags);
-+ return p;
-+}
-+
-+static void led_stop_software_blink(struct led_timer *led)
-+{
-+ del_timer_sync(&led->blink_timer);
-+ led->blink_delay_on = 0;
-+ led->blink_delay_off = 0;
-+}
-+
-+static void led_timer_function(unsigned long data)
-+{
-+ struct led_timer *led = (struct led_timer *)data;
-+ unsigned long brightness;
-+ unsigned long delay;
-+
-+ if (!led->blink_delay_on || !led->blink_delay_off) {
-+ led->cdev->brightness_set(led->cdev, LED_OFF);
-+ return;
-+ }
-+
-+ brightness = led->cdev->brightness;
-+ if (!brightness) {
-+ /* Time to switch the LED on. */
-+ brightness = led->blink_brightness;
-+ delay = led->blink_delay_on;
-+ } else {
-+ /* Store the current brightness value to be able
-+ * to restore it when the delay_off period is over.
-+ */
-+ led->blink_brightness = brightness;
-+ brightness = LED_OFF;
-+ delay = led->blink_delay_off;
-+ }
-+
-+ led_brightness_set(led->cdev, brightness);
-+ mod_timer(&led->blink_timer, jiffies + msecs_to_jiffies(delay));
-+}
-+
-+static struct led_timer *led_new_timer(struct led_classdev *led_cdev)
-+{
-+ struct led_timer *led;
-+ unsigned long flags;
-+
-+ led = kzalloc(sizeof(struct led_timer), GFP_ATOMIC);
-+ if (!led)
-+ return NULL;
-+
-+ led->cdev = led_cdev;
-+ init_timer(&led->blink_timer);
-+ led->blink_timer.function = led_timer_function;
-+ led->blink_timer.data = (unsigned long) led;
-+
-+ spin_lock_irqsave(&led_lock, flags);
-+ list_add(&led->list, &led_timers);
-+ spin_unlock_irqrestore(&led_lock, flags);
-+
-+ return led;
-+}
-+
-+void led_blink_set(struct led_classdev *led_cdev,
-+ unsigned long *delay_on,
-+ unsigned long *delay_off)
-+{
-+ struct led_timer *led = led_get_timer(led_cdev);
-+ int current_brightness;
-+
-+ if (!led) {
-+ led = led_new_timer(led_cdev);
-+ if (!led)
-+ return;
-+ }
-+
-+ /* blink with 1 Hz as default if nothing specified */
-+ if (!*delay_on && !*delay_off)
-+ *delay_on = *delay_off = 500;
-+
-+ if (led->blink_delay_on == *delay_on &&
-+ led->blink_delay_off == *delay_off)
-+ return;
-+
-+ current_brightness = led_cdev->brightness;
-+ if (current_brightness)
-+ led->blink_brightness = current_brightness;
-+ if (!led->blink_brightness)
-+ led->blink_brightness = led_cdev->max_brightness;
-+
-+ led_stop_software_blink(led);
-+ led->blink_delay_on = *delay_on;
-+ led->blink_delay_off = *delay_off;
-+
-+ /* never on - don't blink */
-+ if (!*delay_on)
-+ return;
-+
-+ /* never off - just set to brightness */
-+ if (!*delay_off) {
-+ led_brightness_set(led_cdev, led->blink_brightness);
-+ return;
-+ }
-+
-+ mod_timer(&led->blink_timer, jiffies + 1);
-+}
-+EXPORT_SYMBOL(led_blink_set);
-+
-+void compat_led_brightness_set(struct led_classdev *led_cdev,
-+ enum led_brightness brightness)
-+{
-+ struct led_timer *led = led_get_timer(led_cdev);
-+
-+ if (led)
-+ led_stop_software_blink(led);
-+
-+ return led_cdev->brightness_set(led_cdev, brightness);
-+}
-+EXPORT_SYMBOL(compat_led_brightness_set);
-+
-+void compat_led_classdev_unregister(struct led_classdev *led_cdev)
-+{
-+ struct led_timer *led = led_get_timer(led_cdev);
-+ unsigned long flags;
-+
-+ if (led) {
-+ del_timer_sync(&led->blink_timer);
-+ spin_lock_irqsave(&led_lock, flags);
-+ list_del(&led->list);
-+ spin_unlock_irqrestore(&led_lock, flags);
-+ kfree(led);
-+ }
-+
-+ led_classdev_unregister(led_cdev);
-+}
-+EXPORT_SYMBOL(compat_led_classdev_unregister);
-+
-+#endif
---- a/include/linux/compat-2.6.37.h
-+++ b/include/linux/compat-2.6.37.h
-@@ -6,6 +6,7 @@
- #if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,37))
-
- #include <linux/skbuff.h>
-+#include <linux/leds.h>
-
- #define SDIO_CLASS_BT_AMP 0x09 /* Type-A Bluetooth AMP interface */
-
-@@ -93,6 +94,18 @@ int genl_unregister_family(struct genl_f
- #define genl_register_mc_group(_fam, _grp) genl_register_mc_group(&(_fam)->family, _grp)
- #define genl_unregister_mc_group(_fam, _grp) genl_unregister_mc_group(&(_fam)->family, _grp)
-
-+
-+extern void led_blink_set(struct led_classdev *led_cdev,
-+ unsigned long *delay_on,
-+ unsigned long *delay_off);
-+
-+#define led_classdev_unregister compat_led_classdev_unregister
-+extern void led_classdev_unregister(struct led_classdev *led_cdev);
-+
-+#define led_brightness_set compat_led_brightness_set
-+extern void led_brightness_set(struct led_classdev *led_cdev,
-+ enum led_brightness brightness);
-+
- #endif /* (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,37)) */
-
- #endif /* LINUX_26_37_COMPAT_H */
diff --git a/package/mac80211/patches/561-led_trigger_names.patch b/package/mac80211/patches/561-led_trigger_names.patch
deleted file mode 100644
index 28108ecfb6..0000000000
--- a/package/mac80211/patches/561-led_trigger_names.patch
+++ /dev/null
@@ -1,146 +0,0 @@
-From: Johannes Berg <johannes.berg@intel.com>
-Subject: [PATCH] mac80211: make LED trigger names available early
-
-The throughput trigger will require doing LED
-classdev/trigger handling before register_hw(),
-so drivers should have access to the trigger
-names before it. If trigger registration fails,
-this will still make the trigger name available,
-but that's not a big problem since the default
-trigger will the simply not be found.
-
-Signed-off-by: Johannes Berg <johannes.berg@intel.com>
----
- net/mac80211/led.c | 36 ++++++++++++++++--------------------
- net/mac80211/led.h | 4 ++++
- net/mac80211/main.c | 2 ++
- 3 files changed, 22 insertions(+), 20 deletions(-)
-
---- a/net/mac80211/led.c
-+++ b/net/mac80211/led.c
-@@ -54,12 +54,22 @@ void ieee80211_led_radio(struct ieee8021
- led_trigger_event(local->radio_led, LED_OFF);
- }
-
-+void ieee80211_led_names(struct ieee80211_local *local)
-+{
-+ snprintf(local->rx_led_name, sizeof(local->rx_led_name),
-+ "%srx", wiphy_name(local->hw.wiphy));
-+ snprintf(local->tx_led_name, sizeof(local->tx_led_name),
-+ "%stx", wiphy_name(local->hw.wiphy));
-+ snprintf(local->assoc_led_name, sizeof(local->assoc_led_name),
-+ "%sassoc", wiphy_name(local->hw.wiphy));
-+ snprintf(local->radio_led_name, sizeof(local->radio_led_name),
-+ "%sradio", wiphy_name(local->hw.wiphy));
-+}
-+
- void ieee80211_led_init(struct ieee80211_local *local)
- {
- local->rx_led = kzalloc(sizeof(struct led_trigger), GFP_KERNEL);
- if (local->rx_led) {
-- snprintf(local->rx_led_name, sizeof(local->rx_led_name),
-- "%srx", wiphy_name(local->hw.wiphy));
- local->rx_led->name = local->rx_led_name;
- if (led_trigger_register(local->rx_led)) {
- kfree(local->rx_led);
-@@ -69,8 +79,6 @@ void ieee80211_led_init(struct ieee80211
-
- local->tx_led = kzalloc(sizeof(struct led_trigger), GFP_KERNEL);
- if (local->tx_led) {
-- snprintf(local->tx_led_name, sizeof(local->tx_led_name),
-- "%stx", wiphy_name(local->hw.wiphy));
- local->tx_led->name = local->tx_led_name;
- if (led_trigger_register(local->tx_led)) {
- kfree(local->tx_led);
-@@ -80,8 +88,6 @@ void ieee80211_led_init(struct ieee80211
-
- local->assoc_led = kzalloc(sizeof(struct led_trigger), GFP_KERNEL);
- if (local->assoc_led) {
-- snprintf(local->assoc_led_name, sizeof(local->assoc_led_name),
-- "%sassoc", wiphy_name(local->hw.wiphy));
- local->assoc_led->name = local->assoc_led_name;
- if (led_trigger_register(local->assoc_led)) {
- kfree(local->assoc_led);
-@@ -91,8 +97,6 @@ void ieee80211_led_init(struct ieee80211
-
- local->radio_led = kzalloc(sizeof(struct led_trigger), GFP_KERNEL);
- if (local->radio_led) {
-- snprintf(local->radio_led_name, sizeof(local->radio_led_name),
-- "%sradio", wiphy_name(local->hw.wiphy));
- local->radio_led->name = local->radio_led_name;
- if (led_trigger_register(local->radio_led)) {
- kfree(local->radio_led);
-@@ -125,9 +129,7 @@ char *__ieee80211_get_radio_led_name(str
- {
- struct ieee80211_local *local = hw_to_local(hw);
-
-- if (local->radio_led)
-- return local->radio_led_name;
-- return NULL;
-+ return local->radio_led_name;
- }
- EXPORT_SYMBOL(__ieee80211_get_radio_led_name);
-
-@@ -135,9 +137,7 @@ char *__ieee80211_get_assoc_led_name(str
- {
- struct ieee80211_local *local = hw_to_local(hw);
-
-- if (local->assoc_led)
-- return local->assoc_led_name;
-- return NULL;
-+ return local->assoc_led_name;
- }
- EXPORT_SYMBOL(__ieee80211_get_assoc_led_name);
-
-@@ -145,9 +145,7 @@ char *__ieee80211_get_tx_led_name(struct
- {
- struct ieee80211_local *local = hw_to_local(hw);
-
-- if (local->tx_led)
-- return local->tx_led_name;
-- return NULL;
-+ return local->tx_led_name;
- }
- EXPORT_SYMBOL(__ieee80211_get_tx_led_name);
-
-@@ -155,8 +153,6 @@ char *__ieee80211_get_rx_led_name(struct
- {
- struct ieee80211_local *local = hw_to_local(hw);
-
-- if (local->rx_led)
-- return local->rx_led_name;
-- return NULL;
-+ return local->rx_led_name;
- }
- EXPORT_SYMBOL(__ieee80211_get_rx_led_name);
---- a/net/mac80211/led.h
-+++ b/net/mac80211/led.h
-@@ -18,6 +18,7 @@ extern void ieee80211_led_assoc(struct i
- bool associated);
- extern void ieee80211_led_radio(struct ieee80211_local *local,
- bool enabled);
-+extern void ieee80211_led_names(struct ieee80211_local *local);
- extern void ieee80211_led_init(struct ieee80211_local *local);
- extern void ieee80211_led_exit(struct ieee80211_local *local);
- #else
-@@ -35,6 +36,9 @@ static inline void ieee80211_led_radio(s
- bool enabled)
- {
- }
-+static inline void ieee80211_led_names(struct ieee80211_local *local)
-+{
-+}
- static inline void ieee80211_led_init(struct ieee80211_local *local)
- {
- }
---- a/net/mac80211/main.c
-+++ b/net/mac80211/main.c
-@@ -599,6 +599,8 @@ struct ieee80211_hw *ieee80211_alloc_hw(
- /* init dummy netdev for use w/ NAPI */
- init_dummy_netdev(&local->napi_dev);
-
-+ ieee80211_led_names(local);
-+
- return local_to_hw(local);
- }
- EXPORT_SYMBOL(ieee80211_alloc_hw);
diff --git a/package/mac80211/patches/562-throughput_trigger.patch b/package/mac80211/patches/562-throughput_trigger.patch
deleted file mode 100644
index 7f85c466a1..0000000000
--- a/package/mac80211/patches/562-throughput_trigger.patch
+++ /dev/null
@@ -1,388 +0,0 @@
-Subject: mac80211: add throughput based LED blink trigger
-From: Johannes Berg <johannes.berg@intel.com>
-
-iwlwifi and other drivers like to blink their LED
-based on throughput. Implement this generically in
-mac80211, based on a throughput table the driver
-specifies. That way, drivers can set the blink
-frequencies depending on their desired behaviour
-and max throughput.
-
-All the drivers need to do is provide an LED class
-device, best with blink hardware offload.
-
-Signed-off-by: Johannes Berg <johannes.berg@intel.com>
----
-v2: turn off LED when turning off radio
-v3: - use only data frames
- - fix update frequency to 1 second
- - use DIV_ROUND_UP
-
- include/net/mac80211.h | 38 ++++++++++++++
- net/mac80211/ieee80211_i.h | 13 ++++
- net/mac80211/iface.c | 1
- net/mac80211/led.c | 119 +++++++++++++++++++++++++++++++++++++++++++++
- net/mac80211/led.h | 44 +++++++++++++---
- net/mac80211/rx.c | 3 +
- net/mac80211/tx.c | 3 +
- net/mac80211/util.c | 2
- 8 files changed, 214 insertions(+), 9 deletions(-)
-
---- a/include/net/mac80211.h
-+++ b/include/net/mac80211.h
-@@ -1849,11 +1849,26 @@ struct ieee80211_hw *ieee80211_alloc_hw(
- */
- int ieee80211_register_hw(struct ieee80211_hw *hw);
-
-+/**
-+ * struct ieee80211_tpt_blink - throughput blink description
-+ * @throughput: throughput in Kbit/sec
-+ * @blink_time: blink time in milliseconds
-+ * (full cycle, ie. one off + one on period)
-+ */
-+struct ieee80211_tpt_blink {
-+ int throughput;
-+ int blink_time;
-+};
-+
- #ifdef CONFIG_MAC80211_LEDS
- extern char *__ieee80211_get_tx_led_name(struct ieee80211_hw *hw);
- extern char *__ieee80211_get_rx_led_name(struct ieee80211_hw *hw);
- extern char *__ieee80211_get_assoc_led_name(struct ieee80211_hw *hw);
- extern char *__ieee80211_get_radio_led_name(struct ieee80211_hw *hw);
-+extern char *__ieee80211_create_tpt_led_trigger(
-+ struct ieee80211_hw *hw,
-+ const struct ieee80211_tpt_blink *blink_table,
-+ unsigned int blink_table_len);
- #endif
- /**
- * ieee80211_get_tx_led_name - get name of TX LED
-@@ -1932,6 +1947,29 @@ static inline char *ieee80211_get_radio_
- }
-
- /**
-+ * ieee80211_create_tpt_led_trigger - create throughput LED trigger
-+ * @hw: the hardware to create the trigger for
-+ * @blink_table: the blink table -- needs to be ordered by throughput
-+ * @blink_table_len: size of the blink table
-+ *
-+ * This function returns %NULL (in case of error, or if no LED
-+ * triggers are configured) or the name of the new trigger.
-+ * This function must be called before ieee80211_register_hw().
-+ */
-+static inline char *
-+ieee80211_create_tpt_led_trigger(struct ieee80211_hw *hw,
-+ const struct ieee80211_tpt_blink *blink_table,
-+ unsigned int blink_table_len)
-+{
-+#ifdef CONFIG_MAC80211_LEDS
-+ return __ieee80211_create_tpt_led_trigger(hw, blink_table,
-+ blink_table_len);
-+#else
-+ return NULL;
-+#endif
-+}
-+
-+/**
- * ieee80211_unregister_hw - Unregister a hardware device
- *
- * This function instructs mac80211 to free allocated resources
---- a/net/mac80211/ieee80211_i.h
-+++ b/net/mac80211/ieee80211_i.h
-@@ -23,6 +23,7 @@
- #include <linux/types.h>
- #include <linux/spinlock.h>
- #include <linux/etherdevice.h>
-+#include <linux/leds.h>
- #include <net/ieee80211_radiotap.h>
- #include <net/cfg80211.h>
- #include <net/mac80211.h>
-@@ -636,6 +637,17 @@ enum queue_stop_reason {
- IEEE80211_QUEUE_STOP_REASON_SKB_ADD,
- };
-
-+struct tpt_led_trigger {
-+ struct led_trigger trig;
-+ char name[32];
-+ const struct ieee80211_tpt_blink *blink_table;
-+ unsigned int blink_table_len;
-+ struct timer_list timer;
-+ bool running;
-+ unsigned long prev_traffic;
-+ unsigned long tx_bytes, rx_bytes;
-+};
-+
- /**
- * mac80211 scan flags - currently active scan mode
- *
-@@ -849,6 +861,7 @@ struct ieee80211_local {
- #ifdef CONFIG_MAC80211_LEDS
- int tx_led_counter, rx_led_counter;
- struct led_trigger *tx_led, *rx_led, *assoc_led, *radio_led;
-+ struct tpt_led_trigger *tpt_led_trigger;
- char tx_led_name[32], rx_led_name[32],
- assoc_led_name[32], radio_led_name[32];
- #endif
---- a/net/mac80211/led.c
-+++ b/net/mac80211/led.c
-@@ -103,6 +103,13 @@ void ieee80211_led_init(struct ieee80211
- local->radio_led = NULL;
- }
- }
-+
-+ if (local->tpt_led_trigger) {
-+ if (led_trigger_register(&local->tpt_led_trigger->trig)) {
-+ kfree(local->tpt_led_trigger);
-+ local->tpt_led_trigger = NULL;
-+ }
-+ }
- }
-
- void ieee80211_led_exit(struct ieee80211_local *local)
-@@ -123,6 +130,11 @@ void ieee80211_led_exit(struct ieee80211
- led_trigger_unregister(local->rx_led);
- kfree(local->rx_led);
- }
-+
-+ if (local->tpt_led_trigger) {
-+ led_trigger_unregister(&local->tpt_led_trigger->trig);
-+ kfree(local->tpt_led_trigger);
-+ }
- }
-
- char *__ieee80211_get_radio_led_name(struct ieee80211_hw *hw)
-@@ -156,3 +168,110 @@ char *__ieee80211_get_rx_led_name(struct
- return local->rx_led_name;
- }
- EXPORT_SYMBOL(__ieee80211_get_rx_led_name);
-+
-+static unsigned long tpt_trig_traffic(struct ieee80211_local *local,
-+ struct tpt_led_trigger *tpt_trig)
-+{
-+ unsigned long traffic, delta;
-+
-+ traffic = tpt_trig->tx_bytes + tpt_trig->rx_bytes;
-+
-+ delta = traffic - tpt_trig->prev_traffic;
-+ tpt_trig->prev_traffic = traffic;
-+ return DIV_ROUND_UP(delta, 1024 / 8);
-+}
-+
-+static void tpt_trig_timer(unsigned long data)
-+{
-+ struct ieee80211_local *local = (void *)data;
-+ struct tpt_led_trigger *tpt_trig = local->tpt_led_trigger;
-+ struct led_classdev *led_cdev;
-+ unsigned long on, off, tpt;
-+ int i;
-+
-+ if (!tpt_trig->running)
-+ return;
-+
-+ mod_timer(&tpt_trig->timer, round_jiffies(jiffies + HZ));
-+
-+ tpt = tpt_trig_traffic(local, tpt_trig);
-+
-+ /* default to just solid on */
-+ on = 1;
-+ off = 0;
-+
-+ for (i = tpt_trig->blink_table_len - 1; i >= 0; i--) {
-+ if (tpt > tpt_trig->blink_table[i].throughput) {
-+ off = tpt_trig->blink_table[i].blink_time / 2;
-+ on = tpt_trig->blink_table[i].blink_time - off;
-+ break;
-+ }
-+ }
-+
-+ read_lock(&tpt_trig->trig.leddev_list_lock);
-+ list_for_each_entry(led_cdev, &tpt_trig->trig.led_cdevs, trig_list)
-+ led_blink_set(led_cdev, &on, &off);
-+ read_unlock(&tpt_trig->trig.leddev_list_lock);
-+}
-+
-+extern char *__ieee80211_create_tpt_led_trigger(
-+ struct ieee80211_hw *hw,
-+ const struct ieee80211_tpt_blink *blink_table,
-+ unsigned int blink_table_len)
-+{
-+ struct ieee80211_local *local = hw_to_local(hw);
-+ struct tpt_led_trigger *tpt_trig;
-+
-+ if (WARN_ON(local->tpt_led_trigger))
-+ return NULL;
-+
-+ tpt_trig = kzalloc(sizeof(struct tpt_led_trigger), GFP_KERNEL);
-+ if (!tpt_trig)
-+ return NULL;
-+
-+ snprintf(tpt_trig->name, sizeof(tpt_trig->name),
-+ "%stpt", wiphy_name(local->hw.wiphy));
-+
-+ tpt_trig->trig.name = tpt_trig->name;
-+
-+ tpt_trig->blink_table = blink_table;
-+ tpt_trig->blink_table_len = blink_table_len;
-+
-+ setup_timer(&tpt_trig->timer, tpt_trig_timer, (unsigned long)local);
-+
-+ local->tpt_led_trigger = tpt_trig;
-+
-+ return tpt_trig->name;
-+}
-+EXPORT_SYMBOL(__ieee80211_create_tpt_led_trigger);
-+
-+void ieee80211_start_tpt_led_trig(struct ieee80211_local *local)
-+{
-+ struct tpt_led_trigger *tpt_trig = local->tpt_led_trigger;
-+
-+ if (!tpt_trig)
-+ return;
-+
-+ /* reset traffic */
-+ tpt_trig_traffic(local, tpt_trig);
-+ tpt_trig->running = true;
-+
-+ mod_timer(&tpt_trig->timer, round_jiffies(jiffies + HZ));
-+}
-+
-+void ieee80211_stop_tpt_led_trig(struct ieee80211_local *local)
-+{
-+ struct tpt_led_trigger *tpt_trig = local->tpt_led_trigger;
-+ struct led_classdev *led_cdev;
-+
-+ if (!tpt_trig)
-+ return;
-+
-+ tpt_trig->running = false;
-+ del_timer_sync(&tpt_trig->timer);
-+
-+ read_lock(&tpt_trig->trig.leddev_list_lock);
-+ list_for_each_entry(led_cdev, &tpt_trig->trig.led_cdevs, trig_list)
-+ led_brightness_set(led_cdev, LED_OFF);
-+ read_unlock(&tpt_trig->trig.leddev_list_lock);
-+}
---- a/net/mac80211/led.h
-+++ b/net/mac80211/led.h
-@@ -12,15 +12,17 @@
- #include "ieee80211_i.h"
-
- #ifdef CONFIG_MAC80211_LEDS
--extern void ieee80211_led_rx(struct ieee80211_local *local);
--extern void ieee80211_led_tx(struct ieee80211_local *local, int q);
--extern void ieee80211_led_assoc(struct ieee80211_local *local,
-- bool associated);
--extern void ieee80211_led_radio(struct ieee80211_local *local,
-- bool enabled);
--extern void ieee80211_led_names(struct ieee80211_local *local);
--extern void ieee80211_led_init(struct ieee80211_local *local);
--extern void ieee80211_led_exit(struct ieee80211_local *local);
-+void ieee80211_led_rx(struct ieee80211_local *local);
-+void ieee80211_led_tx(struct ieee80211_local *local, int q);
-+void ieee80211_led_assoc(struct ieee80211_local *local,
-+ bool associated);
-+void ieee80211_led_radio(struct ieee80211_local *local,
-+ bool enabled);
-+void ieee80211_led_names(struct ieee80211_local *local);
-+void ieee80211_led_init(struct ieee80211_local *local);
-+void ieee80211_led_exit(struct ieee80211_local *local);
-+void ieee80211_start_tpt_led_trig(struct ieee80211_local *local);
-+void ieee80211_stop_tpt_led_trig(struct ieee80211_local *local);
- #else
- static inline void ieee80211_led_rx(struct ieee80211_local *local)
- {
-@@ -45,4 +47,28 @@ static inline void ieee80211_led_init(st
- static inline void ieee80211_led_exit(struct ieee80211_local *local)
- {
- }
-+static inline void ieee80211_start_tpt_led_trig(struct ieee80211_local *local)
-+{
-+}
-+static inline void ieee80211_stop_tpt_led_trig(struct ieee80211_local *local)
-+{
-+}
-+#endif
-+
-+static inline void
-+ieee80211_tpt_led_trig_tx(struct ieee80211_local *local, __le16 fc, int bytes)
-+{
-+#ifdef CONFIG_MAC80211_LEDS
-+ if (local->tpt_led_trigger && ieee80211_is_data(fc))
-+ local->tpt_led_trigger->tx_bytes += bytes;
- #endif
-+}
-+
-+static inline void
-+ieee80211_tpt_led_trig_rx(struct ieee80211_local *local, __le16 fc, int bytes)
-+{
-+#ifdef CONFIG_MAC80211_LEDS
-+ if (local->tpt_led_trigger && ieee80211_is_data(fc))
-+ local->tpt_led_trigger->rx_bytes += bytes;
-+#endif
-+}
---- a/net/mac80211/iface.c
-+++ b/net/mac80211/iface.c
-@@ -225,6 +225,7 @@ static int ieee80211_do_open(struct net_
- /* we're brought up, everything changes */
- hw_reconf_flags = ~0;
- ieee80211_led_radio(local, true);
-+ ieee80211_start_tpt_led_trig(local);
- }
-
- /*
---- a/net/mac80211/util.c
-+++ b/net/mac80211/util.c
-@@ -1141,6 +1141,7 @@ u32 ieee80211_sta_get_rates(struct ieee8
- void ieee80211_stop_device(struct ieee80211_local *local)
- {
- ieee80211_led_radio(local, false);
-+ ieee80211_stop_tpt_led_trig(local);
-
- cancel_work_sync(&local->reconfig_filter);
-
-@@ -1175,6 +1176,7 @@ int ieee80211_reconfig(struct ieee80211_
- }
-
- ieee80211_led_radio(local, true);
-+ ieee80211_start_tpt_led_trig(local);
- }
-
- /* add interfaces */
---- a/net/mac80211/rx.c
-+++ b/net/mac80211/rx.c
-@@ -2873,6 +2873,9 @@ void ieee80211_rx(struct ieee80211_hw *h
- return;
- }
-
-+ ieee80211_tpt_led_trig_rx(local,
-+ ((struct ieee80211_hdr *)skb->data)->frame_control,
-+ skb->len);
- __ieee80211_rx_handle_packet(hw, skb);
-
- rcu_read_unlock();
---- a/net/mac80211/tx.c
-+++ b/net/mac80211/tx.c
-@@ -1292,6 +1292,7 @@ static int __ieee80211_tx(struct ieee802
-
- while (skb) {
- int q = skb_get_queue_mapping(skb);
-+ __le16 fc;
-
- spin_lock_irqsave(&local->queue_stop_reason_lock, flags);
- ret = IEEE80211_TX_OK;
-@@ -1334,6 +1335,7 @@ static int __ieee80211_tx(struct ieee802
- else
- info->control.sta = NULL;
-
-+ fc = ((struct ieee80211_hdr *)skb->data)->frame_control;
- ret = drv_tx(local, skb);
- if (WARN_ON(ret != NETDEV_TX_OK && skb->len != len)) {
- dev_kfree_skb(skb);
-@@ -1344,6 +1346,7 @@ static int __ieee80211_tx(struct ieee802
- return IEEE80211_TX_AGAIN;
- }
-
-+ ieee80211_tpt_led_trig_tx(local, fc, len);
- *skbp = skb = next;
- ieee80211_led_tx(local, 1);
- fragm = true;
diff --git a/package/mac80211/patches/580-ath9k_fix_aggr_retries.patch b/package/mac80211/patches/580-ath9k_fix_aggr_retries.patch
deleted file mode 100644
index ca7d35b960..0000000000
--- a/package/mac80211/patches/580-ath9k_fix_aggr_retries.patch
+++ /dev/null
@@ -1,16 +0,0 @@
---- a/drivers/net/wireless/ath/ath9k/xmit.c
-+++ b/drivers/net/wireless/ath/ath9k/xmit.c
-@@ -250,11 +250,11 @@ static void ath_tid_drain(struct ath_sof
- static void ath_tx_set_retry(struct ath_softc *sc, struct ath_txq *txq,
- struct sk_buff *skb)
- {
-- struct ieee80211_tx_info *tx_info = IEEE80211_SKB_CB(skb);
-+ struct ath_frame_info *fi = get_frame_info(skb);
- struct ieee80211_hdr *hdr;
-
- TX_STAT_INC(txq->axq_qnum, a_retries);
-- if (tx_info->control.rates[4].count++ > 0)
-+ if (fi->retries++ > 0)
- return;
-
- hdr = (struct ieee80211_hdr *)skb->data;
diff --git a/package/mac80211/patches/590-ath9k-use-per-device-struct-for-pm_qos_-operations.patch b/package/mac80211/patches/590-ath9k-use-per-device-struct-for-pm_qos_-operations.patch
deleted file mode 100644
index 0e02ce0c57..0000000000
--- a/package/mac80211/patches/590-ath9k-use-per-device-struct-for-pm_qos_-operations.patch
+++ /dev/null
@@ -1,92 +0,0 @@
---- a/drivers/net/wireless/ath/ath9k/ath9k.h
-+++ b/drivers/net/wireless/ath/ath9k/ath9k.h
-@@ -21,6 +21,7 @@
- #include <linux/device.h>
- #include <linux/leds.h>
- #include <linux/completion.h>
-+#include <linux/pm_qos_params.h>
-
- #include "debug.h"
- #include "common.h"
-@@ -618,6 +619,8 @@ struct ath_softc {
- struct ath_descdma txsdma;
-
- struct ath_ant_comb ant_comb;
-+
-+ struct pm_qos_request_list pm_qos_req;
- };
-
- struct ath_wiphy {
-@@ -647,7 +650,6 @@ static inline void ath_read_cachesize(st
- }
-
- extern struct ieee80211_ops ath9k_ops;
--extern struct pm_qos_request_list ath9k_pm_qos_req;
- extern int modparam_nohwcrypt;
- extern int led_blink;
-
---- a/drivers/net/wireless/ath/ath9k/init.c
-+++ b/drivers/net/wireless/ath/ath9k/init.c
-@@ -15,7 +15,6 @@
- */
-
- #include <linux/slab.h>
--#include <linux/pm_qos_params.h>
- #include <linux/ath9k_platform.h>
-
- #include "ath9k.h"
-@@ -195,8 +194,6 @@ static const struct ath_ops ath9k_common
- .write = ath9k_iowrite32,
- };
-
--struct pm_qos_request_list ath9k_pm_qos_req;
--
- /**************************/
- /* Initialization */
- /**************************/
-@@ -786,7 +783,7 @@ int ath9k_init_device(u16 devid, struct
- ath_init_leds(sc);
- ath_start_rfkill_poll(sc);
-
-- pm_qos_add_request(&ath9k_pm_qos_req, PM_QOS_CPU_DMA_LATENCY,
-+ pm_qos_add_request(&sc->pm_qos_req, PM_QOS_CPU_DMA_LATENCY,
- PM_QOS_DEFAULT_VALUE);
-
- return 0;
-@@ -857,7 +854,7 @@ void ath9k_deinit_device(struct ath_soft
- }
-
- ieee80211_unregister_hw(hw);
-- pm_qos_remove_request(&ath9k_pm_qos_req);
-+ pm_qos_remove_request(&sc->pm_qos_req);
- ath_rx_cleanup(sc);
- ath_tx_cleanup(sc);
- ath9k_deinit_softc(sc);
---- a/drivers/net/wireless/ath/ath9k/main.c
-+++ b/drivers/net/wireless/ath/ath9k/main.c
-@@ -15,7 +15,6 @@
- */
-
- #include <linux/nl80211.h>
--#include <linux/pm_qos_params.h>
- #include "ath9k.h"
- #include "btcoex.h"
-
-@@ -1184,7 +1183,7 @@ static int ath9k_start(struct ieee80211_
- ath9k_btcoex_timer_resume(sc);
- }
-
-- pm_qos_update_request(&ath9k_pm_qos_req, 55);
-+ pm_qos_update_request(&sc->pm_qos_req, 55);
-
- mutex_unlock:
- mutex_unlock(&sc->mutex);
-@@ -1336,7 +1335,7 @@ static void ath9k_stop(struct ieee80211_
-
- sc->sc_flags |= SC_OP_INVALID;
-
-- pm_qos_update_request(&ath9k_pm_qos_req, PM_QOS_DEFAULT_VALUE);
-+ pm_qos_update_request(&sc->pm_qos_req, PM_QOS_DEFAULT_VALUE);
-
- mutex_unlock(&sc->mutex);
-