From 178bdb5791f18e33b5a368acee6fab5bb64396fe Mon Sep 17 00:00:00 2001 From: Emmanuel Grumbach Date: Sun, 14 Apr 2013 16:28:39 +0300 Subject: [PATCH 1/9] iwlwifi: mvm: remove TODO which has been addressed Chain noise is done in the firmware and Bluetooth Coexistence is implemented now. Signed-off-by: Emmanuel Grumbach Signed-off-by: Johannes Berg --- drivers/net/wireless/iwlwifi/mvm/phy-ctxt.c | 5 ----- 1 file changed, 5 deletions(-) diff --git a/drivers/net/wireless/iwlwifi/mvm/phy-ctxt.c b/drivers/net/wireless/iwlwifi/mvm/phy-ctxt.c index 0f0b44eabd93..a28a1d1f23eb 100644 --- a/drivers/net/wireless/iwlwifi/mvm/phy-ctxt.c +++ b/drivers/net/wireless/iwlwifi/mvm/phy-ctxt.c @@ -153,11 +153,6 @@ static void iwl_mvm_phy_ctxt_cmd_data(struct iwl_mvm *mvm, cmd->ci.ctrl_pos = iwl_mvm_get_ctrl_pos(chandef); /* Set rx the chains */ - - /* TODO: - * Need to add on chain noise calibration limitations, and - * BT coex considerations. - */ idle_cnt = chains_static; active_cnt = chains_dynamic; From d7dad550e6ddb96db9d3e4d322f7d1dd8a6a9c8d Mon Sep 17 00:00:00 2001 From: Emmanuel Grumbach Date: Sun, 14 Apr 2013 14:41:03 +0300 Subject: [PATCH 2/9] iwlwifi: mvm: fix first_antenna first_antenna is supposed to return the first antenna as a 0-based bitmap: ANT_A is BIT(0), ANT_B is BIT(1), etc... Since ffs is 1 based (ffs(BIT(0)) = 1), then we had an off-by-one bug: BIT(ffs(ANT_A)) = BIT(ffs(BIT(0))) = BIT(1) = ANT_B. So what we really want is: BIT(ffs(ANT_A) - 1) = BIT(ffs(BIT(0)) - 1) = BIT(0) = ANT_A. Signed-off-by: Emmanuel Grumbach Signed-off-by: Johannes Berg --- drivers/net/wireless/iwlwifi/mvm/utils.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/drivers/net/wireless/iwlwifi/mvm/utils.c b/drivers/net/wireless/iwlwifi/mvm/utils.c index 0cc8d8c0d393..687b34e387ac 100644 --- a/drivers/net/wireless/iwlwifi/mvm/utils.c +++ b/drivers/net/wireless/iwlwifi/mvm/utils.c @@ -253,8 +253,9 @@ int iwl_mvm_rx_fw_error(struct iwl_mvm *mvm, struct iwl_rx_cmd_buffer *rxb, u8 first_antenna(u8 mask) { BUILD_BUG_ON(ANT_A != BIT(0)); /* using ffs is wrong if not */ - WARN_ON_ONCE(!mask); /* ffs will return 0 if mask is zeroed */ - return (u8)(BIT(ffs(mask))); + if (WARN_ON_ONCE(!mask)) /* ffs will return 0 if mask is zeroed */ + return BIT(0); + return BIT(ffs(mask) - 1); } /* From 0aed849f61c1235041f98e4178d0a60aaa1dc548 Mon Sep 17 00:00:00 2001 From: Alexander Bondar Date: Sun, 14 Apr 2013 10:18:25 +0300 Subject: [PATCH 3/9] iwlwifi: mvm: change TX/RX AM-to-PSM transition time for LP mode Recently in low power (LP) mode FW moved from active to power save mode after TX/RX completion faster than in balanced power mode (BPS). Change AM-to-PSM transition time so that it will be the same as for BPS. Signed-off-by: Alexander Bondar Reviewed-by: Emmanuel Grumbach Signed-off-by: Johannes Berg --- drivers/net/wireless/iwlwifi/mvm/power.c | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/drivers/net/wireless/iwlwifi/mvm/power.c b/drivers/net/wireless/iwlwifi/mvm/power.c index 9395ab2a1af2..dde384de3ae2 100644 --- a/drivers/net/wireless/iwlwifi/mvm/power.c +++ b/drivers/net/wireless/iwlwifi/mvm/power.c @@ -146,14 +146,8 @@ void iwl_mvm_power_build_cmd(struct iwl_mvm *mvm, struct ieee80211_vif *vif, keep_alive = DIV_ROUND_UP(keep_alive, MSEC_PER_SEC); cmd->keep_alive_seconds = keep_alive; - if (iwlmvm_mod_params.power_scheme == IWL_POWER_SCHEME_LP) { - /* TODO: Also for D3 (device sleep / WoWLAN) */ - cmd->rx_data_timeout = cpu_to_le32(10 * USEC_PER_MSEC); - cmd->tx_data_timeout = cpu_to_le32(10 * USEC_PER_MSEC); - } else { - cmd->rx_data_timeout = cpu_to_le32(100 * USEC_PER_MSEC); - cmd->tx_data_timeout = cpu_to_le32(100 * USEC_PER_MSEC); - } + cmd->rx_data_timeout = cpu_to_le32(100 * USEC_PER_MSEC); + cmd->tx_data_timeout = cpu_to_le32(100 * USEC_PER_MSEC); } int iwl_mvm_power_update_mode(struct iwl_mvm *mvm, struct ieee80211_vif *vif) From 3309ccf7fcebceef540ebe90c65d2f94d745a45b Mon Sep 17 00:00:00 2001 From: Stanislaw Gruszka Date: Tue, 16 Apr 2013 15:38:29 +0200 Subject: [PATCH 4/9] iwlwifi: fix freeing uninitialized pointer If on iwl_dump_nic_event_log() error occurs before that function initialize buf, we process uninitiated pointer in iwl_dbgfs_log_event_read() and can hit "BUG at mm/slub.c:3409" Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=951241 Cc: stable@vger.kernel.org Reported-by: ian.odette@eprize.com Signed-off-by: Stanislaw Gruszka Reviewed-by: Emmanuel Grumbach Signed-off-by: Johannes Berg --- drivers/net/wireless/iwlwifi/dvm/debugfs.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/drivers/net/wireless/iwlwifi/dvm/debugfs.c b/drivers/net/wireless/iwlwifi/dvm/debugfs.c index 7b8178be119f..cb6dd5813fbc 100644 --- a/drivers/net/wireless/iwlwifi/dvm/debugfs.c +++ b/drivers/net/wireless/iwlwifi/dvm/debugfs.c @@ -2237,15 +2237,15 @@ static ssize_t iwl_dbgfs_log_event_read(struct file *file, size_t count, loff_t *ppos) { struct iwl_priv *priv = file->private_data; - char *buf; - int pos = 0; - ssize_t ret = -ENOMEM; + char *buf = NULL; + ssize_t ret; - ret = pos = iwl_dump_nic_event_log(priv, true, &buf, true); - if (buf) { - ret = simple_read_from_buffer(user_buf, count, ppos, buf, pos); - kfree(buf); - } + ret = iwl_dump_nic_event_log(priv, true, &buf, true); + if (ret < 0) + goto err; + ret = simple_read_from_buffer(user_buf, count, ppos, buf, ret); +err: + kfree(buf); return ret; } From a6db00613bd6a0c631848b0debe1d3f7ce67c77d Mon Sep 17 00:00:00 2001 From: Stanislaw Gruszka Date: Tue, 16 Apr 2013 15:40:54 +0200 Subject: [PATCH 5/9] iwlwifi: remove redundant argument from iwl_dump_nic_event_log We can check buf against NULL instead of having additional bool variable. Signed-off-by: Stanislaw Gruszka Reviewed-by: Emmanuel Grumbach Signed-off-by: Johannes Berg --- drivers/net/wireless/iwlwifi/dvm/agn.h | 2 +- drivers/net/wireless/iwlwifi/dvm/debugfs.c | 4 ++-- drivers/net/wireless/iwlwifi/dvm/main.c | 6 +++--- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/drivers/net/wireless/iwlwifi/dvm/agn.h b/drivers/net/wireless/iwlwifi/dvm/agn.h index e575b9b0cda8..48545ab00311 100644 --- a/drivers/net/wireless/iwlwifi/dvm/agn.h +++ b/drivers/net/wireless/iwlwifi/dvm/agn.h @@ -172,7 +172,7 @@ int iwl_calib_set(struct iwl_priv *priv, const struct iwl_calib_hdr *cmd, int len); void iwl_calib_free_results(struct iwl_priv *priv); int iwl_dump_nic_event_log(struct iwl_priv *priv, bool full_log, - char **buf, bool display); + char **buf); int iwlagn_hw_valid_rtc_data_addr(u32 addr); /* lib */ diff --git a/drivers/net/wireless/iwlwifi/dvm/debugfs.c b/drivers/net/wireless/iwlwifi/dvm/debugfs.c index cb6dd5813fbc..17f04de272d8 100644 --- a/drivers/net/wireless/iwlwifi/dvm/debugfs.c +++ b/drivers/net/wireless/iwlwifi/dvm/debugfs.c @@ -2240,7 +2240,7 @@ static ssize_t iwl_dbgfs_log_event_read(struct file *file, char *buf = NULL; ssize_t ret; - ret = iwl_dump_nic_event_log(priv, true, &buf, true); + ret = iwl_dump_nic_event_log(priv, true, &buf); if (ret < 0) goto err; ret = simple_read_from_buffer(user_buf, count, ppos, buf, ret); @@ -2269,7 +2269,7 @@ static ssize_t iwl_dbgfs_log_event_write(struct file *file, if (sscanf(buf, "%d", &event_log_flag) != 1) return -EFAULT; if (event_log_flag == 1) - iwl_dump_nic_event_log(priv, true, NULL, false); + iwl_dump_nic_event_log(priv, true, NULL); return count; } diff --git a/drivers/net/wireless/iwlwifi/dvm/main.c b/drivers/net/wireless/iwlwifi/dvm/main.c index b9e3517652d6..74d7572e7091 100644 --- a/drivers/net/wireless/iwlwifi/dvm/main.c +++ b/drivers/net/wireless/iwlwifi/dvm/main.c @@ -1795,7 +1795,7 @@ static int iwl_print_last_event_logs(struct iwl_priv *priv, u32 capacity, #define DEFAULT_DUMP_EVENT_LOG_ENTRIES (20) int iwl_dump_nic_event_log(struct iwl_priv *priv, bool full_log, - char **buf, bool display) + char **buf) { u32 base; /* SRAM byte address of event log header */ u32 capacity; /* event log capacity in # entries */ @@ -1866,7 +1866,7 @@ int iwl_dump_nic_event_log(struct iwl_priv *priv, bool full_log, size); #ifdef CONFIG_IWLWIFI_DEBUG - if (display) { + if (buf) { if (full_log) bufsz = capacity * 48; else @@ -1962,7 +1962,7 @@ static void iwl_nic_error(struct iwl_op_mode *op_mode) priv->fw->fw_version); iwl_dump_nic_error_log(priv); - iwl_dump_nic_event_log(priv, false, NULL, false); + iwl_dump_nic_event_log(priv, false, NULL); iwlagn_fw_error(priv, false); } From ade50652fc60314f433c6d28322a605874fb3996 Mon Sep 17 00:00:00 2001 From: Alexander Bondar Date: Wed, 3 Apr 2013 16:28:47 +0300 Subject: [PATCH 6/9] iwlwifi: mvm: remove usage of power_save module parameter Make power management in MVM driver enabled by default and remove using the power_save module parameter. Rely only on the power_scheme parameter to decide if power management should be used. Signed-off-by: Alexander Bondar Reviewed-by: Emmanuel Grumbach Signed-off-by: Johannes Berg --- drivers/net/wireless/iwlwifi/mvm/mac80211.c | 2 +- drivers/net/wireless/iwlwifi/mvm/power.c | 6 ++---- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/drivers/net/wireless/iwlwifi/mvm/mac80211.c b/drivers/net/wireless/iwlwifi/mvm/mac80211.c index fe031608fd91..dd158ec571fb 100644 --- a/drivers/net/wireless/iwlwifi/mvm/mac80211.c +++ b/drivers/net/wireless/iwlwifi/mvm/mac80211.c @@ -207,7 +207,7 @@ int iwl_mvm_mac_setup_register(struct iwl_mvm *mvm) hw->wiphy->hw_version = mvm->trans->hw_id; - if (iwlwifi_mod_params.power_save) + if (iwlmvm_mod_params.power_scheme != IWL_POWER_SCHEME_CAM) hw->wiphy->flags |= WIPHY_FLAG_PS_ON_BY_DEFAULT; else hw->wiphy->flags &= ~WIPHY_FLAG_PS_ON_BY_DEFAULT; diff --git a/drivers/net/wireless/iwlwifi/mvm/power.c b/drivers/net/wireless/iwlwifi/mvm/power.c index dde384de3ae2..ed77e437aac4 100644 --- a/drivers/net/wireless/iwlwifi/mvm/power.c +++ b/drivers/net/wireless/iwlwifi/mvm/power.c @@ -111,8 +111,7 @@ void iwl_mvm_power_build_cmd(struct iwl_mvm *mvm, struct ieee80211_vif *vif, */ cmd->keep_alive_seconds = POWER_KEEP_ALIVE_PERIOD_SEC; - if ((iwlmvm_mod_params.power_scheme == IWL_POWER_SCHEME_CAM) || - !iwlwifi_mod_params.power_save) + if (iwlmvm_mod_params.power_scheme == IWL_POWER_SCHEME_CAM) return; cmd->flags |= cpu_to_le16(POWER_FLAGS_POWER_SAVE_ENA_MSK); @@ -171,8 +170,7 @@ int iwl_mvm_power_disable(struct iwl_mvm *mvm, struct ieee80211_vif *vif) if (vif->type != NL80211_IFTYPE_STATION || vif->p2p) return 0; - if ((iwlmvm_mod_params.power_scheme != IWL_POWER_SCHEME_CAM) && - iwlwifi_mod_params.power_save) + if (iwlmvm_mod_params.power_scheme != IWL_POWER_SCHEME_CAM) cmd.flags |= cpu_to_le16(POWER_FLAGS_POWER_SAVE_ENA_MSK); iwl_mvm_power_log(mvm, &cmd); From d557894106f71cc23c9d053876d0c367c285950f Mon Sep 17 00:00:00 2001 From: Stanislaw Gruszka Date: Wed, 17 Apr 2013 08:23:50 +0200 Subject: [PATCH 7/9] iwlwifi: remove unneeded goto from iwl_dbgfs_log_event_read Make code simpler a bit. Reported-by: Jonas Gorski Signed-off-by: Stanislaw Gruszka Reviewed-by: Emmanuel Grumbach Signed-off-by: Johannes Berg --- drivers/net/wireless/iwlwifi/dvm/debugfs.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/drivers/net/wireless/iwlwifi/dvm/debugfs.c b/drivers/net/wireless/iwlwifi/dvm/debugfs.c index 17f04de272d8..d5329489245a 100644 --- a/drivers/net/wireless/iwlwifi/dvm/debugfs.c +++ b/drivers/net/wireless/iwlwifi/dvm/debugfs.c @@ -2241,10 +2241,8 @@ static ssize_t iwl_dbgfs_log_event_read(struct file *file, ssize_t ret; ret = iwl_dump_nic_event_log(priv, true, &buf); - if (ret < 0) - goto err; - ret = simple_read_from_buffer(user_buf, count, ppos, buf, ret); -err: + if (ret > 0) + ret = simple_read_from_buffer(user_buf, count, ppos, buf, ret); kfree(buf); return ret; } From 63b77bf489881747c5118476918cc8c29378ee63 Mon Sep 17 00:00:00 2001 From: Emmanuel Grumbach Date: Wed, 17 Apr 2013 09:47:00 +0300 Subject: [PATCH 8/9] iwlwifi: dvm: don't send zeroed LQ cmd When the stations are being restored because of unassoc RXON, the LQ cmd may not have been initialized because it is initialized only after association. Sending zeroed LQ_CMD makes the fw unhappy: it raises SYSASSERT_2078. Cc: stable@vger.kernel.org Signed-off-by: Emmanuel Grumbach Reviewed-by: Johannes Berg [move zero_lq and make static const] Signed-off-by: Johannes Berg --- drivers/net/wireless/iwlwifi/dvm/sta.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/drivers/net/wireless/iwlwifi/dvm/sta.c b/drivers/net/wireless/iwlwifi/dvm/sta.c index b775769f8322..db183b44e038 100644 --- a/drivers/net/wireless/iwlwifi/dvm/sta.c +++ b/drivers/net/wireless/iwlwifi/dvm/sta.c @@ -695,6 +695,7 @@ void iwl_clear_ucode_stations(struct iwl_priv *priv, void iwl_restore_stations(struct iwl_priv *priv, struct iwl_rxon_context *ctx) { struct iwl_addsta_cmd sta_cmd; + static const struct iwl_link_quality_cmd zero_lq = {}; struct iwl_link_quality_cmd lq; int i; bool found = false; @@ -733,7 +734,9 @@ void iwl_restore_stations(struct iwl_priv *priv, struct iwl_rxon_context *ctx) else memcpy(&lq, priv->stations[i].lq, sizeof(struct iwl_link_quality_cmd)); - send_lq = true; + + if (!memcmp(&lq, &zero_lq, sizeof(lq))) + send_lq = true; } spin_unlock_bh(&priv->sta_lock); ret = iwl_send_add_sta(priv, &sta_cmd, CMD_SYNC); From 499892f2a9ad89910ff21c687273ac80b4367dc0 Mon Sep 17 00:00:00 2001 From: Emmanuel Grumbach Date: Wed, 17 Apr 2013 11:03:57 +0300 Subject: [PATCH 9/9] iwlwifi: add a subdevice ID for 7000 series Add another ID for a 7000 series device. Signed-off-by: Emmanuel Grumbach Signed-off-by: Johannes Berg --- drivers/net/wireless/iwlwifi/pcie/drv.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/net/wireless/iwlwifi/pcie/drv.c b/drivers/net/wireless/iwlwifi/pcie/drv.c index 0016bb24b3d7..8cb53ec2b77b 100644 --- a/drivers/net/wireless/iwlwifi/pcie/drv.c +++ b/drivers/net/wireless/iwlwifi/pcie/drv.c @@ -256,6 +256,7 @@ static DEFINE_PCI_DEVICE_TABLE(iwl_hw_card_ids) = { /* 7000 Series */ {IWL_PCI_DEVICE(0x08B1, 0x4070, iwl7260_2ac_cfg)}, + {IWL_PCI_DEVICE(0x08B1, 0x4062, iwl7260_2ac_cfg)}, {IWL_PCI_DEVICE(0x08B1, 0xC070, iwl7260_2ac_cfg)}, {IWL_PCI_DEVICE(0x08B3, 0x0070, iwl3160_ac_cfg)}, {IWL_PCI_DEVICE(0x08B3, 0x8070, iwl3160_ac_cfg)},