Received: by 2002:a05:6902:102b:0:0:0:0 with SMTP id x11csp3059676ybt; Mon, 29 Jun 2020 14:12:42 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyseubmTxZa6EhQPe5FQ2pqqCzCpnI8HeJ30Vt6OipR3glS0PyjC1jG98bzhBi5D43Y44Sn X-Received: by 2002:a50:8e53:: with SMTP id 19mr2325574edx.185.1593465161769; Mon, 29 Jun 2020 14:12:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1593465161; cv=none; d=google.com; s=arc-20160816; b=SBpf1alAcXU5QFSxTGBhS+QZxdTMK6pp7L7tW7lBuRdnryNHeWKpM8K2PADN5maHkr 12TL+lRnNuCRG0qFbZTlIxEkBtCPNg1+oYeiL+x4updHKsxIrcGQKQnPz8I6BGmG50aP Tl1X23cowwqDhE5jCr/M8+n2JSy2Y0tckcyIaoi43WV2ld2qwyedIe4zE/EwHDLn5ULU lD2TwbRS21bElvHzG5mHPx0r9n7MZQE7+0ZQUoHa1KChuEUyIKMXRo4s7HIqx/CJUIkS YywlPocOybqDODjfAafoRI89voY6SB3Uj62ufCwh1bzq2D6W9v9DGYphmXPoL+tdRzoe m2sw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=pXBvNfZAiXBVRW/nSH44KioJSMiJBv2H+SnEUzerqXg=; b=Khubr2QAM4ViYlN4+VGKrEsOlJ3yiLC6aTs4PiAN76ujZCIIH9n7uLTwqu5HqZc1dT DVC1pMuYWZz+K3rWw1ao44hfTJa5st3rYzV5wmlM0zZlpwNrtl8YS5Z2qc9dgJHEdyE3 hnFXhjO4xm1cc3VttONP4K5SE/bEtUCSRuU0uojYzwfvaT7ispLELYSioLv69VVIlIyK i62WcQ9vJ9TjolTvYq9z495DTVek6GbtEBW8M7+AGlKZkuzcE/XVcmH64L9Ig/Tn1o9V qM3ABhuvvbORWa7lIe58Se6gSniQw10xke4m+QOCNMywzbTM6Td74akOi2cdUt5TSuM9 rG6Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=BiqyLIKc; 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=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id b10si396976eja.426.2020.06.29.14.12.18; Mon, 29 Jun 2020 14:12:41 -0700 (PDT) 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; dkim=pass header.i=@kernel.org header.s=default header.b=BiqyLIKc; 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=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2390360AbgF2VKk (ORCPT + 99 others); Mon, 29 Jun 2020 17:10:40 -0400 Received: from mail.kernel.org ([198.145.29.99]:45428 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730223AbgF2TAR (ORCPT ); Mon, 29 Jun 2020 15:00:17 -0400 Received: from sasha-vm.mshome.net (c-73-47-72-35.hsd1.nh.comcast.net [73.47.72.35]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 1D5BC2551F; Mon, 29 Jun 2020 15:54:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1593446078; bh=LDXT9UF8X44Hnv40HO63lWGGsL9RnJsPrsTfMFszSLI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=BiqyLIKclejyen5yWlsUkaIncwZxCt3XWQHtb7Io/t3B1zbUs8ctb8wNl8GWv7VQy 9sBaD4PbS88CxI1UqvZpyTB1t3AvGkPTHQ7i2lsN+VvLjLomyiRwWuC8bnJW29kR+K Rmwgpi0Vc7SBzXEICUuRCXnpgmkNORdkehQPPIIA= From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Chen Yu , "Rafael J. Wysocki" , Andy Shevchenko , Stable@vger.kernel.org, Aaron Brown , Jeff Kirsher , Sasha Levin Subject: [PATCH 4.4 074/135] e1000e: Do not wake up the system via WOL if device wakeup is disabled Date: Mon, 29 Jun 2020 11:52:08 -0400 Message-Id: <20200629155309.2495516-75-sashal@kernel.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200629155309.2495516-1-sashal@kernel.org> References: <20200629155309.2495516-1-sashal@kernel.org> MIME-Version: 1.0 X-KernelTest-Patch: http://kernel.org/pub/linux/kernel/v4.x/stable-review/patch-4.4.229-rc1.gz X-KernelTest-Tree: git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.git X-KernelTest-Branch: linux-4.4.y X-KernelTest-Patches: git://git.kernel.org/pub/scm/linux/kernel/git/stable/stable-queue.git X-KernelTest-Version: 4.4.229-rc1 X-KernelTest-Deadline: 2020-07-01T15:53+00:00 X-stable: review X-Patchwork-Hint: Ignore Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Chen Yu [ Upstream commit 6bf6be1127f7e6d4bf39f84d56854e944d045d74 ] Currently the system will be woken up via WOL(Wake On LAN) even if the device wakeup ability has been disabled via sysfs: cat /sys/devices/pci0000:00/0000:00:1f.6/power/wakeup disabled The system should not be woken up if the user has explicitly disabled the wake up ability for this device. This patch clears the WOL ability of this network device if the user has disabled the wake up ability in sysfs. Fixes: bc7f75fa9788 ("[E1000E]: New pci-express e1000 driver") Reported-by: "Rafael J. Wysocki" Reviewed-by: Andy Shevchenko Cc: Signed-off-by: Chen Yu Tested-by: Aaron Brown Signed-off-by: Jeff Kirsher Signed-off-by: Sasha Levin --- drivers/net/ethernet/intel/e1000e/netdev.c | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/drivers/net/ethernet/intel/e1000e/netdev.c b/drivers/net/ethernet/intel/e1000e/netdev.c index 203f96faf6fbe..3bd0bdbdfa0e1 100644 --- a/drivers/net/ethernet/intel/e1000e/netdev.c +++ b/drivers/net/ethernet/intel/e1000e/netdev.c @@ -6270,11 +6270,17 @@ static int __e1000_shutdown(struct pci_dev *pdev, bool runtime) struct net_device *netdev = pci_get_drvdata(pdev); struct e1000_adapter *adapter = netdev_priv(netdev); struct e1000_hw *hw = &adapter->hw; - u32 ctrl, ctrl_ext, rctl, status; - /* Runtime suspend should only enable wakeup for link changes */ - u32 wufc = runtime ? E1000_WUFC_LNKC : adapter->wol; + u32 ctrl, ctrl_ext, rctl, status, wufc; int retval = 0; + /* Runtime suspend should only enable wakeup for link changes */ + if (runtime) + wufc = E1000_WUFC_LNKC; + else if (device_may_wakeup(&pdev->dev)) + wufc = adapter->wol; + else + wufc = 0; + status = er32(STATUS); if (status & E1000_STATUS_LU) wufc &= ~E1000_WUFC_LNKC; @@ -6332,7 +6338,7 @@ static int __e1000_shutdown(struct pci_dev *pdev, bool runtime) e1000e_igp3_phy_powerdown_workaround_ich8lan(&adapter->hw); } else if ((hw->mac.type == e1000_pch_lpt) || (hw->mac.type == e1000_pch_spt)) { - if (!(wufc & (E1000_WUFC_EX | E1000_WUFC_MC | E1000_WUFC_BC))) + if (wufc && !(wufc & (E1000_WUFC_EX | E1000_WUFC_MC | E1000_WUFC_BC))) /* ULP does not support wake from unicast, multicast * or broadcast. */ -- 2.25.1