PKG_NAME:=mac80211
-PKG_VERSION:=2010-07-29
+PKG_VERSION:=2010-08-31
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:=fcfb757939c4718efbf9c87ca59c6932
+PKG_MD5SUM:=5d720b6d8de97ae61a4c3e4ee10a6de1
PKG_SOURCE:=compat-wireless-$(PKG_VERSION).tar.bz2
PKG_BUILD_DIR:=$(KERNEL_BUILD_DIR)/compat-wireless-$(PKG_VERSION)
--- /dev/null
+--- a/config.mk
++++ b/config.mk
+@@ -502,7 +502,7 @@ CONFIG_ATH6KL_ENABLE_TARGET_DEBUG_PRINTS
+ # CONFIG_ATH6KL_SKIP_ABI_VERSION_CHECK is not set
+ CONFIG_ATH6KL_VIRTUAL_SCATTER_GATHER=y
+ CONFIG_ATH6K_LEGACY=m
+-endif
++endif #CONFIG_COMPAT_KERNEL_32
+ endif
+
+
--- a/config.mk
+++ b/config.mk
-@@ -268,8 +268,8 @@ endif
+@@ -292,8 +292,8 @@ endif
CONFIG_P54_PCI=m
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")
-@@ -495,8 +495,8 @@ endif
+@@ -557,8 +557,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
+# CONFIG_RFKILL_BACKPORT=m
+# CONFIG_RFKILL_BACKPORT_LEDS=y
+# CONFIG_RFKILL_BACKPORT_INPUT=y
- endif
+ endif #CONFIG_COMPAT_KERNEL_31
+# CONFIG_COMPAT_BLUETOOTH=y
+# CONFIG_COMPAT_BLUETOOTH_MODULES=m
endif
- endif # Kernel >= 2.6.26
+ endif #CONFIG_COMPAT_KERNEL_27
else
include $(KLIB_BUILD)/.config
endif
-@@ -251,21 +250,6 @@ CONFIG_IPW2200_QOS=y
+@@ -275,21 +274,6 @@ CONFIG_IPW2200_QOS=y
#
# % echo 1 > /sys/bus/pci/drivers/ipw2200/*/rtap_iface
CONFIG_P54_PCI=m
# CONFIG_B44=m
-@@ -429,7 +413,6 @@ endif # end of SPI driver list
+@@ -463,7 +447,6 @@ endif # end of SPI driver list
ifneq ($(CONFIG_MMC),)
-CONFIG_SSB_SDIOHOST=y
CONFIG_B43_SDIO=y
- CONFIG_WL1251_SDIO=m
+ ifneq ($(CONFIG_CRC7),)
--- a/config.mk
+++ b/config.mk
-@@ -282,13 +282,13 @@ endif
+@@ -196,7 +196,7 @@ ifneq ($(CONFIG_WIRELESS_EXT),)
+ endif
+
+ ifneq ($(CONFIG_STAGING),)
+-CONFIG_COMPAT_STAGING=m
++# CONFIG_COMPAT_STAGING=m
+ endif
+
+ # mac80211 test driver
+@@ -306,13 +306,13 @@ endif
CONFIG_MWL8K=m
# Ethernet drivers go here
ifdef CONFIG_COMPAT_KERNEL_27
-CONFIG_ATL1C=n
+# CONFIG_ATL1C=n
- else
+ else #CONFIG_COMPAT_KERNEL_27
-CONFIG_ATL1C=m
+# CONFIG_ATL1C=m
- endif
+ endif #CONFIG_COMPAT_KERNEL_27
CONFIG_HERMES=m
-@@ -342,10 +342,10 @@ CONFIG_USB_NET_COMPAT_RNDIS_HOST=n
- CONFIG_USB_NET_COMPAT_RNDIS_WLAN=n
- CONFIG_USB_NET_COMPAT_CDCETHER=n
- else
+@@ -361,17 +361,17 @@ 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
+-CONFIG_USB_COMPAT_USBNET=n
+-CONFIG_USB_NET_COMPAT_RNDIS_HOST=n
+-CONFIG_USB_NET_COMPAT_RNDIS_WLAN=n
+-CONFIG_USB_NET_COMPAT_CDCETHER=n
++# CONFIG_USB_COMPAT_USBNET=n
++# CONFIG_USB_NET_COMPAT_RNDIS_HOST=n
++# CONFIG_USB_NET_COMPAT_RNDIS_WLAN=n
++# CONFIG_USB_NET_COMPAT_CDCETHER=n
+ else #CONFIG_COMPAT_KERNEL_29
-CONFIG_USB_COMPAT_USBNET=m
++# CONFIG_USB_COMPAT_USBNET=m
+ ifdef CONFIG_USB_NET_CDCETHER
-CONFIG_USB_NET_COMPAT_RNDIS_HOST=m
-CONFIG_USB_NET_COMPAT_RNDIS_WLAN=m
--CONFIG_USB_NET_COMPAT_CDCETHER=m
-+# CONFIG_USB_COMPAT_USBNET=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
+ endif #CONFIG_COMPAT_KERNEL_29
+@@ -474,17 +474,17 @@ CONFIG_BT_MRVL_SDIO=m
+
+ ifneq ($(CONFIG_COMPAT_STAGING),)
+ ifdef CONFIG_COMPAT_KERNEL_32
+-CONFIG_ATH6KL_CFG80211=y
+-CONFIG_ATH6KL_DEBUG=y
++# CONFIG_ATH6KL_CFG80211=y
++# CONFIG_ATH6KL_DEBUG=y
+ # CONFIG_ATH6KL_DISABLE_TARGET_DBGLOGS is not set
+ # CONFIG_ATH6KL_ENABLE_COEXISTENCE is not set
+ # CONFIG_ATH6KL_ENABLE_HOST_DEBUG is not set
+-CONFIG_ATH6KL_ENABLE_TARGET_DEBUG_PRINTS=y
++# CONFIG_ATH6KL_ENABLE_TARGET_DEBUG_PRINTS=y
+ # CONFIG_ATH6KL_HCI_BRIDGE is not set
+ # CONFIG_ATH6KL_HTC_RAW_INTERFACE is not set
+ # CONFIG_ATH6KL_SKIP_ABI_VERSION_CHECK is not set
+-CONFIG_ATH6KL_VIRTUAL_SCATTER_GATHER=y
+-CONFIG_ATH6K_LEGACY=m
++# CONFIG_ATH6KL_VIRTUAL_SCATTER_GATHER=y
++# CONFIG_ATH6K_LEGACY=m
+ endif #CONFIG_COMPAT_KERNEL_32
+ endif
+
else
include $(KLIB_BUILD)/.config
endif
-@@ -192,7 +192,7 @@ CONFIG_B43=m
+@@ -216,7 +216,7 @@ CONFIG_B43=m
CONFIG_B43_HWRNG=y
CONFIG_B43_PCI_AUTOSELECT=y
ifneq ($(CONFIG_PCMCIA),)
--- a/config.mk
+++ b/config.mk
-@@ -398,7 +398,7 @@ endif # end of SPI driver list
+@@ -432,7 +432,7 @@ endif # end of SPI driver list
ifneq ($(CONFIG_MMC),)
-CONFIG_B43_SDIO=y
+# CONFIG_B43_SDIO=y
- CONFIG_WL1251_SDIO=m
- ifndef CONFIG_COMPAT_KERNEL_32
+ ifneq ($(CONFIG_CRC7),)
+ CONFIG_WL1251_SDIO=m
--- a/config.mk
+++ b/config.mk
-@@ -196,7 +196,7 @@ ifneq ($(CONFIG_PCMCIA),)
+@@ -220,7 +220,7 @@ ifneq ($(CONFIG_PCMCIA),)
endif
CONFIG_B43_LEDS=y
CONFIG_B43_PHY_LP=y
--- a/config.mk
+++ b/config.mk
-@@ -244,12 +244,12 @@ CONFIG_RTL8180=m
+@@ -268,12 +268,12 @@ CONFIG_RTL8180=m
CONFIG_ADM8211=m
# CONFIG_RT2800PCI_RT30XX=y
# CONFIG_RT2800PCI_RT35XX=y
# CONFIG_RT2800PCI_SOC=y
-@@ -355,7 +355,7 @@ CONFIG_RT2800USB_RT30XX=y
+@@ -382,7 +382,7 @@ CONFIG_RT2800USB_RT30XX=y
CONFIG_RT2800USB_RT35XX=y
CONFIG_RT2800USB_UNKNOWN=y
endif
--- a/include/linux/compat-2.6.36.h
+++ b/include/linux/compat-2.6.36.h
-@@ -8,6 +8,8 @@
- #define kparam_block_sysfs_write(a)
- #define kparam_unblock_sysfs_write(a)
+@@ -15,6 +15,8 @@ struct va_format {
+
+ #define device_rename(dev, new_name) device_rename(dev, (char *)new_name)
+#define PCI_EEPROM_WIDTH_93C86 8
+
--- a/compat/compat-2.6.28.c
+++ b/compat/compat-2.6.28.c
-@@ -87,7 +87,7 @@ EXPORT_SYMBOL_GPL(usb_poison_urb);
+@@ -89,7 +89,7 @@ EXPORT_SYMBOL_GPL(usb_poison_urb);
#endif
#endif /* CONFIG_USB */
--- a/compat/compat-2.6.28.c
+++ b/compat/compat-2.6.28.c
-@@ -166,7 +166,7 @@ EXPORT_SYMBOL(pcmcia_loop_config);
+@@ -168,7 +168,7 @@ EXPORT_SYMBOL(pcmcia_loop_config);
#endif /* CONFIG_PCMCIA */
{
--- a/compat/compat-2.6.29.c
+++ b/compat/compat-2.6.29.c
-@@ -51,7 +51,7 @@ void netdev_attach_ops(struct net_device
+@@ -52,7 +52,7 @@ void netdev_attach_ops(struct net_device
EXPORT_SYMBOL(netdev_attach_ops);
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,23))
+++ /dev/null
---- a/drivers/net/wireless/ipw2x00/ipw2100.c
-+++ b/drivers/net/wireless/ipw2x00/ipw2100.c
-@@ -174,7 +174,9 @@ that only one external action is invoked
- #define DRV_DESCRIPTION "Intel(R) PRO/Wireless 2100 Network Driver"
- #define DRV_COPYRIGHT "Copyright(c) 2003-2006 Intel Corporation"
-
-+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,35))
- static struct pm_qos_request_list *ipw2100_pm_qos_req;
-+#endif
-
- /* Debugging stuff */
- #ifdef CONFIG_IPW2100_DEBUG
-@@ -1741,7 +1743,11 @@ static int ipw2100_up(struct ipw2100_pri
- /* the ipw2100 hardware really doesn't want power management delays
- * longer than 175usec
- */
-+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,35))
- pm_qos_update_request(ipw2100_pm_qos_req, 175);
-+#else
-+ pm_qos_update_requirement(PM_QOS_CPU_DMA_LATENCY, "ipw2100", 175);
-+#endif
-
- /* If the interrupt is enabled, turn it off... */
- spin_lock_irqsave(&priv->low_lock, flags);
-@@ -1889,7 +1895,12 @@ static void ipw2100_down(struct ipw2100_
- ipw2100_disable_interrupts(priv);
- spin_unlock_irqrestore(&priv->low_lock, flags);
-
-+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,35))
- pm_qos_update_request(ipw2100_pm_qos_req, PM_QOS_DEFAULT_VALUE);
-+#else
-+ pm_qos_update_requirement(PM_QOS_CPU_DMA_LATENCY, "ipw2100",
-+ PM_QOS_DEFAULT_VALUE);
-+#endif
-
- /* We have to signal any supplicant if we are disassociating */
- if (associated)
-@@ -6669,7 +6680,11 @@ static int __init ipw2100_init(void)
- if (ret)
- goto out;
-
-+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,35))
- ipw2100_pm_qos_req = pm_qos_add_request(PM_QOS_CPU_DMA_LATENCY,
-+#else
-+ pm_qos_add_requirement(PM_QOS_CPU_DMA_LATENCY, "ipw2100",
-+#endif
- PM_QOS_DEFAULT_VALUE);
- #ifdef CONFIG_IPW2100_DEBUG
- ipw2100_debug_level = debug;
-@@ -6692,7 +6707,11 @@ static void __exit ipw2100_exit(void)
- &driver_attr_debug_level);
- #endif
- pci_unregister_driver(&ipw2100_pci_driver);
-+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,35))
- pm_qos_remove_request(ipw2100_pm_qos_req);
-+#else
-+ pm_qos_remove_requirement(PM_QOS_CPU_DMA_LATENCY, "ipw2100");
-+#endif
- }
-
- module_init(ipw2100_init);
--- a/include/net/cfg80211.h
+++ b/include/net/cfg80211.h
-@@ -2443,9 +2443,8 @@ void cfg80211_cqm_rssi_notify(struct net
+@@ -2574,9 +2574,8 @@ void cfg80211_cqm_rssi_notify(struct net
wiphy_printk(KERN_NOTICE, wiphy, format, ##args)
#define wiphy_info(wiphy, format, args...) \
wiphy_printk(KERN_INFO, wiphy, format, ##args)
#define wiphy_dbg(wiphy, format, args...) \
--- a/net/wireless/core.c
+++ b/net/wireless/core.c
-@@ -921,52 +921,3 @@ static void __exit cfg80211_exit(void)
+@@ -929,52 +929,3 @@ static void __exit cfg80211_exit(void)
destroy_workqueue(cfg80211_wq);
}
module_exit(cfg80211_exit);
+#endif
--- a/drivers/net/wireless/ath/regd.h
+++ b/drivers/net/wireless/ath/regd.h
-@@ -250,6 +250,41 @@ enum CountryCode {
+@@ -249,6 +249,41 @@ enum CountryCode {
CTRY_BELGIUM2 = 5002
};
bool ath_is_world_regd(struct ath_regulatory *reg);
int ath_regd_init(struct ath_regulatory *reg, struct wiphy *wiphy,
int (*reg_notifier)(struct wiphy *wiphy,
-@@ -261,3 +296,5 @@ int ath_reg_notifier_apply(struct wiphy
+@@ -260,3 +295,5 @@ int ath_reg_notifier_apply(struct wiphy
struct ath_regulatory *reg);
#endif
--- a/drivers/net/wireless/ath/ath9k/hw.c
+++ b/drivers/net/wireless/ath/ath9k/hw.c
-@@ -1418,7 +1418,7 @@ int ath9k_hw_reset(struct ath_hw *ah, st
+@@ -1425,7 +1425,7 @@ int ath9k_hw_reset(struct ath_hw *ah, st
if (ah->config.rx_intr_mitigation) {
REG_RMW_FIELD(ah, AR_RIMT, AR_RIMT_LAST, 500);
ath9k_reg_notifier);
--- a/drivers/net/wireless/ath/ath9k/ath9k.h
+++ b/drivers/net/wireless/ath/ath9k/ath9k.h
-@@ -596,6 +596,8 @@ struct ath_softc {
+@@ -589,6 +589,8 @@ struct ath_softc {
int beacon_interval;
sc->sc_ah->led_pin = ATH_LED_PIN_DEF;
--- a/drivers/net/wireless/ath/ath9k/ath9k.h
+++ b/drivers/net/wireless/ath/ath9k/ath9k.h
-@@ -467,6 +467,7 @@ void ath9k_btcoex_timer_pause(struct ath
+@@ -460,6 +460,7 @@ void ath9k_btcoex_timer_pause(struct ath
#define ATH_LED_PIN_DEF 1
#define ATH_LED_PIN_9287 8
-diff -Nur a/include/linux/ath5k_platform.h b/include/linux/ath5k_platform.h
---- a/include/linux/ath5k_platform.h 1970-01-01 01:00:00.000000000 +0100
-+++ b/include/linux/ath5k_platform.h 2010-06-21 00:19:52.000000000 +0200
+--- /dev/null
++++ b/include/linux/ath5k_platform.h
@@ -0,0 +1,30 @@
+/*
+ * Copyright (c) 2008 Atheros Communications Inc.
+};
+
+#endif /* _LINUX_ATH5K_PLATFORM_H */
-
---- a/drivers/net/wireless/ath/ath5k/eeprom.c 2010-06-23 03:08:32.000000000 +0200
-+++ b/drivers/net/wireless/ath/ath5k/eeprom.c 2010-06-23 05:59:30.000000000 +0200
-@@ -22,6 +23,8 @@
+--- a/drivers/net/wireless/ath/ath5k/eeprom.c
++++ b/drivers/net/wireless/ath/ath5k/eeprom.c
+@@ -22,6 +22,8 @@
\*************************************/
#include <linux/slab.h>
#include "ath5k.h"
#include "reg.h"
-@@ -34,6 +37,18 @@
+@@ -34,6 +36,18 @@
static int ath5k_hw_eeprom_read(struct ath5k_hw *ah, u32 offset, u16 *data)
{
u32 status, timeout;
/*
* Initialize EEPROM access
-@@ -1788,7 +1802,7 @@
+@@ -1788,7 +1802,7 @@ ath5k_eeprom_init(struct ath5k_hw *ah)
}
/*
*/
int ath5k_eeprom_read_mac(struct ath5k_hw *ah, u8 *mac)
{
-@@ -1796,6 +1810,16 @@
+@@ -1796,6 +1810,16 @@ int ath5k_eeprom_read_mac(struct ath5k_h
u32 total, offset;
u16 data;
int octet, ret;
ret = ath5k_hw_eeprom_read(ah, 0x20, &data);
if (ret)
-
--- a/drivers/net/wireless/ath/ath9k/mac.c
+++ b/drivers/net/wireless/ath/ath9k/mac.c
-@@ -713,6 +713,8 @@ int ath9k_hw_rxprocdesc(struct ath_hw *a
- rs->rs_status |= ATH9K_RXERR_DECRYPT;
- else if (ads.ds_rxstatus8 & AR_MichaelErr)
+@@ -714,6 +714,8 @@ int ath9k_hw_rxprocdesc(struct ath_hw *a
+ else if ((ads.ds_rxstatus8 & AR_MichaelErr) &&
+ rs->rs_keyix != ATH9K_RXKEYIX_INVALID)
rs->rs_status |= ATH9K_RXERR_MIC;
+ else if (ads.ds_rxstatus8 & AR_KeyMiss)
+ rs->rs_status |= ATH9K_RXERR_DECRYPT;
--- /dev/null
+--- a/drivers/net/wireless/ath/ath9k/ath9k.h
++++ b/drivers/net/wireless/ath/ath9k/ath9k.h
+@@ -254,7 +254,7 @@ struct ath_atx_tid {
+ struct list_head buf_q;
+ struct ath_node *an;
+ struct ath_atx_ac *ac;
+- struct ath_buf *tx_buf[ATH_TID_MAX_BUFS];
++ unsigned long tx_buf[BITS_TO_LONGS(ATH_TID_MAX_BUFS)];
+ u16 seq_start;
+ u16 seq_next;
+ u16 baw_size;
+--- a/drivers/net/wireless/ath/ath9k/xmit.c
++++ b/drivers/net/wireless/ath/ath9k/xmit.c
+@@ -168,9 +168,9 @@ static void ath_tx_update_baw(struct ath
+ index = ATH_BA_INDEX(tid->seq_start, seqno);
+ cindex = (tid->baw_head + index) & (ATH_TID_MAX_BUFS - 1);
+
+- tid->tx_buf[cindex] = NULL;
++ __clear_bit(cindex, tid->tx_buf);
+
+- while (tid->baw_head != tid->baw_tail && !tid->tx_buf[tid->baw_head]) {
++ while (tid->baw_head != tid->baw_tail && !test_bit(tid->baw_head, tid->tx_buf)) {
+ INCR(tid->seq_start, IEEE80211_SEQ_MAX);
+ INCR(tid->baw_head, ATH_TID_MAX_BUFS);
+ }
+@@ -186,9 +186,7 @@ static void ath_tx_addto_baw(struct ath_
+
+ index = ATH_BA_INDEX(tid->seq_start, bf->bf_seqno);
+ cindex = (tid->baw_head + index) & (ATH_TID_MAX_BUFS - 1);
+-
+- BUG_ON(tid->tx_buf[cindex] != NULL);
+- tid->tx_buf[cindex] = bf;
++ __set_bit(cindex, tid->tx_buf);
+
+ if (index >= ((tid->baw_tail - tid->baw_head) &
+ (ATH_TID_MAX_BUFS - 1))) {
+++ /dev/null
---- a/net/mac80211/main.c
-+++ b/net/mac80211/main.c
-@@ -103,11 +103,13 @@ int ieee80211_hw_config(struct ieee80211
- int ret = 0;
- int power;
- enum nl80211_channel_type channel_type;
-+ u32 offchannel_flag;
-
- might_sleep();
-
- scan_chan = local->scan_channel;
-
-+ offchannel_flag = local->hw.conf.flags & IEEE80211_CONF_OFFCHANNEL;
- if (scan_chan) {
- chan = scan_chan;
- channel_type = NL80211_CHAN_NO_HT;
-@@ -121,8 +123,9 @@ int ieee80211_hw_config(struct ieee80211
- channel_type = local->_oper_channel_type;
- local->hw.conf.flags &= ~IEEE80211_CONF_OFFCHANNEL;
- }
-+ offchannel_flag ^= local->hw.conf.flags & IEEE80211_CONF_OFFCHANNEL;
-
-- if (chan != local->hw.conf.channel ||
-+ if (offchannel_flag || chan != local->hw.conf.channel ||
- channel_type != local->hw.conf.channel_type) {
- local->hw.conf.channel = chan;
- local->hw.conf.channel_type = channel_type;
---- a/drivers/net/wireless/ath/ath9k/ar9002_calib.c
-+++ b/drivers/net/wireless/ath/ath9k/ar9002_calib.c
-@@ -63,6 +63,7 @@ static bool ar9002_hw_per_calibration(st
- u8 rxchainmask,
- struct ath9k_cal_list *currCal)
- {
-+ struct ath9k_hw_cal_data *caldata = ah->caldata;
- bool iscaldone = false;
-
- if (currCal->calState == CAL_RUNNING) {
-@@ -81,14 +82,14 @@ static bool ar9002_hw_per_calibration(st
- }
-
- currCal->calData->calPostProc(ah, numChains);
-- ichan->CalValid |= currCal->calData->calType;
-+ caldata->CalValid |= currCal->calData->calType;
- currCal->calState = CAL_DONE;
- iscaldone = true;
- } else {
- ar9002_hw_setup_calibration(ah, currCal);
- }
- }
-- } else if (!(ichan->CalValid & currCal->calData->calType)) {
-+ } else if (!(caldata->CalValid & currCal->calData->calType)) {
- ath9k_hw_reset_calibration(ah, currCal);
- }
-
-@@ -686,8 +687,13 @@ static bool ar9002_hw_calibrate(struct a
- {
- bool iscaldone = true;
- struct ath9k_cal_list *currCal = ah->cal_list_curr;
-+ bool nfcal, nfcal_pending = false;
-
-- if (currCal &&
-+ nfcal = !!(REG_READ(ah, AR_PHY_AGC_CONTROL) & AR_PHY_AGC_CONTROL_NF);
-+ if (ah->caldata)
-+ nfcal_pending = ah->caldata->nfcal_pending;
-+
-+ if (currCal && !nfcal &&
- (currCal->calState == CAL_RUNNING ||
- currCal->calState == CAL_WAITING)) {
- iscaldone = ar9002_hw_per_calibration(ah, chan,
-@@ -703,7 +709,7 @@ static bool ar9002_hw_calibrate(struct a
- }
-
- /* Do NF cal only at longer intervals */
-- if (longcal) {
-+ if (longcal || nfcal_pending) {
- /* Do periodic PAOffset Cal */
- ar9002_hw_pa_cal(ah, false);
- ar9002_hw_olc_temp_compensation(ah);
-@@ -712,16 +718,18 @@ static bool ar9002_hw_calibrate(struct a
- * Get the value from the previous NF cal and update
- * history buffer.
- */
-- ath9k_hw_getnf(ah, chan);
--
-- /*
-- * Load the NF from history buffer of the current channel.
-- * NF is slow time-variant, so it is OK to use a historical
-- * value.
-- */
-- ath9k_hw_loadnf(ah, ah->curchan);
-+ if (ath9k_hw_getnf(ah, chan)) {
-+ /*
-+ * Load the NF from history buffer of the current
-+ * channel.
-+ * NF is slow time-variant, so it is OK to use a
-+ * historical value.
-+ */
-+ ath9k_hw_loadnf(ah, ah->curchan);
-+ }
-
-- ath9k_hw_start_nfcal(ah);
-+ if (longcal)
-+ ath9k_hw_start_nfcal(ah, false);
- }
-
- return iscaldone;
-@@ -869,8 +877,10 @@ static bool ar9002_hw_init_cal(struct at
- ar9002_hw_pa_cal(ah, true);
-
- /* Do NF Calibration after DC offset and other calibrations */
-- REG_WRITE(ah, AR_PHY_AGC_CONTROL,
-- REG_READ(ah, AR_PHY_AGC_CONTROL) | AR_PHY_AGC_CONTROL_NF);
-+ ath9k_hw_start_nfcal(ah, true);
-+
-+ if (ah->caldata)
-+ ah->caldata->nfcal_pending = true;
-
- ah->cal_list = ah->cal_list_last = ah->cal_list_curr = NULL;
-
-@@ -901,7 +911,8 @@ static bool ar9002_hw_init_cal(struct at
- ath9k_hw_reset_calibration(ah, ah->cal_list_curr);
- }
-
-- chan->CalValid = 0;
-+ if (ah->caldata)
-+ ah->caldata->CalValid = 0;
-
- return true;
- }
---- a/drivers/net/wireless/ath/ath9k/ar9003_calib.c
-+++ b/drivers/net/wireless/ath/ath9k/ar9003_calib.c
-@@ -68,6 +68,7 @@ static bool ar9003_hw_per_calibration(st
- u8 rxchainmask,
- struct ath9k_cal_list *currCal)
- {
-+ struct ath9k_hw_cal_data *caldata = ah->caldata;
- /* Cal is assumed not done until explicitly set below */
- bool iscaldone = false;
-
-@@ -95,7 +96,7 @@ static bool ar9003_hw_per_calibration(st
- currCal->calData->calPostProc(ah, numChains);
-
- /* Calibration has finished. */
-- ichan->CalValid |= currCal->calData->calType;
-+ caldata->CalValid |= currCal->calData->calType;
- currCal->calState = CAL_DONE;
- iscaldone = true;
- } else {
-@@ -106,7 +107,7 @@ static bool ar9003_hw_per_calibration(st
- ar9003_hw_setup_calibration(ah, currCal);
- }
- }
-- } else if (!(ichan->CalValid & currCal->calData->calType)) {
-+ } else if (!(caldata->CalValid & currCal->calData->calType)) {
- /* If current cal is marked invalid in channel, kick it off */
- ath9k_hw_reset_calibration(ah, currCal);
- }
-@@ -149,6 +150,12 @@ static bool ar9003_hw_calibrate(struct a
- /* Do NF cal only at longer intervals */
- if (longcal) {
- /*
-+ * Get the value from the previous NF cal and update
-+ * history buffer.
-+ */
-+ ath9k_hw_getnf(ah, chan);
-+
-+ /*
- * Load the NF from history buffer of the current channel.
- * NF is slow time-variant, so it is OK to use a historical
- * value.
-@@ -156,7 +163,7 @@ static bool ar9003_hw_calibrate(struct a
- ath9k_hw_loadnf(ah, ah->curchan);
-
- /* start NF calibration, without updating BB NF register */
-- ath9k_hw_start_nfcal(ah);
-+ ath9k_hw_start_nfcal(ah, false);
- }
-
- return iscaldone;
-@@ -762,6 +769,8 @@ static bool ar9003_hw_init_cal(struct at
- /* Revert chainmasks to their original values before NF cal */
- ar9003_hw_set_chain_masks(ah, ah->rxchainmask, ah->txchainmask);
-
-+ ath9k_hw_start_nfcal(ah, true);
-+
- /* Initialize list pointers */
- ah->cal_list = ah->cal_list_last = ah->cal_list_curr = NULL;
-
-@@ -785,7 +794,8 @@ static bool ar9003_hw_init_cal(struct at
- if (ah->cal_list_curr)
- ath9k_hw_reset_calibration(ah, ah->cal_list_curr);
-
-- chan->CalValid = 0;
-+ if (ah->caldata)
-+ ah->caldata->CalValid = 0;
-
- return true;
- }
---- a/drivers/net/wireless/ath/ath9k/ar9003_phy.c
-+++ b/drivers/net/wireless/ath/ath9k/ar9003_phy.c
-@@ -542,7 +542,11 @@ static void ar9003_hw_prog_ini(struct at
- u32 reg = INI_RA(iniArr, i, 0);
- u32 val = INI_RA(iniArr, i, column);
-
-- REG_WRITE(ah, reg, val);
-+ if (reg >= 0x16000 && reg < 0x17000)
-+ ath9k_hw_analog_shift_regwrite(ah, reg, val);
-+ else
-+ REG_WRITE(ah, reg, val);
-+
- DO_DELAY(regWrites);
- }
- }
---- a/drivers/net/wireless/ath/ath9k/calib.c
-+++ b/drivers/net/wireless/ath/ath9k/calib.c
-@@ -22,23 +22,6 @@
- /* We can tune this as we go by monitoring really low values */
- #define ATH9K_NF_TOO_LOW -60
-
--/* AR5416 may return very high value (like -31 dBm), in those cases the nf
-- * is incorrect and we should use the static NF value. Later we can try to
-- * find out why they are reporting these values */
--
--static bool ath9k_hw_nf_in_range(struct ath_hw *ah, s16 nf)
--{
-- if (nf > ATH9K_NF_TOO_LOW) {
-- ath_print(ath9k_hw_common(ah), ATH_DBG_CALIBRATE,
-- "noise floor value detected (%d) is "
-- "lower than what we think is a "
-- "reasonable value (%d)\n",
-- nf, ATH9K_NF_TOO_LOW);
-- return false;
-- }
-- return true;
--}
--
- static int16_t ath9k_hw_get_nf_hist_mid(int16_t *nfCalBuffer)
- {
- int16_t nfval;
-@@ -121,6 +104,19 @@ void ath9k_hw_reset_calibration(struct a
- ah->cal_samples = 0;
- }
-
-+static s16 ath9k_hw_get_default_nf(struct ath_hw *ah,
-+ struct ath9k_channel *chan)
-+{
-+ struct ath_nf_limits *limit;
-+
-+ if (!chan || IS_CHAN_2GHZ(chan))
-+ limit = &ah->nf_2g;
-+ else
-+ limit = &ah->nf_5g;
-+
-+ return limit->nominal;
-+}
-+
- /* This is done for the currently configured channel */
- bool ath9k_hw_reset_calvalid(struct ath_hw *ah)
- {
-@@ -128,7 +124,7 @@ bool ath9k_hw_reset_calvalid(struct ath_
- struct ieee80211_conf *conf = &common->hw->conf;
- struct ath9k_cal_list *currCal = ah->cal_list_curr;
-
-- if (!ah->curchan)
-+ if (!ah->caldata)
- return true;
-
- if (!AR_SREV_9100(ah) && !AR_SREV_9160_10_OR_LATER(ah))
-@@ -151,37 +147,55 @@ bool ath9k_hw_reset_calvalid(struct ath_
- "Resetting Cal %d state for channel %u\n",
- currCal->calData->calType, conf->channel->center_freq);
-
-- ah->curchan->CalValid &= ~currCal->calData->calType;
-+ ah->caldata->CalValid &= ~currCal->calData->calType;
- currCal->calState = CAL_WAITING;
-
- return false;
- }
- EXPORT_SYMBOL(ath9k_hw_reset_calvalid);
-
--void ath9k_hw_start_nfcal(struct ath_hw *ah)
-+void ath9k_hw_start_nfcal(struct ath_hw *ah, bool update)
- {
-+ if (ah->caldata)
-+ ah->caldata->nfcal_pending = true;
-+
- REG_SET_BIT(ah, AR_PHY_AGC_CONTROL,
- AR_PHY_AGC_CONTROL_ENABLE_NF);
-- REG_SET_BIT(ah, AR_PHY_AGC_CONTROL,
-+
-+ if (update)
-+ REG_CLR_BIT(ah, AR_PHY_AGC_CONTROL,
-+ AR_PHY_AGC_CONTROL_NO_UPDATE_NF);
-+ else
-+ REG_SET_BIT(ah, AR_PHY_AGC_CONTROL,
- AR_PHY_AGC_CONTROL_NO_UPDATE_NF);
-+
- REG_SET_BIT(ah, AR_PHY_AGC_CONTROL, AR_PHY_AGC_CONTROL_NF);
- }
-
- void ath9k_hw_loadnf(struct ath_hw *ah, struct ath9k_channel *chan)
- {
-- struct ath9k_nfcal_hist *h;
-+ struct ath9k_nfcal_hist *h = NULL;
- unsigned i, j;
- int32_t val;
- u8 chainmask = (ah->rxchainmask << 3) | ah->rxchainmask;
- struct ath_common *common = ath9k_hw_common(ah);
-+ s16 default_nf = ath9k_hw_get_default_nf(ah, chan);
-
-- h = ah->nfCalHist;
-+ if (ah->caldata)
-+ h = ah->caldata->nfCalHist;
-
- for (i = 0; i < NUM_NF_READINGS; i++) {
- if (chainmask & (1 << i)) {
-+ s16 nfval;
-+
-+ if (h)
-+ nfval = h[i].privNF;
-+ else
-+ nfval = default_nf;
-+
- val = REG_READ(ah, ah->nf_regs[i]);
- val &= 0xFFFFFE00;
-- val |= (((u32) (h[i].privNF) << 1) & 0x1ff);
-+ val |= (((u32) nfval << 1) & 0x1ff);
- REG_WRITE(ah, ah->nf_regs[i], val);
- }
- }
-@@ -277,22 +291,25 @@ static void ath9k_hw_nf_sanitize(struct
- }
- }
-
--int16_t ath9k_hw_getnf(struct ath_hw *ah,
-- struct ath9k_channel *chan)
-+bool ath9k_hw_getnf(struct ath_hw *ah, struct ath9k_channel *chan)
- {
- struct ath_common *common = ath9k_hw_common(ah);
- int16_t nf, nfThresh;
- int16_t nfarray[NUM_NF_READINGS] = { 0 };
- struct ath9k_nfcal_hist *h;
- struct ieee80211_channel *c = chan->chan;
-+ struct ath9k_hw_cal_data *caldata = ah->caldata;
-+
-+ if (!caldata)
-+ return false;
-
- chan->channelFlags &= (~CHANNEL_CW_INT);
- if (REG_READ(ah, AR_PHY_AGC_CONTROL) & AR_PHY_AGC_CONTROL_NF) {
- ath_print(common, ATH_DBG_CALIBRATE,
- "NF did not complete in calibration window\n");
- nf = 0;
-- chan->rawNoiseFloor = nf;
-- return chan->rawNoiseFloor;
-+ caldata->rawNoiseFloor = nf;
-+ return false;
- } else {
- ath9k_hw_do_getnf(ah, nfarray);
- ath9k_hw_nf_sanitize(ah, nfarray);
-@@ -307,47 +324,40 @@ int16_t ath9k_hw_getnf(struct ath_hw *ah
- }
- }
-
-- h = ah->nfCalHist;
--
-+ h = caldata->nfCalHist;
-+ caldata->nfcal_pending = false;
- ath9k_hw_update_nfcal_hist_buffer(h, nfarray);
-- chan->rawNoiseFloor = h[0].privNF;
--
-- return chan->rawNoiseFloor;
-+ caldata->rawNoiseFloor = h[0].privNF;
-+ return true;
- }
-
--void ath9k_init_nfcal_hist_buffer(struct ath_hw *ah)
-+void ath9k_init_nfcal_hist_buffer(struct ath_hw *ah,
-+ struct ath9k_channel *chan)
- {
-- struct ath_nf_limits *limit;
-+ struct ath9k_nfcal_hist *h;
-+ s16 default_nf;
- int i, j;
-
-- if (!ah->curchan || IS_CHAN_2GHZ(ah->curchan))
-- limit = &ah->nf_2g;
-- else
-- limit = &ah->nf_5g;
-+ if (!ah->caldata)
-+ return;
-
-+ h = ah->caldata->nfCalHist;
-+ default_nf = ath9k_hw_get_default_nf(ah, chan);
- for (i = 0; i < NUM_NF_READINGS; i++) {
-- ah->nfCalHist[i].currIndex = 0;
-- ah->nfCalHist[i].privNF = limit->nominal;
-- ah->nfCalHist[i].invalidNFcount =
-- AR_PHY_CCA_FILTERWINDOW_LENGTH;
-+ h[i].currIndex = 0;
-+ h[i].privNF = default_nf;
-+ h[i].invalidNFcount = AR_PHY_CCA_FILTERWINDOW_LENGTH;
- for (j = 0; j < ATH9K_NF_CAL_HIST_MAX; j++) {
-- ah->nfCalHist[i].nfCalBuffer[j] = limit->nominal;
-+ h[i].nfCalBuffer[j] = default_nf;
- }
- }
- }
-
- s16 ath9k_hw_getchan_noise(struct ath_hw *ah, struct ath9k_channel *chan)
- {
-- s16 nf;
--
-- if (chan->rawNoiseFloor == 0)
-- nf = -96;
-- else
-- nf = chan->rawNoiseFloor;
--
-- if (!ath9k_hw_nf_in_range(ah, nf))
-- nf = ATH_DEFAULT_NOISE_FLOOR;
-+ if (!ah->caldata || !ah->caldata->rawNoiseFloor)
-+ return ath9k_hw_get_default_nf(ah, chan);
-
-- return nf;
-+ return ah->caldata->rawNoiseFloor;
- }
- EXPORT_SYMBOL(ath9k_hw_getchan_noise);
---- a/drivers/net/wireless/ath/ath9k/calib.h
-+++ b/drivers/net/wireless/ath/ath9k/calib.h
-@@ -108,11 +108,11 @@ struct ath9k_pacal_info{
- };
-
- bool ath9k_hw_reset_calvalid(struct ath_hw *ah);
--void ath9k_hw_start_nfcal(struct ath_hw *ah);
-+void ath9k_hw_start_nfcal(struct ath_hw *ah, bool update);
- void ath9k_hw_loadnf(struct ath_hw *ah, struct ath9k_channel *chan);
--int16_t ath9k_hw_getnf(struct ath_hw *ah,
-- struct ath9k_channel *chan);
--void ath9k_init_nfcal_hist_buffer(struct ath_hw *ah);
-+bool ath9k_hw_getnf(struct ath_hw *ah, struct ath9k_channel *chan);
-+void ath9k_init_nfcal_hist_buffer(struct ath_hw *ah,
-+ struct ath9k_channel *chan);
- s16 ath9k_hw_getchan_noise(struct ath_hw *ah, struct ath9k_channel *chan);
- void ath9k_hw_reset_calibration(struct ath_hw *ah,
- struct ath9k_cal_list *currCal);
---- a/drivers/net/wireless/ath/ath9k/hw.c
-+++ b/drivers/net/wireless/ath/ath9k/hw.c
-@@ -622,7 +622,6 @@ static int __ath9k_hw_init(struct ath_hw
- else
- ah->tx_trig_level = (AR_FTRIG_512B >> AR_FTRIG_S);
-
-- ath9k_init_nfcal_hist_buffer(ah);
- ah->bb_watchdog_timeout_ms = 25;
-
- common->state = ATH_HW_INITIALIZED;
-@@ -1195,9 +1194,6 @@ static bool ath9k_hw_channel_change(stru
-
- ath9k_hw_spur_mitigate_freq(ah, chan);
-
-- if (!chan->oneTimeCalsDone)
-- chan->oneTimeCalsDone = true;
--
- return true;
- }
-
-@@ -1230,7 +1226,7 @@ bool ath9k_hw_check_alive(struct ath_hw
- EXPORT_SYMBOL(ath9k_hw_check_alive);
-
- int ath9k_hw_reset(struct ath_hw *ah, struct ath9k_channel *chan,
-- bool bChannelChange)
-+ struct ath9k_hw_cal_data *caldata, bool bChannelChange)
- {
- struct ath_common *common = ath9k_hw_common(ah);
- u32 saveLedState;
-@@ -1255,9 +1251,19 @@ int ath9k_hw_reset(struct ath_hw *ah, st
- if (!ath9k_hw_setpower(ah, ATH9K_PM_AWAKE))
- return -EIO;
-
-- if (curchan && !ah->chip_fullsleep)
-+ if (curchan && !ah->chip_fullsleep && ah->caldata)
- ath9k_hw_getnf(ah, curchan);
-
-+ ah->caldata = caldata;
-+ if (caldata &&
-+ (chan->channel != caldata->channel ||
-+ (chan->channelFlags & ~CHANNEL_CW_INT) !=
-+ (caldata->channelFlags & ~CHANNEL_CW_INT))) {
-+ /* Operating channel changed, reset channel calibration data */
-+ memset(caldata, 0, sizeof(*caldata));
-+ ath9k_init_nfcal_hist_buffer(ah, chan);
-+ }
-+
- if (bChannelChange &&
- (ah->chip_fullsleep != true) &&
- (ah->curchan != NULL) &&
-@@ -1268,7 +1274,7 @@ int ath9k_hw_reset(struct ath_hw *ah, st
-
- if (ath9k_hw_channel_change(ah, chan)) {
- ath9k_hw_loadnf(ah, ah->curchan);
-- ath9k_hw_start_nfcal(ah);
-+ ath9k_hw_start_nfcal(ah, true);
- return 0;
- }
- }
-@@ -1473,11 +1479,8 @@ int ath9k_hw_reset(struct ath_hw *ah, st
- if (ah->btcoex_hw.enabled)
- ath9k_hw_btcoex_enable(ah);
-
-- if (AR_SREV_9300_20_OR_LATER(ah)) {
-- ath9k_hw_loadnf(ah, curchan);
-- ath9k_hw_start_nfcal(ah);
-+ if (AR_SREV_9300_20_OR_LATER(ah))
- ar9003_hw_bb_watchdog_config(ah);
-- }
-
- return 0;
- }
---- a/drivers/net/wireless/ath/ath9k/main.c
-+++ b/drivers/net/wireless/ath/ath9k/main.c
-@@ -155,6 +155,27 @@ void ath9k_ps_restore(struct ath_softc *
- spin_unlock_irqrestore(&sc->sc_pm_lock, flags);
- }
-
-+static void ath_start_ani(struct ath_common *common)
-+{
-+ struct ath_hw *ah = common->ah;
-+ unsigned long timestamp = jiffies_to_msecs(jiffies);
-+ struct ath_softc *sc = (struct ath_softc *) common->priv;
-+
-+ if (!(sc->sc_flags & SC_OP_ANI_RUN))
-+ return;
-+
-+ if (sc->sc_flags & SC_OP_OFFCHANNEL)
-+ return;
-+
-+ common->ani.longcal_timer = timestamp;
-+ common->ani.shortcal_timer = timestamp;
-+ common->ani.checkani_timer = timestamp;
-+
-+ mod_timer(&common->ani.timer,
-+ jiffies +
-+ msecs_to_jiffies((u32)ah->config.ani_poll_interval));
-+}
-+
- /*
- * Set/change channels. If the channel is really being changed, it's done
- * by reseting the chip. To accomplish this we must first cleanup any pending
-@@ -163,16 +184,23 @@ void ath9k_ps_restore(struct ath_softc *
- int ath_set_channel(struct ath_softc *sc, struct ieee80211_hw *hw,
- struct ath9k_channel *hchan)
- {
-+ struct ath_wiphy *aphy = hw->priv;
- struct ath_hw *ah = sc->sc_ah;
- struct ath_common *common = ath9k_hw_common(ah);
- struct ieee80211_conf *conf = &common->hw->conf;
- bool fastcc = true, stopped;
- struct ieee80211_channel *channel = hw->conf.channel;
-+ struct ath9k_hw_cal_data *caldata = NULL;
- int r;
-
- if (sc->sc_flags & SC_OP_INVALID)
- return -EIO;
-
-+ del_timer_sync(&common->ani.timer);
-+ cancel_work_sync(&sc->paprd_work);
-+ cancel_work_sync(&sc->hw_check_work);
-+ cancel_delayed_work_sync(&sc->tx_complete_work);
-+
- ath9k_ps_wakeup(sc);
-
- /*
-@@ -192,9 +220,12 @@ int ath_set_channel(struct ath_softc *sc
- * to flush data frames already in queue because of
- * changing channel. */
-
-- if (!stopped || (sc->sc_flags & SC_OP_FULL_RESET))
-+ if (!stopped || !(sc->sc_flags & SC_OP_OFFCHANNEL))
- fastcc = false;
-
-+ if (!(sc->sc_flags & SC_OP_OFFCHANNEL))
-+ caldata = &aphy->caldata;
-+
- ath_print(common, ATH_DBG_CONFIG,
- "(%u MHz) -> (%u MHz), conf_is_ht40: %d\n",
- sc->sc_ah->curchan->channel,
-@@ -202,7 +233,7 @@ int ath_set_channel(struct ath_softc *sc
-
- spin_lock_bh(&sc->sc_resetlock);
-
-- r = ath9k_hw_reset(ah, hchan, fastcc);
-+ r = ath9k_hw_reset(ah, hchan, caldata, fastcc);
- if (r) {
- ath_print(common, ATH_DBG_FATAL,
- "Unable to reset channel (%u MHz), "
-@@ -213,8 +244,6 @@ int ath_set_channel(struct ath_softc *sc
- }
- spin_unlock_bh(&sc->sc_resetlock);
-
-- sc->sc_flags &= ~SC_OP_FULL_RESET;
--
- if (ath_startrecv(sc) != 0) {
- ath_print(common, ATH_DBG_FATAL,
- "Unable to restart recv logic\n");
-@@ -226,6 +255,12 @@ int ath_set_channel(struct ath_softc *sc
- ath_update_txpow(sc);
- ath9k_hw_set_interrupts(ah, ah->imask);
-
-+ if (!(sc->sc_flags & (SC_OP_OFFCHANNEL | SC_OP_SCANNING))) {
-+ ath_start_ani(common);
-+ ieee80211_queue_delayed_work(sc->hw, &sc->tx_complete_work, 0);
-+ ath_beacon_config(sc, NULL);
-+ }
-+
- ps_restore:
- ath9k_ps_restore(sc);
- return r;
-@@ -234,17 +269,19 @@ int ath_set_channel(struct ath_softc *sc
- static void ath_paprd_activate(struct ath_softc *sc)
- {
- struct ath_hw *ah = sc->sc_ah;
-+ struct ath9k_hw_cal_data *caldata = ah->caldata;
- int chain;
-
-- if (!ah->curchan->paprd_done)
-+ if (!caldata || !caldata->paprd_done)
- return;
-
- ath9k_ps_wakeup(sc);
-+ ar9003_paprd_enable(ah, false);
- for (chain = 0; chain < AR9300_MAX_CHAINS; chain++) {
- if (!(ah->caps.tx_chainmask & BIT(chain)))
- continue;
-
-- ar9003_paprd_populate_single_table(ah, ah->curchan, chain);
-+ ar9003_paprd_populate_single_table(ah, caldata, chain);
- }
-
- ar9003_paprd_enable(ah, true);
-@@ -262,6 +299,7 @@ void ath_paprd_calibrate(struct work_str
- int band = hw->conf.channel->band;
- struct ieee80211_supported_band *sband = &sc->sbands[band];
- struct ath_tx_control txctl;
-+ struct ath9k_hw_cal_data *caldata = ah->caldata;
- int qnum, ftype;
- int chain_ok = 0;
- int chain;
-@@ -269,6 +307,9 @@ void ath_paprd_calibrate(struct work_str
- int time_left;
- int i;
-
-+ if (!caldata)
-+ return;
-+
- skb = alloc_skb(len, GFP_KERNEL);
- if (!skb)
- return;
-@@ -323,7 +364,7 @@ void ath_paprd_calibrate(struct work_str
- if (!ar9003_paprd_is_done(ah))
- break;
-
-- if (ar9003_paprd_create_curve(ah, ah->curchan, chain) != 0)
-+ if (ar9003_paprd_create_curve(ah, caldata, chain) != 0)
- break;
-
- chain_ok = 1;
-@@ -331,7 +372,7 @@ void ath_paprd_calibrate(struct work_str
- kfree_skb(skb);
-
- if (chain_ok) {
-- ah->curchan->paprd_done = true;
-+ caldata->paprd_done = true;
- ath_paprd_activate(sc);
- }
-
-@@ -440,33 +481,14 @@ set_timer:
- cal_interval = min(cal_interval, (u32)short_cal_interval);
-
- mod_timer(&common->ani.timer, jiffies + msecs_to_jiffies(cal_interval));
-- if ((sc->sc_ah->caps.hw_caps & ATH9K_HW_CAP_PAPRD) &&
-- !(sc->sc_flags & SC_OP_SCANNING)) {
-- if (!sc->sc_ah->curchan->paprd_done)
-+ if ((sc->sc_ah->caps.hw_caps & ATH9K_HW_CAP_PAPRD) && ah->caldata) {
-+ if (!ah->caldata->paprd_done)
- ieee80211_queue_work(sc->hw, &sc->paprd_work);
- else
- ath_paprd_activate(sc);
- }
- }
-
--static void ath_start_ani(struct ath_common *common)
--{
-- struct ath_hw *ah = common->ah;
-- unsigned long timestamp = jiffies_to_msecs(jiffies);
-- struct ath_softc *sc = (struct ath_softc *) common->priv;
--
-- if (!(sc->sc_flags & SC_OP_ANI_RUN))
-- return;
--
-- common->ani.longcal_timer = timestamp;
-- common->ani.shortcal_timer = timestamp;
-- common->ani.checkani_timer = timestamp;
--
-- mod_timer(&common->ani.timer,
-- jiffies +
-- msecs_to_jiffies((u32)ah->config.ani_poll_interval));
--}
--
- /*
- * Update tx/rx chainmask. For legacy association,
- * hard code chainmask to 1x1, for 11n association, use
-@@ -478,7 +500,7 @@ void ath_update_chainmask(struct ath_sof
- struct ath_hw *ah = sc->sc_ah;
- struct ath_common *common = ath9k_hw_common(ah);
-
-- if ((sc->sc_flags & SC_OP_SCANNING) || is_ht ||
-+ if ((sc->sc_flags & SC_OP_OFFCHANNEL) || is_ht ||
- (ah->btcoex_hw.scheme != ATH_BTCOEX_CFG_NONE)) {
- common->tx_chainmask = ah->caps.tx_chainmask;
- common->rx_chainmask = ah->caps.rx_chainmask;
-@@ -818,7 +840,7 @@ void ath_radio_enable(struct ath_softc *
- ah->curchan = ath_get_curchannel(sc, sc->hw);
-
- spin_lock_bh(&sc->sc_resetlock);
-- r = ath9k_hw_reset(ah, ah->curchan, false);
-+ r = ath9k_hw_reset(ah, ah->curchan, ah->caldata, false);
- if (r) {
- ath_print(common, ATH_DBG_FATAL,
- "Unable to reset channel (%u MHz), "
-@@ -878,7 +900,7 @@ void ath_radio_disable(struct ath_softc
- ah->curchan = ath_get_curchannel(sc, hw);
-
- spin_lock_bh(&sc->sc_resetlock);
-- r = ath9k_hw_reset(ah, ah->curchan, false);
-+ r = ath9k_hw_reset(ah, ah->curchan, ah->caldata, false);
- if (r) {
- ath_print(ath9k_hw_common(sc->sc_ah), ATH_DBG_FATAL,
- "Unable to reset channel (%u MHz), "
-@@ -911,7 +933,7 @@ int ath_reset(struct ath_softc *sc, bool
- ath_flushrecv(sc);
-
- spin_lock_bh(&sc->sc_resetlock);
-- r = ath9k_hw_reset(ah, sc->sc_ah->curchan, false);
-+ r = ath9k_hw_reset(ah, sc->sc_ah->curchan, ah->caldata, false);
- if (r)
- ath_print(common, ATH_DBG_FATAL,
- "Unable to reset hardware; reset status %d\n", r);
-@@ -1086,7 +1108,7 @@ static int ath9k_start(struct ieee80211_
- * and then setup of the interrupt mask.
- */
- spin_lock_bh(&sc->sc_resetlock);
-- r = ath9k_hw_reset(ah, init_channel, false);
-+ r = ath9k_hw_reset(ah, init_channel, ah->caldata, false);
- if (r) {
- ath_print(common, ATH_DBG_FATAL,
- "Unable to reset hardware; reset status %d "
-@@ -1580,6 +1602,10 @@ static int ath9k_config(struct ieee80211
-
- aphy->chan_idx = pos;
- aphy->chan_is_ht = conf_is_ht(conf);
-+ if (hw->conf.flags & IEEE80211_CONF_OFFCHANNEL)
-+ sc->sc_flags |= SC_OP_OFFCHANNEL;
-+ else
-+ sc->sc_flags &= ~SC_OP_OFFCHANNEL;
-
- if (aphy->state == ATH_WIPHY_SCAN ||
- aphy->state == ATH_WIPHY_ACTIVE)
-@@ -1991,7 +2017,6 @@ static void ath9k_sw_scan_start(struct i
- {
- struct ath_wiphy *aphy = hw->priv;
- struct ath_softc *sc = aphy->sc;
-- struct ath_common *common = ath9k_hw_common(sc->sc_ah);
-
- mutex_lock(&sc->mutex);
- if (ath9k_wiphy_scanning(sc)) {
-@@ -2009,10 +2034,6 @@ static void ath9k_sw_scan_start(struct i
- aphy->state = ATH_WIPHY_SCAN;
- ath9k_wiphy_pause_all_forced(sc, aphy);
- sc->sc_flags |= SC_OP_SCANNING;
-- del_timer_sync(&common->ani.timer);
-- cancel_work_sync(&sc->paprd_work);
-- cancel_work_sync(&sc->hw_check_work);
-- cancel_delayed_work_sync(&sc->tx_complete_work);
- mutex_unlock(&sc->mutex);
- }
-
-@@ -2024,15 +2045,10 @@ static void ath9k_sw_scan_complete(struc
- {
- struct ath_wiphy *aphy = hw->priv;
- struct ath_softc *sc = aphy->sc;
-- struct ath_common *common = ath9k_hw_common(sc->sc_ah);
-
- mutex_lock(&sc->mutex);
- aphy->state = ATH_WIPHY_ACTIVE;
- sc->sc_flags &= ~SC_OP_SCANNING;
-- sc->sc_flags |= SC_OP_FULL_RESET;
-- ath_start_ani(common);
-- ieee80211_queue_delayed_work(sc->hw, &sc->tx_complete_work, 0);
-- ath_beacon_config(sc, NULL);
- mutex_unlock(&sc->mutex);
- }
-
---- a/drivers/net/wireless/ath/ath9k/ar9003_paprd.c
-+++ b/drivers/net/wireless/ath/ath9k/ar9003_paprd.c
-@@ -577,10 +577,11 @@ static bool create_pa_curve(u32 *data_L,
- }
-
- void ar9003_paprd_populate_single_table(struct ath_hw *ah,
-- struct ath9k_channel *chan, int chain)
-+ struct ath9k_hw_cal_data *caldata,
-+ int chain)
- {
-- u32 *paprd_table_val = chan->pa_table[chain];
-- u32 small_signal_gain = chan->small_signal_gain[chain];
-+ u32 *paprd_table_val = caldata->pa_table[chain];
-+ u32 small_signal_gain = caldata->small_signal_gain[chain];
- u32 training_power;
- u32 reg = 0;
- int i;
-@@ -654,17 +655,17 @@ int ar9003_paprd_setup_gain_table(struct
- }
- EXPORT_SYMBOL(ar9003_paprd_setup_gain_table);
-
--int ar9003_paprd_create_curve(struct ath_hw *ah, struct ath9k_channel *chan,
-- int chain)
-+int ar9003_paprd_create_curve(struct ath_hw *ah,
-+ struct ath9k_hw_cal_data *caldata, int chain)
- {
-- u16 *small_signal_gain = &chan->small_signal_gain[chain];
-- u32 *pa_table = chan->pa_table[chain];
-+ u16 *small_signal_gain = &caldata->small_signal_gain[chain];
-+ u32 *pa_table = caldata->pa_table[chain];
- u32 *data_L, *data_U;
- int i, status = 0;
- u32 *buf;
- u32 reg;
-
-- memset(chan->pa_table[chain], 0, sizeof(chan->pa_table[chain]));
-+ memset(caldata->pa_table[chain], 0, sizeof(caldata->pa_table[chain]));
-
- buf = kmalloc(2 * 48 * sizeof(u32), GFP_ATOMIC);
- if (!buf)
---- a/drivers/net/wireless/ath/ath9k/ath9k.h
-+++ b/drivers/net/wireless/ath/ath9k/ath9k.h
-@@ -511,7 +511,7 @@ void ath_deinit_leds(struct ath_softc *s
- #define SC_OP_BEACONS BIT(1)
- #define SC_OP_RXAGGR BIT(2)
- #define SC_OP_TXAGGR BIT(3)
--#define SC_OP_FULL_RESET BIT(4)
-+#define SC_OP_OFFCHANNEL BIT(4)
- #define SC_OP_PREAMBLE_SHORT BIT(5)
- #define SC_OP_PROTECT_ENABLE BIT(6)
- #define SC_OP_RXFLUSH BIT(7)
-@@ -612,6 +612,7 @@ struct ath_softc {
- struct ath_wiphy {
- struct ath_softc *sc; /* shared for all virtual wiphys */
- struct ieee80211_hw *hw;
-+ struct ath9k_hw_cal_data caldata;
- enum ath_wiphy_state {
- ATH_WIPHY_INACTIVE,
- ATH_WIPHY_ACTIVE,
---- a/drivers/net/wireless/ath/ath9k/htc.h
-+++ b/drivers/net/wireless/ath/ath9k/htc.h
-@@ -353,6 +353,8 @@ struct ath9k_htc_priv {
- u16 seq_no;
- u32 bmiss_cnt;
-
-+ struct ath9k_hw_cal_data caldata[38];
-+
- spinlock_t beacon_lock;
-
- bool tx_queues_stop;
---- a/drivers/net/wireless/ath/ath9k/htc_drv_main.c
-+++ b/drivers/net/wireless/ath/ath9k/htc_drv_main.c
-@@ -125,6 +125,7 @@ static int ath9k_htc_set_channel(struct
- struct ieee80211_conf *conf = &common->hw->conf;
- bool fastcc = true;
- struct ieee80211_channel *channel = hw->conf.channel;
-+ struct ath9k_hw_cal_data *caldata;
- enum htc_phymode mode;
- __be16 htc_mode;
- u8 cmd_rsp;
-@@ -149,7 +150,8 @@ static int ath9k_htc_set_channel(struct
- priv->ah->curchan->channel,
- channel->center_freq, conf_is_ht(conf), conf_is_ht40(conf));
-
-- ret = ath9k_hw_reset(ah, hchan, fastcc);
-+ caldata = &priv->caldata[channel->hw_value];
-+ ret = ath9k_hw_reset(ah, hchan, caldata, fastcc);
- if (ret) {
- ath_print(common, ATH_DBG_FATAL,
- "Unable to reset channel (%u Mhz) "
-@@ -1028,7 +1030,7 @@ static void ath9k_htc_radio_enable(struc
- ah->curchan = ath9k_cmn_get_curchannel(hw, ah);
-
- /* Reset the HW */
-- ret = ath9k_hw_reset(ah, ah->curchan, false);
-+ ret = ath9k_hw_reset(ah, ah->curchan, ah->caldata, false);
- if (ret) {
- ath_print(common, ATH_DBG_FATAL,
- "Unable to reset hardware; reset status %d "
-@@ -1091,7 +1093,7 @@ static void ath9k_htc_radio_disable(stru
- ah->curchan = ath9k_cmn_get_curchannel(hw, ah);
-
- /* Reset the HW */
-- ret = ath9k_hw_reset(ah, ah->curchan, false);
-+ ret = ath9k_hw_reset(ah, ah->curchan, ah->caldata, false);
- if (ret) {
- ath_print(common, ATH_DBG_FATAL,
- "Unable to reset hardware; reset status %d "
-@@ -1179,7 +1181,7 @@ static int ath9k_htc_start(struct ieee80
- ath9k_hw_configpcipowersave(ah, 0, 0);
-
- ath9k_hw_htc_resetinit(ah);
-- ret = ath9k_hw_reset(ah, init_channel, false);
-+ ret = ath9k_hw_reset(ah, init_channel, ah->caldata, false);
- if (ret) {
- ath_print(common, ATH_DBG_FATAL,
- "Unable to reset hardware; reset status %d "
---- a/drivers/net/wireless/ath/ath9k/hw.h
-+++ b/drivers/net/wireless/ath/ath9k/hw.h
-@@ -346,19 +346,25 @@ enum ath9k_int {
- CHANNEL_HT40PLUS | \
- CHANNEL_HT40MINUS)
-
--struct ath9k_channel {
-- struct ieee80211_channel *chan;
-+struct ath9k_hw_cal_data {
- u16 channel;
- u32 channelFlags;
-- u32 chanmode;
- int32_t CalValid;
-- bool oneTimeCalsDone;
- int8_t iCoff;
- int8_t qCoff;
- int16_t rawNoiseFloor;
- bool paprd_done;
-+ bool nfcal_pending;
- u16 small_signal_gain[AR9300_MAX_CHAINS];
- u32 pa_table[AR9300_MAX_CHAINS][PAPRD_TABLE_SZ];
-+ struct ath9k_nfcal_hist nfCalHist[NUM_NF_READINGS];
-+};
-+
-+struct ath9k_channel {
-+ struct ieee80211_channel *chan;
-+ u16 channel;
-+ u32 channelFlags;
-+ u32 chanmode;
- };
-
- #define IS_CHAN_G(_c) ((((_c)->channelFlags & (CHANNEL_G)) == CHANNEL_G) || \
-@@ -669,7 +675,7 @@ struct ath_hw {
- enum nl80211_iftype opmode;
- enum ath9k_power_mode power_mode;
-
-- struct ath9k_nfcal_hist nfCalHist[NUM_NF_READINGS];
-+ struct ath9k_hw_cal_data *caldata;
- struct ath9k_pacal_info pacal_info;
- struct ar5416Stats stats;
- struct ath9k_tx_queue_info txq[ATH9K_NUM_TX_QUEUES];
-@@ -863,7 +869,7 @@ const char *ath9k_hw_probe(u16 vendorid,
- void ath9k_hw_deinit(struct ath_hw *ah);
- int ath9k_hw_init(struct ath_hw *ah);
- int ath9k_hw_reset(struct ath_hw *ah, struct ath9k_channel *chan,
-- bool bChannelChange);
-+ struct ath9k_hw_cal_data *caldata, bool bChannelChange);
- int ath9k_hw_fill_cap_info(struct ath_hw *ah);
- u32 ath9k_regd_get_ctl(struct ath_regulatory *reg, struct ath9k_channel *chan);
-
-@@ -958,9 +964,10 @@ void ar9003_hw_bb_watchdog_read(struct a
- void ar9003_hw_bb_watchdog_dbg_info(struct ath_hw *ah);
- void ar9003_paprd_enable(struct ath_hw *ah, bool val);
- void ar9003_paprd_populate_single_table(struct ath_hw *ah,
-- struct ath9k_channel *chan, int chain);
--int ar9003_paprd_create_curve(struct ath_hw *ah, struct ath9k_channel *chan,
-- int chain);
-+ struct ath9k_hw_cal_data *caldata,
-+ int chain);
-+int ar9003_paprd_create_curve(struct ath_hw *ah,
-+ struct ath9k_hw_cal_data *caldata, int chain);
- int ar9003_paprd_setup_gain_table(struct ath_hw *ah, int chain);
- int ar9003_paprd_init_table(struct ath_hw *ah);
- bool ar9003_paprd_is_done(struct ath_hw *ah);
---- a/drivers/net/wireless/ath/ath9k/xmit.c
-+++ b/drivers/net/wireless/ath/ath9k/xmit.c
-@@ -1181,7 +1181,7 @@ void ath_drain_all_txq(struct ath_softc
- "Failed to stop TX DMA. Resetting hardware!\n");
-
- spin_lock_bh(&sc->sc_resetlock);
-- r = ath9k_hw_reset(ah, sc->sc_ah->curchan, false);
-+ r = ath9k_hw_reset(ah, sc->sc_ah->curchan, ah->caldata, false);
- if (r)
- ath_print(common, ATH_DBG_FATAL,
- "Unable to reset hardware; reset status %d\n",
--- /dev/null
+--- a/drivers/net/wireless/ath/ath9k/xmit.c
++++ b/drivers/net/wireless/ath/ath9k/xmit.c
+@@ -124,7 +124,8 @@ static void ath_tx_resume_tid(struct ath
+ {
+ struct ath_txq *txq = &sc->tx.txq[tid->ac->qnum];
+
+- WARN_ON(!tid->paused);
++ if (!tid->paused)
++ return;
+
+ spin_lock_bh(&txq->axq_lock);
+ tid->paused = false;
+++ /dev/null
---- a/drivers/net/wireless/ath/ath9k/xmit.c
-+++ b/drivers/net/wireless/ath/ath9k/xmit.c
-@@ -120,26 +120,14 @@ static void ath_tx_queue_tid(struct ath_
- list_add_tail(&ac->list, &txq->axq_acq);
- }
-
--static void ath_tx_pause_tid(struct ath_softc *sc, struct ath_atx_tid *tid)
--{
-- struct ath_txq *txq = &sc->tx.txq[tid->ac->qnum];
--
-- spin_lock_bh(&txq->axq_lock);
-- tid->paused++;
-- spin_unlock_bh(&txq->axq_lock);
--}
--
- static void ath_tx_resume_tid(struct ath_softc *sc, struct ath_atx_tid *tid)
- {
- struct ath_txq *txq = &sc->tx.txq[tid->ac->qnum];
-
-- BUG_ON(tid->paused <= 0);
-- spin_lock_bh(&txq->axq_lock);
--
-- tid->paused--;
-+ WARN_ON(!tid->paused);
-
-- if (tid->paused > 0)
-- goto unlock;
-+ spin_lock_bh(&txq->axq_lock);
-+ tid->paused = false;
-
- if (list_empty(&tid->buf_q))
- goto unlock;
-@@ -157,15 +145,10 @@ static void ath_tx_flush_tid(struct ath_
- struct list_head bf_head;
- INIT_LIST_HEAD(&bf_head);
-
-- BUG_ON(tid->paused <= 0);
-- spin_lock_bh(&txq->axq_lock);
-+ WARN_ON(!tid->paused);
-
-- tid->paused--;
--
-- if (tid->paused > 0) {
-- spin_unlock_bh(&txq->axq_lock);
-- return;
-- }
-+ spin_lock_bh(&txq->axq_lock);
-+ tid->paused = false;
-
- while (!list_empty(&tid->buf_q)) {
- bf = list_first_entry(&tid->buf_q, struct ath_buf, list);
-@@ -811,7 +794,7 @@ void ath_tx_aggr_start(struct ath_softc
- an = (struct ath_node *)sta->drv_priv;
- txtid = ATH_AN_2_TID(an, tid);
- txtid->state |= AGGR_ADDBA_PROGRESS;
-- ath_tx_pause_tid(sc, txtid);
-+ txtid->paused = true;
- *ssn = txtid->seq_start;
- }
-
-@@ -835,10 +818,9 @@ void ath_tx_aggr_stop(struct ath_softc *
- return;
- }
-
-- ath_tx_pause_tid(sc, txtid);
--
- /* drop all software retried frames and mark this TID */
- spin_lock_bh(&txq->axq_lock);
-+ txtid->paused = true;
- while (!list_empty(&txtid->buf_q)) {
- bf = list_first_entry(&txtid->buf_q, struct ath_buf, list);
- if (!bf_isretried(bf)) {
+++ /dev/null
---- a/drivers/net/wireless/ath/debug.h
-+++ b/drivers/net/wireless/ath/debug.h
-@@ -36,6 +36,7 @@
- * @ATH_DBG_PS: power save processing
- * @ATH_DBG_HWTIMER: hardware timer handling
- * @ATH_DBG_BTCOEX: bluetooth coexistance
-+ * @ATH_DBG_BSTUCK: stuck beacons
- * @ATH_DBG_ANY: enable all debugging
- *
- * The debug level is used to control the amount and type of debugging output
-@@ -60,6 +61,7 @@ enum ATH_DEBUG {
- ATH_DBG_HWTIMER = 0x00001000,
- ATH_DBG_BTCOEX = 0x00002000,
- ATH_DBG_WMI = 0x00004000,
-+ ATH_DBG_BSTUCK = 0x00008000,
- ATH_DBG_ANY = 0xffffffff
- };
-
---- a/drivers/net/wireless/ath/ath9k/beacon.c
-+++ b/drivers/net/wireless/ath/ath9k/beacon.c
-@@ -359,11 +359,11 @@ void ath_beacon_tasklet(unsigned long da
- sc->beacon.bmisscnt++;
-
- if (sc->beacon.bmisscnt < BSTUCK_THRESH) {
-- ath_print(common, ATH_DBG_BEACON,
-+ ath_print(common, ATH_DBG_BSTUCK,
- "missed %u consecutive beacons\n",
- sc->beacon.bmisscnt);
- } else if (sc->beacon.bmisscnt >= BSTUCK_THRESH) {
-- ath_print(common, ATH_DBG_BEACON,
-+ ath_print(common, ATH_DBG_BSTUCK,
- "beacon is officially stuck\n");
- sc->sc_flags |= SC_OP_TSF_RESET;
- ath_reset(sc, false);
-@@ -373,7 +373,7 @@ void ath_beacon_tasklet(unsigned long da
- }
-
- if (sc->beacon.bmisscnt != 0) {
-- ath_print(common, ATH_DBG_BEACON,
-+ ath_print(common, ATH_DBG_BSTUCK,
- "resume beacon xmit after %u misses\n",
- sc->beacon.bmisscnt);
- sc->beacon.bmisscnt = 0;
+++ /dev/null
---- a/drivers/net/wireless/ath/ath9k/calib.c
-+++ b/drivers/net/wireless/ath/ath9k/calib.c
-@@ -19,8 +19,7 @@
-
- /* Common calibration code */
-
--/* We can tune this as we go by monitoring really low values */
--#define ATH9K_NF_TOO_LOW -60
-+#define ATH9K_NF_TOO_HIGH -60
-
- static int16_t ath9k_hw_get_nf_hist_mid(int16_t *nfCalBuffer)
- {
-@@ -45,11 +44,35 @@ static int16_t ath9k_hw_get_nf_hist_mid(
- return nfval;
- }
-
--static void ath9k_hw_update_nfcal_hist_buffer(struct ath9k_nfcal_hist *h,
-+static struct ath_nf_limits *ath9k_hw_get_nf_limits(struct ath_hw *ah,
-+ struct ath9k_channel *chan)
-+{
-+ struct ath_nf_limits *limit;
-+
-+ if (!chan || IS_CHAN_2GHZ(chan))
-+ limit = &ah->nf_2g;
-+ else
-+ limit = &ah->nf_5g;
-+
-+ return limit;
-+}
-+
-+static s16 ath9k_hw_get_default_nf(struct ath_hw *ah,
-+ struct ath9k_channel *chan)
-+{
-+ return ath9k_hw_get_nf_limits(ah, chan)->nominal;
-+}
-+
-+
-+static void ath9k_hw_update_nfcal_hist_buffer(struct ath_hw *ah,
-+ struct ath9k_nfcal_hist *h,
- int16_t *nfarray)
- {
-+ struct ath_nf_limits *limit;
- int i;
-
-+ limit = ath9k_hw_get_nf_limits(ah, ah->curchan);
-+
- for (i = 0; i < NUM_NF_READINGS; i++) {
- h[i].nfCalBuffer[h[i].currIndex] = nfarray[i];
-
-@@ -63,6 +86,9 @@ static void ath9k_hw_update_nfcal_hist_b
- h[i].privNF =
- ath9k_hw_get_nf_hist_mid(h[i].nfCalBuffer);
- }
-+
-+ if (h[i].privNF > limit->max)
-+ h[i].privNF = limit->max;
- }
- }
-
-@@ -104,19 +130,6 @@ void ath9k_hw_reset_calibration(struct a
- ah->cal_samples = 0;
- }
-
--static s16 ath9k_hw_get_default_nf(struct ath_hw *ah,
-- struct ath9k_channel *chan)
--{
-- struct ath_nf_limits *limit;
--
-- if (!chan || IS_CHAN_2GHZ(chan))
-- limit = &ah->nf_2g;
-- else
-- limit = &ah->nf_5g;
--
-- return limit->nominal;
--}
--
- /* This is done for the currently configured channel */
- bool ath9k_hw_reset_calvalid(struct ath_hw *ah)
- {
-@@ -277,10 +290,10 @@ static void ath9k_hw_nf_sanitize(struct
- "NF calibrated [%s] [chain %d] is %d\n",
- (i >= 3 ? "ext" : "ctl"), i % 3, nf[i]);
-
-- if (nf[i] > limit->max) {
-+ if (nf[i] > ATH9K_NF_TOO_HIGH) {
- ath_print(common, ATH_DBG_CALIBRATE,
- "NF[%d] (%d) > MAX (%d), correcting to MAX",
-- i, nf[i], limit->max);
-+ i, nf[i], ATH9K_NF_TOO_HIGH);
- nf[i] = limit->max;
- } else if (nf[i] < limit->min) {
- ath_print(common, ATH_DBG_CALIBRATE,
-@@ -326,7 +339,7 @@ bool ath9k_hw_getnf(struct ath_hw *ah, s
-
- h = caldata->nfCalHist;
- caldata->nfcal_pending = false;
-- ath9k_hw_update_nfcal_hist_buffer(h, nfarray);
-+ ath9k_hw_update_nfcal_hist_buffer(ah, h, nfarray);
- caldata->rawNoiseFloor = h[0].privNF;
- return true;
- }
+++ /dev/null
---- a/drivers/net/wireless/ath/ath9k/beacon.c
-+++ b/drivers/net/wireless/ath/ath9k/beacon.c
-@@ -362,6 +362,7 @@ void ath_beacon_tasklet(unsigned long da
- ath_print(common, ATH_DBG_BSTUCK,
- "missed %u consecutive beacons\n",
- sc->beacon.bmisscnt);
-+ ath9k_hw_bstuck_nfcal(ah);
- } else if (sc->beacon.bmisscnt >= BSTUCK_THRESH) {
- ath_print(common, ATH_DBG_BSTUCK,
- "beacon is officially stuck\n");
---- a/drivers/net/wireless/ath/ath9k/calib.c
-+++ b/drivers/net/wireless/ath/ath9k/calib.c
-@@ -65,12 +65,16 @@ static s16 ath9k_hw_get_default_nf(struc
-
-
- static void ath9k_hw_update_nfcal_hist_buffer(struct ath_hw *ah,
-- struct ath9k_nfcal_hist *h,
-+ struct ath9k_hw_cal_data *cal,
- int16_t *nfarray)
- {
-+ struct ath_common *common = ath9k_hw_common(ah);
- struct ath_nf_limits *limit;
-+ struct ath9k_nfcal_hist *h;
-+ bool high_nf_mid = false;
- int i;
-
-+ h = cal->nfCalHist;
- limit = ath9k_hw_get_nf_limits(ah, ah->curchan);
-
- for (i = 0; i < NUM_NF_READINGS; i++) {
-@@ -87,9 +91,38 @@ static void ath9k_hw_update_nfcal_hist_b
- ath9k_hw_get_nf_hist_mid(h[i].nfCalBuffer);
- }
-
-- if (h[i].privNF > limit->max)
-- h[i].privNF = limit->max;
-+ if (!h[i].privNF)
-+ continue;
-+
-+ if (h[i].privNF > limit->max) {
-+ high_nf_mid = true;
-+
-+ ath_print(common, ATH_DBG_CALIBRATE,
-+ "NFmid[%d] (%d) > MAX (%d), %s\n",
-+ i, h[i].privNF, limit->max,
-+ (cal->nfcal_interference ?
-+ "not corrected (due to interference)" :
-+ "correcting to MAX"));
-+
-+ /*
-+ * Normally we limit the average noise floor by the
-+ * hardware specific maximum here. However if we have
-+ * encountered stuck beacons because of interference,
-+ * we bypass this limit here in order to better deal
-+ * with our environment.
-+ */
-+ if (!cal->nfcal_interference)
-+ h[i].privNF = limit->max;
-+ }
- }
-+
-+ /*
-+ * If the noise floor seems normal for all chains, assume that
-+ * there is no significant interference in the environment anymore.
-+ * Re-enable the enforcement of the NF maximum again.
-+ */
-+ if (!high_nf_mid)
-+ cal->nfcal_interference = false;
- }
-
- static bool ath9k_hw_get_nf_thresh(struct ath_hw *ah,
-@@ -339,7 +372,7 @@ bool ath9k_hw_getnf(struct ath_hw *ah, s
-
- h = caldata->nfCalHist;
- caldata->nfcal_pending = false;
-- ath9k_hw_update_nfcal_hist_buffer(ah, h, nfarray);
-+ ath9k_hw_update_nfcal_hist_buffer(ah, caldata, nfarray);
- caldata->rawNoiseFloor = h[0].privNF;
- return true;
- }
-@@ -374,3 +407,28 @@ s16 ath9k_hw_getchan_noise(struct ath_hw
- return ah->caldata->rawNoiseFloor;
- }
- EXPORT_SYMBOL(ath9k_hw_getchan_noise);
-+
-+void ath9k_hw_bstuck_nfcal(struct ath_hw *ah)
-+{
-+ struct ath9k_hw_cal_data *caldata = ah->caldata;
-+
-+ if (unlikely(!caldata))
-+ return;
-+
-+ /*
-+ * If beacons are stuck, the most likely cause is interference.
-+ * Triggering a noise floor calibration at this point helps the
-+ * hardware adapt to a noisy environment much faster.
-+ * To ensure that we recover from stuck beacons quickly, let
-+ * the baseband update the internal NF value itself, similar to
-+ * what is being done after a full reset.
-+ */
-+ if (!caldata->nfcal_pending)
-+ ath9k_hw_start_nfcal(ah, true);
-+ else if (!(REG_READ(ah, AR_PHY_AGC_CONTROL) & AR_PHY_AGC_CONTROL_NF))
-+ ath9k_hw_getnf(ah, ah->curchan);
-+
-+ caldata->nfcal_interference = true;
-+}
-+EXPORT_SYMBOL(ath9k_hw_bstuck_nfcal);
-+
---- a/drivers/net/wireless/ath/ath9k/calib.h
-+++ b/drivers/net/wireless/ath/ath9k/calib.h
-@@ -113,6 +113,7 @@ void ath9k_hw_loadnf(struct ath_hw *ah,
- bool ath9k_hw_getnf(struct ath_hw *ah, struct ath9k_channel *chan);
- void ath9k_init_nfcal_hist_buffer(struct ath_hw *ah,
- struct ath9k_channel *chan);
-+void ath9k_hw_bstuck_nfcal(struct ath_hw *ah);
- s16 ath9k_hw_getchan_noise(struct ath_hw *ah, struct ath9k_channel *chan);
- void ath9k_hw_reset_calibration(struct ath_hw *ah,
- struct ath9k_cal_list *currCal);
---- a/drivers/net/wireless/ath/ath9k/hw.h
-+++ b/drivers/net/wireless/ath/ath9k/hw.h
-@@ -355,6 +355,7 @@ struct ath9k_hw_cal_data {
- int16_t rawNoiseFloor;
- bool paprd_done;
- bool nfcal_pending;
-+ bool nfcal_interference;
- u16 small_signal_gain[AR9300_MAX_CHAINS];
- u32 pa_table[AR9300_MAX_CHAINS][PAPRD_TABLE_SZ];
- struct ath9k_nfcal_hist nfCalHist[NUM_NF_READINGS];
+++ /dev/null
---- a/drivers/net/wireless/ath/ath9k/ath9k.h
-+++ b/drivers/net/wireless/ath/ath9k/ath9k.h
-@@ -423,6 +423,7 @@ int ath_beaconq_config(struct ath_softc
- #define ATH_AP_SHORT_CALINTERVAL 100 /* 100 ms */
- #define ATH_ANI_POLLINTERVAL_OLD 100 /* 100 ms */
- #define ATH_ANI_POLLINTERVAL_NEW 1000 /* 1000 ms */
-+#define ATH_LONG_CALINTERVAL_INT 1000 /* 1000 ms */
- #define ATH_LONG_CALINTERVAL 30000 /* 30 seconds */
- #define ATH_RESTART_CALINTERVAL 1200000 /* 20 minutes */
-
---- a/drivers/net/wireless/ath/ath9k/main.c
-+++ b/drivers/net/wireless/ath/ath9k/main.c
-@@ -396,7 +396,12 @@ void ath_ani_calibrate(unsigned long dat
- bool shortcal = false;
- bool aniflag = false;
- unsigned int timestamp = jiffies_to_msecs(jiffies);
-- u32 cal_interval, short_cal_interval;
-+ u32 cal_interval, short_cal_interval, long_cal_interval;
-+
-+ if (ah->caldata && ah->caldata->nfcal_interference)
-+ long_cal_interval = ATH_LONG_CALINTERVAL_INT;
-+ else
-+ long_cal_interval = ATH_LONG_CALINTERVAL;
-
- short_cal_interval = (ah->opmode == NL80211_IFTYPE_AP) ?
- ATH_AP_SHORT_CALINTERVAL : ATH_STA_SHORT_CALINTERVAL;
-@@ -408,7 +413,7 @@ void ath_ani_calibrate(unsigned long dat
- ath9k_ps_wakeup(sc);
-
- /* Long calibration runs independently of short calibration. */
-- if ((timestamp - common->ani.longcal_timer) >= ATH_LONG_CALINTERVAL) {
-+ if ((timestamp - common->ani.longcal_timer) >= long_cal_interval) {
- longcal = true;
- ath_print(common, ATH_DBG_ANI, "longcal @%lu\n", jiffies);
- common->ani.longcal_timer = timestamp;
+++ /dev/null
-ath9k_rx_skb_preprocess nulls rxs and the mactime is never set again -
-mactime is always 0. This causes problems in IBSS mode.
-
-ieee80211_rx_bss_info uses mactime to decide if an IBSS merge is needed.
-Without this patch the merge is triggered by each beacon received.
-
-This can be recognized by the "beacon TSF higher than local TSF - IBSS
-merge with BSSID" log message accompanying each beacon.
-
-This problem was not completely fixed in commit
-a6d2055b02dde1067075795274672720baadd3ca and is not a stable kernel fix.
-It is solely intended for wireless-testing.
-
-Signed-off-by: Jan Friedrich <jft@dev2day.de>
----
- drivers/net/wireless/ath/ath9k/recv.c | 10 +++++-----
- 1 files changed, 5 insertions(+), 5 deletions(-)
-
---- a/drivers/net/wireless/ath/ath9k/recv.c
-+++ b/drivers/net/wireless/ath/ath9k/recv.c
-@@ -1140,6 +1140,11 @@ int ath_rx_tasklet(struct ath_softc *sc,
- if (flush)
- goto requeue;
-
-+ retval = ath9k_rx_skb_preprocess(common, hw, hdr, &rs,
-+ rxs, &decrypt_error);
-+ if (retval)
-+ goto requeue;
-+
- rxs->mactime = (tsf & ~0xffffffffULL) | rs.rs_tstamp;
- if (rs.rs_tstamp > tsf_lower &&
- unlikely(rs.rs_tstamp - tsf_lower > 0x10000000))
-@@ -1149,11 +1154,6 @@ int ath_rx_tasklet(struct ath_softc *sc,
- unlikely(tsf_lower - rs.rs_tstamp > 0x10000000))
- rxs->mactime += 0x100000000ULL;
-
-- retval = ath9k_rx_skb_preprocess(common, hw, hdr, &rs,
-- rxs, &decrypt_error);
-- if (retval)
-- goto requeue;
--
- /* Ensure we always have an skb to requeue once we are done
- * processing the current buffer's skb */
- requeue_skb = ath_rxbuf_alloc(common, common->rx_bufsize, GFP_ATOMIC);
+++ /dev/null
---- a/drivers/net/wireless/ath/ath9k/ath9k.h
-+++ b/drivers/net/wireless/ath/ath9k/ath9k.h
-@@ -254,7 +254,7 @@ struct ath_atx_tid {
- struct list_head buf_q;
- struct ath_node *an;
- struct ath_atx_ac *ac;
-- struct ath_buf *tx_buf[ATH_TID_MAX_BUFS];
-+ unsigned long tx_buf[BITS_TO_LONGS(ATH_TID_MAX_BUFS)];
- u16 seq_start;
- u16 seq_next;
- u16 baw_size;
---- a/drivers/net/wireless/ath/ath9k/xmit.c
-+++ b/drivers/net/wireless/ath/ath9k/xmit.c
-@@ -168,9 +168,9 @@ static void ath_tx_update_baw(struct ath
- index = ATH_BA_INDEX(tid->seq_start, seqno);
- cindex = (tid->baw_head + index) & (ATH_TID_MAX_BUFS - 1);
-
-- tid->tx_buf[cindex] = NULL;
-+ __clear_bit(cindex, tid->tx_buf);
-
-- while (tid->baw_head != tid->baw_tail && !tid->tx_buf[tid->baw_head]) {
-+ while (tid->baw_head != tid->baw_tail && !test_bit(tid->baw_head, tid->tx_buf)) {
- INCR(tid->seq_start, IEEE80211_SEQ_MAX);
- INCR(tid->baw_head, ATH_TID_MAX_BUFS);
- }
-@@ -186,9 +186,7 @@ static void ath_tx_addto_baw(struct ath_
-
- index = ATH_BA_INDEX(tid->seq_start, bf->bf_seqno);
- cindex = (tid->baw_head + index) & (ATH_TID_MAX_BUFS - 1);
--
-- BUG_ON(tid->tx_buf[cindex] != NULL);
-- tid->tx_buf[cindex] = bf;
-+ __set_bit(cindex, tid->tx_buf);
-
- if (index >= ((tid->baw_tail - tid->baw_head) &
- (ATH_TID_MAX_BUFS - 1))) {
+++ /dev/null
---- a/drivers/net/wireless/ath/ath.h
-+++ b/drivers/net/wireless/ath/ath.h
-@@ -119,6 +119,7 @@ struct ath_common {
-
- u32 keymax;
- DECLARE_BITMAP(keymap, ATH_KEYMAX);
-+ DECLARE_BITMAP(tkip_keymap, ATH_KEYMAX);
- u8 splitmic;
-
- struct ath_regulatory regulatory;
---- a/drivers/net/wireless/ath/ath9k/common.c
-+++ b/drivers/net/wireless/ath/ath9k/common.c
-@@ -366,9 +366,13 @@ int ath9k_cmn_key_config(struct ath_comm
- set_bit(idx, common->keymap);
- if (key->alg == ALG_TKIP) {
- set_bit(idx + 64, common->keymap);
-+ set_bit(idx, common->tkip_keymap);
-+ set_bit(idx + 64, common->tkip_keymap);
- if (common->splitmic) {
- set_bit(idx + 32, common->keymap);
- set_bit(idx + 64 + 32, common->keymap);
-+ set_bit(idx + 32, common->tkip_keymap);
-+ set_bit(idx + 64 + 32, common->tkip_keymap);
- }
- }
-
-@@ -393,10 +397,17 @@ void ath9k_cmn_key_delete(struct ath_com
- return;
-
- clear_bit(key->hw_key_idx + 64, common->keymap);
-+
-+ clear_bit(key->hw_key_idx, common->tkip_keymap);
-+ clear_bit(key->hw_key_idx + 64, common->tkip_keymap);
-+
- if (common->splitmic) {
- ath9k_hw_keyreset(ah, key->hw_key_idx + 32);
- clear_bit(key->hw_key_idx + 32, common->keymap);
- clear_bit(key->hw_key_idx + 64 + 32, common->keymap);
-+
-+ clear_bit(key->hw_key_idx + 32, common->tkip_keymap);
-+ clear_bit(key->hw_key_idx + 64 + 32, common->tkip_keymap);
- }
- }
- EXPORT_SYMBOL(ath9k_cmn_key_delete);
---- a/drivers/net/wireless/ath/ath9k/recv.c
-+++ b/drivers/net/wireless/ath/ath9k/recv.c
-@@ -870,15 +870,18 @@ static bool ath9k_rx_accept(struct ath_c
- if (rx_stats->rs_status & ATH9K_RXERR_DECRYPT) {
- *decrypt_error = true;
- } else if (rx_stats->rs_status & ATH9K_RXERR_MIC) {
-- if (ieee80211_is_ctl(fc))
-- /*
-- * Sometimes, we get invalid
-- * MIC failures on valid control frames.
-- * Remove these mic errors.
-- */
-- rx_stats->rs_status &= ~ATH9K_RXERR_MIC;
-- else
-+ /*
-+ * The MIC error bit is only valid if the frame
-+ * is not a control frame or fragment, and it was
-+ * decrypted using a valid TKIP key.
-+ */
-+ if (!ieee80211_is_ctl(fc) &&
-+ !ieee80211_has_morefrags(fc) &&
-+ !(le16_to_cpu(hdr->seq_ctrl) & IEEE80211_SCTL_FRAG) &&
-+ test_bit(rx_stats->rs_keyix, common->tkip_keymap))
- rxs->flag |= RX_FLAG_MMIC_ERROR;
-+ else
-+ rx_stats->rs_status &= ~ATH9K_RXERR_MIC;
- }
- /*
- * Reject error frames with the exception of
---- a/drivers/net/wireless/ath/ath9k/mac.c
-+++ b/drivers/net/wireless/ath/ath9k/mac.c
-@@ -711,7 +711,8 @@ int ath9k_hw_rxprocdesc(struct ath_hw *a
- rs->rs_phyerr = phyerr;
- } else if (ads.ds_rxstatus8 & AR_DecryptCRCErr)
- rs->rs_status |= ATH9K_RXERR_DECRYPT;
-- else if (ads.ds_rxstatus8 & AR_MichaelErr)
-+ else if ((ads.ds_rxstatus8 & AR_MichaelErr) &&
-+ rs->rs_keyix != ATH9K_RXKEYIX_INVALID)
- rs->rs_status |= ATH9K_RXERR_MIC;
- else if (ads.ds_rxstatus8 & AR_KeyMiss)
- rs->rs_status |= ATH9K_RXERR_DECRYPT;
+++ /dev/null
---- a/drivers/net/wireless/ath/ath9k/xmit.c
-+++ b/drivers/net/wireless/ath/ath9k/xmit.c
-@@ -124,7 +124,8 @@ static void ath_tx_resume_tid(struct ath
- {
- struct ath_txq *txq = &sc->tx.txq[tid->ac->qnum];
-
-- WARN_ON(!tid->paused);
-+ if (!tid->paused)
-+ return;
-
- spin_lock_bh(&txq->axq_lock);
- tid->paused = false;
/*
* PCI driver handlers.
*/
-@@ -382,6 +383,7 @@ int rt2x00pci_resume(struct pci_dev *pci
+@@ -381,6 +382,7 @@ int rt2x00pci_resume(struct pci_dev *pci
}
EXPORT_SYMBOL_GPL(rt2x00pci_resume);
#endif /* CONFIG_PM */
--- a/drivers/net/wireless/mwl8k.c
+++ b/drivers/net/wireless/mwl8k.c
-@@ -3884,6 +3884,7 @@ MODULE_FIRMWARE("mwl8k/helper_8366.fw");
+@@ -3897,6 +3897,7 @@ MODULE_FIRMWARE("mwl8k/helper_8366.fw");
MODULE_FIRMWARE("mwl8k/fmimage_8366.fw");
static DEFINE_PCI_DEVICE_TABLE(mwl8k_pci_id_table) = {
net/mac80211/util.c | 6 ++++++
15 files changed, 69 insertions(+), 7 deletions(-)
---- compat-wireless-2010-07-29.orig/config.mk
-+++ compat-wireless-2010-07-29/config.mk
+--- a/config.mk
++++ b/config.mk
@@ -115,7 +115,7 @@ CONFIG_COMPAT_MAC80211_RC_DEFAULT=minstr
# CONFIG_MAC80211_RC_PID=y
CONFIG_MAC80211_RC_MINSTREL=y
# enable mesh networking too
CONFIG_MAC80211_MESH=y
-@@ -194,7 +194,7 @@ CONFIG_B43_PCI_AUTOSELECT=y
+@@ -218,7 +218,7 @@ CONFIG_B43_PCI_AUTOSELECT=y
ifneq ($(CONFIG_PCMCIA),)
# CONFIG_B43_PCMCIA=y
endif
CONFIG_B43_PHY_LP=y
# CONFIG_B43_NPHY is not set
# CONFIG_B43_FORCE_PIO=y
-@@ -203,7 +203,7 @@ CONFIG_B43_PHY_LP=y
+@@ -227,7 +227,7 @@ CONFIG_B43_PHY_LP=y
CONFIG_B43LEGACY=m
CONFIG_B43LEGACY_HWRNG=y
CONFIG_B43LEGACY_PCI_AUTOSELECT=y
# CONFIG_B43LEGACY_DEBUG=y
CONFIG_B43LEGACY_DMA=y
CONFIG_B43LEGACY_PIO=y
-@@ -336,13 +336,13 @@ endif
-
- CONFIG_P54_USB=m
- CONFIG_RTL8187=m
--CONFIG_RTL8187_LEDS=y
-+# CONFIG_RTL8187_LEDS=y
-
- CONFIG_AT76C50X_USB=m
-
- ifndef CONFIG_COMPAT_KERNEL_28
- CONFIG_AR9170_USB=m
--CONFIG_AR9170_LEDS=y
-+# CONFIG_AR9170_LEDS=y
- endif
-
- CONFIG_ATH9K_HTC=m
-@@ -426,7 +426,7 @@ CONFIG_RT2800_LIB=m
- CONFIG_RT2X00_LIB_HT=y
- CONFIG_RT2X00_LIB_FIRMWARE=y
- CONFIG_RT2X00_LIB_CRYPTO=y
--CONFIG_RT2X00_LIB_LEDS=y
-+# CONFIG_RT2X00_LIB_LEDS=y
- # CONFIG_RT2X00_DEBUG=y
- # CONFIG_RT2X00_LIB_DEBUGFS
- endif
-@@ -437,7 +437,7 @@ endif
+@@ -499,7 +499,7 @@ endif
# p54
CONFIG_P54_COMMON=m
# Atheros
CONFIG_ATH_COMMON=m
---- compat-wireless-2010-07-29.orig/include/linux/compat-2.6.25.h
-+++ compat-wireless-2010-07-29/include/linux/compat-2.6.25.h
-@@ -146,10 +146,12 @@ static inline void __hwrng_unregister(st
+--- a/include/linux/compat-2.6.25.h
++++ b/include/linux/compat-2.6.25.h
+@@ -148,10 +148,12 @@ static inline void __hwrng_unregister(st
hwrng_unregister(rng);
}
/**
* The following things are out of ./include/linux/kernel.h
---- compat-wireless-2010-07-29.orig/drivers/net/wireless/ath/ath9k/gpio.c
-+++ compat-wireless-2010-07-29/drivers/net/wireless/ath/ath9k/gpio.c
+--- a/drivers/net/wireless/ath/ath9k/gpio.c
++++ b/drivers/net/wireless/ath/ath9k/gpio.c
@@ -20,6 +20,7 @@
/* LED functions */
/********************************/
/*******************/
/* Rfkill */
---- compat-wireless-2010-07-29.orig/drivers/net/wireless/ath/ath9k/pci.c
-+++ compat-wireless-2010-07-29/drivers/net/wireless/ath/ath9k/pci.c
+--- a/drivers/net/wireless/ath/ath9k/pci.c
++++ b/drivers/net/wireless/ath/ath9k/pci.c
@@ -273,7 +273,9 @@ static int ath_pci_suspend(struct pci_de
struct ath_wiphy *aphy = hw->priv;
struct ath_softc *sc = aphy->sc;
return 0;
}
---- compat-wireless-2010-07-29.orig/drivers/net/wireless/ath/ath9k/ath9k.h
-+++ compat-wireless-2010-07-29/drivers/net/wireless/ath/ath9k/ath9k.h
-@@ -465,6 +465,7 @@ void ath9k_btcoex_timer_pause(struct ath
+--- a/drivers/net/wireless/ath/ath9k/ath9k.h
++++ b/drivers/net/wireless/ath/ath9k/ath9k.h
+@@ -457,6 +457,7 @@ void ath9k_btcoex_timer_pause(struct ath
/********************/
/* LED Control */
/********************/
#define ATH_LED_PIN_DEF 1
#define ATH_LED_PIN_9287 8
-@@ -489,6 +490,7 @@ struct ath_led {
+@@ -481,6 +482,7 @@ struct ath_led {
void ath_init_leds(struct ath_softc *sc);
void ath_deinit_leds(struct ath_softc *sc);
/********************/
/* Main driver core */
-@@ -586,6 +588,7 @@ struct ath_softc {
+@@ -578,6 +580,7 @@ struct ath_softc {
enum wireless_mode cur_rate_mode;
struct ieee80211_supported_band sbands[IEEE80211_NUM_BANDS];
struct ath_led radio_led;
struct ath_led assoc_led;
struct ath_led tx_led;
-@@ -595,6 +598,7 @@ struct ath_softc {
+@@ -587,6 +590,7 @@ struct ath_softc {
int led_off_duration;
int led_on_cnt;
int led_off_cnt;
int beacon_interval;
---- compat-wireless-2010-07-29.orig/drivers/net/wireless/ath/ath9k/init.c
-+++ compat-wireless-2010-07-29/drivers/net/wireless/ath/ath9k/init.c
-@@ -34,9 +34,11 @@ int modparam_nohwcrypt;
- module_param_named(nohwcrypt, modparam_nohwcrypt, int, 0444);
- MODULE_PARM_DESC(nohwcrypt, "Disable hardware encryption");
-
-+#ifdef CONFIG_MAC80211_LEDS
- int led_blink = 1;
- module_param_named(blink, led_blink, int, 0444);
- MODULE_PARM_DESC(blink, "Enable LED blink on activity");
-+#endif
-
- /* We use the hw_value as an index into our private channel structure */
-
-@@ -757,7 +759,9 @@ int ath9k_init_device(u16 devid, struct
+--- a/drivers/net/wireless/ath/ath9k/init.c
++++ b/drivers/net/wireless/ath/ath9k/init.c
+@@ -757,7 +757,9 @@ int ath9k_init_device(u16 devid, struct
INIT_DELAYED_WORK(&sc->wiphy_work, ath9k_wiphy_work);
sc->wiphy_scheduler_int = msecs_to_jiffies(500);
ath_start_rfkill_poll(sc);
return 0;
-@@ -810,7 +814,9 @@ void ath9k_deinit_device(struct ath_soft
+@@ -810,7 +812,9 @@ void ath9k_deinit_device(struct ath_soft
ath9k_ps_wakeup(sc);
wiphy_rfkill_stop_polling(sc->hw->wiphy);
for (i = 0; i < sc->num_sec_wiphy; i++) {
struct ath_wiphy *aphy = sc->sec_wiphy[i];
---- compat-wireless-2010-07-29.orig/drivers/net/wireless/ath/ath9k/main.c
-+++ compat-wireless-2010-07-29/drivers/net/wireless/ath/ath9k/main.c
-@@ -868,9 +868,11 @@ void ath_radio_enable(struct ath_softc *
+--- a/drivers/net/wireless/ath/ath9k/main.c
++++ b/drivers/net/wireless/ath/ath9k/main.c
+@@ -869,9 +869,11 @@ void ath_radio_enable(struct ath_softc *
ath9k_hw_set_interrupts(ah, ah->imask);
/* Enable LED */
ieee80211_wake_queues(hw);
ath9k_ps_restore(sc);
-@@ -889,10 +891,12 @@ void ath_radio_disable(struct ath_softc
+@@ -890,10 +892,12 @@ void ath_radio_disable(struct ath_softc
* Keep the LED on when the radio is disabled
* during idle unassociated state.
*/
/* Disable interrupts */
ath9k_hw_set_interrupts(ah, 0);
-@@ -1303,8 +1307,10 @@ static void ath9k_stop(struct ieee80211_
+@@ -1304,8 +1308,10 @@ static void ath9k_stop(struct ieee80211_
aphy->state = ATH_WIPHY_INACTIVE;
cancel_delayed_work_sync(&sc->tx_complete_work);
cancel_work_sync(&sc->paprd_work);
---- compat-wireless-2010-07-29.orig/net/mac80211/iface.c
-+++ compat-wireless-2010-07-29/net/mac80211/iface.c
+--- a/net/mac80211/iface.c
++++ b/net/mac80211/iface.c
@@ -21,7 +21,9 @@
#include "sta_info.h"
#include "debugfs_netdev.h"
#include "driver-ops.h"
#include "wme.h"
-@@ -189,7 +191,9 @@ static int ieee80211_open(struct net_dev
- goto err_del_bss;
+@@ -201,7 +203,9 @@ static int ieee80211_do_open(struct net_
+ napi_enable(&local->napi);
/* we're brought up, everything changes */
hw_reconf_flags = ~0;
+#ifdef CONFIG_MAC80211_LEDS
}
/*
---- compat-wireless-2010-07-29.orig/net/mac80211/main.c
-+++ compat-wireless-2010-07-29/net/mac80211/main.c
+--- a/net/mac80211/main.c
++++ b/net/mac80211/main.c
@@ -29,7 +29,9 @@
#include "rate.h"
#include "mesh.h"
#include "cfg.h"
#include "debugfs.h"
-@@ -674,7 +676,9 @@ int ieee80211_register_hw(struct ieee802
+@@ -778,7 +780,9 @@ int ieee80211_register_hw(struct ieee802
rtnl_unlock();
local->network_latency_notifier.notifier_call =
ieee80211_max_network_latency;
-@@ -699,7 +703,9 @@ int ieee80211_register_hw(struct ieee802
- &local->network_latency_notifier);
+@@ -808,7 +812,9 @@ int ieee80211_register_hw(struct ieee802
rtnl_lock();
+ #endif
fail_pm_qos:
+#ifdef CONFIG_MAC80211_LEDS
ieee80211_led_exit(local);
ieee80211_remove_interfaces(local);
fail_rate:
rtnl_unlock();
-@@ -755,7 +761,9 @@ void ieee80211_unregister_hw(struct ieee
+@@ -872,7 +878,9 @@ void ieee80211_unregister_hw(struct ieee
destroy_workqueue(local->workqueue);
wiphy_unregister(local->hw.wiphy);
ieee80211_wep_free(local);
kfree(local->int_scan_req);
}
EXPORT_SYMBOL(ieee80211_unregister_hw);
---- compat-wireless-2010-07-29.orig/net/mac80211/mlme.c
-+++ compat-wireless-2010-07-29/net/mac80211/mlme.c
+--- a/net/mac80211/mlme.c
++++ b/net/mac80211/mlme.c
@@ -26,7 +26,9 @@
#include "ieee80211_i.h"
#include "driver-ops.h"
#define IEEE80211_MAX_PROBE_TRIES 5
-@@ -872,7 +874,9 @@ static void ieee80211_set_associated(str
+@@ -879,7 +881,9 @@ static void ieee80211_set_associated(str
*/
sdata->u.mgd.wmm_last_param_set = -1;
if (local->hw.flags & IEEE80211_HW_NEED_DTIM_PERIOD)
bss_conf->dtim_period = bss->dtim_period;
-@@ -958,7 +962,9 @@ static void ieee80211_set_disassoc(struc
+@@ -965,7 +969,9 @@ static void ieee80211_set_disassoc(struc
changed |= ieee80211_reset_erp_info(sdata);
changed |= BSS_CHANGED_ASSOC;
sdata->vif.bss_conf.assoc = false;
---- compat-wireless-2010-07-29.orig/net/mac80211/pm.c
-+++ compat-wireless-2010-07-29/net/mac80211/pm.c
+--- a/net/mac80211/pm.c
++++ b/net/mac80211/pm.c
@@ -4,7 +4,9 @@
#include "ieee80211_i.h"
#include "mesh.h"
int __ieee80211_suspend(struct ieee80211_hw *hw)
{
---- compat-wireless-2010-07-29.orig/net/mac80211/rx.c
-+++ compat-wireless-2010-07-29/net/mac80211/rx.c
+--- a/net/mac80211/rx.c
++++ b/net/mac80211/rx.c
@@ -21,7 +21,9 @@
#include "ieee80211_i.h"
#include "mesh.h"
#include "wep.h"
#include "wpa.h"
-@@ -1342,8 +1344,10 @@ ieee80211_rx_h_defragment(struct ieee802
+@@ -1377,8 +1379,10 @@ ieee80211_rx_h_defragment(struct ieee802
rx->sta->rx_packets++;
if (is_multicast_ether_addr(hdr->addr1))
rx->local->dot11MulticastReceivedFrameCount++;
return RX_CONTINUE;
}
---- compat-wireless-2010-07-29.orig/net/mac80211/status.c
-+++ compat-wireless-2010-07-29/net/mac80211/status.c
+--- a/net/mac80211/status.c
++++ b/net/mac80211/status.c
@@ -13,7 +13,9 @@
#include "ieee80211_i.h"
#include "rate.h"
void ieee80211_tx_status_irqsafe(struct ieee80211_hw *hw,
-@@ -247,7 +249,9 @@ void ieee80211_tx_status(struct ieee8021
+@@ -246,7 +248,9 @@ void ieee80211_tx_status(struct ieee8021
rcu_read_unlock();
/* SNMP counters
* Fragments are passed to low-level drivers as separate skbs, so these
---- compat-wireless-2010-07-29.orig/net/mac80211/tx.c
-+++ compat-wireless-2010-07-29/net/mac80211/tx.c
+--- a/net/mac80211/tx.c
++++ b/net/mac80211/tx.c
@@ -26,7 +26,9 @@
#include "ieee80211_i.h"
#include "mesh.h"
#include "wep.h"
#include "wpa.h"
-@@ -1312,7 +1314,9 @@ static int __ieee80211_tx(struct ieee802
+@@ -1334,7 +1336,9 @@ static int __ieee80211_tx(struct ieee802
}
*skbp = skb = next;
fragm = true;
}
---- compat-wireless-2010-07-29.orig/net/mac80211/util.c
-+++ compat-wireless-2010-07-29/net/mac80211/util.c
+--- a/net/mac80211/util.c
++++ b/net/mac80211/util.c
@@ -29,7 +29,9 @@
#include "rate.h"
#include "mesh.h"
#include "wep.h"
/* privid for wiphys to determine whether they belong to us or not */
-@@ -1107,7 +1109,9 @@ u32 ieee80211_sta_get_rates(struct ieee8
+@@ -1110,7 +1112,9 @@ u32 ieee80211_sta_get_rates(struct ieee8
void ieee80211_stop_device(struct ieee80211_local *local)
{
cancel_work_sync(&local->reconfig_filter);
-@@ -1141,7 +1145,9 @@ int ieee80211_reconfig(struct ieee80211_
+@@ -1144,7 +1148,9 @@ int ieee80211_reconfig(struct ieee80211_
return res;
}
+++ /dev/null
-From: Christian Lamparter <chunkeey@googlemail.com>\r
-\r
-Michael reported that p54* never really entered power\r
-save mode, even tough it was enabled.\r
-\r
-It turned out that upon a power save mode change the\r
-firmware will set a special flag onto the last outgoing\r
-frame tx status (which in this case is almost always the\r
-designated PSM nullfunc frame). This flag confused the\r
-driver; It erroneously reported transmission failures\r
-to the stack, which then generated the next nullfunc.\r
-and so on...\r
-\r
-Cc: <stable@kernel.org>\r
-Reported-by: Michael Buesch <mb@bu3sch.de>\r
-Tested-by: Michael Buesch <mb@bu3sch.de>\r
-Signed-off-by: Christian Lamparter <chunkeey@googlemail.com>\r
----\r
----
- drivers/net/wireless/p54/txrx.c | 2 +-
- 1 file changed, 1 insertion(+), 1 deletion(-)
-
---- compat-wireless-2010-07-29.orig/drivers/net/wireless/p54/txrx.c
-+++ compat-wireless-2010-07-29/drivers/net/wireless/p54/txrx.c
-@@ -446,7 +446,7 @@ static void p54_rx_frame_sent(struct p54
- }
-
- if (!(info->flags & IEEE80211_TX_CTL_NO_ACK) &&
-- (!payload->status))
-+ !(payload->status & P54_TX_FAILED))
- info->flags |= IEEE80211_TX_STAT_ACK;
- if (payload->status & P54_TX_PSM_CANCELLED)
- info->flags |= IEEE80211_TX_STAT_TX_FILTERED;