iwlwifi: mvm: Fix quota handling for monitor interface
authorIlan Peer <ilan.peer@intel.com>
Wed, 13 Mar 2013 12:52:04 +0000 (14:52 +0200)
committerJohannes Berg <johannes.berg@intel.com>
Wed, 20 Mar 2013 13:17:08 +0000 (14:17 +0100)
1. Quota for the monitor interface should be added only if there is
   a channel context assigned to the interface.
2. In the unassign channel context flow, need to remove the quota
   for the monitor interface binding, before unbinding.

Signed-off-by: Ilan Peer <ilan.peer@intel.com>
Reviewed-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
drivers/net/wireless/iwlwifi/mvm/mac80211.c
drivers/net/wireless/iwlwifi/mvm/mvm.h
drivers/net/wireless/iwlwifi/mvm/quota.c

index 3492d6092b2dc98e73eefb166a6be91cc0d42430..064eaefdff7216cbab1e149a7abf29aae7f6c37f 100644 (file)
@@ -1264,6 +1264,7 @@ static int iwl_mvm_assign_vif_chanctx(struct ieee80211_hw *hw,
         * will handle quota settings.
         */
        if (vif->type == NL80211_IFTYPE_MONITOR) {
+               mvmvif->monitor_active = true;
                ret = iwl_mvm_update_quotas(mvm, vif);
                if (ret)
                        goto out_remove_binding;
@@ -1294,15 +1295,16 @@ static void iwl_mvm_unassign_vif_chanctx(struct ieee80211_hw *hw,
        if (vif->type == NL80211_IFTYPE_AP)
                goto out_unlock;
 
-       iwl_mvm_binding_remove_vif(mvm, vif);
        switch (vif->type) {
        case NL80211_IFTYPE_MONITOR:
-               iwl_mvm_update_quotas(mvm, vif);
+               mvmvif->monitor_active = false;
+               iwl_mvm_update_quotas(mvm, NULL);
                break;
        default:
                break;
        }
 
+       iwl_mvm_binding_remove_vif(mvm, vif);
 out_unlock:
        mvmvif->phy_ctxt = NULL;
        mutex_unlock(&mvm->mutex);
index 43a1d297ec1e21fcb9f09a8a1c8255104edcb7f7..53d58968e30ace324600e2eef6112973282058ec 100644 (file)
@@ -157,6 +157,8 @@ enum iwl_power_scheme {
  * @uploaded: indicates the MAC context has been added to the device
  * @ap_active: indicates that ap context is configured, and that the interface
  *  should get quota etc.
+ * @monitor_active: indicates that monitor context is configured, and that the
+ * interface should get quota etc.
  * @queue_params: QoS params for this MAC
  * @bcast_sta: station used for broadcast packets. Used by the following
  *  vifs: P2P_DEVICE, GO and AP.
@@ -169,6 +171,7 @@ struct iwl_mvm_vif {
 
        bool uploaded;
        bool ap_active;
+       bool monitor_active;
 
        u32 ap_beacon_time;
 
index df85c49dc59919fef7ed95771c3c44ada2404d45..a1e3e923ea3e12c1fb6a0adabab88d05b1c5530e 100644 (file)
@@ -114,7 +114,8 @@ static void iwl_mvm_quota_iterator(void *_data, u8 *mac,
                        data->n_interfaces[id]++;
                break;
        case NL80211_IFTYPE_MONITOR:
-               data->n_interfaces[id]++;
+               if (mvmvif->monitor_active)
+                       data->n_interfaces[id]++;
                break;
        case NL80211_IFTYPE_P2P_DEVICE:
                break;