From patchwork Mon Nov 24 14:34:43 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Emmanuel Grumbach X-Patchwork-Id: 5367121 Return-Path: X-Original-To: patchwork-linux-wireless@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id C91A4C11AD for ; Mon, 24 Nov 2014 14:36:58 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id EF9D3203EC for ; Mon, 24 Nov 2014 14:36:57 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 0E26D203EB for ; Mon, 24 Nov 2014 14:36:57 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932355AbaKXOgq (ORCPT ); Mon, 24 Nov 2014 09:36:46 -0500 Received: from mail-wi0-f174.google.com ([209.85.212.174]:39463 "EHLO mail-wi0-f174.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932350AbaKXOgp (ORCPT ); Mon, 24 Nov 2014 09:36:45 -0500 Received: by mail-wi0-f174.google.com with SMTP id h11so5851061wiw.13 for ; Mon, 24 Nov 2014 06:36:44 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=W+rH+ynLqHPueLSuQq9NoZ5F/inR/fT8uCza37FpEP4=; b=zj7sQNchSTSmHP6guoTFNAzwGUh4UFJyriEOe2+U/0xl0J9mF2JVOXTrg8AM0bWTX7 hKxSzdrF6a9z+d5YPZ4vt927+inHW3x/o1z18CGdcgPGDBMtnD6QPW6T9n8j4OGMcLvf jFVx6MTsEE5fIlsPXBt9v94Y+0P+WqgM9XnsnuXhmRYn9k1W5IcX6IterwJxCj/DbOJZ tlD/h3+AR7pFgci22aNQLkFh3ZlR6G2kc8S6luMRkPvN3xyqEgjOBtGKIsFk2f5Ff7sO 7cELa6SY26If5M64DoaTppYmxL4fS8fkFbwfvMVAJwBJXdK40m5gslVic4XEN6q+B0zB n7JQ== X-Received: by 10.180.101.104 with SMTP id ff8mr16237054wib.12.1416839804445; Mon, 24 Nov 2014 06:36:44 -0800 (PST) Received: from localhost.localdomain (46-116-150-134.bb.netvision.net.il. [46.116.150.134]) by mx.google.com with ESMTPSA id n3sm21274744wjz.21.2014.11.24.06.36.43 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 24 Nov 2014 06:36:43 -0800 (PST) From: Emmanuel Grumbach To: linux-wireless@vger.kernel.org Cc: Luciano Coelho , Emmanuel Grumbach Subject: [PATCH 67/75] iwlwifi: mvm: treat netdetect wake up separately Date: Mon, 24 Nov 2014 16:34:43 +0200 Message-Id: <1416839691-28533-67-git-send-email-egrumbach@gmail.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: References: Sender: linux-wireless-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org X-Spam-Status: No, score=-6.8 required=5.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, T_DKIM_INVALID, T_RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Luciano Coelho When the device wakes up due to netdetect, we need to query different things from the firmware than when it wakes up with a normal WoWLAN. To make this easier, separate the netdetect wake up handling from the rest. For now, we don't send netdetect as a wake up reason, treating it as a non-wireless wake up. Signed-off-by: Luciano Coelho Signed-off-by: Emmanuel Grumbach --- drivers/net/wireless/iwlwifi/mvm/d3.c | 40 +++++++++++++++++++++++++++++++--- drivers/net/wireless/iwlwifi/mvm/mvm.h | 1 + 2 files changed, 38 insertions(+), 3 deletions(-) diff --git a/drivers/net/wireless/iwlwifi/mvm/d3.c b/drivers/net/wireless/iwlwifi/mvm/d3.c index c72d2e9..176556e 100644 --- a/drivers/net/wireless/iwlwifi/mvm/d3.c +++ b/drivers/net/wireless/iwlwifi/mvm/d3.c @@ -1048,6 +1048,8 @@ static int __iwl_mvm_suspend(struct ieee80211_hw *hw, mvm, wowlan, wowlan->nd_config ?: mvm->nd_config, vif); if (ret) goto out; + + mvm->net_detect = true; } else { struct iwl_wowlan_config_cmd_v3 wowlan_config_cmd = {}; @@ -1067,6 +1069,8 @@ static int __iwl_mvm_suspend(struct ieee80211_hw *hw, vif, mvmvif, ap_sta); if (ret) goto out; + + mvm->net_detect = false; } ret = iwl_mvm_power_update_device(mvm); @@ -1621,6 +1625,32 @@ out_unlock: return false; } +static void iwl_mvm_query_netdetect_reasons(struct iwl_mvm *mvm, + struct ieee80211_vif *vif) +{ + struct cfg80211_wowlan_wakeup wakeup = { + .pattern_idx = -1, + }; + struct cfg80211_wowlan_wakeup *wakeup_report = &wakeup; + struct iwl_wowlan_status *fw_status; + u32 reasons = 0; + + fw_status = iwl_mvm_get_wakeup_status(mvm, vif); + if (!IS_ERR_OR_NULL(fw_status)) + reasons = le32_to_cpu(fw_status->wakeup_reasons); + + if (reasons & IWL_WOWLAN_WAKEUP_BY_RFKILL_DEASSERTED) + wakeup.rfkill_release = true; + + if (reasons == IWL_WOWLAN_WAKEUP_BY_NON_WIRELESS) { + /* TODO: read and check if it was netdetect */ + wakeup_report = NULL; + } + + mutex_unlock(&mvm->mutex); + ieee80211_report_wowlan_wakeup(vif, wakeup_report, GFP_KERNEL); +} + static void iwl_mvm_read_d3_sram(struct iwl_mvm *mvm) { #ifdef CONFIG_IWLWIFI_DEBUGFS @@ -1678,11 +1708,15 @@ static int __iwl_mvm_resume(struct iwl_mvm *mvm, bool test) /* query SRAM first in case we want event logging */ iwl_mvm_read_d3_sram(mvm); - keep = iwl_mvm_query_wakeup_reasons(mvm, vif); + if (mvm->net_detect) { + iwl_mvm_query_netdetect_reasons(mvm, vif); + } else { + keep = iwl_mvm_query_wakeup_reasons(mvm, vif); #ifdef CONFIG_IWLWIFI_DEBUGFS - if (keep) - mvm->keep_vif = vif; + if (keep) + mvm->keep_vif = vif; #endif + } /* has unlocked the mutex, so skip that */ goto out; diff --git a/drivers/net/wireless/iwlwifi/mvm/mvm.h b/drivers/net/wireless/iwlwifi/mvm/mvm.h index 7c62f80..e6079f4 100644 --- a/drivers/net/wireless/iwlwifi/mvm/mvm.h +++ b/drivers/net/wireless/iwlwifi/mvm/mvm.h @@ -685,6 +685,7 @@ struct iwl_mvm { /* sched scan settings for net detect */ struct cfg80211_sched_scan_request *nd_config; struct ieee80211_scan_ies nd_ies; + bool net_detect; #ifdef CONFIG_IWLWIFI_DEBUGFS u32 d3_wake_sysassert; /* must be u32 for debugfs_create_bool */ bool d3_test_active;