From 7c50aea1ec953a4e70edc02105f7c7358c51ce0c Mon Sep 17 00:00:00 2001
From: Felix Fietkau <nbd@openwrt.org>
Date: Wed, 17 Oct 2012 18:53:46 +0000
Subject: [PATCH] mac80211: merge a client mode state handling fix, refresh
 patches

SVN-Revision: 33821
---
 .../mac80211/patches/300-pending_work.patch   | 59 +++++++++++++++++++
 .../524-mac80211_configure_antenna_gain.patch |  4 +-
 ...start-adding-support-for-core-rev-28.patch |  2 +-
 3 files changed, 62 insertions(+), 3 deletions(-)

diff --git a/package/mac80211/patches/300-pending_work.patch b/package/mac80211/patches/300-pending_work.patch
index f7a0aede53..9a4b24e4ea 100644
--- a/package/mac80211/patches/300-pending_work.patch
+++ b/package/mac80211/patches/300-pending_work.patch
@@ -510,6 +510,29 @@
  
  	ieee80211_bss_info_change_notify(sdata, changed);
  }
+@@ -3526,6 +3572,7 @@ int ieee80211_mgd_deauth(struct ieee8021
+ {
+ 	struct ieee80211_if_managed *ifmgd = &sdata->u.mgd;
+ 	u8 frame_buf[DEAUTH_DISASSOC_LEN];
++	bool tx = !req->local_state_change;
+ 
+ 	mutex_lock(&ifmgd->mtx);
+ 
+@@ -3542,12 +3589,12 @@ int ieee80211_mgd_deauth(struct ieee8021
+ 	if (ifmgd->associated &&
+ 	    ether_addr_equal(ifmgd->associated->bssid, req->bssid)) {
+ 		ieee80211_set_disassoc(sdata, IEEE80211_STYPE_DEAUTH,
+-				       req->reason_code, true, frame_buf);
++				       req->reason_code, tx, frame_buf);
+ 	} else {
+ 		drv_mgd_prepare_tx(sdata->local, sdata);
+ 		ieee80211_send_deauth_disassoc(sdata, req->bssid,
+ 					       IEEE80211_STYPE_DEAUTH,
+-					       req->reason_code, true,
++					       req->reason_code, tx,
+ 					       frame_buf);
+ 	}
+ 
 --- a/net/mac80211/sta_info.c
 +++ b/net/mac80211/sta_info.c
 @@ -674,7 +674,7 @@ int __must_check __sta_info_destroy(stru
@@ -590,3 +613,39 @@
  
  	if (local->user_power_level >= 0)
  		power = min(power, local->user_power_level);
+--- a/include/net/cfg80211.h
++++ b/include/net/cfg80211.h
+@@ -1218,6 +1218,7 @@ struct cfg80211_deauth_request {
+ 	const u8 *ie;
+ 	size_t ie_len;
+ 	u16 reason_code;
++	bool local_state_change;
+ };
+ 
+ /**
+--- a/net/wireless/mlme.c
++++ b/net/wireless/mlme.c
+@@ -457,20 +457,14 @@ int __cfg80211_mlme_deauth(struct cfg802
+ 		.reason_code = reason,
+ 		.ie = ie,
+ 		.ie_len = ie_len,
++		.local_state_change = local_state_change,
+ 	};
+ 
+ 	ASSERT_WDEV_LOCK(wdev);
+ 
+-	if (local_state_change) {
+-		if (wdev->current_bss &&
+-		    ether_addr_equal(wdev->current_bss->pub.bssid, bssid)) {
+-			cfg80211_unhold_bss(wdev->current_bss);
+-			cfg80211_put_bss(&wdev->current_bss->pub);
+-			wdev->current_bss = NULL;
+-		}
+-
++	if (local_state_change && (!wdev->current_bss ||
++	    !ether_addr_equal(wdev->current_bss->pub.bssid, bssid)))
+ 		return 0;
+-	}
+ 
+ 	return rdev->ops->deauth(&rdev->wiphy, dev, &req);
+ }
diff --git a/package/mac80211/patches/524-mac80211_configure_antenna_gain.patch b/package/mac80211/patches/524-mac80211_configure_antenna_gain.patch
index b2870a8aa1..b3b4ebb2f3 100644
--- a/package/mac80211/patches/524-mac80211_configure_antenna_gain.patch
+++ b/package/mac80211/patches/524-mac80211_configure_antenna_gain.patch
@@ -161,7 +161,7 @@
  	CFG80211_TESTMODE_CMD(ieee80211_testmode_cmd)
 --- a/include/net/cfg80211.h
 +++ b/include/net/cfg80211.h
-@@ -1551,6 +1551,7 @@ struct cfg80211_gtk_rekey_data {
+@@ -1552,6 +1552,7 @@ struct cfg80211_gtk_rekey_data {
   *	the power passed is in mBm, to get dBm use MBM_TO_DBM().
   * @get_tx_power: store the current TX power into the dbm variable;
   *	return 0 if successful
@@ -169,7 +169,7 @@
   *
   * @set_wds_peer: set the WDS peer for a WDS interface
   *
-@@ -1750,6 +1751,7 @@ struct cfg80211_ops {
+@@ -1751,6 +1752,7 @@ struct cfg80211_ops {
  	int	(*set_tx_power)(struct wiphy *wiphy,
  				enum nl80211_tx_power_setting type, int mbm);
  	int	(*get_tx_power)(struct wiphy *wiphy, int *dbm);
diff --git a/package/mac80211/patches/851-brcmsmac-start-adding-support-for-core-rev-28.patch b/package/mac80211/patches/851-brcmsmac-start-adding-support-for-core-rev-28.patch
index 198af613cc..bfa9ff5b1a 100644
--- a/package/mac80211/patches/851-brcmsmac-start-adding-support-for-core-rev-28.patch
+++ b/package/mac80211/patches/851-brcmsmac-start-adding-support-for-core-rev-28.patch
@@ -1,7 +1,7 @@
 --- a/drivers/net/wireless/brcm80211/brcmsmac/mac80211_if.c
 +++ b/drivers/net/wireless/brcm80211/brcmsmac/mac80211_if.c
 @@ -97,6 +97,7 @@ static struct bcma_device_id brcms_corei
- //	BCMA_CORE(BCMA_MANUF_BCM, BCMA_CORE_80211, 17, BCMA_ANY_CLASS),
+ 	BCMA_CORE(BCMA_MANUF_BCM, BCMA_CORE_80211, 17, BCMA_ANY_CLASS),
  	BCMA_CORE(BCMA_MANUF_BCM, BCMA_CORE_80211, 23, BCMA_ANY_CLASS),
  	BCMA_CORE(BCMA_MANUF_BCM, BCMA_CORE_80211, 24, BCMA_ANY_CLASS),
 +//	BCMA_CORE(BCMA_MANUF_BCM, BCMA_CORE_80211, 28, BCMA_ANY_CLASS),
-- 
2.30.2