diff options
author | Johannes Berg <johannes.berg@intel.com> | 2014-11-18 11:21:19 -0500 |
---|---|---|
committer | Emmanuel Grumbach <emmanuel.grumbach@intel.com> | 2014-11-23 13:07:15 -0500 |
commit | effd05ac479b80641835f9126bbe93146686c2b8 (patch) | |
tree | dd0d0a4339f5ef274faa1273f4d9da977700d6c3 /drivers/net/wireless/iwlwifi/mvm | |
parent | b975e55adcda54aa778e9b4f5eb162891f952cde (diff) |
iwlwifi: mvm: support random MAC address for scanning
For background and scheduled scan, using the new unified scan API,
support random MAC address scanning.
Unfortunately, the firmware right now doesn't support randomising
itself, so for now do it on the host - we'll change this once the
firmware supports randomising the address for each scan iteration
using the address/mask.
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
Diffstat (limited to 'drivers/net/wireless/iwlwifi/mvm')
-rw-r--r-- | drivers/net/wireless/iwlwifi/mvm/mac80211.c | 6 | ||||
-rw-r--r-- | drivers/net/wireless/iwlwifi/mvm/scan.c | 35 |
2 files changed, 34 insertions, 7 deletions
diff --git a/drivers/net/wireless/iwlwifi/mvm/mac80211.c b/drivers/net/wireless/iwlwifi/mvm/mac80211.c index bc5883a38f05..d37d5a8b383e 100644 --- a/drivers/net/wireless/iwlwifi/mvm/mac80211.c +++ b/drivers/net/wireless/iwlwifi/mvm/mac80211.c | |||
@@ -344,8 +344,12 @@ int iwl_mvm_mac_setup_register(struct iwl_mvm *mvm) | |||
344 | } | 344 | } |
345 | 345 | ||
346 | if (mvm->fw->ucode_capa.api[0] & IWL_UCODE_TLV_API_LMAC_SCAN || | 346 | if (mvm->fw->ucode_capa.api[0] & IWL_UCODE_TLV_API_LMAC_SCAN || |
347 | mvm->fw->ucode_capa.capa[0] & IWL_UCODE_TLV_CAPA_UMAC_SCAN) | 347 | mvm->fw->ucode_capa.capa[0] & IWL_UCODE_TLV_CAPA_UMAC_SCAN) { |
348 | hw->flags |= IEEE80211_SINGLE_HW_SCAN_ON_ALL_BANDS; | 348 | hw->flags |= IEEE80211_SINGLE_HW_SCAN_ON_ALL_BANDS; |
349 | hw->wiphy->features |= | ||
350 | NL80211_FEATURE_SCHED_SCAN_RANDOM_MAC_ADDR | | ||
351 | NL80211_FEATURE_SCAN_RANDOM_MAC_ADDR; | ||
352 | } | ||
349 | 353 | ||
350 | hw->sta_data_size = sizeof(struct iwl_mvm_sta); | 354 | hw->sta_data_size = sizeof(struct iwl_mvm_sta); |
351 | hw->vif_data_size = sizeof(struct iwl_mvm_vif); | 355 | hw->vif_data_size = sizeof(struct iwl_mvm_vif); |
diff --git a/drivers/net/wireless/iwlwifi/mvm/scan.c b/drivers/net/wireless/iwlwifi/mvm/scan.c index 219174597ff0..54303d935c57 100644 --- a/drivers/net/wireless/iwlwifi/mvm/scan.c +++ b/drivers/net/wireless/iwlwifi/mvm/scan.c | |||
@@ -1224,14 +1224,25 @@ static u8 *iwl_mvm_copy_and_insert_ds_elem(struct iwl_mvm *mvm, const u8 *ies, | |||
1224 | static void | 1224 | static void |
1225 | iwl_mvm_build_unified_scan_probe(struct iwl_mvm *mvm, struct ieee80211_vif *vif, | 1225 | iwl_mvm_build_unified_scan_probe(struct iwl_mvm *mvm, struct ieee80211_vif *vif, |
1226 | struct ieee80211_scan_ies *ies, | 1226 | struct ieee80211_scan_ies *ies, |
1227 | struct iwl_scan_probe_req *preq) | 1227 | struct iwl_scan_probe_req *preq, |
1228 | const u8 *mac_addr, const u8 *mac_addr_mask) | ||
1228 | { | 1229 | { |
1229 | struct ieee80211_mgmt *frame = (struct ieee80211_mgmt *)preq->buf; | 1230 | struct ieee80211_mgmt *frame = (struct ieee80211_mgmt *)preq->buf; |
1230 | u8 *pos, *newpos; | 1231 | u8 *pos, *newpos; |
1231 | 1232 | ||
1233 | /* | ||
1234 | * Unfortunately, right now the offload scan doesn't support randomising | ||
1235 | * within the firmware, so until the firmware API is ready we implement | ||
1236 | * it in the driver. This means that the scan iterations won't really be | ||
1237 | * random, only when it's restarted, but at least that helps a bit. | ||
1238 | */ | ||
1239 | if (mac_addr) | ||
1240 | get_random_mask_addr(frame->sa, mac_addr, mac_addr_mask); | ||
1241 | else | ||
1242 | memcpy(frame->sa, vif->addr, ETH_ALEN); | ||
1243 | |||
1232 | frame->frame_control = cpu_to_le16(IEEE80211_STYPE_PROBE_REQ); | 1244 | frame->frame_control = cpu_to_le16(IEEE80211_STYPE_PROBE_REQ); |
1233 | eth_broadcast_addr(frame->da); | 1245 | eth_broadcast_addr(frame->da); |
1234 | memcpy(frame->sa, vif->addr, ETH_ALEN); | ||
1235 | eth_broadcast_addr(frame->bssid); | 1246 | eth_broadcast_addr(frame->bssid); |
1236 | frame->seq_ctrl = 0; | 1247 | frame->seq_ctrl = 0; |
1237 | 1248 | ||
@@ -1375,7 +1386,10 @@ int iwl_mvm_unified_scan_lmac(struct iwl_mvm *mvm, | |||
1375 | preq = (void *)(cmd->data + sizeof(struct iwl_scan_channel_cfg_lmac) * | 1386 | preq = (void *)(cmd->data + sizeof(struct iwl_scan_channel_cfg_lmac) * |
1376 | mvm->fw->ucode_capa.n_scan_channels); | 1387 | mvm->fw->ucode_capa.n_scan_channels); |
1377 | 1388 | ||
1378 | iwl_mvm_build_unified_scan_probe(mvm, vif, &req->ies, preq); | 1389 | iwl_mvm_build_unified_scan_probe(mvm, vif, &req->ies, preq, |
1390 | req->req.flags & NL80211_SCAN_FLAG_RANDOM_ADDR ? | ||
1391 | req->req.mac_addr : NULL, | ||
1392 | req->req.mac_addr_mask); | ||
1379 | 1393 | ||
1380 | ret = iwl_mvm_send_cmd(mvm, &hcmd); | 1394 | ret = iwl_mvm_send_cmd(mvm, &hcmd); |
1381 | if (!ret) { | 1395 | if (!ret) { |
@@ -1466,7 +1480,10 @@ int iwl_mvm_unified_sched_scan_lmac(struct iwl_mvm *mvm, | |||
1466 | preq = (void *)(cmd->data + sizeof(struct iwl_scan_channel_cfg_lmac) * | 1480 | preq = (void *)(cmd->data + sizeof(struct iwl_scan_channel_cfg_lmac) * |
1467 | mvm->fw->ucode_capa.n_scan_channels); | 1481 | mvm->fw->ucode_capa.n_scan_channels); |
1468 | 1482 | ||
1469 | iwl_mvm_build_unified_scan_probe(mvm, vif, ies, preq); | 1483 | iwl_mvm_build_unified_scan_probe(mvm, vif, ies, preq, |
1484 | req->flags & NL80211_SCAN_FLAG_RANDOM_ADDR ? | ||
1485 | req->mac_addr : NULL, | ||
1486 | req->mac_addr_mask); | ||
1470 | 1487 | ||
1471 | ret = iwl_mvm_send_cmd(mvm, &hcmd); | 1488 | ret = iwl_mvm_send_cmd(mvm, &hcmd); |
1472 | if (!ret) { | 1489 | if (!ret) { |
@@ -1796,7 +1813,10 @@ int iwl_mvm_scan_umac(struct iwl_mvm *mvm, struct ieee80211_vif *vif, | |||
1796 | sec_part->schedule[0].iter_count = 1; | 1813 | sec_part->schedule[0].iter_count = 1; |
1797 | sec_part->delay = 0; | 1814 | sec_part->delay = 0; |
1798 | 1815 | ||
1799 | iwl_mvm_build_unified_scan_probe(mvm, vif, &req->ies, &sec_part->preq); | 1816 | iwl_mvm_build_unified_scan_probe(mvm, vif, &req->ies, &sec_part->preq, |
1817 | req->req.flags & NL80211_SCAN_FLAG_RANDOM_ADDR ? | ||
1818 | req->req.mac_addr : NULL, | ||
1819 | req->req.mac_addr_mask); | ||
1800 | 1820 | ||
1801 | iwl_mvm_scan_fill_ssids(sec_part->direct_scan, req->req.ssids, | 1821 | iwl_mvm_scan_fill_ssids(sec_part->direct_scan, req->req.ssids, |
1802 | req->req.n_ssids, 0); | 1822 | req->req.n_ssids, 0); |
@@ -1901,7 +1921,10 @@ int iwl_mvm_sched_scan_umac(struct iwl_mvm *mvm, struct ieee80211_vif *vif, | |||
1901 | 1921 | ||
1902 | sec_part->delay = 0; | 1922 | sec_part->delay = 0; |
1903 | 1923 | ||
1904 | iwl_mvm_build_unified_scan_probe(mvm, vif, ies, &sec_part->preq); | 1924 | iwl_mvm_build_unified_scan_probe(mvm, vif, ies, &sec_part->preq, |
1925 | req->flags & NL80211_SCAN_FLAG_RANDOM_ADDR ? | ||
1926 | req->mac_addr : NULL, | ||
1927 | req->mac_addr_mask); | ||
1905 | 1928 | ||
1906 | ret = iwl_mvm_send_cmd(mvm, &hcmd); | 1929 | ret = iwl_mvm_send_cmd(mvm, &hcmd); |
1907 | if (!ret) { | 1930 | if (!ret) { |