Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp1729529pxu; Tue, 24 Nov 2020 07:35:12 -0800 (PST) X-Google-Smtp-Source: ABdhPJyWCYzZJ3qSfWGKBYwQNQ29q23gP/8IIre5mhZydyudTJDsFo+eVHuHkIIdTSpgQ6SFawEk X-Received: by 2002:a17:906:34cd:: with SMTP id h13mr4565313ejb.350.1606232112143; Tue, 24 Nov 2020 07:35:12 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1606232112; cv=none; d=google.com; s=arc-20160816; b=PVpFxarBNbtfjkMsG75kZY8m698lGBJPotMpxHN7ze08jbquTsbsq6En252dbQULDg SZJegRIGGv5BbbaRp8LPj57o7Y3aIGe/f//CcR7GMv4aANJ58hFpFAHCjbIjkuyTnhqj b0v42y3w66jt7De0uNStc/QrXIZ7dRh/jIUxZrcN60BaJupMUzcWT8jxiyi1fkX44oxR rk0wIhxvKUbC37Vr3oapPvlMinZZWjuMpPU8yDQvTN5hbb8PjlQvwWPDJPg2g1xxoDJq 1u+8+4uTbQlVixjfibn91RdCQsxXXRxk4ztKENMXevmnlGDA2+sPvKZj5mYATkfKVrj3 Ew+Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:message-id:date:subject:cc:to:from:ironport-sdr :ironport-sdr; bh=Q9JCEvzKVjhfC2I5l4ShMuOgAHeZvFLRNiLbDDklOLk=; b=YqG7IeAXpBGkZxuZcnKx3DgOevMfQIbApwRAG0/eDZ+0QYmROyg84Lrx3VOT8zexrQ prDe6MYDM+kUqFlQClBSvM9YHR6ojX2IB/QgKfX2YzRudmOoy70Aj2h5tJP5lz9UDNKj 0VNHlNV1F1ZcmJv13ghZU8v+gmARJQhGCgC2e8X4a4tS2JaKCE/0PTpCtYjQFydmRj67 s7hCCjS6zGtMp4uZZoWXLWIyEMynXjDXFCPRnWKwDtZlgtHU4AUWdF6BU5b1TPmeOfR8 243/FGI0nSu2kR+Z+7+ADnhC64BKRzSgv/NhfsQ5jQ+eqOhzojAv3zhetGoWkzHT9g7I BBkw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id a12si8964317edy.403.2020.11.24.07.34.49; Tue, 24 Nov 2020 07:35:12 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2389529AbgKXP3x (ORCPT + 99 others); Tue, 24 Nov 2020 10:29:53 -0500 Received: from mga11.intel.com ([192.55.52.93]:4560 "EHLO mga11.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2388503AbgKXP3x (ORCPT ); Tue, 24 Nov 2020 10:29:53 -0500 IronPort-SDR: yi5RIhHXcJrDHS+gTVKFwQeJ/IrEeQJclQsqrGSb+9JytBleXU3OeqcW7wzSJhlsEOzyhNIad4 1mImdnPWuM4w== X-IronPort-AV: E=McAfee;i="6000,8403,9815"; a="168453629" X-IronPort-AV: E=Sophos;i="5.78,366,1599548400"; d="scan'208";a="168453629" X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga005.jf.intel.com ([10.7.209.41]) by fmsmga102.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 24 Nov 2020 07:29:52 -0800 IronPort-SDR: fQ9I22IVv+TiwPdND4euQLiZL77uLd+BkWrMNAdcHQoR8q5461FCJzLbqRbjVYgdrDFpTOj+D3 JmkubIBnLlZA== X-IronPort-AV: E=Sophos;i="5.78,366,1599548400"; d="scan'208";a="546868986" Received: from chenyu-office.sh.intel.com ([10.239.158.173]) by orsmga005-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 24 Nov 2020 07:29:49 -0800 From: Chen Yu To: "Rafael J. Wysocki" , Len Brown , Tony Nguyen , Jesse Brandeburg Cc: intel-wired-lan@lists.osuosl.org, linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org, Sasha Neftin , Jeff Kirsher , Kai-Heng Feng , Chen Yu Subject: [PATCH] e1000e: Assign DPM_FLAG_SMART_SUSPEND and DPM_FLAG_MAY_SKIP_RESUME to speed up s2ram Date: Tue, 24 Nov 2020 23:32:21 +0800 Message-Id: <20201124153221.11265-1-yu.c.chen@intel.com> X-Mailer: git-send-email 2.17.1 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The NIC is put in runtime suspend status when there is no wire connected. As a result, it is safe to keep this NIC in runtime suspended during s2ram because the system does not rely on the NIC plug event nor WOL to wake up the system. Unlike the s2idle, s2ram does not need to manipulate S0ix settings during suspend. This patch assigns DPM_FLAG_SMART_SUSPEND and DPM_FLAG_MAY_SKIP_RESUME to the e1000e driver so that the s2ram could skip the .suspend_late(), .suspend_noirq() and .resume_noirq() .resume_early() when possible. Also skip .suspend() and .resume() if dev_pm_skip_suspend() and dev_pm_skip_resume() return true, so as to speed up the s2ram. Signed-off-by: Chen Yu --- drivers/base/power/main.c | 2 ++ drivers/net/ethernet/intel/e1000e/netdev.c | 14 +++++++++++++- 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/drivers/base/power/main.c b/drivers/base/power/main.c index c7ac49042cee..9cd8abba8612 100644 --- a/drivers/base/power/main.c +++ b/drivers/base/power/main.c @@ -580,6 +580,7 @@ bool dev_pm_skip_resume(struct device *dev) return !dev->power.must_resume; } +EXPORT_SYMBOL_GPL(dev_pm_skip_resume); /** * device_resume_noirq - Execute a "noirq resume" callback for given device. @@ -2010,3 +2011,4 @@ bool dev_pm_skip_suspend(struct device *dev) return dev_pm_test_driver_flags(dev, DPM_FLAG_SMART_SUSPEND) && pm_runtime_status_suspended(dev); } +EXPORT_SYMBOL_GPL(dev_pm_skip_suspend); diff --git a/drivers/net/ethernet/intel/e1000e/netdev.c b/drivers/net/ethernet/intel/e1000e/netdev.c index b30f00891c03..d79fddabc553 100644 --- a/drivers/net/ethernet/intel/e1000e/netdev.c +++ b/drivers/net/ethernet/intel/e1000e/netdev.c @@ -6965,6 +6965,14 @@ static __maybe_unused int e1000e_pm_suspend(struct device *dev) struct e1000_hw *hw = &adapter->hw; int rc; + /* Runtime suspended means that there is no wired connection + * and it has nothing to do with WOL that, we don't need to + * adjust the WOL settings. So it is safe to put NIC in + * runtime suspend while doing system suspend. + */ + if (dev_pm_skip_suspend(dev)) + return 0; + e1000e_flush_lpic(pdev); e1000e_pm_freeze(dev); @@ -6989,6 +6997,9 @@ static __maybe_unused int e1000e_pm_resume(struct device *dev) struct e1000_hw *hw = &adapter->hw; int rc; + if (dev_pm_skip_resume(dev)) + return 0; + /* Introduce S0ix implementation */ if (hw->mac.type >= e1000_pch_cnp && !e1000e_check_me(hw->adapter->pdev->device)) @@ -7665,7 +7676,8 @@ static int e1000_probe(struct pci_dev *pdev, const struct pci_device_id *ent) e1000_print_device_info(adapter); - dev_pm_set_driver_flags(&pdev->dev, DPM_FLAG_NO_DIRECT_COMPLETE); + dev_pm_set_driver_flags(&pdev->dev, DPM_FLAG_NO_DIRECT_COMPLETE | + DPM_FLAG_SMART_SUSPEND | DPM_FLAG_MAY_SKIP_RESUME); if (pci_dev_run_wake(pdev) && hw->mac.type < e1000_pch_cnp) pm_runtime_put_noidle(&pdev->dev); -- 2.25.1