From owner-svn-src-stable-12@freebsd.org Thu Oct 24 14:18:07 2019 Return-Path: Delivered-To: svn-src-stable-12@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 03F5916E1B1; Thu, 24 Oct 2019 14:18:07 +0000 (UTC) (envelope-from marius@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46zTqL6HlHz3K8Q; Thu, 24 Oct 2019 14:18:06 +0000 (UTC) (envelope-from marius@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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id BC7F0F64B; Thu, 24 Oct 2019 14:18:06 +0000 (UTC) (envelope-from marius@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x9OEI6o6002312; Thu, 24 Oct 2019 14:18:06 GMT (envelope-from marius@FreeBSD.org) Received: (from marius@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9OEI62d002311; Thu, 24 Oct 2019 14:18:06 GMT (envelope-from marius@FreeBSD.org) Message-Id: <201910241418.x9OEI62d002311@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: marius set sender to marius@FreeBSD.org using -f From: Marius Strobl Date: Thu, 24 Oct 2019 14:18:06 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r354021 - stable/12/sys/dev/e1000 X-SVN-Group: stable-12 X-SVN-Commit-Author: marius X-SVN-Commit-Paths: stable/12/sys/dev/e1000 X-SVN-Commit-Revision: 354021 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-12@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for only the 12-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 24 Oct 2019 14:18:07 -0000 Author: marius Date: Thu Oct 24 14:18:06 2019 New Revision: 354021 URL: https://svnweb.freebsd.org/changeset/base/354021 Log: MFC: r353778 - In em_intr(), just call em_handle_link() instead of duplicating it. - In em_msix_link(), properly handle IGB-class devices after the iflib(4) conversion again by only setting EM_MSIX_LINK for the EM-class 82574 and by re-arming link interrupts unconditionally, i. e. not only in case of spurious interrupts. This fixes the interface link state change detection for the IGB-class. [1] - In em_if_update_admin_status(), only re-arm the link state change interrupt for 82574 and also only if such a device uses MSI-X, i. e. takes advantage of autoclearing. In case of INTx and MSI as well as for LEM- and IGB-class devices, re-arming isn't appropriate here and setting EM_MSIX_LINK isn't either. While at it, consistently take advantage of the hw variable. PR: 236724 [1] Differential Revision: https://reviews.freebsd.org/D21924 Modified: stable/12/sys/dev/e1000/if_em.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/dev/e1000/if_em.c ============================================================================== --- stable/12/sys/dev/e1000/if_em.c Thu Oct 24 12:16:15 2019 (r354020) +++ stable/12/sys/dev/e1000/if_em.c Thu Oct 24 14:18:06 2019 (r354021) @@ -1395,10 +1395,8 @@ em_intr(void *arg) IFDI_INTR_DISABLE(ctx); /* Link status change */ - if (reg_icr & (E1000_ICR_RXSEQ | E1000_ICR_LSC)) { - adapter->hw.mac.get_link_status = 1; - iflib_admin_intr_deferred(ctx); - } + if (reg_icr & (E1000_ICR_RXSEQ | E1000_ICR_LSC)) + em_handle_link(ctx); if (reg_icr & E1000_ICR_RXO) adapter->rx_overruns++; @@ -1481,22 +1479,24 @@ em_msix_link(void *arg) if (reg_icr & (E1000_ICR_RXSEQ | E1000_ICR_LSC)) { em_handle_link(adapter->ctx); - } else { - E1000_WRITE_REG(&adapter->hw, E1000_IMS, - EM_MSIX_LINK | E1000_IMS_LSC); - if (adapter->hw.mac.type >= igb_mac_min) - E1000_WRITE_REG(&adapter->hw, E1000_EIMS, adapter->link_mask); + } else if (adapter->hw.mac.type == e1000_82574) { + /* Only re-arm 82574 if em_if_update_admin_status() won't. */ + E1000_WRITE_REG(&adapter->hw, E1000_IMS, EM_MSIX_LINK | + E1000_IMS_LSC); } - /* - * Because we must read the ICR for this interrupt - * it may clear other causes using autoclear, for - * this reason we simply create a soft interrupt - * for all these vectors. - */ - if (reg_icr && adapter->hw.mac.type < igb_mac_min) { - E1000_WRITE_REG(&adapter->hw, - E1000_ICS, adapter->ims); + if (adapter->hw.mac.type == e1000_82574) { + /* + * Because we must read the ICR for this interrupt it may + * clear other causes using autoclear, for this reason we + * simply create a soft interrupt for all these vectors. + */ + if (reg_icr) + E1000_WRITE_REG(&adapter->hw, E1000_ICS, adapter->ims); + } else { + /* Re-arm unconditionally */ + E1000_WRITE_REG(&adapter->hw, E1000_IMS, E1000_IMS_LSC); + E1000_WRITE_REG(&adapter->hw, E1000_EIMS, adapter->link_mask); } return (FILTER_HANDLED); @@ -1512,7 +1512,6 @@ em_handle_link(void *context) iflib_admin_intr_deferred(ctx); } - /********************************************************************* * * Media Ioctl callback @@ -1829,14 +1828,15 @@ em_if_update_admin_status(if_ctx_t ctx) em_update_stats_counters(adapter); /* Reset LAA into RAR[0] on 82571 */ - if ((adapter->hw.mac.type == e1000_82571) && - e1000_get_laa_state_82571(&adapter->hw)) - e1000_rar_set(&adapter->hw, adapter->hw.mac.addr, 0); + if (hw->mac.type == e1000_82571 && e1000_get_laa_state_82571(hw)) + e1000_rar_set(hw, hw->mac.addr, 0); - if (adapter->hw.mac.type < em_mac_min) + if (hw->mac.type < em_mac_min) lem_smartspeed(adapter); - - E1000_WRITE_REG(&adapter->hw, E1000_IMS, EM_MSIX_LINK | E1000_IMS_LSC); + else if (hw->mac.type == e1000_82574 && + adapter->intr_type == IFLIB_INTR_MSIX) + E1000_WRITE_REG(&adapter->hw, E1000_IMS, EM_MSIX_LINK | + E1000_IMS_LSC); } static void