提交 0166230c 编写于 作者: J Johannes Berg 提交者: Emmanuel Grumbach

iwlwifi: mvm: remove update type argument from quota update

It turns out that adding the update type argument was pointless as
quota update is never called from the add_interface() callback.
Therefore, IWL_MVM_QUOTA_UPDATE_TYPE_NEW isn't actually needed and
then only a "disabled_vif" argument is needed for the upcoming CSA
work.

Remove the whole enum iwl_mvm_quota_update_type and pass the right
arguments (always NULL for disabled vif right now) to the function
in all current call sites.
Signed-off-by: NJohannes Berg <johannes.berg@intel.com>
Reviewed-by: NLuciano Coelho <luciano.coelho@intel.com>
Signed-off-by: NEmmanuel Grumbach <emmanuel.grumbach@intel.com>
上级 494983e0
...@@ -834,8 +834,7 @@ static void iwl_mvm_mac_restart_complete(struct ieee80211_hw *hw) ...@@ -834,8 +834,7 @@ static void iwl_mvm_mac_restart_complete(struct ieee80211_hw *hw)
clear_bit(IWL_MVM_STATUS_IN_HW_RESTART, &mvm->status); clear_bit(IWL_MVM_STATUS_IN_HW_RESTART, &mvm->status);
iwl_mvm_d0i3_enable_tx(mvm, NULL); iwl_mvm_d0i3_enable_tx(mvm, NULL);
ret = iwl_mvm_update_quotas(mvm, NULL, ret = iwl_mvm_update_quotas(mvm, NULL);
IWL_MVM_QUOTA_UPDATE_TYPE_REGULAR);
if (ret) if (ret)
IWL_ERR(mvm, "Failed to update quotas after restart (%d)\n", IWL_ERR(mvm, "Failed to update quotas after restart (%d)\n",
ret); ret);
...@@ -1422,8 +1421,7 @@ static void iwl_mvm_bss_info_changed_station(struct iwl_mvm *mvm, ...@@ -1422,8 +1421,7 @@ static void iwl_mvm_bss_info_changed_station(struct iwl_mvm *mvm,
if (changes & BSS_CHANGED_ASSOC) { if (changes & BSS_CHANGED_ASSOC) {
if (bss_conf->assoc) { if (bss_conf->assoc) {
/* add quota for this interface */ /* add quota for this interface */
ret = iwl_mvm_update_quotas(mvm, vif, ret = iwl_mvm_update_quotas(mvm, NULL);
IWL_MVM_QUOTA_UPDATE_TYPE_NEW);
if (ret) { if (ret) {
IWL_ERR(mvm, "failed to update quotas\n"); IWL_ERR(mvm, "failed to update quotas\n");
return; return;
...@@ -1471,8 +1469,7 @@ static void iwl_mvm_bss_info_changed_station(struct iwl_mvm *mvm, ...@@ -1471,8 +1469,7 @@ static void iwl_mvm_bss_info_changed_station(struct iwl_mvm *mvm,
mvm->d0i3_ap_sta_id = IWL_MVM_STATION_COUNT; mvm->d0i3_ap_sta_id = IWL_MVM_STATION_COUNT;
mvmvif->ap_sta_id = IWL_MVM_STATION_COUNT; mvmvif->ap_sta_id = IWL_MVM_STATION_COUNT;
/* remove quota for this interface */ /* remove quota for this interface */
ret = iwl_mvm_update_quotas(mvm, NULL, ret = iwl_mvm_update_quotas(mvm, NULL);
IWL_MVM_QUOTA_UPDATE_TYPE_REGULAR);
if (ret) if (ret)
IWL_ERR(mvm, "failed to update quotas\n"); IWL_ERR(mvm, "failed to update quotas\n");
...@@ -1571,7 +1568,7 @@ static int iwl_mvm_start_ap_ibss(struct ieee80211_hw *hw, ...@@ -1571,7 +1568,7 @@ static int iwl_mvm_start_ap_ibss(struct ieee80211_hw *hw,
/* power updated needs to be done before quotas */ /* power updated needs to be done before quotas */
iwl_mvm_power_update_mac(mvm); iwl_mvm_power_update_mac(mvm);
ret = iwl_mvm_update_quotas(mvm, vif, IWL_MVM_QUOTA_UPDATE_TYPE_NEW); ret = iwl_mvm_update_quotas(mvm, NULL);
if (ret) if (ret)
goto out_quota_failed; goto out_quota_failed;
...@@ -1620,7 +1617,7 @@ static void iwl_mvm_stop_ap_ibss(struct ieee80211_hw *hw, ...@@ -1620,7 +1617,7 @@ static void iwl_mvm_stop_ap_ibss(struct ieee80211_hw *hw,
if (vif->p2p && mvm->p2p_device_vif) if (vif->p2p && mvm->p2p_device_vif)
iwl_mvm_mac_ctxt_changed(mvm, mvm->p2p_device_vif, false); iwl_mvm_mac_ctxt_changed(mvm, mvm->p2p_device_vif, false);
iwl_mvm_update_quotas(mvm, NULL, IWL_MVM_QUOTA_UPDATE_TYPE_REGULAR); iwl_mvm_update_quotas(mvm, NULL);
iwl_mvm_send_rm_bcast_sta(mvm, &mvmvif->bcast_sta); iwl_mvm_send_rm_bcast_sta(mvm, &mvmvif->bcast_sta);
iwl_mvm_binding_remove_vif(mvm, vif); iwl_mvm_binding_remove_vif(mvm, vif);
...@@ -2406,15 +2403,14 @@ static int iwl_mvm_assign_vif_chanctx(struct ieee80211_hw *hw, ...@@ -2406,15 +2403,14 @@ static int iwl_mvm_assign_vif_chanctx(struct ieee80211_hw *hw,
*/ */
if (vif->type == NL80211_IFTYPE_MONITOR) { if (vif->type == NL80211_IFTYPE_MONITOR) {
mvmvif->monitor_active = true; mvmvif->monitor_active = true;
ret = iwl_mvm_update_quotas(mvm, vif, ret = iwl_mvm_update_quotas(mvm, NULL);
IWL_MVM_QUOTA_UPDATE_TYPE_NEW);
if (ret) if (ret)
goto out_remove_binding; goto out_remove_binding;
} }
/* Handle binding during CSA */ /* Handle binding during CSA */
if (vif->type == NL80211_IFTYPE_AP) { if (vif->type == NL80211_IFTYPE_AP) {
iwl_mvm_update_quotas(mvm, vif, IWL_MVM_QUOTA_UPDATE_TYPE_NEW); iwl_mvm_update_quotas(mvm, NULL);
iwl_mvm_mac_ctxt_changed(mvm, vif, false); iwl_mvm_mac_ctxt_changed(mvm, vif, false);
} }
...@@ -2446,8 +2442,7 @@ static void iwl_mvm_unassign_vif_chanctx(struct ieee80211_hw *hw, ...@@ -2446,8 +2442,7 @@ static void iwl_mvm_unassign_vif_chanctx(struct ieee80211_hw *hw,
goto out_unlock; goto out_unlock;
case NL80211_IFTYPE_MONITOR: case NL80211_IFTYPE_MONITOR:
mvmvif->monitor_active = false; mvmvif->monitor_active = false;
iwl_mvm_update_quotas(mvm, NULL, iwl_mvm_update_quotas(mvm, NULL);
IWL_MVM_QUOTA_UPDATE_TYPE_REGULAR);
break; break;
case NL80211_IFTYPE_AP: case NL80211_IFTYPE_AP:
/* This part is triggered only during CSA */ /* This part is triggered only during CSA */
...@@ -2455,8 +2450,7 @@ static void iwl_mvm_unassign_vif_chanctx(struct ieee80211_hw *hw, ...@@ -2455,8 +2450,7 @@ static void iwl_mvm_unassign_vif_chanctx(struct ieee80211_hw *hw,
goto out_unlock; goto out_unlock;
mvmvif->ap_ibss_active = false; mvmvif->ap_ibss_active = false;
iwl_mvm_update_quotas(mvm, NULL, iwl_mvm_update_quotas(mvm, NULL);
IWL_MVM_QUOTA_UPDATE_TYPE_REGULAR);
default: default:
break; break;
} }
...@@ -2520,8 +2514,7 @@ static int __iwl_mvm_mac_testmode_cmd(struct iwl_mvm *mvm, ...@@ -2520,8 +2514,7 @@ static int __iwl_mvm_mac_testmode_cmd(struct iwl_mvm *mvm,
mvm->noa_duration = noa_duration; mvm->noa_duration = noa_duration;
mvm->noa_vif = vif; mvm->noa_vif = vif;
return iwl_mvm_update_quotas(mvm, NULL, return iwl_mvm_update_quotas(mvm, NULL);
IWL_MVM_QUOTA_UPDATE_TYPE_REGULAR);
case IWL_MVM_TM_CMD_SET_BEACON_FILTER: case IWL_MVM_TM_CMD_SET_BEACON_FILTER:
/* must be associated client vif - ignore authorized */ /* must be associated client vif - ignore authorized */
if (!vif || vif->type != NL80211_IFTYPE_STATION || if (!vif || vif->type != NL80211_IFTYPE_STATION ||
......
...@@ -844,29 +844,8 @@ int iwl_mvm_binding_add_vif(struct iwl_mvm *mvm, struct ieee80211_vif *vif); ...@@ -844,29 +844,8 @@ int iwl_mvm_binding_add_vif(struct iwl_mvm *mvm, struct ieee80211_vif *vif);
int iwl_mvm_binding_remove_vif(struct iwl_mvm *mvm, struct ieee80211_vif *vif); int iwl_mvm_binding_remove_vif(struct iwl_mvm *mvm, struct ieee80211_vif *vif);
/* Quota management */ /* Quota management */
int iwl_mvm_update_quotas(struct iwl_mvm *mvm,
/** struct ieee80211_vif *disabled_vif);
* enum iwl_mvm_quota_update_type - quota update type
* @IWL_MVM_QUOTA_UPDATE_TYPE_REGULAR: regular quota update, use the
* existing vifs (ie. no new vif nor a disabled vif is passed).
* @IWL_MVM_QUOTA_UPDATE_TYPE_NEW: a new vif is being added to the
* quota calculation and needs to be treated differently.
* @IWL_MVM_QUOTA_UPDATE_TYPE_DISABLED: temporarily disable a vif from
* the quota calculation. The mvm mutex must remain held for the
* entire time during which the vif is to remain disabled,
* otherwise there is no guarantee that another code flow will
* not reenable it accidentally (by updating the quotas without
* marking the vif as disabled).
*/
enum iwl_mvm_quota_update_type {
IWL_MVM_QUOTA_UPDATE_TYPE_REGULAR,
IWL_MVM_QUOTA_UPDATE_TYPE_NEW,
IWL_MVM_QUOTA_UPDATE_TYPE_DISABLED,
};
int iwl_mvm_update_quotas(struct iwl_mvm *mvm, struct ieee80211_vif *vif,
enum iwl_mvm_quota_update_type type);
/* Scanning */ /* Scanning */
int iwl_mvm_scan_request(struct iwl_mvm *mvm, int iwl_mvm_scan_request(struct iwl_mvm *mvm,
......
...@@ -73,7 +73,7 @@ struct iwl_mvm_quota_iterator_data { ...@@ -73,7 +73,7 @@ struct iwl_mvm_quota_iterator_data {
int colors[MAX_BINDINGS]; int colors[MAX_BINDINGS];
int low_latency[MAX_BINDINGS]; int low_latency[MAX_BINDINGS];
int n_low_latency_bindings; int n_low_latency_bindings;
struct ieee80211_vif *skip_vif; struct ieee80211_vif *disabled_vif;
}; };
static void iwl_mvm_quota_iterator(void *_data, u8 *mac, static void iwl_mvm_quota_iterator(void *_data, u8 *mac,
...@@ -83,14 +83,8 @@ static void iwl_mvm_quota_iterator(void *_data, u8 *mac, ...@@ -83,14 +83,8 @@ static void iwl_mvm_quota_iterator(void *_data, u8 *mac,
struct iwl_mvm_vif *mvmvif = iwl_mvm_vif_from_mac80211(vif); struct iwl_mvm_vif *mvmvif = iwl_mvm_vif_from_mac80211(vif);
u16 id; u16 id;
/* /* skip disabled interfaces here immediately */
* We'll account for the new interface (if any) below, if (vif == data->disabled_vif)
* skip it here in case we're not called from within
* the add_interface callback (otherwise it won't show
* up in iteration)
* Also skip disabled interfaces here immediately.
*/
if (vif == data->skip_vif)
return; return;
if (!mvmvif->phy_ctxt) if (!mvmvif->phy_ctxt)
...@@ -172,15 +166,15 @@ static void iwl_mvm_adjust_quota_for_noa(struct iwl_mvm *mvm, ...@@ -172,15 +166,15 @@ static void iwl_mvm_adjust_quota_for_noa(struct iwl_mvm *mvm,
#endif #endif
} }
int iwl_mvm_update_quotas(struct iwl_mvm *mvm, struct ieee80211_vif *vif, int iwl_mvm_update_quotas(struct iwl_mvm *mvm,
enum iwl_mvm_quota_update_type type) struct ieee80211_vif *disabled_vif)
{ {
struct iwl_time_quota_cmd cmd = {}; struct iwl_time_quota_cmd cmd = {};
int i, idx, ret, num_active_macs, quota, quota_rem, n_non_lowlat; int i, idx, ret, num_active_macs, quota, quota_rem, n_non_lowlat;
struct iwl_mvm_quota_iterator_data data = { struct iwl_mvm_quota_iterator_data data = {
.n_interfaces = {}, .n_interfaces = {},
.colors = { -1, -1, -1, -1 }, .colors = { -1, -1, -1, -1 },
.skip_vif = vif, .disabled_vif = disabled_vif,
}; };
lockdep_assert_held(&mvm->mutex); lockdep_assert_held(&mvm->mutex);
...@@ -192,17 +186,9 @@ int iwl_mvm_update_quotas(struct iwl_mvm *mvm, struct ieee80211_vif *vif, ...@@ -192,17 +186,9 @@ int iwl_mvm_update_quotas(struct iwl_mvm *mvm, struct ieee80211_vif *vif,
/* iterator data above must match */ /* iterator data above must match */
BUILD_BUG_ON(MAX_BINDINGS != 4); BUILD_BUG_ON(MAX_BINDINGS != 4);
if (WARN_ON_ONCE((type != IWL_MVM_QUOTA_UPDATE_TYPE_REGULAR && !vif) ||
(type == IWL_MVM_QUOTA_UPDATE_TYPE_REGULAR && vif)))
return -EINVAL;
ieee80211_iterate_active_interfaces_atomic( ieee80211_iterate_active_interfaces_atomic(
mvm->hw, IEEE80211_IFACE_ITER_NORMAL, mvm->hw, IEEE80211_IFACE_ITER_NORMAL,
iwl_mvm_quota_iterator, &data); iwl_mvm_quota_iterator, &data);
if (type == IWL_MVM_QUOTA_UPDATE_TYPE_NEW) {
data.skip_vif = NULL;
iwl_mvm_quota_iterator(&data, vif->addr, vif);
}
/* /*
* The FW's scheduling session consists of * The FW's scheduling session consists of
......
...@@ -631,8 +631,7 @@ int iwl_mvm_update_low_latency(struct iwl_mvm *mvm, struct ieee80211_vif *vif, ...@@ -631,8 +631,7 @@ int iwl_mvm_update_low_latency(struct iwl_mvm *mvm, struct ieee80211_vif *vif,
mvmvif->low_latency = value; mvmvif->low_latency = value;
res = iwl_mvm_update_quotas(mvm, NULL, res = iwl_mvm_update_quotas(mvm, NULL);
IWL_MVM_QUOTA_UPDATE_TYPE_REGULAR);
if (res) if (res)
return res; return res;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册