summaryrefslogtreecommitdiffstats
path: root/net/wireless/mlme.c
diff options
context:
space:
mode:
authorJohannes Berg <johannes.berg@intel.com>2013-02-21 17:36:01 +0100
committerJohannes Berg <johannes.berg@intel.com>2013-03-06 16:35:47 +0100
commitee2aca343c9aa64d277a75a5df043299dc84cfd9 (patch)
tree697ac55d4d0119e97ead3a530ebac8cf37922f78 /net/wireless/mlme.c
parentc8bb93f5f5d478a01db66127844d1d2dd30abec7 (diff)
downloadop-kernel-dev-ee2aca343c9aa64d277a75a5df043299dc84cfd9.zip
op-kernel-dev-ee2aca343c9aa64d277a75a5df043299dc84cfd9.tar.gz
cfg80211: add ability to override VHT capabilities
For testing it's sometimes useful to be able to override certain VHT capability advertisement, add the ability to do that in cfg80211. Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Diffstat (limited to 'net/wireless/mlme.c')
-rw-r--r--net/wireless/mlme.c35
1 files changed, 32 insertions, 3 deletions
diff --git a/net/wireless/mlme.c b/net/wireless/mlme.c
index 5a97ce6..c82adfe 100644
--- a/net/wireless/mlme.c
+++ b/net/wireless/mlme.c
@@ -343,6 +343,23 @@ void cfg80211_oper_and_ht_capa(struct ieee80211_ht_cap *ht_capa,
p1[i] &= p2[i];
}
+/* Do a logical ht_capa &= ht_capa_mask. */
+void cfg80211_oper_and_vht_capa(struct ieee80211_vht_cap *vht_capa,
+ const struct ieee80211_vht_cap *vht_capa_mask)
+{
+ int i;
+ u8 *p1, *p2;
+ if (!vht_capa_mask) {
+ memset(vht_capa, 0, sizeof(*vht_capa));
+ return;
+ }
+
+ p1 = (u8*)(vht_capa);
+ p2 = (u8*)(vht_capa_mask);
+ for (i = 0; i < sizeof(*vht_capa); i++)
+ p1[i] &= p2[i];
+}
+
int __cfg80211_mlme_assoc(struct cfg80211_registered_device *rdev,
struct net_device *dev,
struct ieee80211_channel *chan,
@@ -351,7 +368,9 @@ int __cfg80211_mlme_assoc(struct cfg80211_registered_device *rdev,
const u8 *ie, int ie_len, bool use_mfp,
struct cfg80211_crypto_settings *crypt,
u32 assoc_flags, struct ieee80211_ht_cap *ht_capa,
- struct ieee80211_ht_cap *ht_capa_mask)
+ struct ieee80211_ht_cap *ht_capa_mask,
+ struct ieee80211_vht_cap *vht_capa,
+ struct ieee80211_vht_cap *vht_capa_mask)
{
struct wireless_dev *wdev = dev->ieee80211_ptr;
struct cfg80211_assoc_request req;
@@ -388,6 +407,13 @@ int __cfg80211_mlme_assoc(struct cfg80211_registered_device *rdev,
sizeof(req.ht_capa_mask));
cfg80211_oper_and_ht_capa(&req.ht_capa_mask,
rdev->wiphy.ht_capa_mod_mask);
+ if (vht_capa)
+ memcpy(&req.vht_capa, vht_capa, sizeof(req.vht_capa));
+ if (vht_capa_mask)
+ memcpy(&req.vht_capa_mask, vht_capa_mask,
+ sizeof(req.vht_capa_mask));
+ cfg80211_oper_and_vht_capa(&req.vht_capa_mask,
+ rdev->wiphy.vht_capa_mod_mask);
req.bss = cfg80211_get_bss(&rdev->wiphy, chan, bssid, ssid, ssid_len,
WLAN_CAPABILITY_ESS, WLAN_CAPABILITY_ESS);
@@ -422,7 +448,9 @@ int cfg80211_mlme_assoc(struct cfg80211_registered_device *rdev,
const u8 *ie, int ie_len, bool use_mfp,
struct cfg80211_crypto_settings *crypt,
u32 assoc_flags, struct ieee80211_ht_cap *ht_capa,
- struct ieee80211_ht_cap *ht_capa_mask)
+ struct ieee80211_ht_cap *ht_capa_mask,
+ struct ieee80211_vht_cap *vht_capa,
+ struct ieee80211_vht_cap *vht_capa_mask)
{
struct wireless_dev *wdev = dev->ieee80211_ptr;
int err;
@@ -431,7 +459,8 @@ int cfg80211_mlme_assoc(struct cfg80211_registered_device *rdev,
wdev_lock(wdev);
err = __cfg80211_mlme_assoc(rdev, dev, chan, bssid, prev_bssid,
ssid, ssid_len, ie, ie_len, use_mfp, crypt,
- assoc_flags, ht_capa, ht_capa_mask);
+ assoc_flags, ht_capa, ht_capa_mask,
+ vht_capa, vht_capa_mask);
wdev_unlock(wdev);
mutex_unlock(&rdev->devlist_mtx);
OpenPOWER on IntegriCloud