diff options
Diffstat (limited to 'drivers/net/wireless/intel/iwlwifi/mvm/utils.c')
-rw-r--r-- | drivers/net/wireless/intel/iwlwifi/mvm/utils.c | 71 |
1 files changed, 0 insertions, 71 deletions
diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/utils.c b/drivers/net/wireless/intel/iwlwifi/mvm/utils.c index 2ea74abad73d..328035640669 100644 --- a/drivers/net/wireless/intel/iwlwifi/mvm/utils.c +++ b/drivers/net/wireless/intel/iwlwifi/mvm/utils.c | |||
@@ -1389,74 +1389,3 @@ void iwl_mvm_get_sync_time(struct iwl_mvm *mvm, u32 *gp2, u64 *boottime) | |||
1389 | iwl_mvm_power_update_device(mvm); | 1389 | iwl_mvm_power_update_device(mvm); |
1390 | } | 1390 | } |
1391 | } | 1391 | } |
1392 | |||
1393 | int iwl_mvm_send_lqm_cmd(struct ieee80211_vif *vif, | ||
1394 | enum iwl_lqm_cmd_operatrions operation, | ||
1395 | u32 duration, u32 timeout) | ||
1396 | { | ||
1397 | struct iwl_mvm_vif *mvm_vif = iwl_mvm_vif_from_mac80211(vif); | ||
1398 | struct iwl_link_qual_msrmnt_cmd cmd = { | ||
1399 | .cmd_operation = cpu_to_le32(operation), | ||
1400 | .mac_id = cpu_to_le32(mvm_vif->id), | ||
1401 | .measurement_time = cpu_to_le32(duration), | ||
1402 | .timeout = cpu_to_le32(timeout), | ||
1403 | }; | ||
1404 | u32 cmdid = | ||
1405 | iwl_cmd_id(LINK_QUALITY_MEASUREMENT_CMD, MAC_CONF_GROUP, 0); | ||
1406 | int ret; | ||
1407 | |||
1408 | if (!fw_has_capa(&mvm_vif->mvm->fw->ucode_capa, | ||
1409 | IWL_UCODE_TLV_CAPA_LQM_SUPPORT)) | ||
1410 | return -EOPNOTSUPP; | ||
1411 | |||
1412 | if (vif->type != NL80211_IFTYPE_STATION || vif->p2p) | ||
1413 | return -EINVAL; | ||
1414 | |||
1415 | switch (operation) { | ||
1416 | case LQM_CMD_OPERATION_START_MEASUREMENT: | ||
1417 | if (iwl_mvm_lqm_active(mvm_vif->mvm)) | ||
1418 | return -EBUSY; | ||
1419 | if (!vif->bss_conf.assoc) | ||
1420 | return -EINVAL; | ||
1421 | mvm_vif->lqm_active = true; | ||
1422 | break; | ||
1423 | case LQM_CMD_OPERATION_STOP_MEASUREMENT: | ||
1424 | if (!iwl_mvm_lqm_active(mvm_vif->mvm)) | ||
1425 | return -EINVAL; | ||
1426 | break; | ||
1427 | default: | ||
1428 | return -EINVAL; | ||
1429 | } | ||
1430 | |||
1431 | ret = iwl_mvm_send_cmd_pdu(mvm_vif->mvm, cmdid, 0, sizeof(cmd), | ||
1432 | &cmd); | ||
1433 | |||
1434 | /* command failed - roll back lqm_active state */ | ||
1435 | if (ret) { | ||
1436 | mvm_vif->lqm_active = | ||
1437 | operation == LQM_CMD_OPERATION_STOP_MEASUREMENT; | ||
1438 | } | ||
1439 | |||
1440 | return ret; | ||
1441 | } | ||
1442 | |||
1443 | static void iwl_mvm_lqm_active_iterator(void *_data, u8 *mac, | ||
1444 | struct ieee80211_vif *vif) | ||
1445 | { | ||
1446 | struct iwl_mvm_vif *mvm_vif = iwl_mvm_vif_from_mac80211(vif); | ||
1447 | bool *lqm_active = _data; | ||
1448 | |||
1449 | *lqm_active = *lqm_active || mvm_vif->lqm_active; | ||
1450 | } | ||
1451 | |||
1452 | bool iwl_mvm_lqm_active(struct iwl_mvm *mvm) | ||
1453 | { | ||
1454 | bool ret = false; | ||
1455 | |||
1456 | lockdep_assert_held(&mvm->mutex); | ||
1457 | ieee80211_iterate_active_interfaces_atomic( | ||
1458 | mvm->hw, IEEE80211_IFACE_ITER_NORMAL, | ||
1459 | iwl_mvm_lqm_active_iterator, &ret); | ||
1460 | |||
1461 | return ret; | ||
1462 | } | ||