Commit 763cc3bf authored by Johannes Berg's avatar Johannes Berg Committed by Wey-Yi Guy

iwlwifi: avoid sending too many commands

When the PAN context is unused, there's no
need to continually update it in the device.
So track which contexts are active (with the
special case that the WLAN context is always
active ...) and only send their commands to
the device when needed.
Signed-off-by: default avatarJohannes Berg <johannes.berg@intel.com>
Signed-off-by: default avatarWey-Yi Guy <wey-yi.w.guy@intel.com>
parent c6abdc0d
...@@ -287,6 +287,15 @@ static int iwlagn_set_pan_params(struct iwl_priv *priv) ...@@ -287,6 +287,15 @@ static int iwlagn_set_pan_params(struct iwl_priv *priv)
ctx_bss = &priv->contexts[IWL_RXON_CTX_BSS]; ctx_bss = &priv->contexts[IWL_RXON_CTX_BSS];
ctx_pan = &priv->contexts[IWL_RXON_CTX_PAN]; ctx_pan = &priv->contexts[IWL_RXON_CTX_PAN];
/*
* If the PAN context is inactive, then we don't need
* to update the PAN parameters, the last thing we'll
* have done before it goes inactive is making the PAN
* parameters be WLAN-only.
*/
if (!ctx_pan->is_active)
return 0;
memset(&cmd, 0, sizeof(cmd)); memset(&cmd, 0, sizeof(cmd));
/* only 2 slots are currently allowed */ /* only 2 slots are currently allowed */
......
...@@ -110,6 +110,9 @@ int iwl_commit_rxon(struct iwl_priv *priv, struct iwl_rxon_context *ctx) ...@@ -110,6 +110,9 @@ int iwl_commit_rxon(struct iwl_priv *priv, struct iwl_rxon_context *ctx)
if (!iwl_is_alive(priv)) if (!iwl_is_alive(priv))
return -EBUSY; return -EBUSY;
if (!ctx->is_active)
return 0;
/* always get timestamp with Rx frame */ /* always get timestamp with Rx frame */
ctx->staging.flags |= RXON_FLG_TSF2HOST_MSK; ctx->staging.flags |= RXON_FLG_TSF2HOST_MSK;
...@@ -4301,6 +4304,8 @@ static int iwl_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent) ...@@ -4301,6 +4304,8 @@ static int iwl_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
for (i = 0; i < NUM_IWL_RXON_CTX; i++) for (i = 0; i < NUM_IWL_RXON_CTX; i++)
priv->contexts[i].ctxid = i; priv->contexts[i].ctxid = i;
priv->contexts[IWL_RXON_CTX_BSS].always_active = true;
priv->contexts[IWL_RXON_CTX_BSS].is_active = true;
priv->contexts[IWL_RXON_CTX_BSS].rxon_cmd = REPLY_RXON; priv->contexts[IWL_RXON_CTX_BSS].rxon_cmd = REPLY_RXON;
priv->contexts[IWL_RXON_CTX_BSS].rxon_timing_cmd = REPLY_RXON_TIMING; priv->contexts[IWL_RXON_CTX_BSS].rxon_timing_cmd = REPLY_RXON_TIMING;
priv->contexts[IWL_RXON_CTX_BSS].rxon_assoc_cmd = REPLY_RXON_ASSOC; priv->contexts[IWL_RXON_CTX_BSS].rxon_assoc_cmd = REPLY_RXON_ASSOC;
......
...@@ -196,6 +196,9 @@ static void iwl_update_qos(struct iwl_priv *priv, struct iwl_rxon_context *ctx) ...@@ -196,6 +196,9 @@ static void iwl_update_qos(struct iwl_priv *priv, struct iwl_rxon_context *ctx)
if (test_bit(STATUS_EXIT_PENDING, &priv->status)) if (test_bit(STATUS_EXIT_PENDING, &priv->status))
return; return;
if (!ctx->is_active)
return;
ctx->qos_data.def_qos_parm.qos_flags = 0; ctx->qos_data.def_qos_parm.qos_flags = 0;
if (ctx->qos_data.qos_active) if (ctx->qos_data.qos_active)
...@@ -2008,9 +2011,14 @@ int iwl_mac_add_interface(struct ieee80211_hw *hw, struct ieee80211_vif *vif) ...@@ -2008,9 +2011,14 @@ int iwl_mac_add_interface(struct ieee80211_hw *hw, struct ieee80211_vif *vif)
*/ */
priv->iw_mode = vif->type; priv->iw_mode = vif->type;
ctx->is_active = true;
err = iwl_set_mode(priv, vif); err = iwl_set_mode(priv, vif);
if (err) if (err) {
if (!ctx->always_active)
ctx->is_active = false;
goto out_err; goto out_err;
}
if (priv->cfg->advanced_bt_coexist && if (priv->cfg->advanced_bt_coexist &&
vif->type == NL80211_IFTYPE_ADHOC) { vif->type == NL80211_IFTYPE_ADHOC) {
...@@ -2052,6 +2060,9 @@ void iwl_mac_remove_interface(struct ieee80211_hw *hw, ...@@ -2052,6 +2060,9 @@ void iwl_mac_remove_interface(struct ieee80211_hw *hw,
iwl_scan_cancel_timeout(priv, 100); iwl_scan_cancel_timeout(priv, 100);
iwl_set_mode(priv, vif); iwl_set_mode(priv, vif);
if (!ctx->always_active)
ctx->is_active = false;
if (priv->scan_vif == vif) { if (priv->scan_vif == vif) {
scan_completed = true; scan_completed = true;
priv->scan_vif = NULL; priv->scan_vif = NULL;
......
...@@ -1116,6 +1116,13 @@ struct iwl_rxon_context { ...@@ -1116,6 +1116,13 @@ struct iwl_rxon_context {
const u8 *ac_to_queue; const u8 *ac_to_queue;
u8 mcast_queue; u8 mcast_queue;
/*
* We could use the vif to indicate active, but we
* also need it to be active during disabling when
* we already removed the vif for type setting.
*/
bool always_active, is_active;
enum iwl_rxon_context_id ctxid; enum iwl_rxon_context_id ctxid;
u32 interface_modes, exclusive_interface_modes; u32 interface_modes, exclusive_interface_modes;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment