Received: by 2002:a05:6902:102b:0:0:0:0 with SMTP id x11csp7628ybt; Tue, 23 Jun 2020 13:51:19 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwV3/kHcEfOxBEjoxlMcD9uv9sedja8FnQCEXiPoFCnmKQDby7XVG0w+8TEGy1xCiY+zkUp X-Received: by 2002:a17:906:5799:: with SMTP id k25mr2343494ejq.540.1592945479777; Tue, 23 Jun 2020 13:51:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1592945479; cv=none; d=google.com; s=arc-20160816; b=i/EscLsChF2kDpzggBJYHiGbmM3FEtZeZhu0pJkkcvpXzWFSBG5i7yL+Oct0HnMtds Ss9nTclIJzGlpJwFgBrS5/ACv8Bua8+DhqnsErubm7i0cTbMH/1DzR0IvYkp6BBxa4yC FBF/5aGcFFoHDKgS+n8XPuxw43yr0fobRiJiuX3N57LwnpcOI7zrYHExT2OzWacgd5pF QW/hLU4oCm2pSSp6FwICbLJYQBU/7qaw3e1SZ7MXJcZY4KtYkhYOa2pSUMWrFmEh+Bfx 9QXgmMPKUYfh3Ww3aJkU/ZGTfdc1VloH9ETzewcuqDCqOMl8IA1qFue8E49vCicy6RCD mOfg== 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 :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=Xwphd7tbsDfsO07G4yimd9HWbx1NY0S3lT7TnHPcXsA=; b=GJSRRdiZbd0AeKU4zFCAEoDfdPAOo0cRxUM1SFzJbp/iQO7dEVpCXXPuqE+esajrGH s73wrPzA/NXyq0uamZ+6o0lzGt+MBVb+YhpB/IZ+iMX0DzY93hLy2VyCNrvvizVIYG7d 33yAGhHIbx4OL+xzcU5RkCtVxaH4Yw1/dJiuCMZbbThwlmFzMDm7clAmYb8WI+mJ3fKk jrZk2FszRAj0pXLC8cdc1En7WmZWQ7gsJ5zEUUywBk120EJxR6HRlabP4NfqV+HlMIm9 XECKEMl/YOvemsdQhReQuIR2ZRrLaxJH0sMh/LI7PoMQy+N0DsKRoO98NG7UO7cDXLIu 2BwQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=FLSLBXJn; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id cn4si4984326edb.462.2020.06.23.13.50.56; Tue, 23 Jun 2020 13:51:19 -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=FLSLBXJn; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2392980AbgFWUtd (ORCPT + 99 others); Tue, 23 Jun 2020 16:49:33 -0400 Received: from mail.kernel.org ([198.145.29.99]:48898 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2389240AbgFWUtT (ORCPT ); Tue, 23 Jun 2020 16:49:19 -0400 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id B2F6721548; Tue, 23 Jun 2020 20:49:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1592945359; bh=YODy5P+xJJ8eXbvroM7ztyXK8tz1plvw8dxRsqkUtcg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=FLSLBXJn/iqeUPmYkPq4bBPMQpWCXW8Nv9Nn79o0pd4dmWeBRale5tvRYpVDQNhAf /0RU6659LxGJabK5yrnzDu3fSn9vMmBFXPdNuJx+KSDldZKtsdP3qOb4SZpCixNSV8 lQYQe2hPz0Zq4pGY2zov1SRplwX3J/DoT8IKUs2Q= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, "Rafael J. Wysocki" , Andy Shevchenko , Stable@vger.kernel.org, Chen Yu , Aaron Brown , Jeff Kirsher Subject: [PATCH 4.14 133/136] e1000e: Do not wake up the system via WOL if device wakeup is disabled Date: Tue, 23 Jun 2020 21:59:49 +0200 Message-Id: <20200623195310.515172910@linuxfoundation.org> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20200623195303.601828702@linuxfoundation.org> References: <20200623195303.601828702@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 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 commit 6bf6be1127f7e6d4bf39f84d56854e944d045d74 upstream. 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: Greg Kroah-Hartman --- drivers/net/ethernet/intel/e1000e/netdev.c | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) --- a/drivers/net/ethernet/intel/e1000e/netdev.c +++ b/drivers/net/ethernet/intel/e1000e/netdev.c @@ -6328,11 +6328,17 @@ static int __e1000_shutdown(struct pci_d 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; @@ -6389,7 +6395,7 @@ static int __e1000_shutdown(struct pci_d if (adapter->hw.phy.type == e1000_phy_igp_3) { e1000e_igp3_phy_powerdown_workaround_ich8lan(&adapter->hw); } else if (hw->mac.type >= e1000_pch_lpt) { - 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. */