diff options
Diffstat (limited to 'drivers/net/wireless/iwlwifi/mvm/quota.c')
-rw-r--r-- | drivers/net/wireless/iwlwifi/mvm/quota.c | 42 |
1 files changed, 37 insertions, 5 deletions
diff --git a/drivers/net/wireless/iwlwifi/mvm/quota.c b/drivers/net/wireless/iwlwifi/mvm/quota.c index 5c6ae16ec52b..17e2bc827f9a 100644 --- a/drivers/net/wireless/iwlwifi/mvm/quota.c +++ b/drivers/net/wireless/iwlwifi/mvm/quota.c | |||
@@ -110,7 +110,8 @@ static void iwl_mvm_quota_iterator(void *_data, u8 *mac, | |||
110 | data->n_interfaces[id]++; | 110 | data->n_interfaces[id]++; |
111 | break; | 111 | break; |
112 | case NL80211_IFTYPE_AP: | 112 | case NL80211_IFTYPE_AP: |
113 | if (mvmvif->ap_active) | 113 | case NL80211_IFTYPE_ADHOC: |
114 | if (mvmvif->ap_ibss_active) | ||
114 | data->n_interfaces[id]++; | 115 | data->n_interfaces[id]++; |
115 | break; | 116 | break; |
116 | case NL80211_IFTYPE_MONITOR: | 117 | case NL80211_IFTYPE_MONITOR: |
@@ -119,16 +120,45 @@ static void iwl_mvm_quota_iterator(void *_data, u8 *mac, | |||
119 | break; | 120 | break; |
120 | case NL80211_IFTYPE_P2P_DEVICE: | 121 | case NL80211_IFTYPE_P2P_DEVICE: |
121 | break; | 122 | break; |
122 | case NL80211_IFTYPE_ADHOC: | ||
123 | if (vif->bss_conf.ibss_joined) | ||
124 | data->n_interfaces[id]++; | ||
125 | break; | ||
126 | default: | 123 | default: |
127 | WARN_ON_ONCE(1); | 124 | WARN_ON_ONCE(1); |
128 | break; | 125 | break; |
129 | } | 126 | } |
130 | } | 127 | } |
131 | 128 | ||
129 | static void iwl_mvm_adjust_quota_for_noa(struct iwl_mvm *mvm, | ||
130 | struct iwl_time_quota_cmd *cmd) | ||
131 | { | ||
132 | #ifdef CONFIG_NL80211_TESTMODE | ||
133 | struct iwl_mvm_vif *mvmvif; | ||
134 | int i, phy_id = -1, beacon_int = 0; | ||
135 | |||
136 | if (!mvm->noa_duration || !mvm->noa_vif) | ||
137 | return; | ||
138 | |||
139 | mvmvif = iwl_mvm_vif_from_mac80211(mvm->noa_vif); | ||
140 | if (!mvmvif->ap_ibss_active) | ||
141 | return; | ||
142 | |||
143 | phy_id = mvmvif->phy_ctxt->id; | ||
144 | beacon_int = mvm->noa_vif->bss_conf.beacon_int; | ||
145 | |||
146 | for (i = 0; i < MAX_BINDINGS; i++) { | ||
147 | u32 id_n_c = le32_to_cpu(cmd->quotas[i].id_and_color); | ||
148 | u32 id = (id_n_c & FW_CTXT_ID_MSK) >> FW_CTXT_ID_POS; | ||
149 | u32 quota = le32_to_cpu(cmd->quotas[i].quota); | ||
150 | |||
151 | if (id != phy_id) | ||
152 | continue; | ||
153 | |||
154 | quota *= (beacon_int - mvm->noa_duration); | ||
155 | quota /= beacon_int; | ||
156 | |||
157 | cmd->quotas[i].quota = cpu_to_le32(quota); | ||
158 | } | ||
159 | #endif | ||
160 | } | ||
161 | |||
132 | int iwl_mvm_update_quotas(struct iwl_mvm *mvm, struct ieee80211_vif *newvif) | 162 | int iwl_mvm_update_quotas(struct iwl_mvm *mvm, struct ieee80211_vif *newvif) |
133 | { | 163 | { |
134 | struct iwl_time_quota_cmd cmd = {}; | 164 | struct iwl_time_quota_cmd cmd = {}; |
@@ -196,6 +226,8 @@ int iwl_mvm_update_quotas(struct iwl_mvm *mvm, struct ieee80211_vif *newvif) | |||
196 | /* Give the remainder of the session to the first binding */ | 226 | /* Give the remainder of the session to the first binding */ |
197 | le32_add_cpu(&cmd.quotas[0].quota, quota_rem); | 227 | le32_add_cpu(&cmd.quotas[0].quota, quota_rem); |
198 | 228 | ||
229 | iwl_mvm_adjust_quota_for_noa(mvm, &cmd); | ||
230 | |||
199 | ret = iwl_mvm_send_cmd_pdu(mvm, TIME_QUOTA_CMD, CMD_SYNC, | 231 | ret = iwl_mvm_send_cmd_pdu(mvm, TIME_QUOTA_CMD, CMD_SYNC, |
200 | sizeof(cmd), &cmd); | 232 | sizeof(cmd), &cmd); |
201 | if (ret) | 233 | if (ret) |