From owner-svn-src-head@freebsd.org Sun Jan 22 18:04:58 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 8D0C0CBC319; Sun, 22 Jan 2017 18:04:58 +0000 (UTC) (envelope-from sbruno@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 67DA13BB; Sun, 22 Jan 2017 18:04:58 +0000 (UTC) (envelope-from sbruno@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v0MI4vRE052603; Sun, 22 Jan 2017 18:04:57 GMT (envelope-from sbruno@FreeBSD.org) Received: (from sbruno@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v0MI4vjF052602; Sun, 22 Jan 2017 18:04:57 GMT (envelope-from sbruno@FreeBSD.org) Message-Id: <201701221804.v0MI4vjF052602@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: sbruno set sender to sbruno@FreeBSD.org using -f From: Sean Bruno Date: Sun, 22 Jan 2017 18:04:57 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r312641 - head/sys/dev/e1000 X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 22 Jan 2017 18:04:58 -0000 Author: sbruno Date: Sun Jan 22 18:04:57 2017 New Revision: 312641 URL: https://svnweb.freebsd.org/changeset/base/312641 Log: igb(4) enable WOL features for this class of devices. PR: 208343 Submitted by: Kaho Tashikazu Modified: head/sys/dev/e1000/if_em.c Modified: head/sys/dev/e1000/if_em.c ============================================================================== --- head/sys/dev/e1000/if_em.c Sun Jan 22 18:04:41 2017 (r312640) +++ head/sys/dev/e1000/if_em.c Sun Jan 22 18:04:57 2017 (r312641) @@ -1738,7 +1738,7 @@ em_if_stop(if_ctx_t ctx) e1000_reset_hw(&adapter->hw); if (adapter->hw.mac.type >= e1000_82544) - E1000_WRITE_REG(&adapter->hw, E1000_WUC, 0); + E1000_WRITE_REG(&adapter->hw, E1000_WUFC, 0); e1000_led_off(&adapter->hw); e1000_cleanup_led(&adapter->hw); @@ -2313,7 +2313,7 @@ em_reset(if_ctx_t ctx) /* Issue a global reset */ e1000_reset_hw(hw); - E1000_WRITE_REG(hw, E1000_WUC, 0); + E1000_WRITE_REG(hw, E1000_WUFC, 0); em_disable_aspm(adapter); /* and a re-init */ if (e1000_init_hw(hw) < 0) { @@ -2514,9 +2514,12 @@ em_setup_interface(if_ctx_t ctx) /* Enable only WOL MAGIC by default */ if (adapter->wol) { - if_setcapabilitiesbit(ifp, IFCAP_WOL, 0); - if_setcapenablebit(ifp, IFCAP_WOL_MAGIC, 0); - } + if_setcapenablebit(ifp, IFCAP_WOL_MAGIC, + IFCAP_WOL_MCAST| IFCAP_WOL_UCAST); + } else { + if_setcapenablebit(ifp, 0, IFCAP_WOL_MAGIC | + IFCAP_WOL_MCAST| IFCAP_WOL_UCAST); + } /* * Specify the media types supported by this adapter and register @@ -3314,6 +3317,15 @@ em_get_wakeup(if_ctx_t ctx) case e1000_pch2lan: case e1000_pch_lpt: case e1000_pch_spt: + case e1000_82575: /* listing all igb devices */ + case e1000_82576: + case e1000_82580: + case e1000_i350: + case e1000_i354: + case e1000_i210: + case e1000_i211: + case e1000_vfadapt: + case e1000_vfadapt_i350: apme_mask = E1000_WUC_APME; adapter->has_amt = TRUE; eeprom_data = E1000_READ_REG(&adapter->hw, E1000_WUC); @@ -3393,7 +3405,7 @@ em_enable_wakeup(if_ctx_t ctx) ctrl |= (E1000_CTRL_SWDPIN2 | E1000_CTRL_SWDPIN3); E1000_WRITE_REG(&adapter->hw, E1000_CTRL, ctrl); wuc = E1000_READ_REG(&adapter->hw, E1000_WUC); - wuc |= E1000_WUC_PME_EN ; + wuc |= (E1000_WUC_PME_EN | E1000_WUC_APME); E1000_WRITE_REG(&adapter->hw, E1000_WUC, wuc); if ((adapter->hw.mac.type == e1000_ich8lan) || @@ -3417,6 +3429,9 @@ em_enable_wakeup(if_ctx_t ctx) if ((if_getcapenable(ifp) & IFCAP_WOL_MAGIC) == 0) adapter->wol &= ~E1000_WUFC_MAG; + if ((if_getcapenable(ifp) & IFCAP_WOL_UCAST) == 0) + adapter->wol &= ~E1000_WUFC_EX; + if ((if_getcapenable(ifp) & IFCAP_WOL_MCAST) == 0) adapter->wol &= ~E1000_WUFC_MC; else { @@ -3425,10 +3440,7 @@ em_enable_wakeup(if_ctx_t ctx) E1000_WRITE_REG(&adapter->hw, E1000_RCTL, rctl); } - if ((adapter->hw.mac.type == e1000_pchlan) || - (adapter->hw.mac.type == e1000_pch2lan) || - (adapter->hw.mac.type == e1000_pch_lpt) || - (adapter->hw.mac.type == e1000_pch_spt)) { + if ( adapter->hw.mac.type >= e1000_pchlan) { if (em_enable_phy_wakeup(adapter)) return; } else { @@ -3493,7 +3505,7 @@ em_enable_phy_wakeup(struct adapter *ada /* enable PHY wakeup in MAC register */ E1000_WRITE_REG(hw, E1000_WUC, - E1000_WUC_PHY_WAKE | E1000_WUC_PME_EN); + E1000_WUC_PHY_WAKE | E1000_WUC_PME_EN | E1000_WUC_APME); E1000_WRITE_REG(hw, E1000_WUFC, adapter->wol); /* configure and enable PHY wakeup in PHY registers */