From owner-svn-src-stable@freebsd.org Sun May 12 07:53:25 2019 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 25B8615900A7; Sun, 12 May 2019 07:53:25 +0000 (UTC) (envelope-from kib@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 BE2268CFEE; Sun, 12 May 2019 07:53:24 +0000 (UTC) (envelope-from kib@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 9870127BC5; Sun, 12 May 2019 07:53:24 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x4C7rOWN036323; Sun, 12 May 2019 07:53:24 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x4C7rOXO036322; Sun, 12 May 2019 07:53:24 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201905120753.x4C7rOXO036322@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Sun, 12 May 2019 07:53:24 +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: r347508 - stable/12/sys/vm X-SVN-Group: stable-12 X-SVN-Commit-Author: kib X-SVN-Commit-Paths: stable/12/sys/vm X-SVN-Commit-Revision: 347508 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: BE2268CFEE X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.95 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.996,0]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; NEURAL_HAM_SHORT(-0.96)[-0.955,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US] X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 12 May 2019 07:53:25 -0000 Author: kib Date: Sun May 12 07:53:24 2019 New Revision: 347508 URL: https://svnweb.freebsd.org/changeset/base/347508 Log: MFC r347150, r347180: Do not collapse objects with OBJ_NOSPLIT backing swap or default object. Modified: stable/12/sys/vm/vm_object.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/vm/vm_object.c ============================================================================== --- stable/12/sys/vm/vm_object.c Sun May 12 07:13:25 2019 (r347507) +++ stable/12/sys/vm/vm_object.c Sun May 12 07:53:24 2019 (r347508) @@ -1748,8 +1748,8 @@ vm_object_collapse(vm_object_t object) VM_OBJECT_WLOCK(backing_object); if (backing_object->handle != NULL || (backing_object->type != OBJT_DEFAULT && - backing_object->type != OBJT_SWAP) || - (backing_object->flags & OBJ_DEAD) || + backing_object->type != OBJT_SWAP) || + (backing_object->flags & (OBJ_DEAD | OBJ_NOSPLIT)) != 0 || object->handle != NULL || (object->type != OBJT_DEFAULT && object->type != OBJT_SWAP) || From owner-svn-src-stable@freebsd.org Sun May 12 07:55:26 2019 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id BE09F15902B7; Sun, 12 May 2019 07:55:26 +0000 (UTC) (envelope-from kib@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 645608D24D; Sun, 12 May 2019 07:55:26 +0000 (UTC) (envelope-from kib@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 2E18727BC6; Sun, 12 May 2019 07:55:26 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x4C7tQe2036487; Sun, 12 May 2019 07:55:26 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x4C7tQ4u036486; Sun, 12 May 2019 07:55:26 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201905120755.x4C7tQ4u036486@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Sun, 12 May 2019 07:55:26 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r347509 - stable/11/sys/vm X-SVN-Group: stable-11 X-SVN-Commit-Author: kib X-SVN-Commit-Paths: stable/11/sys/vm X-SVN-Commit-Revision: 347509 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 645608D24D X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.95 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.996,0]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; NEURAL_HAM_SHORT(-0.96)[-0.955,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US] X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 12 May 2019 07:55:26 -0000 Author: kib Date: Sun May 12 07:55:25 2019 New Revision: 347509 URL: https://svnweb.freebsd.org/changeset/base/347509 Log: MFC r347150, r347180: Do not collapse objects with OBJ_NOSPLIT backing swap or default object. Modified: stable/11/sys/vm/vm_object.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/vm/vm_object.c ============================================================================== --- stable/11/sys/vm/vm_object.c Sun May 12 07:53:24 2019 (r347508) +++ stable/11/sys/vm/vm_object.c Sun May 12 07:55:25 2019 (r347509) @@ -1777,8 +1777,8 @@ vm_object_collapse(vm_object_t object) VM_OBJECT_WLOCK(backing_object); if (backing_object->handle != NULL || (backing_object->type != OBJT_DEFAULT && - backing_object->type != OBJT_SWAP) || - (backing_object->flags & OBJ_DEAD) || + backing_object->type != OBJT_SWAP) || + (backing_object->flags & (OBJ_DEAD | OBJ_NOSPLIT)) != 0 || object->handle != NULL || (object->type != OBJT_DEFAULT && object->type != OBJT_SWAP) || From owner-svn-src-stable@freebsd.org Sun May 12 12:30:47 2019 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id E4F1215965FD; Sun, 12 May 2019 12:30:46 +0000 (UTC) (envelope-from avos@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 881926E208; Sun, 12 May 2019 12:30:46 +0000 (UTC) (envelope-from avos@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 647A52A8C3; Sun, 12 May 2019 12:30:46 +0000 (UTC) (envelope-from avos@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x4CCUkRb078350; Sun, 12 May 2019 12:30:46 GMT (envelope-from avos@FreeBSD.org) Received: (from avos@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x4CCUjp9078347; Sun, 12 May 2019 12:30:45 GMT (envelope-from avos@FreeBSD.org) Message-Id: <201905121230.x4CCUjp9078347@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: avos set sender to avos@FreeBSD.org using -f From: Andriy Voskoboinyk Date: Sun, 12 May 2019 12:30:45 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r347511 - in stable: 11/sys/dev/iwi 11/sys/dev/otus 11/sys/dev/usb/wlan 12/sys/dev/iwi 12/sys/dev/otus 12/sys/dev/usb/wlan X-SVN-Group: stable-11 X-SVN-Commit-Author: avos X-SVN-Commit-Paths: in stable: 11/sys/dev/iwi 11/sys/dev/otus 11/sys/dev/usb/wlan 12/sys/dev/iwi 12/sys/dev/otus 12/sys/dev/usb/wlan X-SVN-Commit-Revision: 347511 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 881926E208 X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.91 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.996,0]; NEURAL_HAM_SHORT(-0.92)[-0.918,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US]; NEURAL_HAM_LONG(-1.00)[-1.000,0] X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 12 May 2019 12:30:47 -0000 Author: avos Date: Sun May 12 12:30:45 2019 New Revision: 347511 URL: https://svnweb.freebsd.org/changeset/base/347511 Log: MFC r346073: urtw(4), otus(4), iwi(4): allow to set non-default MAC address via ifconfig(8) Was tested with Netgear WG111 v3 (RTL8187B, urtw(4)), STA mode. Modified: stable/11/sys/dev/iwi/if_iwi.c stable/11/sys/dev/otus/if_otus.c stable/11/sys/dev/usb/wlan/if_urtw.c Directory Properties: stable/11/ (props changed) Changes in other areas also in this revision: Modified: stable/12/sys/dev/iwi/if_iwi.c stable/12/sys/dev/otus/if_otus.c stable/12/sys/dev/usb/wlan/if_urtw.c Directory Properties: stable/12/ (props changed) Modified: stable/11/sys/dev/iwi/if_iwi.c ============================================================================== --- stable/11/sys/dev/iwi/if_iwi.c Sun May 12 07:56:01 2019 (r347510) +++ stable/11/sys/dev/iwi/if_iwi.c Sun May 12 12:30:45 2019 (r347511) @@ -2549,16 +2549,19 @@ static int iwi_config(struct iwi_softc *sc) { struct ieee80211com *ic = &sc->sc_ic; + struct ieee80211vap *vap = TAILQ_FIRST(&ic->ic_vaps); struct iwi_configuration config; struct iwi_rateset rs; struct iwi_txpower power; + uint8_t *macaddr; uint32_t data; int error, i; IWI_LOCK_ASSERT(sc); - DPRINTF(("Setting MAC address to %6D\n", ic->ic_macaddr, ":")); - error = iwi_cmd(sc, IWI_CMD_SET_MAC_ADDRESS, ic->ic_macaddr, + macaddr = vap ? vap->iv_myaddr : ic->ic_macaddr; + DPRINTF(("Setting MAC address to %6D\n", macaddr, ":")); + error = iwi_cmd(sc, IWI_CMD_SET_MAC_ADDRESS, macaddr, IEEE80211_ADDR_LEN); if (error != 0) return error; Modified: stable/11/sys/dev/otus/if_otus.c ============================================================================== --- stable/11/sys/dev/otus/if_otus.c Sun May 12 07:56:01 2019 (r347510) +++ stable/11/sys/dev/otus/if_otus.c Sun May 12 12:30:45 2019 (r347511) @@ -3095,7 +3095,7 @@ otus_set_operating_mode(struct otus_softc *sc) */ IEEE80211_ADDR_COPY(bssid, zero_macaddr); vap = TAILQ_FIRST(&ic->ic_vaps); - macaddr = ic->ic_macaddr; + macaddr = vap ? vap->iv_myaddr : ic->ic_macaddr; switch (ic->ic_opmode) { case IEEE80211_M_STA: Modified: stable/11/sys/dev/usb/wlan/if_urtw.c ============================================================================== --- stable/11/sys/dev/usb/wlan/if_urtw.c Sun May 12 07:56:01 2019 (r347510) +++ stable/11/sys/dev/usb/wlan/if_urtw.c Sun May 12 12:30:45 2019 (r347511) @@ -744,6 +744,7 @@ static void urtw_free_tx_data_list(struct urtw_softc static void urtw_free_rx_data_list(struct urtw_softc *); static void urtw_free_data_list(struct urtw_softc *, struct urtw_data data[], int, int); +static usb_error_t urtw_set_macaddr(struct urtw_softc *, const uint8_t *); static usb_error_t urtw_adapter_start(struct urtw_softc *); static usb_error_t urtw_adapter_start_b(struct urtw_softc *); static usb_error_t urtw_set_mode(struct urtw_softc *, uint32_t); @@ -1179,9 +1180,23 @@ fail: } static usb_error_t +urtw_set_macaddr(struct urtw_softc *sc, const uint8_t *macaddr) +{ + usb_error_t error; + + urtw_write32_m(sc, URTW_MAC0, ((const uint32_t *)macaddr)[0]); + urtw_write16_m(sc, URTW_MAC4, ((const uint32_t *)macaddr)[1] & 0xffff); + +fail: + return (error); +} + +static usb_error_t urtw_adapter_start(struct urtw_softc *sc) { struct ieee80211com *ic = &sc->sc_ic; + struct ieee80211vap *vap = TAILQ_FIRST(&ic->ic_vaps); + const uint8_t *macaddr; usb_error_t error; error = urtw_reset(sc); @@ -1201,8 +1216,11 @@ urtw_adapter_start(struct urtw_softc *sc) if (error) goto fail; /* applying MAC address again. */ - urtw_write32_m(sc, URTW_MAC0, ((uint32_t *)ic->ic_macaddr)[0]); - urtw_write16_m(sc, URTW_MAC4, ((uint32_t *)ic->ic_macaddr)[1] & 0xffff); + macaddr = vap ? vap->iv_myaddr : ic->ic_macaddr; + urtw_set_macaddr(sc, macaddr); + if (error) + goto fail; + error = urtw_set_mode(sc, URTW_EPROM_CMD_NORMAL); if (error) goto fail; @@ -3185,6 +3203,8 @@ static usb_error_t urtw_8225v2b_rf_init(struct urtw_softc *sc) { struct ieee80211com *ic = &sc->sc_ic; + struct ieee80211vap *vap = TAILQ_FIRST(&ic->ic_vaps); + const uint8_t *macaddr; unsigned int i; uint8_t data8; usb_error_t error; @@ -3232,8 +3252,10 @@ urtw_8225v2b_rf_init(struct urtw_softc *sc) urtw_write8_m(sc, URTW_CONFIG1, data8); /* applying MAC address again. */ - urtw_write32_m(sc, URTW_MAC0, ((uint32_t *)ic->ic_macaddr)[0]); - urtw_write16_m(sc, URTW_MAC4, ((uint32_t *)ic->ic_macaddr)[1] & 0xffff); + macaddr = vap ? vap->iv_myaddr : ic->ic_macaddr; + error = urtw_set_macaddr(sc, macaddr); + if (error) + goto fail; error = urtw_set_mode(sc, URTW_EPROM_CMD_NORMAL); if (error) From owner-svn-src-stable@freebsd.org Sun May 12 12:30:47 2019 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id AA0671596603; Sun, 12 May 2019 12:30:47 +0000 (UTC) (envelope-from avos@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 4CECB6E20D; Sun, 12 May 2019 12:30:47 +0000 (UTC) (envelope-from avos@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 28A312A8C5; Sun, 12 May 2019 12:30:47 +0000 (UTC) (envelope-from avos@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x4CCUlD9078358; Sun, 12 May 2019 12:30:47 GMT (envelope-from avos@FreeBSD.org) Received: (from avos@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x4CCUkGs078355; Sun, 12 May 2019 12:30:46 GMT (envelope-from avos@FreeBSD.org) Message-Id: <201905121230.x4CCUkGs078355@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: avos set sender to avos@FreeBSD.org using -f From: Andriy Voskoboinyk Date: Sun, 12 May 2019 12:30:46 +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: r347511 - in stable: 11/sys/dev/iwi 11/sys/dev/otus 11/sys/dev/usb/wlan 12/sys/dev/iwi 12/sys/dev/otus 12/sys/dev/usb/wlan X-SVN-Group: stable-12 X-SVN-Commit-Author: avos X-SVN-Commit-Paths: in stable: 11/sys/dev/iwi 11/sys/dev/otus 11/sys/dev/usb/wlan 12/sys/dev/iwi 12/sys/dev/otus 12/sys/dev/usb/wlan X-SVN-Commit-Revision: 347511 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 4CECB6E20D X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.91 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.996,0]; NEURAL_HAM_SHORT(-0.92)[-0.918,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US]; NEURAL_HAM_LONG(-1.00)[-1.000,0] X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 12 May 2019 12:30:47 -0000 Author: avos Date: Sun May 12 12:30:45 2019 New Revision: 347511 URL: https://svnweb.freebsd.org/changeset/base/347511 Log: MFC r346073: urtw(4), otus(4), iwi(4): allow to set non-default MAC address via ifconfig(8) Was tested with Netgear WG111 v3 (RTL8187B, urtw(4)), STA mode. Modified: stable/12/sys/dev/iwi/if_iwi.c stable/12/sys/dev/otus/if_otus.c stable/12/sys/dev/usb/wlan/if_urtw.c Directory Properties: stable/12/ (props changed) Changes in other areas also in this revision: Modified: stable/11/sys/dev/iwi/if_iwi.c stable/11/sys/dev/otus/if_otus.c stable/11/sys/dev/usb/wlan/if_urtw.c Directory Properties: stable/11/ (props changed) Modified: stable/12/sys/dev/iwi/if_iwi.c ============================================================================== --- stable/12/sys/dev/iwi/if_iwi.c Sun May 12 07:56:01 2019 (r347510) +++ stable/12/sys/dev/iwi/if_iwi.c Sun May 12 12:30:45 2019 (r347511) @@ -2576,15 +2576,18 @@ static int iwi_config(struct iwi_softc *sc) { struct ieee80211com *ic = &sc->sc_ic; + struct ieee80211vap *vap = TAILQ_FIRST(&ic->ic_vaps); struct iwi_configuration config; struct iwi_txpower power; + uint8_t *macaddr; uint32_t data; int error, i; IWI_LOCK_ASSERT(sc); - DPRINTF(("Setting MAC address to %6D\n", ic->ic_macaddr, ":")); - error = iwi_cmd(sc, IWI_CMD_SET_MAC_ADDRESS, ic->ic_macaddr, + macaddr = vap ? vap->iv_myaddr : ic->ic_macaddr; + DPRINTF(("Setting MAC address to %6D\n", macaddr, ":")); + error = iwi_cmd(sc, IWI_CMD_SET_MAC_ADDRESS, macaddr, IEEE80211_ADDR_LEN); if (error != 0) return error; Modified: stable/12/sys/dev/otus/if_otus.c ============================================================================== --- stable/12/sys/dev/otus/if_otus.c Sun May 12 07:56:01 2019 (r347510) +++ stable/12/sys/dev/otus/if_otus.c Sun May 12 12:30:45 2019 (r347511) @@ -3108,7 +3108,7 @@ otus_set_operating_mode(struct otus_softc *sc) */ IEEE80211_ADDR_COPY(bssid, zero_macaddr); vap = TAILQ_FIRST(&ic->ic_vaps); - macaddr = ic->ic_macaddr; + macaddr = vap ? vap->iv_myaddr : ic->ic_macaddr; switch (ic->ic_opmode) { case IEEE80211_M_STA: Modified: stable/12/sys/dev/usb/wlan/if_urtw.c ============================================================================== --- stable/12/sys/dev/usb/wlan/if_urtw.c Sun May 12 07:56:01 2019 (r347510) +++ stable/12/sys/dev/usb/wlan/if_urtw.c Sun May 12 12:30:45 2019 (r347511) @@ -752,6 +752,7 @@ static void urtw_free_tx_data_list(struct urtw_softc static void urtw_free_rx_data_list(struct urtw_softc *); static void urtw_free_data_list(struct urtw_softc *, struct urtw_data data[], int, int); +static usb_error_t urtw_set_macaddr(struct urtw_softc *, const uint8_t *); static usb_error_t urtw_adapter_start(struct urtw_softc *); static usb_error_t urtw_adapter_start_b(struct urtw_softc *); static usb_error_t urtw_set_mode(struct urtw_softc *, uint32_t); @@ -1187,9 +1188,23 @@ fail: } static usb_error_t +urtw_set_macaddr(struct urtw_softc *sc, const uint8_t *macaddr) +{ + usb_error_t error; + + urtw_write32_m(sc, URTW_MAC0, ((const uint32_t *)macaddr)[0]); + urtw_write16_m(sc, URTW_MAC4, ((const uint32_t *)macaddr)[1] & 0xffff); + +fail: + return (error); +} + +static usb_error_t urtw_adapter_start(struct urtw_softc *sc) { struct ieee80211com *ic = &sc->sc_ic; + struct ieee80211vap *vap = TAILQ_FIRST(&ic->ic_vaps); + const uint8_t *macaddr; usb_error_t error; error = urtw_reset(sc); @@ -1209,8 +1224,11 @@ urtw_adapter_start(struct urtw_softc *sc) if (error) goto fail; /* applying MAC address again. */ - urtw_write32_m(sc, URTW_MAC0, ((uint32_t *)ic->ic_macaddr)[0]); - urtw_write16_m(sc, URTW_MAC4, ((uint32_t *)ic->ic_macaddr)[1] & 0xffff); + macaddr = vap ? vap->iv_myaddr : ic->ic_macaddr; + urtw_set_macaddr(sc, macaddr); + if (error) + goto fail; + error = urtw_set_mode(sc, URTW_EPROM_CMD_NORMAL); if (error) goto fail; @@ -3180,6 +3198,8 @@ static usb_error_t urtw_8225v2b_rf_init(struct urtw_softc *sc) { struct ieee80211com *ic = &sc->sc_ic; + struct ieee80211vap *vap = TAILQ_FIRST(&ic->ic_vaps); + const uint8_t *macaddr; unsigned int i; uint8_t data8; usb_error_t error; @@ -3227,8 +3247,10 @@ urtw_8225v2b_rf_init(struct urtw_softc *sc) urtw_write8_m(sc, URTW_CONFIG1, data8); /* applying MAC address again. */ - urtw_write32_m(sc, URTW_MAC0, ((uint32_t *)ic->ic_macaddr)[0]); - urtw_write16_m(sc, URTW_MAC4, ((uint32_t *)ic->ic_macaddr)[1] & 0xffff); + macaddr = vap ? vap->iv_myaddr : ic->ic_macaddr; + error = urtw_set_macaddr(sc, macaddr); + if (error) + goto fail; error = urtw_set_mode(sc, URTW_EPROM_CMD_NORMAL); if (error) From owner-svn-src-stable@freebsd.org Mon May 13 08:26:22 2019 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id D673C1584DED; Mon, 13 May 2019 08:26:22 +0000 (UTC) (envelope-from ae@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 7A4546E806; Mon, 13 May 2019 08:26:22 +0000 (UTC) (envelope-from ae@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 5E90C744D; Mon, 13 May 2019 08:26:22 +0000 (UTC) (envelope-from ae@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x4D8QMRb019274; Mon, 13 May 2019 08:26:22 GMT (envelope-from ae@FreeBSD.org) Received: (from ae@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x4D8QMSt019273; Mon, 13 May 2019 08:26:22 GMT (envelope-from ae@FreeBSD.org) Message-Id: <201905130826.x4D8QMSt019273@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ae set sender to ae@FreeBSD.org using -f From: "Andrey V. Elsukov" Date: Mon, 13 May 2019 08:26:22 +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: r347516 - stable/12/sbin/ipfw X-SVN-Group: stable-12 X-SVN-Commit-Author: ae X-SVN-Commit-Paths: stable/12/sbin/ipfw X-SVN-Commit-Revision: 347516 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 7A4546E806 X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.97 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.998,0]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; NEURAL_HAM_SHORT(-0.98)[-0.976,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US] X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 13 May 2019 08:26:23 -0000 Author: ae Date: Mon May 13 08:26:21 2019 New Revision: 347516 URL: https://svnweb.freebsd.org/changeset/base/347516 Log: MFC r346885: Handle HAVE_PROTO flag and print "proto" keyword for O_IP4 and O_IP6 opcodes when it is needed. This should fix the problem, when printed by `ipfw show` rule can not be added due to missing "proto" keyword. Modified: stable/12/sbin/ipfw/ipfw2.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sbin/ipfw/ipfw2.c ============================================================================== --- stable/12/sbin/ipfw/ipfw2.c Mon May 13 01:18:17 2019 (r347515) +++ stable/12/sbin/ipfw/ipfw2.c Mon May 13 08:26:21 2019 (r347516) @@ -1701,9 +1701,13 @@ print_instruction(struct buf_pr *bp, const struct form IPFW_TLV_STATE_NAME)); break; case O_IP6: + if (state->flags & HAVE_PROTO) + bprintf(bp, " proto"); bprintf(bp, " ip6"); break; case O_IP4: + if (state->flags & HAVE_PROTO) + bprintf(bp, " proto"); bprintf(bp, " ip4"); break; case O_ICMP6TYPE: From owner-svn-src-stable@freebsd.org Mon May 13 08:27:53 2019 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id E09291584E97; Mon, 13 May 2019 08:27:53 +0000 (UTC) (envelope-from ae@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 842B36E96F; Mon, 13 May 2019 08:27:53 +0000 (UTC) (envelope-from ae@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 5BBD7745F; Mon, 13 May 2019 08:27:53 +0000 (UTC) (envelope-from ae@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x4D8RrNY019389; Mon, 13 May 2019 08:27:53 GMT (envelope-from ae@FreeBSD.org) Received: (from ae@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x4D8Rr2B019388; Mon, 13 May 2019 08:27:53 GMT (envelope-from ae@FreeBSD.org) Message-Id: <201905130827.x4D8Rr2B019388@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ae set sender to ae@FreeBSD.org using -f From: "Andrey V. Elsukov" Date: Mon, 13 May 2019 08:27:53 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r347517 - stable/11/sbin/ipfw X-SVN-Group: stable-11 X-SVN-Commit-Author: ae X-SVN-Commit-Paths: stable/11/sbin/ipfw X-SVN-Commit-Revision: 347517 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 842B36E96F X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.97 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.998,0]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; NEURAL_HAM_SHORT(-0.98)[-0.976,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US] X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 13 May 2019 08:27:54 -0000 Author: ae Date: Mon May 13 08:27:52 2019 New Revision: 347517 URL: https://svnweb.freebsd.org/changeset/base/347517 Log: MFC r346885: Handle HAVE_PROTO flag and print "proto" keyword for O_IP4 and O_IP6 opcodes when it is needed. This should fix the problem, when printed by `ipfw show` rule can not be added due to missing "proto" keyword. Modified: stable/11/sbin/ipfw/ipfw2.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sbin/ipfw/ipfw2.c ============================================================================== --- stable/11/sbin/ipfw/ipfw2.c Mon May 13 08:26:21 2019 (r347516) +++ stable/11/sbin/ipfw/ipfw2.c Mon May 13 08:27:52 2019 (r347517) @@ -1701,9 +1701,13 @@ print_instruction(struct buf_pr *bp, const struct form IPFW_TLV_STATE_NAME)); break; case O_IP6: + if (state->flags & HAVE_PROTO) + bprintf(bp, " proto"); bprintf(bp, " ip6"); break; case O_IP4: + if (state->flags & HAVE_PROTO) + bprintf(bp, " proto"); bprintf(bp, " ip4"); break; case O_ICMP6TYPE: From owner-svn-src-stable@freebsd.org Mon May 13 08:29:29 2019 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 39DDC1584F4D; Mon, 13 May 2019 08:29:29 +0000 (UTC) (envelope-from ae@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 D4D5C6EAC7; Mon, 13 May 2019 08:29:28 +0000 (UTC) (envelope-from ae@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 AD6C17461; Mon, 13 May 2019 08:29:28 +0000 (UTC) (envelope-from ae@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x4D8TSY9019512; Mon, 13 May 2019 08:29:28 GMT (envelope-from ae@FreeBSD.org) Received: (from ae@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x4D8TSQE019511; Mon, 13 May 2019 08:29:28 GMT (envelope-from ae@FreeBSD.org) Message-Id: <201905130829.x4D8TSQE019511@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ae set sender to ae@FreeBSD.org using -f From: "Andrey V. Elsukov" Date: Mon, 13 May 2019 08:29:28 +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: r347518 - stable/12/libexec/rc/rc.d X-SVN-Group: stable-12 X-SVN-Commit-Author: ae X-SVN-Commit-Paths: stable/12/libexec/rc/rc.d X-SVN-Commit-Revision: 347518 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: D4D5C6EAC7 X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.97 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.998,0]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; NEURAL_HAM_SHORT(-0.98)[-0.976,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US] X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 13 May 2019 08:29:29 -0000 Author: ae Date: Mon May 13 08:29:28 2019 New Revision: 347518 URL: https://svnweb.freebsd.org/changeset/base/347518 Log: MFC r347178: Add ipsec.ko to required_modules for rc.d/ipsec script. Thus it can be automatically loaded if ipsec_enable="YES" and option IPSEC is not in the kernel config. Modified: stable/12/libexec/rc/rc.d/ipsec Directory Properties: stable/12/ (props changed) Modified: stable/12/libexec/rc/rc.d/ipsec ============================================================================== --- stable/12/libexec/rc/rc.d/ipsec Mon May 13 08:27:52 2019 (r347517) +++ stable/12/libexec/rc/rc.d/ipsec Mon May 13 08:29:28 2019 (r347518) @@ -20,6 +20,7 @@ stop_cmd="ipsec_stop" reload_cmd="ipsec_reload" extra_commands="reload" ipsec_program="/sbin/setkey" +required_modules="ipsec" # ipsec_file is set by rc.conf ipsec_prestart() From owner-svn-src-stable@freebsd.org Mon May 13 10:43:19 2019 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id B8933158A6B4; Mon, 13 May 2019 10:43:19 +0000 (UTC) (envelope-from dchagin@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 5A8897361E; Mon, 13 May 2019 10:43:19 +0000 (UTC) (envelope-from dchagin@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 32D438BB7; Mon, 13 May 2019 10:43:19 +0000 (UTC) (envelope-from dchagin@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x4DAhJQv096626; Mon, 13 May 2019 10:43:19 GMT (envelope-from dchagin@FreeBSD.org) Received: (from dchagin@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x4DAhIj1096624; Mon, 13 May 2019 10:43:18 GMT (envelope-from dchagin@FreeBSD.org) Message-Id: <201905131043.x4DAhIj1096624@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: dchagin set sender to dchagin@FreeBSD.org using -f From: Dmitry Chagin Date: Mon, 13 May 2019 10:43:18 +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: r347520 - stable/12/sys/compat/linux X-SVN-Group: stable-12 X-SVN-Commit-Author: dchagin X-SVN-Commit-Paths: stable/12/sys/compat/linux X-SVN-Commit-Revision: 347520 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 5A8897361E X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.95 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.998,0]; NEURAL_HAM_SHORT(-0.96)[-0.957,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US]; NEURAL_HAM_LONG(-1.00)[-1.000,0] X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 13 May 2019 10:43:20 -0000 Author: dchagin Date: Mon May 13 10:43:18 2019 New Revision: 347520 URL: https://svnweb.freebsd.org/changeset/base/347520 Log: MFC r346965: Follow the FreeBSD and implement PDEATH_SIG prctl ops in the Linuxulator. It was first introduced in r163734 and missied by me in r283383. Modified: stable/12/sys/compat/linux/linux_emul.c stable/12/sys/compat/linux/linux_emul.h stable/12/sys/compat/linux/linux_misc.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/compat/linux/linux_emul.c ============================================================================== --- stable/12/sys/compat/linux/linux_emul.c Mon May 13 08:34:13 2019 (r347519) +++ stable/12/sys/compat/linux/linux_emul.c Mon May 13 10:43:18 2019 (r347520) @@ -127,7 +127,6 @@ linux_proc_init(struct thread *td, struct thread *newt em->em_tid = p->p_pid; em->flags = 0; - em->pdeath_signal = 0; em->robust_futexes = NULL; em->child_clear_tid = NULL; em->child_set_tid = NULL; Modified: stable/12/sys/compat/linux/linux_emul.h ============================================================================== --- stable/12/sys/compat/linux/linux_emul.h Mon May 13 08:34:13 2019 (r347519) +++ stable/12/sys/compat/linux/linux_emul.h Mon May 13 10:43:18 2019 (r347520) @@ -40,7 +40,6 @@ struct linux_emuldata { int *child_set_tid; /* in clone(): Child's TID to set on clone */ int *child_clear_tid;/* in clone(): Child's TID to clear on exit */ - int pdeath_signal; /* parent death signal */ int flags; /* thread emuldata flags */ int em_tid; /* thread id */ Modified: stable/12/sys/compat/linux/linux_misc.c ============================================================================== --- stable/12/sys/compat/linux/linux_misc.c Mon May 13 08:34:13 2019 (r347519) +++ stable/12/sys/compat/linux/linux_misc.c Mon May 13 10:43:18 2019 (r347520) @@ -51,6 +51,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include #include @@ -1993,7 +1994,6 @@ linux_prctl(struct thread *td, struct linux_prctl_args int error = 0, max_size; struct proc *p = td->td_proc; char comm[LINUX_MAX_COMM_LEN]; - struct linux_emuldata *em; int pdeath_signal; #ifdef DEBUG @@ -2007,17 +2007,18 @@ linux_prctl(struct thread *td, struct linux_prctl_args case LINUX_PR_SET_PDEATHSIG: if (!LINUX_SIG_VALID(args->arg2)) return (EINVAL); - em = em_find(td); - KASSERT(em != NULL, ("prctl: emuldata not found.\n")); - em->pdeath_signal = args->arg2; - break; + pdeath_signal = linux_to_bsd_signal(args->arg2); + return (kern_procctl(td, P_PID, 0, PROC_PDEATHSIG_CTL, + &pdeath_signal)); case LINUX_PR_GET_PDEATHSIG: - em = em_find(td); - KASSERT(em != NULL, ("prctl: emuldata not found.\n")); - pdeath_signal = em->pdeath_signal; - error = copyout(&pdeath_signal, + error = kern_procctl(td, P_PID, 0, PROC_PDEATHSIG_STATUS, + &pdeath_signal); + if (error != 0) + return (error); + pdeath_signal = bsd_to_linux_signal(pdeath_signal); + return (copyout(&pdeath_signal, (void *)(register_t)args->arg2, - sizeof(pdeath_signal)); + sizeof(pdeath_signal))); break; case LINUX_PR_GET_KEEPCAPS: /* From owner-svn-src-stable@freebsd.org Mon May 13 11:17:33 2019 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 17782158C2B6; Mon, 13 May 2019 11:17:33 +0000 (UTC) (envelope-from dchagin@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 ADC38752C1; Mon, 13 May 2019 11:17:32 +0000 (UTC) (envelope-from dchagin@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 82B669100; Mon, 13 May 2019 11:17:32 +0000 (UTC) (envelope-from dchagin@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x4DBHW3Z013532; Mon, 13 May 2019 11:17:32 GMT (envelope-from dchagin@FreeBSD.org) Received: (from dchagin@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x4DBHWe4013530; Mon, 13 May 2019 11:17:32 GMT (envelope-from dchagin@FreeBSD.org) Message-Id: <201905131117.x4DBHWe4013530@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: dchagin set sender to dchagin@FreeBSD.org using -f From: Dmitry Chagin Date: Mon, 13 May 2019 11:17:32 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r347521 - stable/11/sys/compat/linux X-SVN-Group: stable-11 X-SVN-Commit-Author: dchagin X-SVN-Commit-Paths: stable/11/sys/compat/linux X-SVN-Commit-Revision: 347521 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: ADC38752C1 X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.97 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.998,0]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; NEURAL_HAM_SHORT(-0.97)[-0.968,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US] X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 13 May 2019 11:17:33 -0000 Author: dchagin Date: Mon May 13 11:17:31 2019 New Revision: 347521 URL: https://svnweb.freebsd.org/changeset/base/347521 Log: MFC r346965: Follow the FreeBSD and implement PDEATH_SIG prctl ops in the Linuxulator. It was first introduced in r163734 and missied by me in r283383. Modified: stable/11/sys/compat/linux/linux_emul.c stable/11/sys/compat/linux/linux_emul.h stable/11/sys/compat/linux/linux_misc.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/compat/linux/linux_emul.c ============================================================================== --- stable/11/sys/compat/linux/linux_emul.c Mon May 13 10:43:18 2019 (r347520) +++ stable/11/sys/compat/linux/linux_emul.c Mon May 13 11:17:31 2019 (r347521) @@ -127,7 +127,6 @@ linux_proc_init(struct thread *td, struct thread *newt em->em_tid = p->p_pid; em->flags = 0; - em->pdeath_signal = 0; em->robust_futexes = NULL; em->child_clear_tid = NULL; em->child_set_tid = NULL; Modified: stable/11/sys/compat/linux/linux_emul.h ============================================================================== --- stable/11/sys/compat/linux/linux_emul.h Mon May 13 10:43:18 2019 (r347520) +++ stable/11/sys/compat/linux/linux_emul.h Mon May 13 11:17:31 2019 (r347521) @@ -40,7 +40,6 @@ struct linux_emuldata { int *child_set_tid; /* in clone(): Child's TID to set on clone */ int *child_clear_tid;/* in clone(): Child's TID to clear on exit */ - int pdeath_signal; /* parent death signal */ int flags; /* thread emuldata flags */ int em_tid; /* thread id */ Modified: stable/11/sys/compat/linux/linux_misc.c ============================================================================== --- stable/11/sys/compat/linux/linux_misc.c Mon May 13 10:43:18 2019 (r347520) +++ stable/11/sys/compat/linux/linux_misc.c Mon May 13 11:17:31 2019 (r347521) @@ -49,6 +49,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include #include @@ -1995,7 +1996,6 @@ linux_prctl(struct thread *td, struct linux_prctl_args int error = 0, max_size; struct proc *p = td->td_proc; char comm[LINUX_MAX_COMM_LEN]; - struct linux_emuldata *em; int pdeath_signal; #ifdef DEBUG @@ -2009,17 +2009,18 @@ linux_prctl(struct thread *td, struct linux_prctl_args case LINUX_PR_SET_PDEATHSIG: if (!LINUX_SIG_VALID(args->arg2)) return (EINVAL); - em = em_find(td); - KASSERT(em != NULL, ("prctl: emuldata not found.\n")); - em->pdeath_signal = args->arg2; - break; + pdeath_signal = linux_to_bsd_signal(args->arg2); + return (kern_procctl(td, P_PID, 0, PROC_PDEATHSIG_CTL, + &pdeath_signal)); case LINUX_PR_GET_PDEATHSIG: - em = em_find(td); - KASSERT(em != NULL, ("prctl: emuldata not found.\n")); - pdeath_signal = em->pdeath_signal; - error = copyout(&pdeath_signal, + error = kern_procctl(td, P_PID, 0, PROC_PDEATHSIG_STATUS, + &pdeath_signal); + if (error != 0) + return (error); + pdeath_signal = bsd_to_linux_signal(pdeath_signal); + return (copyout(&pdeath_signal, (void *)(register_t)args->arg2, - sizeof(pdeath_signal)); + sizeof(pdeath_signal))); break; case LINUX_PR_GET_KEEPCAPS: /* From owner-svn-src-stable@freebsd.org Mon May 13 13:28:43 2019 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 9F57815900FE; Mon, 13 May 2019 13:28:43 +0000 (UTC) (envelope-from mav@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 3D94A818BD; Mon, 13 May 2019 13:28:43 +0000 (UTC) (envelope-from mav@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 E54A5A681; Mon, 13 May 2019 13:28:42 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x4DDSg3l082095; Mon, 13 May 2019 13:28:42 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x4DDSgP0082093; Mon, 13 May 2019 13:28:42 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201905131328.x4DDSgP0082093@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Mon, 13 May 2019 13:28:42 +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: r347523 - in stable/12: sbin/nvmecontrol sys/dev/nvme X-SVN-Group: stable-12 X-SVN-Commit-Author: mav X-SVN-Commit-Paths: in stable/12: sbin/nvmecontrol sys/dev/nvme X-SVN-Commit-Revision: 347523 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 3D94A818BD X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.96 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.998,0]; NEURAL_HAM_SHORT(-0.96)[-0.965,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US]; NEURAL_HAM_LONG(-1.00)[-1.000,0] X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 13 May 2019 13:28:43 -0000 Author: mav Date: Mon May 13 13:28:42 2019 New Revision: 347523 URL: https://svnweb.freebsd.org/changeset/base/347523 Log: MFC r347158: Decode Deallocate Logical Block Features. Modified: stable/12/sbin/nvmecontrol/identify.c stable/12/sys/dev/nvme/nvme.h Directory Properties: stable/12/ (props changed) Modified: stable/12/sbin/nvmecontrol/identify.c ============================================================================== --- stable/12/sbin/nvmecontrol/identify.c Mon May 13 12:38:33 2019 (r347522) +++ stable/12/sbin/nvmecontrol/identify.c Mon May 13 13:28:42 2019 (r347523) @@ -49,7 +49,7 @@ print_namespace(struct nvme_namespace_data *nsdata) uint32_t i; uint32_t lbaf, lbads, ms, rp; uint8_t thin_prov, ptype; - uint8_t flbas_fmt; + uint8_t flbas_fmt, t; thin_prov = (nsdata->nsfeat >> NVME_NS_DATA_NSFEAT_THIN_PROV_SHIFT) & NVME_NS_DATA_NSFEAT_THIN_PROV_MASK; @@ -122,6 +122,16 @@ print_namespace(struct nvme_namespace_data *nsdata) NVME_NS_DATA_FPI_PERC_MASK); } else printf("Not Supported\n"); + t = (nsdata->dlfeat >> NVME_NS_DATA_DLFEAT_READ_SHIFT) & + NVME_NS_DATA_DLFEAT_READ_MASK; + printf("Deallocate Logical Block: Read %s%s%s\n", + (t == NVME_NS_DATA_DLFEAT_READ_NR) ? "Not Reported" : + (t == NVME_NS_DATA_DLFEAT_READ_00) ? "00h" : + (t == NVME_NS_DATA_DLFEAT_READ_FF) ? "FFh" : "Unknown", + (nsdata->dlfeat >> NVME_NS_DATA_DLFEAT_DWZ_SHIFT) & + NVME_NS_DATA_DLFEAT_DWZ_MASK ? ", Write Zero" : "", + (nsdata->dlfeat >> NVME_NS_DATA_DLFEAT_GCRC_SHIFT) & + NVME_NS_DATA_DLFEAT_GCRC_MASK ? ", Guard CRC" : ""); printf("Optimal I/O Boundary (LBAs): %u\n", nsdata->noiob); printf("Globally Unique Identifier: "); for (i = 0; i < sizeof(nsdata->nguid); i++) Modified: stable/12/sys/dev/nvme/nvme.h ============================================================================== --- stable/12/sys/dev/nvme/nvme.h Mon May 13 12:38:33 2019 (r347522) +++ stable/12/sys/dev/nvme/nvme.h Mon May 13 13:28:42 2019 (r347523) @@ -349,6 +349,20 @@ #define NVME_NS_DATA_FPI_SUPP_SHIFT (7) #define NVME_NS_DATA_FPI_SUPP_MASK (0x1) +/** Deallocate Logical Block Features */ +/* deallocated logical block read behavior */ +#define NVME_NS_DATA_DLFEAT_READ_SHIFT (0) +#define NVME_NS_DATA_DLFEAT_READ_MASK (0x07) +#define NVME_NS_DATA_DLFEAT_READ_NR (0x00) +#define NVME_NS_DATA_DLFEAT_READ_00 (0x01) +#define NVME_NS_DATA_DLFEAT_READ_FF (0x02) +/* supports the Deallocate bit in the Write Zeroes */ +#define NVME_NS_DATA_DLFEAT_DWZ_SHIFT (3) +#define NVME_NS_DATA_DLFEAT_DWZ_MASK (0x01) +/* Guard field for deallocated logical blocks is set to the CRC */ +#define NVME_NS_DATA_DLFEAT_GCRC_SHIFT (4) +#define NVME_NS_DATA_DLFEAT_GCRC_MASK (0x01) + /** lba format support */ /* metadata size */ #define NVME_NS_DATA_LBAF_MS_SHIFT (0) From owner-svn-src-stable@freebsd.org Mon May 13 13:29:53 2019 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id E22EE1590179; Mon, 13 May 2019 13:29:52 +0000 (UTC) (envelope-from mav@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 84B05819F4; Mon, 13 May 2019 13:29:52 +0000 (UTC) (envelope-from mav@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 58389A682; Mon, 13 May 2019 13:29:52 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x4DDTqWw082194; Mon, 13 May 2019 13:29:52 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x4DDTq0g082193; Mon, 13 May 2019 13:29:52 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201905131329.x4DDTq0g082193@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Mon, 13 May 2019 13:29:52 +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: r347524 - stable/12/sys/cam/ata X-SVN-Group: stable-12 X-SVN-Commit-Author: mav X-SVN-Commit-Paths: stable/12/sys/cam/ata X-SVN-Commit-Revision: 347524 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 84B05819F4 X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.96 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.998,0]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; NEURAL_HAM_SHORT(-0.96)[-0.965,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US] X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 13 May 2019 13:29:53 -0000 Author: mav Date: Mon May 13 13:29:51 2019 New Revision: 347524 URL: https://svnweb.freebsd.org/changeset/base/347524 Log: MFC r347160: Decode some more ATA commands found in ACS-4. Modified: stable/12/sys/cam/ata/ata_all.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/cam/ata/ata_all.c ============================================================================== --- stable/12/sys/cam/ata/ata_all.c Mon May 13 13:28:42 2019 (r347523) +++ stable/12/sys/cam/ata/ata_all.c Mon May 13 13:29:51 2019 (r347524) @@ -89,8 +89,14 @@ ata_op_string(struct ata_cmd *cmd) case 0x01: return ("DSM TRIM"); } return "DSM"; + case 0x07: + switch (cmd->features) { + case 0x01: return ("DSM_XL TRIM"); + } + return "DSM_XL"; case 0x08: return ("DEVICE_RESET"); case 0x0b: return ("REQUEST_SENSE_DATA_EXT"); + case 0x12: return ("GET_PHYSICAL_ELEMENT_STATUS"); case 0x20: return ("READ"); case 0x24: return ("READ48"); case 0x25: return ("READ_DMA48"); @@ -113,7 +119,11 @@ ata_op_string(struct ata_cmd *cmd) case 0x3f: return ("WRITE_LOG_EXT"); case 0x40: return ("READ_VERIFY"); case 0x42: return ("READ_VERIFY48"); - case 0x44: return ("ZERO_EXT"); + case 0x44: + switch (cmd->features) { + case 0x01: return ("ZERO_EXT TRIM"); + } + return "ZERO_EXT"; case 0x45: switch (cmd->features) { case 0x55: return ("WRITE_UNCORRECTABLE48 PSEUDO"); @@ -135,6 +145,9 @@ ata_op_string(struct ata_cmd *cmd) switch (cmd->features & 0xf) { case 0x00: return ("NCQ_NON_DATA ABORT NCQ QUEUE"); case 0x01: return ("NCQ_NON_DATA DEADLINE HANDLING"); + case 0x02: return ("NCQ_NON_DATA HYBRID DEMOTE BY SIZE"); + case 0x03: return ("NCQ_NON_DATA HYBRID CHANGE BY LBA RANGE"); + case 0x04: return ("NCQ_NON_DATA HYBRID CONTROL"); case 0x05: return ("NCQ_NON_DATA SET FEATURES"); /* * XXX KDM need common decoding between NCQ and non-NCQ @@ -147,6 +160,7 @@ ata_op_string(struct ata_cmd *cmd) case 0x64: switch (cmd->sector_count_exp & 0xf) { case 0x00: return ("SEND_FPDMA_QUEUED DATA SET MANAGEMENT"); + case 0x01: return ("SEND_FPDMA_QUEUED HYBRID EVICT"); case 0x02: return ("SEND_FPDMA_QUEUED WRITE LOG DMA EXT"); case 0x03: return ("SEND_FPDMA_QUEUED ZAC MANAGEMENT OUT"); case 0x04: return ("SEND_FPDMA_QUEUED DATA SET MANAGEMENT XL"); @@ -171,6 +185,7 @@ ata_op_string(struct ata_cmd *cmd) case 0x70: return ("SEEK"); case 0x77: return ("SET_DATE_TIME_EXT"); case 0x78: return ("ACCESSIBLE_MAX_ADDRESS_CONFIGURATION"); + case 0x7C: return ("REMOVE_ELEMENT_AND_TRUNCATE"); case 0x87: return ("CFA_TRANSLATE_SECTOR"); case 0x90: return ("EXECUTE_DEVICE_DIAGNOSTIC"); case 0x92: return ("DOWNLOAD_MICROCODE"); @@ -185,13 +200,15 @@ ata_op_string(struct ata_cmd *cmd) case 0xd1: return ("SMART READ ATTR THRESHOLDS"); case 0xd3: return ("SMART SAVE ATTR VALUES"); case 0xd4: return ("SMART EXECUTE OFFLINE IMMEDIATE"); - case 0xd5: return ("SMART READ LOG DATA"); + case 0xd5: return ("SMART READ LOG"); + case 0xd6: return ("SMART WRITE LOG"); case 0xd8: return ("SMART ENABLE OPERATION"); case 0xd9: return ("SMART DISABLE OPERATION"); case 0xda: return ("SMART RETURN STATUS"); } return ("SMART"); case 0xb1: return ("DEVICE CONFIGURATION"); + case 0xb2: return ("SET_SECTOR_CONFIGURATION_EXT"); case 0xb4: return ("SANITIZE_DEVICE"); case 0xc0: return ("CFA_ERASE"); case 0xc4: return ("READ_MUL"); @@ -229,7 +246,7 @@ ata_op_string(struct ata_cmd *cmd) switch (cmd->features) { case 0x02: return ("SETFEATURES ENABLE WCACHE"); case 0x03: return ("SETFEATURES SET TRANSFER MODE"); - case 0x04: return ("SETFEATURES ENABLE APM"); + case 0x05: return ("SETFEATURES ENABLE APM"); case 0x06: return ("SETFEATURES ENABLE PUIS"); case 0x07: return ("SETFEATURES SPIN-UP"); case 0x0b: return ("SETFEATURES ENABLE WRITE READ VERIFY"); @@ -239,6 +256,7 @@ ata_op_string(struct ata_cmd *cmd) case 0x43: return ("SETFEATURES SET MAX HOST INT SECT TIMES"); case 0x45: return ("SETFEATURES SET RATE BASIS"); case 0x4a: return ("SETFEATURES EXTENDED POWER CONDITIONS"); + case 0x50: return ("SETFEATURES ADVANCED BACKGROUD OPERATION"); case 0x55: return ("SETFEATURES DISABLE RCACHE"); case 0x5d: return ("SETFEATURES ENABLE RELIRQ"); case 0x5e: return ("SETFEATURES ENABLE SRVIRQ"); From owner-svn-src-stable@freebsd.org Mon May 13 13:30:35 2019 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 3EF8F15901EE; Mon, 13 May 2019 13:30:35 +0000 (UTC) (envelope-from mav@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 DAC9881BC1; Mon, 13 May 2019 13:30:34 +0000 (UTC) (envelope-from mav@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 B52E2A687; Mon, 13 May 2019 13:30:34 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x4DDUYCa082310; Mon, 13 May 2019 13:30:34 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x4DDUYDf082309; Mon, 13 May 2019 13:30:34 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201905131330.x4DDUYDf082309@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Mon, 13 May 2019 13:30:34 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r347525 - stable/11/sys/cam/ata X-SVN-Group: stable-11 X-SVN-Commit-Author: mav X-SVN-Commit-Paths: stable/11/sys/cam/ata X-SVN-Commit-Revision: 347525 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: DAC9881BC1 X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.96 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.998,0]; NEURAL_HAM_SHORT(-0.96)[-0.965,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US]; NEURAL_HAM_LONG(-1.00)[-1.000,0] X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 13 May 2019 13:30:35 -0000 Author: mav Date: Mon May 13 13:30:34 2019 New Revision: 347525 URL: https://svnweb.freebsd.org/changeset/base/347525 Log: MFC r347160: Decode some more ATA commands found in ACS-4. Modified: stable/11/sys/cam/ata/ata_all.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/cam/ata/ata_all.c ============================================================================== --- stable/11/sys/cam/ata/ata_all.c Mon May 13 13:29:51 2019 (r347524) +++ stable/11/sys/cam/ata/ata_all.c Mon May 13 13:30:34 2019 (r347525) @@ -87,8 +87,14 @@ ata_op_string(struct ata_cmd *cmd) case 0x01: return ("DSM TRIM"); } return "DSM"; + case 0x07: + switch (cmd->features) { + case 0x01: return ("DSM_XL TRIM"); + } + return "DSM_XL"; case 0x08: return ("DEVICE_RESET"); case 0x0b: return ("REQUEST_SENSE_DATA_EXT"); + case 0x12: return ("GET_PHYSICAL_ELEMENT_STATUS"); case 0x20: return ("READ"); case 0x24: return ("READ48"); case 0x25: return ("READ_DMA48"); @@ -111,7 +117,11 @@ ata_op_string(struct ata_cmd *cmd) case 0x3f: return ("WRITE_LOG_EXT"); case 0x40: return ("READ_VERIFY"); case 0x42: return ("READ_VERIFY48"); - case 0x44: return ("ZERO_EXT"); + case 0x44: + switch (cmd->features) { + case 0x01: return ("ZERO_EXT TRIM"); + } + return "ZERO_EXT"; case 0x45: switch (cmd->features) { case 0x55: return ("WRITE_UNCORRECTABLE48 PSEUDO"); @@ -133,6 +143,9 @@ ata_op_string(struct ata_cmd *cmd) switch (cmd->features & 0xf) { case 0x00: return ("NCQ_NON_DATA ABORT NCQ QUEUE"); case 0x01: return ("NCQ_NON_DATA DEADLINE HANDLING"); + case 0x02: return ("NCQ_NON_DATA HYBRID DEMOTE BY SIZE"); + case 0x03: return ("NCQ_NON_DATA HYBRID CHANGE BY LBA RANGE"); + case 0x04: return ("NCQ_NON_DATA HYBRID CONTROL"); case 0x05: return ("NCQ_NON_DATA SET FEATURES"); /* * XXX KDM need common decoding between NCQ and non-NCQ @@ -145,6 +158,7 @@ ata_op_string(struct ata_cmd *cmd) case 0x64: switch (cmd->sector_count_exp & 0xf) { case 0x00: return ("SEND_FPDMA_QUEUED DATA SET MANAGEMENT"); + case 0x01: return ("SEND_FPDMA_QUEUED HYBRID EVICT"); case 0x02: return ("SEND_FPDMA_QUEUED WRITE LOG DMA EXT"); case 0x03: return ("SEND_FPDMA_QUEUED ZAC MANAGEMENT OUT"); case 0x04: return ("SEND_FPDMA_QUEUED DATA SET MANAGEMENT XL"); @@ -169,6 +183,7 @@ ata_op_string(struct ata_cmd *cmd) case 0x70: return ("SEEK"); case 0x77: return ("SET_DATE_TIME_EXT"); case 0x78: return ("ACCESSIBLE_MAX_ADDRESS_CONFIGURATION"); + case 0x7C: return ("REMOVE_ELEMENT_AND_TRUNCATE"); case 0x87: return ("CFA_TRANSLATE_SECTOR"); case 0x90: return ("EXECUTE_DEVICE_DIAGNOSTIC"); case 0x92: return ("DOWNLOAD_MICROCODE"); @@ -183,13 +198,15 @@ ata_op_string(struct ata_cmd *cmd) case 0xd1: return ("SMART READ ATTR THRESHOLDS"); case 0xd3: return ("SMART SAVE ATTR VALUES"); case 0xd4: return ("SMART EXECUTE OFFLINE IMMEDIATE"); - case 0xd5: return ("SMART READ LOG DATA"); + case 0xd5: return ("SMART READ LOG"); + case 0xd6: return ("SMART WRITE LOG"); case 0xd8: return ("SMART ENABLE OPERATION"); case 0xd9: return ("SMART DISABLE OPERATION"); case 0xda: return ("SMART RETURN STATUS"); } return ("SMART"); case 0xb1: return ("DEVICE CONFIGURATION"); + case 0xb2: return ("SET_SECTOR_CONFIGURATION_EXT"); case 0xb4: return ("SANITIZE_DEVICE"); case 0xc0: return ("CFA_ERASE"); case 0xc4: return ("READ_MUL"); @@ -227,7 +244,7 @@ ata_op_string(struct ata_cmd *cmd) switch (cmd->features) { case 0x02: return ("SETFEATURES ENABLE WCACHE"); case 0x03: return ("SETFEATURES SET TRANSFER MODE"); - case 0x04: return ("SETFEATURES ENABLE APM"); + case 0x05: return ("SETFEATURES ENABLE APM"); case 0x06: return ("SETFEATURES ENABLE PUIS"); case 0x07: return ("SETFEATURES SPIN-UP"); case 0x0b: return ("SETFEATURES ENABLE WRITE READ VERIFY"); @@ -237,6 +254,7 @@ ata_op_string(struct ata_cmd *cmd) case 0x43: return ("SETFEATURES SET MAX HOST INT SECT TIMES"); case 0x45: return ("SETFEATURES SET RATE BASIS"); case 0x4a: return ("SETFEATURES EXTENDED POWER CONDITIONS"); + case 0x50: return ("SETFEATURES ADVANCED BACKGROUD OPERATION"); case 0x55: return ("SETFEATURES DISABLE RCACHE"); case 0x5d: return ("SETFEATURES ENABLE RELIRQ"); case 0x5e: return ("SETFEATURES ENABLE SRVIRQ"); From owner-svn-src-stable@freebsd.org Mon May 13 14:50:52 2019 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 47BDF1591DAB; Mon, 13 May 2019 14:50:52 +0000 (UTC) (envelope-from emaste@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 E3C168495E; Mon, 13 May 2019 14:50:51 +0000 (UTC) (envelope-from emaste@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 B9C74B44C; Mon, 13 May 2019 14:50:51 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x4DEopWE027348; Mon, 13 May 2019 14:50:51 GMT (envelope-from emaste@FreeBSD.org) Received: (from emaste@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x4DEoph7027347; Mon, 13 May 2019 14:50:51 GMT (envelope-from emaste@FreeBSD.org) Message-Id: <201905131450.x4DEoph7027347@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: emaste set sender to emaste@FreeBSD.org using -f From: Ed Maste Date: Mon, 13 May 2019 14:50:51 +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: r347528 - stable/12/sys/arm64/linux X-SVN-Group: stable-12 X-SVN-Commit-Author: emaste X-SVN-Commit-Paths: stable/12/sys/arm64/linux X-SVN-Commit-Revision: 347528 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: E3C168495E X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.98 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.998,0]; NEURAL_HAM_SHORT(-0.98)[-0.978,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US]; NEURAL_HAM_LONG(-1.00)[-1.000,0] X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 13 May 2019 14:50:52 -0000 Author: emaste Date: Mon May 13 14:50:51 2019 New Revision: 347528 URL: https://svnweb.freebsd.org/changeset/base/347528 Log: MFC r347186: Reformat arm64 linux syscalls.master per current style Modified: stable/12/sys/arm64/linux/syscalls.master Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/arm64/linux/syscalls.master ============================================================================== --- stable/12/sys/arm64/linux/syscalls.master Mon May 13 14:07:02 2019 (r347527) +++ stable/12/sys/arm64/linux/syscalls.master Mon May 13 14:50:51 2019 (r347528) @@ -18,499 +18,1557 @@ 2 AUE_NULL UNIMPL linux_io_submit 3 AUE_NULL UNIMPL linux_io_cancel 4 AUE_NULL UNIMPL linux_io_getevents -5 AUE_NULL STD { int linux_setxattr(void); } -6 AUE_NULL STD { int linux_lsetxattr(void); } -7 AUE_NULL STD { int linux_fsetxattr(void); } -8 AUE_NULL STD { int linux_getxattr(void); } -9 AUE_NULL STD { int linux_lgetxattr(void); } -10 AUE_NULL STD { int linux_fgetxattr(void); } -11 AUE_NULL STD { int linux_listxattr(void); } -12 AUE_NULL STD { int linux_llistxattr(void); } -13 AUE_NULL STD { int linux_flistxattr(void); } -14 AUE_NULL STD { int linux_removexattr(void); } -15 AUE_NULL STD { int linux_lremovexattr(void); } -16 AUE_NULL STD { int linux_fremovexattr(void); } -17 AUE_GETCWD STD { int linux_getcwd(char *buf, \ - l_ulong bufsize); } -18 AUE_NULL STD { int linux_lookup_dcookie(void); } -19 AUE_NULL STD { int linux_eventfd2(l_uint initval, \ - l_int flags); } -20 AUE_NULL STD { int linux_epoll_create1(l_int flags); } -21 AUE_NULL STD { int linux_epoll_ctl(l_int epfd, l_int op, \ - l_int fd, struct epoll_event *event); } -22 AUE_NULL STD { int linux_epoll_pwait(l_int epfd, \ - struct epoll_event *events, \ - l_int maxevents, l_int timeout, \ - l_sigset_t *mask, l_size_t sigsetsize); } -23 AUE_DUP NOPROTO { int dup(u_int fd); } -24 AUE_NULL STD { int linux_dup3(l_int oldfd, l_int newfd, \ - l_int flags); } -25 AUE_FCNTL STD { int linux_fcntl(l_uint fd, l_uint cmd, \ - l_ulong arg); } -26 AUE_NULL STD { int linux_inotify_init1(l_int flags); } -27 AUE_NULL STD { int linux_inotify_add_watch(void); } -28 AUE_NULL STD { int linux_inotify_rm_watch(void); } -29 AUE_IOCTL STD { int linux_ioctl(l_uint fd, l_uint cmd, \ - uintptr_t arg); } -30 AUE_NULL STD { int linux_ioprio_set(void); } -31 AUE_NULL STD { int linux_ioprio_get(void); } -32 AUE_FLOCK NOPROTO { int flock(int fd, int how); } -33 AUE_MKNODAT STD { int linux_mknodat(l_int dfd, \ - const char *filename, l_int mode, \ - l_uint dev); } -34 AUE_MKDIRAT STD { int linux_mkdirat(l_int dfd, \ - const char *pathname, l_int mode); } -35 AUE_UNLINKAT STD { int linux_unlinkat(l_int dfd, \ - const char *pathname, l_int flag); } -36 AUE_SYMLINKAT STD { int linux_symlinkat(const char *oldname, \ - l_int newdfd, const char *newname); } -37 AUE_LINKAT STD { int linux_linkat(l_int olddfd, \ - const char *oldname, l_int newdfd, \ - const char *newname, l_int flag); } -38 AUE_RENAMEAT STD { int linux_renameat(l_int olddfd, \ - const char *oldname, l_int newdfd, \ - const char *newname); } +5 AUE_NULL STD { + int linux_setxattr(void); + } +6 AUE_NULL STD { + int linux_lsetxattr(void); + } +7 AUE_NULL STD { + int linux_fsetxattr(void); + } +8 AUE_NULL STD { + int linux_getxattr(void); + } +9 AUE_NULL STD { + int linux_lgetxattr(void); + } +10 AUE_NULL STD { + int linux_fgetxattr(void); + } +11 AUE_NULL STD { + int linux_listxattr(void); + } +12 AUE_NULL STD { + int linux_llistxattr(void); + } +13 AUE_NULL STD { + int linux_flistxattr(void); + } +14 AUE_NULL STD { + int linux_removexattr(void); + } +15 AUE_NULL STD { + int linux_lremovexattr(void); + } +16 AUE_NULL STD { + int linux_fremovexattr(void); + } +17 AUE_GETCWD STD { + int linux_getcwd( + char *buf, + l_ulong bufsize + ); + } +18 AUE_NULL STD { + int linux_lookup_dcookie(void); + } +19 AUE_NULL STD { + int linux_eventfd2( + l_uint initval, + l_int flags + ); + } +20 AUE_NULL STD { + int linux_epoll_create1( + l_int flags + ); + } +21 AUE_NULL STD { + int linux_epoll_ctl( + l_int epfd, + l_int op, + l_int fd, + struct epoll_event *event + ); + } +22 AUE_NULL STD { + int linux_epoll_pwait( + l_int epfd, + struct epoll_event *events, + l_int maxevents, + l_int timeout, + l_sigset_t *mask, + l_size_t sigsetsize + ); + } +23 AUE_DUP NOPROTO { + int dup( + u_int fd); + } +24 AUE_NULL STD { + int linux_dup3( + l_int oldfd, + l_int newfd, + l_int flags + ); + } +25 AUE_FCNTL STD { + int linux_fcntl( + l_uint fd, + l_uint cmd, + l_ulong arg + ); + } +26 AUE_NULL STD { + int linux_inotify_init1( + l_int flags + ); + } +27 AUE_NULL STD { + int linux_inotify_add_watch(void); + } +28 AUE_NULL STD { + int linux_inotify_rm_watch(void); + } +29 AUE_IOCTL STD { + int linux_ioctl( + l_uint fd, + l_uint cmd, + uintptr_t arg + ); + } +30 AUE_NULL STD { + int linux_ioprio_set(void); + } +31 AUE_NULL STD { + int linux_ioprio_get(void); + } +32 AUE_FLOCK NOPROTO { + int flock( + int fd, + int how + ); + } +33 AUE_MKNODAT STD { + int linux_mknodat( + l_int dfd, + const char *filename, + l_int mode, + l_uint dev + ); + } +34 AUE_MKDIRAT STD { + int linux_mkdirat( + l_int dfd, + const char *pathname, + l_int mode + ); + } +35 AUE_UNLINKAT STD { + int linux_unlinkat( + l_int dfd, + const char *pathname, + l_int flag + ); + } +36 AUE_SYMLINKAT STD { + int linux_symlinkat( + const char *oldname, + l_int newdfd, + const char *newname + ); + } +37 AUE_LINKAT STD { + int linux_linkat( + l_int olddfd, + const char *oldname, + l_int newdfd, + const char *newname, + l_int flag + ); + } +38 AUE_RENAMEAT STD { + int linux_renameat( + l_int olddfd, + const char *oldname, + l_int newdfd, + const char *newname + ); + } 39 AUE_NULL UNIMPL linux_umount2 -40 AUE_MOUNT STD { int linux_mount(char *specialfile, \ - char *dir, char *filesystemtype, \ - l_ulong rwflag, void *data); } -41 AUE_PIVOT_ROOT STD { int linux_pivot_root(void); } +40 AUE_MOUNT STD { + int linux_mount( + char *specialfile, + char *dir, + char *filesystemtype, + l_ulong rwflag, + void *data + ); + } +41 AUE_PIVOT_ROOT STD { + int linux_pivot_root(void); + } 42 AUE_NULL UNIMPL nfsservctl -43 AUE_STATFS STD { int linux_statfs(char *path, \ - struct l_statfs_buf *buf); } -44 AUE_FSTATFS STD { int linux_fstatfs(l_uint fd, \ - struct l_statfs_buf *buf); } -45 AUE_TRUNCATE STD { int linux_truncate(char *path, \ - l_ulong length); } -46 AUE_FTRUNCATE STD { int linux_ftruncate(l_int fd, \ - l_long length); } -47 AUE_NULL STD { int linux_fallocate(l_int fd, l_int mode, \ - l_loff_t offset, l_loff_t len); } -48 AUE_FACCESSAT STD { int linux_faccessat(l_int dfd, \ - const char *filename, l_int amode); } -49 AUE_CHDIR STD { int linux_chdir(char *path); } -50 AUE_FCHDIR NOPROTO { int fchdir(int fd); } -51 AUE_CHROOT NOPROTO { int chroot(char *path); } -52 AUE_FCHMOD NOPROTO { int fchmod(int fd, int mode); } -53 AUE_FCHMODAT STD { int linux_fchmodat(l_int dfd, \ - const char *filename, l_mode_t mode); } -54 AUE_FCHOWNAT STD { int linux_fchownat(l_int dfd, \ - const char *filename, l_uid_t uid, \ - l_gid_t gid, l_int flag); } -55 AUE_FCHOWN NOPROTO { int fchown(int fd, int uid, int gid); } -56 AUE_OPEN_RWTC STD { int linux_openat(l_int dfd, \ - const char *filename, l_int flags, \ - l_int mode); } -57 AUE_CLOSE NOPROTO { int close(int fd); } -58 AUE_NULL STD { int linux_vhangup(void); } -59 AUE_NULL STD { int linux_pipe2(l_int *pipefds, \ - l_int flags); } +43 AUE_STATFS STD { + int linux_statfs( + char *path, + struct l_statfs_buf *buf + ); + } +44 AUE_FSTATFS STD { + int linux_fstatfs( + l_uint fd, + struct l_statfs_buf *buf + ); + } +45 AUE_TRUNCATE STD { + int linux_truncate( + char *path, + l_ulong length + ); + } +46 AUE_FTRUNCATE STD { + int linux_ftruncate( + l_int fd, + l_long length + ); + } +47 AUE_NULL STD { + int linux_fallocate( + l_int fd, + l_int mode, + l_loff_t offset, + l_loff_t len + ); + } +48 AUE_FACCESSAT STD { + int linux_faccessat( + l_int dfd, + const char *filename, + l_int amode + ); + } +49 AUE_CHDIR STD { + int linux_chdir( + char *path + ); + } +50 AUE_FCHDIR NOPROTO { + int fchdir( + int fd); + } +51 AUE_CHROOT NOPROTO { + int chroot( + char *path + ); + } +52 AUE_FCHMOD NOPROTO { + int fchmod( + int fd, + int mode + ); + } +53 AUE_FCHMODAT STD { + int linux_fchmodat( + l_int dfd, + const char *filename, + l_mode_t mode + ); + } +54 AUE_FCHOWNAT STD { + int linux_fchownat( + l_int dfd, + const char *filename, + l_uid_t uid, + l_gid_t gid, + l_int flag + ); + } +55 AUE_FCHOWN NOPROTO { + int fchown( + int fd, + int uid, + int gid); + } +56 AUE_OPEN_RWTC STD { + int linux_openat( + l_int dfd, + const char *filename, + l_int flags, + l_int mode + ); + } +57 AUE_CLOSE NOPROTO { + int close( + int fd); + } +58 AUE_NULL STD { + int linux_vhangup(void); + } +59 AUE_NULL STD { + int linux_pipe2( + l_int *pipefds, + l_int flags + ); + } 60 AUE_NULL UNIMPL linux_quotactl -61 AUE_GETDIRENTRIES STD { int linux_getdents64(l_uint fd, \ - void *dirent, l_uint count); } -62 AUE_LSEEK STD { int linux_lseek(l_uint fdes, l_off_t off, \ - l_int whence); } -63 AUE_NULL NOPROTO { int read(int fd, char *buf, \ - u_int nbyte); } -64 AUE_NULL NOPROTO { int write(int fd, char *buf, \ - u_int nbyte); } -65 AUE_READV NOPROTO { int readv(int fd, struct iovec *iovp, \ - u_int iovcnt); } -66 AUE_WRITEV NOPROTO { int writev(int fd, struct iovec *iovp, \ - u_int iovcnt); } -67 AUE_PREAD STD { int linux_pread(l_uint fd, char *buf, \ - l_size_t nbyte, l_loff_t offset); } -68 AUE_PWRITE STD { int linux_pwrite(l_uint fd, char *buf, \ - l_size_t nbyte, l_loff_t offset); } -69 AUE_NULL STD { int linux_preadv(l_ulong fd, \ - struct iovec *vec, l_ulong vlen, \ - l_ulong pos_l, l_ulong pos_h); } -70 AUE_NULL STD { int linux_pwritev(l_ulong fd, \ - struct iovec *vec, l_ulong vlen, \ - l_ulong pos_l, l_ulong pos_h); } -71 AUE_SENDFILE STD { int linux_sendfile(l_int out, l_int in, \ - l_long *offset, l_size_t count); } -72 AUE_SELECT STD { int linux_pselect6(l_int nfds, \ - l_fd_set *readfds, l_fd_set *writefds, \ - l_fd_set *exceptfds, \ - struct l_timespec *tsp, l_uintptr_t *sig); } -73 AUE_POLL STD { int linux_ppoll(struct pollfd *fds, \ - uint32_t nfds, struct l_timespec *tsp, \ - l_sigset_t *sset, l_size_t ssize); } -74 AUE_NULL STD { int linux_signalfd4(void); } -75 AUE_NULL STD { int linux_vmsplice(void); } -76 AUE_NULL STD { int linux_splice(void); } -77 AUE_NULL STD { int linux_tee(void); } -78 AUE_READLINKAT STD { int linux_readlinkat(l_int dfd, \ - const char *path, char *buf, \ - l_int bufsiz); } -79 AUE_FSTATAT STD { int linux_newfstatat(l_int dfd, \ - char *pathname, struct l_stat64 *statbuf, \ - l_int flag); } -80 AUE_FSTAT STD { int linux_newfstat(l_uint fd, \ - struct l_newstat *buf); } +61 AUE_GETDIRENTRIES STD { + int linux_getdents64( + l_uint fd, + void *dirent, + l_uint count + ); + } +62 AUE_LSEEK STD { + int linux_lseek( + l_uint fdes, + l_off_t off, + l_int whence + ); + } +63 AUE_NULL NOPROTO { + int read( + int fd, + char *buf, + u_int nbyte + ); + } +64 AUE_NULL NOPROTO { + int write( + int fd, + char *buf, + u_int nbyte + ); + } +65 AUE_READV NOPROTO { + int readv( + int fd, + struct iovec *iovp, + u_int iovcnt + ); + } +66 AUE_WRITEV NOPROTO { + int writev( + int fd, + struct iovec *iovp, + u_int iovcnt + ); + } +67 AUE_PREAD STD { + int linux_pread( + l_uint fd, + char *buf, + l_size_t nbyte, + l_loff_t offset + ); + } +68 AUE_PWRITE STD { + int linux_pwrite( + l_uint fd, + char *buf, + l_size_t nbyte, + l_loff_t offset + ); + } +69 AUE_NULL STD { + int linux_preadv( + l_ulong fd, + struct iovec *vec, + l_ulong vlen, + l_ulong pos_l, + l_ulong pos_h + ); + } +70 AUE_NULL STD { + int linux_pwritev( + l_ulong fd, + struct iovec *vec, + l_ulong vlen, + l_ulong pos_l, + l_ulong pos_h + ); + } +71 AUE_SENDFILE STD { + int linux_sendfile( + l_int out, + l_int in, + l_long *offset, + l_size_t count + ); + } +72 AUE_SELECT STD { + int linux_pselect6( + l_int nfds, + l_fd_set *readfds, + l_fd_set *writefds, + l_fd_set *exceptfds, + struct l_timespec *tsp, + l_uintptr_t *sig + ); + } +73 AUE_POLL STD { + int linux_ppoll( + struct pollfd *fds, + uint32_t nfds, + struct l_timespec *tsp, + l_sigset_t *sset, + l_size_t ssize + ); + } +74 AUE_NULL STD { + int linux_signalfd4(void); + } +75 AUE_NULL STD { + int linux_vmsplice(void); + } +76 AUE_NULL STD { + int linux_splice(void); + } +77 AUE_NULL STD { + int linux_tee(void); + } +78 AUE_READLINKAT STD { + int linux_readlinkat( + l_int dfd, + const char *path, + char *buf, + l_int bufsiz + ); + } +79 AUE_FSTATAT STD { + int linux_newfstatat( + l_int dfd, + char *pathname, + struct l_stat64 *statbuf, + l_int flag + ); + } +80 AUE_FSTAT STD { + int linux_newfstat( + l_uint fd, + struct l_newstat *buf + ); + } 81 AUE_NULL UNIMPL linux_sync -82 AUE_FSYNC NOPROTO { int fsync(int fd); } -83 AUE_NULL STD { int linux_fdatasync(l_uint fd); } -84 AUE_NULL STD { int linux_sync_file_range(void); } -85 AUE_NULL STD { int linux_timerfd_create(l_int clockid, \ - l_int flags); } -86 AUE_NULL STD { int linux_timerfd_settime(l_int fd, \ - l_int flags, \ - const struct l_itimerspec *new_value, \ - struct l_itimerspec *old_value); } -87 AUE_NULL STD { int linux_timerfd_gettime(l_int fd, \ - struct l_itimerspec *old_value); } -88 AUE_FUTIMESAT STD { int linux_utimensat(l_int dfd, \ - const char *pathname, \ - const struct l_timespec *times, \ - l_int flags); } -89 AUE_ACCT NOPROTO { int acct(char *path); } -90 AUE_CAPGET STD { int linux_capget( \ - struct l_user_cap_header *hdrp, \ - struct l_user_cap_data *datap); } -91 AUE_CAPSET STD { int linux_capset( \ - struct l_user_cap_header *hdrp, \ - struct l_user_cap_data *datap); } -92 AUE_PERSONALITY STD { int linux_personality(l_uint per); } -93 AUE_EXIT STD { int linux_exit(int rval); } -94 AUE_EXIT STD { int linux_exit_group(int error_code); } -95 AUE_WAIT6 STD { int linux_waitid(l_int idtype, l_pid_t id, \ - l_siginfo_t *info, l_int options, \ - struct rusage *rusage); } -96 AUE_NULL STD { int linux_set_tid_address(int *tidptr); } -97 AUE_NULL STD { int linux_unshare(void); } -98 AUE_NULL STD { int linux_sys_futex(void *uaddr, int op, \ - int val, struct l_timespec *timeout, \ - void *uaddr2, int val3); } -99 AUE_NULL STD { int linux_set_robust_list( \ - struct linux_robust_list_head *head, \ - l_size_t len); } -100 AUE_NULL STD { int linux_get_robust_list(l_int pid, \ - struct linux_robust_list_head **head, \ - l_size_t *len); } -101 AUE_NULL STD { int linux_nanosleep( \ - const struct l_timespec *rqtp, \ - struct l_timespec *rmtp); } -102 AUE_GETITIMER STD { int linux_getitimer(l_int which, \ - struct l_itimerval *itv); } -103 AUE_SETITIMER STD { int linux_setitimer(l_int which, \ - struct l_itimerval *itv, \ - struct l_itimerval *oitv); } -104 AUE_NULL STD { int linux_kexec_load(void); } -105 AUE_NULL STD { int linux_init_module(void); } -106 AUE_NULL STD { int linux_delete_module(void); } -107 AUE_NULL STD { int linux_timer_create(clockid_t clock_id, \ - struct sigevent *evp, l_timer_t *timerid); } -108 AUE_NULL STD { int linux_timer_gettime(l_timer_t timerid, \ - struct itimerspec *setting); } -109 AUE_NULL STD { int linux_timer_getoverrun( \ - l_timer_t timerid); } -110 AUE_NULL STD { int linux_timer_settime(l_timer_t timerid, \ - l_int flags, const struct itimerspec *new, \ - struct itimerspec *old); } -111 AUE_NULL STD { int linux_timer_delete(l_timer_t timerid); } -112 AUE_CLOCK_SETTIME STD { int linux_clock_settime( \ - clockid_t which, struct l_timespec *tp); } -113 AUE_NULL STD { int linux_clock_gettime(clockid_t which, \ - struct l_timespec *tp); } -114 AUE_NULL STD { int linux_clock_getres(clockid_t which, \ - struct l_timespec *tp); } -115 AUE_NULL STD { int linux_clock_nanosleep(clockid_t which, \ - int flags, struct l_timespec *rqtp, \ - struct l_timespec *rmtp); } -116 AUE_NULL STD { int linux_syslog(l_int type, char *buf, \ - l_int len); } -117 AUE_PTRACE STD { int linux_ptrace(l_long req, l_long pid, \ - l_ulong addr, l_ulong data); } -118 AUE_SCHED_SETPARAM STD { int linux_sched_setparam( \ - l_pid_t pid, struct sched_param *param); } -119 AUE_SCHED_SETSCHEDULER STD { int linux_sched_setscheduler( \ - l_pid_t pid, l_int policy, \ - struct sched_param *param); } -120 AUE_SCHED_GETSCHEDULER STD { int linux_sched_getscheduler( \ - l_pid_t pid); } -121 AUE_SCHED_GETPARAM STD { int linux_sched_getparam( \ - l_pid_t pid, struct sched_param *param); } -122 AUE_NULL STD { int linux_sched_setaffinity(l_pid_t pid, \ - l_uint len, l_ulong *user_mask_ptr); } -123 AUE_NULL STD { int linux_sched_getaffinity(l_pid_t pid, \ - l_uint len, l_ulong *user_mask_ptr); } -124 AUE_NULL NOPROTO { int sched_yield(void); } -125 AUE_SCHED_GET_PRIORITY_MAX STD { int linux_sched_get_priority_max(\ - l_int policy); } -126 AUE_SCHED_GET_PRIORITY_MIN STD { int linux_sched_get_priority_min(\ - l_int policy); } -127 AUE_SCHED_RR_GET_INTERVAL STD { int linux_sched_rr_get_interval( \ - l_pid_t pid, struct l_timespec *interval); } +82 AUE_FSYNC NOPROTO { + int fsync( + int fd); + } +83 AUE_NULL STD { + int linux_fdatasync( + l_uint fd); + } +84 AUE_NULL STD { + int linux_sync_file_range(void); + } +85 AUE_NULL STD { + int linux_timerfd_create( + l_int clockid, + l_int flags + ); + } +86 AUE_NULL STD { + int linux_timerfd_settime( + l_int fd, + l_int flags, + const struct l_itimerspec *new_value, + struct l_itimerspec *old_value + ); + } +87 AUE_NULL STD { + int linux_timerfd_gettime( + l_int fd, + struct l_itimerspec *old_value + ); + } +88 AUE_FUTIMESAT STD { + int linux_utimensat( + l_int dfd, + const char *pathname, + const struct l_timespec *times, + l_int flags + ); + } +89 AUE_ACCT NOPROTO { + int acct( + char *path + ); + } +90 AUE_CAPGET STD { + int linux_capget( + struct l_user_cap_header *hdrp, + struct l_user_cap_data *datap + ); + } +91 AUE_CAPSET STD { + int linux_capset( + struct l_user_cap_header *hdrp, + struct l_user_cap_data *datap + ); + } +92 AUE_PERSONALITY STD { + int linux_personality( + l_uint per + ); + } +93 AUE_EXIT STD { + int linux_exit( + int rval + ); + } +94 AUE_EXIT STD { + int linux_exit_group( + int error_code + ); + } +95 AUE_WAIT6 STD { + int linux_waitid( + l_int idtype, + l_pid_t id, + l_siginfo_t *info, + l_int options, + struct rusage *rusage + ); + } +96 AUE_NULL STD { + int linux_set_tid_address( + int *tidptr + ); + } +97 AUE_NULL STD { + int linux_unshare(void); + } +98 AUE_NULL STD { + int linux_sys_futex(void *uaddr, + int op, + int val, + struct l_timespec *timeout, + void *uaddr2, + int val3 + ); + } +99 AUE_NULL STD { + int linux_set_robust_list( + struct linux_robust_list_head *head, + l_size_t len + ); + } +100 AUE_NULL STD { + int linux_get_robust_list( + l_int pid, + struct linux_robust_list_head **head, + l_size_t *len + ); + } +101 AUE_NULL STD { + int linux_nanosleep( + const struct l_timespec *rqtp, + struct l_timespec *rmtp + ); + } +102 AUE_GETITIMER STD { + int linux_getitimer( + l_int which, + struct l_itimerval *itv + ); + } +103 AUE_SETITIMER STD { + int linux_setitimer( + l_int which, + struct l_itimerval *itv, + struct l_itimerval *oitv + ); + } +104 AUE_NULL STD { + int linux_kexec_load(void); + } +105 AUE_NULL STD { + int linux_init_module(void); + } +106 AUE_NULL STD { + int linux_delete_module(void); + } +107 AUE_NULL STD { + int linux_timer_create( + clockid_t clock_id, + struct sigevent *evp, + l_timer_t *timerid); + } +108 AUE_NULL STD { + int linux_timer_gettime( + l_timer_t timerid, + struct itimerspec *setting + ); + } +109 AUE_NULL STD { + int linux_timer_getoverrun( + l_timer_t timerid); + } +110 AUE_NULL STD { + int linux_timer_settime( + l_timer_t timerid, + l_int flags, + const struct itimerspec *new, + struct itimerspec *old); + } +111 AUE_NULL STD { + int linux_timer_delete( + l_timer_t timerid); + } +112 AUE_CLOCK_SETTIME STD { + int linux_clock_settime( + clockid_t which, + struct l_timespec *tp + ); + } +113 AUE_NULL STD { + int linux_clock_gettime( + clockid_t which, + struct l_timespec *tp + ); + } +114 AUE_NULL STD { + int linux_clock_getres( + clockid_t which, + struct l_timespec *tp + ); + } +115 AUE_NULL STD { + int linux_clock_nanosleep( + clockid_t which, + int flags, + struct l_timespec *rqtp, + struct l_timespec *rmtp + ); + } +116 AUE_NULL STD { + int linux_syslog( + l_int type, + char *buf, + l_int len + ); + } +117 AUE_PTRACE STD { + int linux_ptrace( + l_long req, + l_long pid, + l_ulong addr, + l_ulong data + ); + } +118 AUE_SCHED_SETPARAM STD { + int linux_sched_setparam( + l_pid_t pid, + struct sched_param *param + ); + } +119 AUE_SCHED_SETSCHEDULER STD { + int linux_sched_setscheduler( + l_pid_t pid, + l_int policy, + struct sched_param *param + ); + } +120 AUE_SCHED_GETSCHEDULER STD { + int linux_sched_getscheduler( + l_pid_t pid); + } +121 AUE_SCHED_GETPARAM STD { + int linux_sched_getparam( + l_pid_t pid, + struct sched_param *param + ); + } +122 AUE_NULL STD { + int linux_sched_setaffinity( + l_pid_t pid, + l_uint len, + l_ulong *user_mask_ptr + ); + } +123 AUE_NULL STD { + int linux_sched_getaffinity( + l_pid_t pid, + l_uint len, + l_ulong *user_mask_ptr + ); + } +124 AUE_NULL NOPROTO { + int sched_yield(void); + } +125 AUE_SCHED_GET_PRIORITY_MAX STD { + int linux_sched_get_priority_max( + \ + l_int policy + ); + } +126 AUE_SCHED_GET_PRIORITY_MIN STD { + int linux_sched_get_priority_min( + \ + l_int policy + ); + } +127 AUE_SCHED_RR_GET_INTERVAL STD { + int linux_sched_rr_get_interval( + l_pid_t pid, + struct l_timespec *interval + ); + } 128 AUE_NULL UNIMPL restart_syscall -129 AUE_KILL STD { int linux_kill(l_int pid, l_int signum); } -130 AUE_NULL STD { int linux_tkill(l_int tid, l_int sig); } -131 AUE_NULL STD { int linux_tgkill(l_int tgid, l_int pid, \ - l_int sig); } -132 AUE_NULL STD { int linux_sigaltstack(l_stack_t *uss, \ - l_stack_t *uoss); } -133 AUE_NULL STD { int linux_rt_sigsuspend( \ - l_sigset_t *newset, \ - l_size_t sigsetsize); } -134 AUE_NULL STD { int linux_rt_sigaction(l_int sig, \ - l_sigaction_t *act, l_sigaction_t *oact, \ - l_size_t sigsetsize); } -135 AUE_NULL STD { int linux_rt_sigprocmask(l_int how, \ - l_sigset_t *mask, l_sigset_t *omask, \ - l_size_t sigsetsize); } -136 AUE_NULL STD { int linux_rt_sigpending(l_sigset_t *set, \ - l_size_t sigsetsize); } -137 AUE_NULL STD { int linux_rt_sigtimedwait(l_sigset_t *mask, \ - l_siginfo_t *ptr, \ - struct l_timeval *timeout, \ - l_size_t sigsetsize); } -138 AUE_NULL STD { int linux_rt_sigqueueinfo(l_pid_t pid, \ - l_int sig, l_siginfo_t *info); } -139 AUE_NULL STD { int linux_rt_sigreturn( \ - struct l_ucontext *ucp); } -140 AUE_SETPRIORITY NOPROTO { int setpriority(int which, int who, \ - int prio); } -141 AUE_GETPRIORITY STD { int linux_getpriority(l_int which, \ - l_int who); } -142 AUE_REBOOT STD { int linux_reboot(l_int magic1, \ - l_int magic2, l_uint cmd, void *arg); } -143 AUE_SETREGID NOPROTO { int setregid(gid_t rgid, gid_t egid); } -144 AUE_SETGID NOPROTO { int setgid(gid_t gid); } -145 AUE_SETREUID NOPROTO { int setreuid(uid_t ruid, uid_t euid); } -146 AUE_SETUID NOPROTO { int setuid(uid_t uid); } -147 AUE_SETRESUID NOPROTO { int setresuid(uid_t ruid, uid_t euid, \ - uid_t suid); } -148 AUE_GETRESUID NOPROTO { int getresuid(uid_t *ruid, uid_t *euid, \ - uid_t *suid); } -149 AUE_SETRESGID NOPROTO { int setresgid(gid_t rgid, gid_t egid, \ - gid_t sgid); } -150 AUE_GETRESGID NOPROTO { int getresgid(gid_t *rgid, gid_t *egid, \ - gid_t *sgid); } -151 AUE_SETFSUID STD { int linux_setfsuid(l_uid_t uid); } -152 AUE_SETFSGID STD { int linux_setfsgid(l_gid_t gid); } -153 AUE_NULL STD { int linux_times(struct l_times_argv *buf); } -154 AUE_SETPGRP NOPROTO { int setpgid(int pid, int pgid); } -155 AUE_GETPGID NOPROTO { int getpgid(int pid); } -156 AUE_GETSID STD { int linux_getsid(l_pid_t pid); } -157 AUE_SETSID NOPROTO { int setsid(void); } -158 AUE_GETGROUPS STD { int linux_getgroups(l_int gidsetsize, \ - l_gid_t *grouplist); } -159 AUE_SETGROUPS STD { int linux_setgroups(l_int gidsetsize, \ - l_gid_t *grouplist); } -160 AUE_NULL STD { int linux_newuname( \ - struct l_new_utsname *buf); } -161 AUE_SYSCTL STD { int linux_sethostname(char *hostname, \ - l_uint len); } -162 AUE_SYSCTL STD { int linux_setdomainname(char *name, \ - l_int len); } -163 AUE_GETRLIMIT STD { int linux_getrlimit(l_uint resource, \ - struct l_rlimit *rlim); } -164 AUE_SETRLIMIT STD { int linux_setrlimit(l_uint resource, \ - struct l_rlimit *rlim); } -165 AUE_GETRUSAGE NOPROTO { int getrusage(int who, \ - struct rusage *rusage); } -166 AUE_UMASK NOPROTO { int umask(int newmask); } -167 AUE_PRCTL STD { int linux_prctl(l_int option, \ - l_uintptr_t arg2, l_uintptr_t arg3, \ - l_uintptr_t arg4, l_uintptr_t arg5); } -168 AUE_NULL STD { int linux_getcpu(l_uint *cpu, l_uint *node, \ - void *cache); } -169 AUE_NULL NOPROTO { int gettimeofday(struct l_timeval *tp, \ - struct timezone *tzp); } -170 AUE_SETTIMEOFDAY NOPROTO { int settimeofday( \ - struct l_timeval *tv, \ - struct timezone *tzp); } -171 AUE_ADJTIME STD { int linux_adjtimex(void); } -172 AUE_GETPID STD { int linux_getpid(void); } -173 AUE_GETPPID STD { int linux_getppid(void); } -174 AUE_GETUID STD { int linux_getuid(void); } -175 AUE_GETEUID NOPROTO { int geteuid(void); } -176 AUE_GETGID STD { int linux_getgid(void); } -177 AUE_GETEGID NOPROTO { int getegid(void); } -178 AUE_NULL STD { int linux_gettid(void); } *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-stable@freebsd.org Mon May 13 14:52:51 2019 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id B7A7C1591FA0; Mon, 13 May 2019 14:52:51 +0000 (UTC) (envelope-from emaste@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 5CA0F84CE3; Mon, 13 May 2019 14:52:51 +0000 (UTC) (envelope-from emaste@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 47096B5D5; Mon, 13 May 2019 14:52:51 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x4DEqpbh029873; Mon, 13 May 2019 14:52:51 GMT (envelope-from emaste@FreeBSD.org) Received: (from emaste@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x4DEqphq029872; Mon, 13 May 2019 14:52:51 GMT (envelope-from emaste@FreeBSD.org) Message-Id: <201905131452.x4DEqphq029872@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: emaste set sender to emaste@FreeBSD.org using -f From: Ed Maste Date: Mon, 13 May 2019 14:52:51 +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: r347529 - stable/12/sys/net X-SVN-Group: stable-12 X-SVN-Commit-Author: emaste X-SVN-Commit-Paths: stable/12/sys/net X-SVN-Commit-Revision: 347529 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 5CA0F84CE3 X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.97 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.998,0]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; NEURAL_HAM_SHORT(-0.98)[-0.975,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US] X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 13 May 2019 14:52:51 -0000 Author: emaste Date: Mon May 13 14:52:50 2019 New Revision: 347529 URL: https://svnweb.freebsd.org/changeset/base/347529 Log: MFC r347031: iflib: remove assertion that isc_capabilities is nonzero It's atypical, but not invalid, for a driver to pass no capabilities. Submitted by: Gerald Aryeetey Sponsored by: The FreeBSD Foundation Modified: stable/12/sys/net/iflib.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/net/iflib.c ============================================================================== --- stable/12/sys/net/iflib.c Mon May 13 14:50:51 2019 (r347528) +++ stable/12/sys/net/iflib.c Mon May 13 14:52:50 2019 (r347529) @@ -4444,7 +4444,6 @@ iflib_device_register(device_t dev, void *sc, if_share ctx->ifc_txrx = *scctx->isc_txrx; #ifdef INVARIANTS - MPASS(scctx->isc_capabilities); if (scctx->isc_capabilities & IFCAP_TXCSUM) MPASS(scctx->isc_tx_csum_flags); #endif @@ -4678,7 +4677,6 @@ iflib_pseudo_register(device_t dev, if_shared_ctx_t sc ifmedia_set(&ctx->ifc_media, IFM_ETHER | IFM_AUTO); #ifdef INVARIANTS - MPASS(scctx->isc_capabilities); if (scctx->isc_capabilities & IFCAP_TXCSUM) MPASS(scctx->isc_tx_csum_flags); #endif From owner-svn-src-stable@freebsd.org Mon May 13 18:48:09 2019 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id AED651598106; Mon, 13 May 2019 18:48:09 +0000 (UTC) (envelope-from shurd@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 542648EFD5; Mon, 13 May 2019 18:48:09 +0000 (UTC) (envelope-from shurd@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 28DCEDE3E; Mon, 13 May 2019 18:48:09 +0000 (UTC) (envelope-from shurd@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x4DIm9oh054360; Mon, 13 May 2019 18:48:09 GMT (envelope-from shurd@FreeBSD.org) Received: (from shurd@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x4DIm8hG054346; Mon, 13 May 2019 18:48:08 GMT (envelope-from shurd@FreeBSD.org) Message-Id: <201905131848.x4DIm8hG054346@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: shurd set sender to shurd@FreeBSD.org using -f From: Stephen Hurd Date: Mon, 13 May 2019 18:48:08 +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: r347542 - in stable/12: share/man/man4 sys/net X-SVN-Group: stable-12 X-SVN-Commit-Author: shurd X-SVN-Commit-Paths: in stable/12: share/man/man4 sys/net X-SVN-Commit-Revision: 347542 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 542648EFD5 X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.96 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.998,0]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; NEURAL_HAM_SHORT(-0.96)[-0.960,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US] X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 13 May 2019 18:48:10 -0000 Author: shurd Date: Mon May 13 18:48:08 2019 New Revision: 347542 URL: https://svnweb.freebsd.org/changeset/base/347542 Log: MFC r346708: iflib: Better control over queue core assignment By default, cores are now assigned to queues in a sequential manner rather than all NICs starting at the first core. On a four-core system with two NICs each using two queue pairs, the nic:queue -> core mapping has changed from this: 0:0 -> 0, 0:1 -> 1 1:0 -> 0, 1:1 -> 1 To this: 0:0 -> 0, 0:1 -> 1 1:0 -> 2, 1:1 -> 3 Additionally, a device can now be configured to use separate cores for TX and RX queues. Two new tunables have been added, dev.X.Y.iflib.separate_txrx and dev.X.Y.iflib.core_offset. If core_offset is set, the NIC is not part of the auto-assigned sequence. Reviewed by: marius Sponsored by: Limelight Networks Differential Revision: https://reviews.freebsd.org/D20029 Modified: stable/12/share/man/man4/iflib.4 stable/12/sys/net/iflib.c Directory Properties: stable/12/ (props changed) Modified: stable/12/share/man/man4/iflib.4 ============================================================================== --- stable/12/share/man/man4/iflib.4 Mon May 13 18:40:01 2019 (r347541) +++ stable/12/share/man/man4/iflib.4 Mon May 13 18:48:08 2019 (r347542) @@ -55,6 +55,16 @@ If zero, the number of TX queues is derived from the n socket connected to the controller. .It Va disable_msix Disables MSI-X interrupts for the device. +.It Va core_offset +Specifies a starting core offset to assign queues to. +If the value is unspecified or 65535, cores are assigned sequentially across +controllers. +.It Va separate_txrx +Requests that RX and TX queues not be paired on the same core. +If this is zero or not set, an RX and TX queue pair will be assigned to each +core. +When set to a non-zero value, TX queues are assigned to cores following the +last RX queue. .El .Pp These Modified: stable/12/sys/net/iflib.c ============================================================================== --- stable/12/sys/net/iflib.c Mon May 13 18:40:01 2019 (r347541) +++ stable/12/sys/net/iflib.c Mon May 13 18:48:08 2019 (r347542) @@ -191,6 +191,9 @@ struct iflib_ctx { uint16_t ifc_sysctl_qs_eq_override; uint16_t ifc_sysctl_rx_budget; uint16_t ifc_sysctl_tx_abdicate; + uint16_t ifc_sysctl_core_offset; +#define CORE_OFFSET_UNSPECIFIED 0xffff + uint8_t ifc_sysctl_separate_txrx; qidx_t ifc_sysctl_ntxds[8]; qidx_t ifc_sysctl_nrxds[8]; @@ -728,6 +731,18 @@ static void iflib_free_intr_mem(if_ctx_t ctx); static struct mbuf * iflib_fixup_rx(struct mbuf *m); #endif +static SLIST_HEAD(cpu_offset_list, cpu_offset) cpu_offsets = + SLIST_HEAD_INITIALIZER(cpu_offsets); +struct cpu_offset { + SLIST_ENTRY(cpu_offset) entries; + cpuset_t set; + unsigned int refcount; + uint16_t offset; +}; +static struct mtx cpu_offset_mtx; +MTX_SYSINIT(iflib_cpu_offset, &cpu_offset_mtx, "iflib_cpu_offset lock", + MTX_DEF); + NETDUMP_DEFINE(iflib); #ifdef DEV_NETMAP @@ -4401,6 +4416,71 @@ iflib_reset_qvalues(if_ctx_t ctx) } } +static uint16_t +get_ctx_core_offset(if_ctx_t ctx) +{ + if_softc_ctx_t scctx = &ctx->ifc_softc_ctx; + struct cpu_offset *op; + uint16_t qc; + uint16_t ret = ctx->ifc_sysctl_core_offset; + + if (ret != CORE_OFFSET_UNSPECIFIED) + return (ret); + + if (ctx->ifc_sysctl_separate_txrx) + qc = scctx->isc_ntxqsets + scctx->isc_nrxqsets; + else + qc = max(scctx->isc_ntxqsets, scctx->isc_nrxqsets); + + mtx_lock(&cpu_offset_mtx); + SLIST_FOREACH(op, &cpu_offsets, entries) { + if (CPU_CMP(&ctx->ifc_cpus, &op->set) == 0) { + ret = op->offset; + op->offset += qc; + MPASS(op->refcount < UINT_MAX); + op->refcount++; + break; + } + } + if (ret == CORE_OFFSET_UNSPECIFIED) { + ret = 0; + op = malloc(sizeof(struct cpu_offset), M_IFLIB, + M_NOWAIT | M_ZERO); + if (op == NULL) { + device_printf(ctx->ifc_dev, + "allocation for cpu offset failed.\n"); + } else { + op->offset = qc; + op->refcount = 1; + CPU_COPY(&ctx->ifc_cpus, &op->set); + SLIST_INSERT_HEAD(&cpu_offsets, op, entries); + } + } + mtx_unlock(&cpu_offset_mtx); + + return (ret); +} + +static void +unref_ctx_core_offset(if_ctx_t ctx) +{ + struct cpu_offset *op, *top; + + mtx_lock(&cpu_offset_mtx); + SLIST_FOREACH_SAFE(op, &cpu_offsets, entries, top) { + if (CPU_CMP(&ctx->ifc_cpus, &op->set) == 0) { + MPASS(op->refcount > 0); + op->refcount--; + if (op->refcount == 0) { + SLIST_REMOVE(&cpu_offsets, op, cpu_offset, entries); + free(op, M_IFLIB); + } + break; + } + } + mtx_unlock(&cpu_offset_mtx); +} + int iflib_device_register(device_t dev, void *sc, if_shared_ctx_t sctx, if_ctx_t *ctxp) { @@ -4551,6 +4631,11 @@ iflib_device_register(device_t dev, void *sc, if_share goto fail_queues; /* + * Now that we know how many queues there are, get the core offset. + */ + ctx->ifc_sysctl_core_offset = get_ctx_core_offset(ctx); + + /* * Group taskqueues aren't properly set up until SMP is started, * so we disable interrupts until we can handle them post * SI_SUB_SMP. @@ -4971,6 +5056,7 @@ iflib_device_deregister(if_ctx_t ctx) iflib_rx_structures_free(ctx); if (ctx->ifc_flags & IFC_SC_ALLOCATED) free(ctx->ifc_softc, M_IFLIB); + unref_ctx_core_offset(ctx); STATE_LOCK_DESTROY(ctx); free(ctx, M_IFLIB); return (0); @@ -5589,7 +5675,7 @@ find_child_with_core(int cpu, struct cpu_group *grp) * Find the nth "close" core to the specified core * "close" is defined as the deepest level that shares * at least an L2 cache. With threads, this will be - * threads on the same core. If the sahred cache is L3 + * threads on the same core. If the shared cache is L3 * or higher, simply returns the same core. */ static int @@ -5671,10 +5757,12 @@ static inline int iflib_irq_set_affinity(if_ctx_t ctx, int irq, iflib_intr_type_t type, int qid, struct grouptask *gtask, struct taskqgroup *tqg, void *uniq, const char *name) { - int cpuid; - int err, tid; + int co, cpuid, err, tid; - cpuid = find_nth(ctx, qid); + co = ctx->ifc_sysctl_core_offset; + if (ctx->ifc_sysctl_separate_txrx && type == IFLIB_INTR_TX) + co += ctx->ifc_softc_ctx.isc_nrxqsets; + cpuid = find_nth(ctx, qid + co); tid = get_core_offset(ctx, type, qid); MPASS(tid >= 0); cpuid = find_close_core(cpuid, tid); @@ -6264,6 +6352,13 @@ iflib_add_device_sysctl_pre(if_ctx_t ctx) SYSCTL_ADD_U16(ctx_list, oid_list, OID_AUTO, "tx_abdicate", CTLFLAG_RWTUN, &ctx->ifc_sysctl_tx_abdicate, 0, "cause tx to abdicate instead of running to completion"); + ctx->ifc_sysctl_core_offset = CORE_OFFSET_UNSPECIFIED; + SYSCTL_ADD_U16(ctx_list, oid_list, OID_AUTO, "core_offset", + CTLFLAG_RDTUN, &ctx->ifc_sysctl_core_offset, 0, + "offset to start using cores at"); + SYSCTL_ADD_U8(ctx_list, oid_list, OID_AUTO, "separate_txrx", + CTLFLAG_RDTUN, &ctx->ifc_sysctl_separate_txrx, 0, + "use separate cores for TX and RX"); /* XXX change for per-queue sizes */ SYSCTL_ADD_PROC(ctx_list, oid_list, OID_AUTO, "override_ntxds", From owner-svn-src-stable@freebsd.org Tue May 14 00:34:09 2019 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 8D88E159F165; Tue, 14 May 2019 00:34:09 +0000 (UTC) (envelope-from markj@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 2FE2A74B71; Tue, 14 May 2019 00:34:09 +0000 (UTC) (envelope-from markj@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 04A72198B1; Tue, 14 May 2019 00:34:09 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x4E0Y8Fg040717; Tue, 14 May 2019 00:34:08 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x4E0Y8u3040716; Tue, 14 May 2019 00:34:08 GMT (envelope-from markj@FreeBSD.org) Message-Id: <201905140034.x4E0Y8u3040716@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Tue, 14 May 2019 00:34:08 +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: r347556 - stable/12/sys/kern X-SVN-Group: stable-12 X-SVN-Commit-Author: markj X-SVN-Commit-Paths: stable/12/sys/kern X-SVN-Commit-Revision: 347556 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 2FE2A74B71 X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.97 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.998,0]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; NEURAL_HAM_SHORT(-0.97)[-0.974,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US] X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 14 May 2019 00:34:09 -0000 Author: markj Date: Tue May 14 00:34:08 2019 New Revision: 347556 URL: https://svnweb.freebsd.org/changeset/base/347556 Log: MFC r347227: Simplify the test against maxproc in fork1(). Modified: stable/12/sys/kern/kern_fork.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/kern/kern_fork.c ============================================================================== --- stable/12/sys/kern/kern_fork.c Mon May 13 23:37:44 2019 (r347555) +++ stable/12/sys/kern/kern_fork.c Tue May 14 00:34:08 2019 (r347556) @@ -885,17 +885,20 @@ fork1(struct thread *td, struct fork_req *fr) * processes; don't let root exceed the limit. */ nprocs_new = atomic_fetchadd_int(&nprocs, 1) + 1; - if ((nprocs_new >= maxproc - 10 && priv_check_cred(td->td_ucred, - PRIV_MAXPROC, 0) != 0) || nprocs_new >= maxproc) { - error = EAGAIN; - sx_xlock(&allproc_lock); - if (ppsratecheck(&lastfail, &curfail, 1)) { - printf("maxproc limit exceeded by uid %u (pid %d); " - "see tuning(7) and login.conf(5)\n", - td->td_ucred->cr_ruid, p1->p_pid); + if (nprocs_new >= maxproc - 10) { + if (priv_check_cred(td->td_ucred, PRIV_MAXPROC, 0) != 0 || + nprocs_new >= maxproc) { + error = EAGAIN; + sx_xlock(&allproc_lock); + if (ppsratecheck(&lastfail, &curfail, 1)) { + printf("maxproc limit exceeded by uid %u " + "(pid %d); see tuning(7) and " + "login.conf(5)\n", + td->td_ucred->cr_ruid, p1->p_pid); + } + sx_xunlock(&allproc_lock); + goto fail2; } - sx_xunlock(&allproc_lock); - goto fail2; } /* From owner-svn-src-stable@freebsd.org Tue May 14 02:00:14 2019 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id E5C7C15A10E9; Tue, 14 May 2019 02:00:13 +0000 (UTC) (envelope-from kevans@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 89FD676F15; Tue, 14 May 2019 02:00:13 +0000 (UTC) (envelope-from kevans@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 653691A627; Tue, 14 May 2019 02:00:13 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x4E20DhL083821; Tue, 14 May 2019 02:00:13 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x4E20DjS083820; Tue, 14 May 2019 02:00:13 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <201905140200.x4E20DjS083820@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Tue, 14 May 2019 02:00:13 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r347557 - in stable: 11/sbin/ifconfig 12/sbin/ifconfig X-SVN-Group: stable-11 X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: in stable: 11/sbin/ifconfig 12/sbin/ifconfig X-SVN-Commit-Revision: 347557 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 89FD676F15 X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.97 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.998,0]; NEURAL_HAM_SHORT(-0.97)[-0.972,0]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US] X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 14 May 2019 02:00:14 -0000 Author: kevans Date: Tue May 14 02:00:12 2019 New Revision: 347557 URL: https://svnweb.freebsd.org/changeset/base/347557 Log: MFC r347241 (partial), r347392, r347429: ifconfig(8) ifname <-> kld mapping MFC r347241 (partial): Initial mechanism for mapping ifname <-> kld if_tun/if_tap mappings have been removed and the vmnet mapping has been updated to the if_tap module. MFC r347392: ifconfig(8): Partial revert of r347241 r347241 introduced an ifname <-> kld mapping table, mostly so tun/tap/vmnet can autoload the correct module on use. It also inadvertently made bogus some previously valid uses of sizeof(). Revert back to ifkind on the stack for simplicity sake. This reduces the diff from the previous version of ifmaybeload for easiser auditing. MFC r347429: ifconfig(8): Add kld mappings for ipsec/enc Additionally, providing mappings makes the comparison for already loaded modules a little more strict. This should have been done at initial introduction, but there was no real reason- however, it proves necessary for enc which has a standard enc -> if_enc mapping but there also exists an 'enc' module that's actually CAM. The mapping lets us unambiguously determine the correct module. Modified: stable/11/sbin/ifconfig/ifconfig.c Directory Properties: stable/11/ (props changed) Changes in other areas also in this revision: Modified: stable/12/sbin/ifconfig/ifconfig.c Directory Properties: stable/12/ (props changed) Modified: stable/11/sbin/ifconfig/ifconfig.c ============================================================================== --- stable/11/sbin/ifconfig/ifconfig.c Tue May 14 00:34:08 2019 (r347556) +++ stable/11/sbin/ifconfig/ifconfig.c Tue May 14 02:00:12 2019 (r347557) @@ -69,6 +69,7 @@ static const char rcsid[] = #ifdef JAIL #include #endif +#include #include #include #include @@ -125,6 +126,31 @@ struct ifa_order_elt { TAILQ_HEAD(ifa_queue, ifa_order_elt); +static struct module_map_entry { + const char *ifname; + const char *kldname; +} module_map[] = { + { + .ifname = "vmnet", + .kldname = "if_tap", + }, + { + .ifname = "ipsec", + .kldname = "ipsec", + }, + { + /* + * This mapping exists because there is a conflicting enc module + * in CAM. ifconfig's guessing behavior will attempt to match + * the ifname to a module as well as if_${ifname} and clash with + * CAM enc. This is an assertion of the correct module to load. + */ + .ifname = "enc", + .kldname = "if_enc", + }, +}; + + void opt_register(struct option *p) { @@ -1371,9 +1397,11 @@ ifmaybeload(const char *name) { #define MOD_PREFIX_LEN 3 /* "if_" */ struct module_stat mstat; - int fileid, modid; + int i, fileid, modid; char ifkind[IFNAMSIZ + MOD_PREFIX_LEN], ifname[IFNAMSIZ], *dp; const char *cp; + struct module_map_entry *mme; + bool found; /* loading suppressed by the user */ if (noload) @@ -1387,10 +1415,25 @@ ifmaybeload(const char *name) break; } - /* turn interface and unit into module name */ - strlcpy(ifkind, "if_", sizeof(ifkind)); - strlcat(ifkind, ifname, sizeof(ifkind)); + /* Either derive it from the map or guess otherwise */ + *ifkind = '\0'; + found = false; + for (i = 0; i < nitems(module_map); ++i) { + mme = &module_map[i]; + if (strcmp(mme->ifname, ifname) == 0) { + strlcpy(ifkind, mme->kldname, sizeof(ifkind)); + found = true; + break; + } + } + /* We didn't have an alias for it... we'll guess. */ + if (!found) { + /* turn interface and unit into module name */ + strlcpy(ifkind, "if_", sizeof(ifkind)); + strlcat(ifkind, ifname, sizeof(ifkind)); + } + /* scan files in kernel */ mstat.version = sizeof(struct module_stat); for (fileid = kldnext(0); fileid > 0; fileid = kldnext(fileid)) { @@ -1405,8 +1448,12 @@ ifmaybeload(const char *name) } else { cp = mstat.name; } - /* already loaded? */ - if (strcmp(ifname, cp) == 0 || + /* + * Is it already loaded? Don't compare with ifname if + * we were specifically told which kld to use. Doing + * so could lead to conflicts not trivially solved. + */ + if ((!found && strcmp(ifname, cp) == 0) || strcmp(ifkind, cp) == 0) return; } From owner-svn-src-stable@freebsd.org Tue May 14 02:00:14 2019 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 465D015A10EF; Tue, 14 May 2019 02:00:14 +0000 (UTC) (envelope-from kevans@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 E078176F16; Tue, 14 May 2019 02:00:13 +0000 (UTC) (envelope-from kevans@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 BABF61A628; Tue, 14 May 2019 02:00:13 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x4E20DrO083827; Tue, 14 May 2019 02:00:13 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x4E20DTV083826; Tue, 14 May 2019 02:00:13 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <201905140200.x4E20DTV083826@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Tue, 14 May 2019 02:00:13 +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: r347557 - in stable: 11/sbin/ifconfig 12/sbin/ifconfig X-SVN-Group: stable-12 X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: in stable: 11/sbin/ifconfig 12/sbin/ifconfig X-SVN-Commit-Revision: 347557 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: E078176F16 X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.97 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.998,0]; NEURAL_HAM_SHORT(-0.97)[-0.972,0]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US] X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 14 May 2019 02:00:14 -0000 Author: kevans Date: Tue May 14 02:00:12 2019 New Revision: 347557 URL: https://svnweb.freebsd.org/changeset/base/347557 Log: MFC r347241 (partial), r347392, r347429: ifconfig(8) ifname <-> kld mapping MFC r347241 (partial): Initial mechanism for mapping ifname <-> kld if_tun/if_tap mappings have been removed and the vmnet mapping has been updated to the if_tap module. MFC r347392: ifconfig(8): Partial revert of r347241 r347241 introduced an ifname <-> kld mapping table, mostly so tun/tap/vmnet can autoload the correct module on use. It also inadvertently made bogus some previously valid uses of sizeof(). Revert back to ifkind on the stack for simplicity sake. This reduces the diff from the previous version of ifmaybeload for easiser auditing. MFC r347429: ifconfig(8): Add kld mappings for ipsec/enc Additionally, providing mappings makes the comparison for already loaded modules a little more strict. This should have been done at initial introduction, but there was no real reason- however, it proves necessary for enc which has a standard enc -> if_enc mapping but there also exists an 'enc' module that's actually CAM. The mapping lets us unambiguously determine the correct module. Modified: stable/12/sbin/ifconfig/ifconfig.c Directory Properties: stable/12/ (props changed) Changes in other areas also in this revision: Modified: stable/11/sbin/ifconfig/ifconfig.c Directory Properties: stable/11/ (props changed) Modified: stable/12/sbin/ifconfig/ifconfig.c ============================================================================== --- stable/12/sbin/ifconfig/ifconfig.c Tue May 14 00:34:08 2019 (r347556) +++ stable/12/sbin/ifconfig/ifconfig.c Tue May 14 02:00:12 2019 (r347557) @@ -71,6 +71,7 @@ static const char rcsid[] = #ifdef JAIL #include #endif +#include #include #include #include @@ -130,6 +131,31 @@ struct ifa_order_elt { TAILQ_HEAD(ifa_queue, ifa_order_elt); +static struct module_map_entry { + const char *ifname; + const char *kldname; +} module_map[] = { + { + .ifname = "vmnet", + .kldname = "if_tap", + }, + { + .ifname = "ipsec", + .kldname = "ipsec", + }, + { + /* + * This mapping exists because there is a conflicting enc module + * in CAM. ifconfig's guessing behavior will attempt to match + * the ifname to a module as well as if_${ifname} and clash with + * CAM enc. This is an assertion of the correct module to load. + */ + .ifname = "enc", + .kldname = "if_enc", + }, +}; + + void opt_register(struct option *p) { @@ -1413,9 +1439,11 @@ ifmaybeload(const char *name) { #define MOD_PREFIX_LEN 3 /* "if_" */ struct module_stat mstat; - int fileid, modid; + int i, fileid, modid; char ifkind[IFNAMSIZ + MOD_PREFIX_LEN], ifname[IFNAMSIZ], *dp; const char *cp; + struct module_map_entry *mme; + bool found; /* loading suppressed by the user */ if (noload) @@ -1429,10 +1457,25 @@ ifmaybeload(const char *name) break; } - /* turn interface and unit into module name */ - strlcpy(ifkind, "if_", sizeof(ifkind)); - strlcat(ifkind, ifname, sizeof(ifkind)); + /* Either derive it from the map or guess otherwise */ + *ifkind = '\0'; + found = false; + for (i = 0; i < nitems(module_map); ++i) { + mme = &module_map[i]; + if (strcmp(mme->ifname, ifname) == 0) { + strlcpy(ifkind, mme->kldname, sizeof(ifkind)); + found = true; + break; + } + } + /* We didn't have an alias for it... we'll guess. */ + if (!found) { + /* turn interface and unit into module name */ + strlcpy(ifkind, "if_", sizeof(ifkind)); + strlcat(ifkind, ifname, sizeof(ifkind)); + } + /* scan files in kernel */ mstat.version = sizeof(struct module_stat); for (fileid = kldnext(0); fileid > 0; fileid = kldnext(fileid)) { @@ -1447,8 +1490,12 @@ ifmaybeload(const char *name) } else { cp = mstat.name; } - /* already loaded? */ - if (strcmp(ifname, cp) == 0 || + /* + * Is it already loaded? Don't compare with ifname if + * we were specifically told which kld to use. Doing + * so could lead to conflicts not trivially solved. + */ + if ((!found && strcmp(ifname, cp) == 0) || strcmp(ifkind, cp) == 0) return; } From owner-svn-src-stable@freebsd.org Tue May 14 03:05:07 2019 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 870B915A30BC; Tue, 14 May 2019 03:05:07 +0000 (UTC) (envelope-from ganbold@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 28A1C81507; Tue, 14 May 2019 03:05:07 +0000 (UTC) (envelope-from ganbold@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 036EA1B232; Tue, 14 May 2019 03:05:07 +0000 (UTC) (envelope-from ganbold@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x4E35641022022; Tue, 14 May 2019 03:05:06 GMT (envelope-from ganbold@FreeBSD.org) Received: (from ganbold@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x4E356wE022021; Tue, 14 May 2019 03:05:06 GMT (envelope-from ganbold@FreeBSD.org) Message-Id: <201905140305.x4E356wE022021@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ganbold set sender to ganbold@FreeBSD.org using -f From: Ganbold Tsagaankhuu Date: Tue, 14 May 2019 03:05:06 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r347558 - stable/11/sys/dev/usb/net X-SVN-Group: stable-11 X-SVN-Commit-Author: ganbold X-SVN-Commit-Paths: stable/11/sys/dev/usb/net X-SVN-Commit-Revision: 347558 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 28A1C81507 X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.97 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.998,0]; NEURAL_HAM_SHORT(-0.97)[-0.971,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US]; NEURAL_HAM_LONG(-1.00)[-1.000,0] X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 14 May 2019 03:05:07 -0000 Author: ganbold Date: Tue May 14 03:05:06 2019 New Revision: 347558 URL: https://svnweb.freebsd.org/changeset/base/347558 Log: MFC r346028: Fix URE_WDT6_SET_MODE value in the register definition. Both linux and u-boot sources for RTL8152 driver has this value. RTL8152 USB ethernet is used in NanoPI R1 board as second ethernet. This fixes RTL8152 USB ethernet not detected problem after reboot. Modified: stable/11/sys/dev/usb/net/if_urereg.h Modified: stable/11/sys/dev/usb/net/if_urereg.h ============================================================================== --- stable/11/sys/dev/usb/net/if_urereg.h Tue May 14 02:00:12 2019 (r347557) +++ stable/11/sys/dev/usb/net/if_urereg.h Tue May 14 03:05:06 2019 (r347558) @@ -176,7 +176,7 @@ #define URE_EEEP_CR_EEEP_TX 0x0002 /* PLA_WDT6_CTRL */ -#define URE_WDT6_SET_MODE 0x001 +#define URE_WDT6_SET_MODE 0x0010 /* PLA_TCR0 */ #define URE_TCR0_TX_EMPTY 0x0800 From owner-svn-src-stable@freebsd.org Tue May 14 03:08:38 2019 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id AF6FC15A318A; Tue, 14 May 2019 03:08:38 +0000 (UTC) (envelope-from ganbold@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 53216816DB; Tue, 14 May 2019 03:08:38 +0000 (UTC) (envelope-from ganbold@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 2AB841B262; Tue, 14 May 2019 03:08:38 +0000 (UTC) (envelope-from ganbold@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x4E38cAj022232; Tue, 14 May 2019 03:08:38 GMT (envelope-from ganbold@FreeBSD.org) Received: (from ganbold@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x4E38cMb022231; Tue, 14 May 2019 03:08:38 GMT (envelope-from ganbold@FreeBSD.org) Message-Id: <201905140308.x4E38cMb022231@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ganbold set sender to ganbold@FreeBSD.org using -f From: Ganbold Tsagaankhuu Date: Tue, 14 May 2019 03:08:38 +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: r347559 - stable/12/sys/dev/usb/net X-SVN-Group: stable-12 X-SVN-Commit-Author: ganbold X-SVN-Commit-Paths: stable/12/sys/dev/usb/net X-SVN-Commit-Revision: 347559 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 53216816DB X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.97 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.998,0]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; NEURAL_HAM_SHORT(-0.97)[-0.971,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US] X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 14 May 2019 03:08:38 -0000 Author: ganbold Date: Tue May 14 03:08:37 2019 New Revision: 347559 URL: https://svnweb.freebsd.org/changeset/base/347559 Log: MFC r346028: Fix URE_WDT6_SET_MODE value in the register definition. Both linux and u-boot sources for RTL8152 driver has this value. RTL8152 USB ethernet is used in NanoPI R1 board as second ethernet. This fixes RTL8152 USB ethernet not detected problem after reboot. Modified: stable/12/sys/dev/usb/net/if_urereg.h Modified: stable/12/sys/dev/usb/net/if_urereg.h ============================================================================== --- stable/12/sys/dev/usb/net/if_urereg.h Tue May 14 03:05:06 2019 (r347558) +++ stable/12/sys/dev/usb/net/if_urereg.h Tue May 14 03:08:37 2019 (r347559) @@ -176,7 +176,7 @@ #define URE_EEEP_CR_EEEP_TX 0x0002 /* PLA_WDT6_CTRL */ -#define URE_WDT6_SET_MODE 0x001 +#define URE_WDT6_SET_MODE 0x0010 /* PLA_TCR0 */ #define URE_TCR0_TX_EMPTY 0x0800 From owner-svn-src-stable@freebsd.org Tue May 14 04:14:33 2019 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id EA3A615A46AE; Tue, 14 May 2019 04:14:32 +0000 (UTC) (envelope-from obrien@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 8BC3F83ACF; Tue, 14 May 2019 04:14:32 +0000 (UTC) (envelope-from obrien@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 661641BE97; Tue, 14 May 2019 04:14:32 +0000 (UTC) (envelope-from obrien@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x4E4EWIG059043; Tue, 14 May 2019 04:14:32 GMT (envelope-from obrien@FreeBSD.org) Received: (from obrien@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x4E4EWFe059042; Tue, 14 May 2019 04:14:32 GMT (envelope-from obrien@FreeBSD.org) Message-Id: <201905140414.x4E4EWFe059042@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: obrien set sender to obrien@FreeBSD.org using -f From: "David E. O'Brien" Date: Tue, 14 May 2019 04:14:32 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r347561 - stable/11/lib/libc/gen X-SVN-Group: stable-11 X-SVN-Commit-Author: obrien X-SVN-Commit-Paths: stable/11/lib/libc/gen X-SVN-Commit-Revision: 347561 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 8BC3F83ACF X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.95 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.998,0]; NEURAL_HAM_SHORT(-0.95)[-0.950,0]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US] X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 14 May 2019 04:14:33 -0000 Author: obrien Date: Tue May 14 04:14:31 2019 New Revision: 347561 URL: https://svnweb.freebsd.org/changeset/base/347561 Log: MFC r344085: Note that readpassphrase() came into FreeBSD's libc at 4.6. Modified: stable/11/lib/libc/gen/readpassphrase.3 Directory Properties: stable/11/ (props changed) Modified: stable/11/lib/libc/gen/readpassphrase.3 ============================================================================== --- stable/11/lib/libc/gen/readpassphrase.3 Tue May 14 03:52:06 2019 (r347560) +++ stable/11/lib/libc/gen/readpassphrase.3 Tue May 14 04:14:31 2019 (r347561) @@ -178,4 +178,6 @@ extension and should not be used if portability is des The .Fn readpassphrase function first appeared in +.Fx 4.6 +and .Ox 2.9 . From owner-svn-src-stable@freebsd.org Tue May 14 04:34:59 2019 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 9347715A4B68; Tue, 14 May 2019 04:34:59 +0000 (UTC) (envelope-from obrien@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 28BAB8438D; Tue, 14 May 2019 04:34:59 +0000 (UTC) (envelope-from obrien@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 F13DB1C1EC; Tue, 14 May 2019 04:34:58 +0000 (UTC) (envelope-from obrien@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x4E4YwSH069627; Tue, 14 May 2019 04:34:58 GMT (envelope-from obrien@FreeBSD.org) Received: (from obrien@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x4E4Yw6K069626; Tue, 14 May 2019 04:34:58 GMT (envelope-from obrien@FreeBSD.org) Message-Id: <201905140434.x4E4Yw6K069626@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: obrien set sender to obrien@FreeBSD.org using -f From: "David E. O'Brien" Date: Tue, 14 May 2019 04:34:58 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r347562 - stable/10/lib/libc/gen X-SVN-Group: stable-10 X-SVN-Commit-Author: obrien X-SVN-Commit-Paths: stable/10/lib/libc/gen X-SVN-Commit-Revision: 347562 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 28BAB8438D X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.95 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_SHORT(-0.95)[-0.950,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US]; NEURAL_HAM_MEDIUM(-1.00)[-0.998,0]; NEURAL_HAM_LONG(-1.00)[-1.000,0] X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 14 May 2019 04:34:59 -0000 Author: obrien Date: Tue May 14 04:34:58 2019 New Revision: 347562 URL: https://svnweb.freebsd.org/changeset/base/347562 Log: MF11 r347561. MFC r344085: Note that readpassphrase() came into FreeBSD's libc at 4.6. Modified: stable/10/lib/libc/gen/readpassphrase.3 Directory Properties: stable/10/ (props changed) Modified: stable/10/lib/libc/gen/readpassphrase.3 ============================================================================== --- stable/10/lib/libc/gen/readpassphrase.3 Tue May 14 04:14:31 2019 (r347561) +++ stable/10/lib/libc/gen/readpassphrase.3 Tue May 14 04:34:58 2019 (r347562) @@ -178,4 +178,6 @@ extension and should not be used if portability is des The .Fn readpassphrase function first appeared in +.Fx 4.6 +and .Ox 2.9 . From owner-svn-src-stable@freebsd.org Tue May 14 17:04:04 2019 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 887FA1593162; Tue, 14 May 2019 17:04:04 +0000 (UTC) (envelope-from kib@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 3A77D74A13; Tue, 14 May 2019 17:04:04 +0000 (UTC) (envelope-from kib@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 E0BF923E42; Tue, 14 May 2019 17:04:03 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x4EH43oT064420; Tue, 14 May 2019 17:04:03 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x4EH41w1064403; Tue, 14 May 2019 17:04:01 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201905141704.x4EH41w1064403@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Tue, 14 May 2019 17:04:01 +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: r347567 - in stable/12/sys: amd64/amd64 amd64/include dev/cpuctl i386/i386 i386/include x86/include x86/x86 X-SVN-Group: stable-12 X-SVN-Commit-Author: kib X-SVN-Commit-Paths: in stable/12/sys: amd64/amd64 amd64/include dev/cpuctl i386/i386 i386/include x86/include x86/x86 X-SVN-Commit-Revision: 347567 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 3A77D74A13 X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.97 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.998,0]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; NEURAL_HAM_SHORT(-0.97)[-0.970,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US] X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 14 May 2019 17:04:04 -0000 Author: kib Date: Tue May 14 17:04:00 2019 New Revision: 347567 URL: https://svnweb.freebsd.org/changeset/base/347567 Log: MFC r347566: Mitigations for Microarchitectural Data Sampling. Reference: https://www.intel.com/content/www/us/en/security-center/advisory/intel-sa-00233.html Security: CVE-2018-12126, CVE-2018-12127, CVE-2018-12130, CVE-2019-11091 Security: FreeBSD-SA-19:07.mds Reviewed by: jhb Tested by: emaste, lwhsu Approved by: so (gtetlow) Modified: stable/12/sys/amd64/amd64/exception.S stable/12/sys/amd64/amd64/genassym.c stable/12/sys/amd64/amd64/initcpu.c stable/12/sys/amd64/amd64/machdep.c stable/12/sys/amd64/amd64/support.S stable/12/sys/amd64/include/pcpu.h stable/12/sys/dev/cpuctl/cpuctl.c stable/12/sys/i386/i386/exception.s stable/12/sys/i386/i386/genassym.c stable/12/sys/i386/i386/initcpu.c stable/12/sys/i386/i386/support.s stable/12/sys/i386/include/pcpu.h stable/12/sys/x86/include/specialreg.h stable/12/sys/x86/include/x86_var.h stable/12/sys/x86/x86/cpu_machdep.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/amd64/amd64/exception.S ============================================================================== --- stable/12/sys/amd64/amd64/exception.S Tue May 14 17:02:20 2019 (r347566) +++ stable/12/sys/amd64/amd64/exception.S Tue May 14 17:04:00 2019 (r347567) @@ -512,6 +512,7 @@ fast_syscall_common: testl $TDF_ASTPENDING | TDF_NEEDRESCHED,TD_FLAGS(%rax) jne 3f call handle_ibrs_exit + callq *mds_handler /* Restore preserved registers. */ MEXITCOUNT movq TF_RDI(%rsp),%rdi /* bonus; preserve arg 1 */ @@ -1157,6 +1158,7 @@ ld_regs: jz 2f /* keep running with kernel GS.base */ cli call handle_ibrs_exit_rs + callq *mds_handler cmpq $~0,PCPU(UCR3) je 1f pushq %rdx Modified: stable/12/sys/amd64/amd64/genassym.c ============================================================================== --- stable/12/sys/amd64/amd64/genassym.c Tue May 14 17:02:20 2019 (r347566) +++ stable/12/sys/amd64/amd64/genassym.c Tue May 14 17:04:00 2019 (r347567) @@ -233,6 +233,9 @@ ASSYM(PC_PTI_STACK, offsetof(struct pcpu, pc_pti_stack ASSYM(PC_PTI_STACK_SZ, PC_PTI_STACK_SZ); ASSYM(PC_PTI_RSP0, offsetof(struct pcpu, pc_pti_rsp0)); ASSYM(PC_IBPB_SET, offsetof(struct pcpu, pc_ibpb_set)); +ASSYM(PC_MDS_TMP, offsetof(struct pcpu, pc_mds_tmp)); +ASSYM(PC_MDS_BUF, offsetof(struct pcpu, pc_mds_buf)); +ASSYM(PC_MDS_BUF64, offsetof(struct pcpu, pc_mds_buf64)); ASSYM(LA_EOI, LAPIC_EOI * LAPIC_MEM_MUL); ASSYM(LA_ISR, LAPIC_ISR0 * LAPIC_MEM_MUL); Modified: stable/12/sys/amd64/amd64/initcpu.c ============================================================================== --- stable/12/sys/amd64/amd64/initcpu.c Tue May 14 17:02:20 2019 (r347566) +++ stable/12/sys/amd64/amd64/initcpu.c Tue May 14 17:04:00 2019 (r347567) @@ -257,6 +257,7 @@ initializecpu(void) hw_ibrs_recalculate(); hw_ssb_recalculate(false); amd64_syscall_ret_flush_l1d_recalc(); + hw_mds_recalculate(); switch (cpu_vendor_id) { case CPU_VENDOR_AMD: init_amd(); Modified: stable/12/sys/amd64/amd64/machdep.c ============================================================================== --- stable/12/sys/amd64/amd64/machdep.c Tue May 14 17:02:20 2019 (r347566) +++ stable/12/sys/amd64/amd64/machdep.c Tue May 14 17:04:00 2019 (r347567) @@ -1733,6 +1733,7 @@ hammer_time(u_int64_t modulep, u_int64_t physfree) TUNABLE_INT_FETCH("hw.spec_store_bypass_disable", &hw_ssb_disable); TUNABLE_INT_FETCH("machdep.syscall_ret_l1d_flush", &syscall_ret_l1d_flush_mode); + TUNABLE_INT_FETCH("hw.mds_disable", &hw_mds_disable); finishidentcpu(); /* Final stage of CPU initialization */ initializecpu(); /* Initialize CPU registers */ Modified: stable/12/sys/amd64/amd64/support.S ============================================================================== --- stable/12/sys/amd64/amd64/support.S Tue May 14 17:02:20 2019 (r347566) +++ stable/12/sys/amd64/amd64/support.S Tue May 14 17:04:00 2019 (r347567) @@ -1,8 +1,13 @@ /*- + * Copyright (c) 2018-2019 The FreeBSD Foundation * Copyright (c) 2003 Peter Wemm. * Copyright (c) 1993 The Regents of the University of California. * All rights reserved. * + * Portions of this software were developed by + * Konstantin Belousov under sponsorship from + * the FreeBSD Foundation. + * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: @@ -1626,3 +1631,239 @@ ENTRY(flush_l1d_sw_abi) popq %rbx ret END(flush_l1d_sw_abi) + +ENTRY(mds_handler_void) + retq +END(mds_handler_void) + +ENTRY(mds_handler_verw) + subq $8, %rsp + movw %ds, (%rsp) + verw (%rsp) + addq $8, %rsp + retq +END(mds_handler_verw) + +ENTRY(mds_handler_ivb) + pushq %rax + pushq %rdx + pushq %rcx + + movq %cr0, %rax + testb $CR0_TS, %al + je 1f + clts +1: movq PCPU(MDS_BUF), %rdx + movdqa %xmm0, PCPU(MDS_TMP) + pxor %xmm0, %xmm0 + + lfence + orpd (%rdx), %xmm0 + orpd (%rdx), %xmm0 + mfence + movl $40, %ecx + addq $16, %rdx +2: movntdq %xmm0, (%rdx) + addq $16, %rdx + decl %ecx + jnz 2b + mfence + + movdqa PCPU(MDS_TMP),%xmm0 + testb $CR0_TS, %al + je 3f + movq %rax, %cr0 +3: popq %rcx + popq %rdx + popq %rax + retq +END(mds_handler_ivb) + +ENTRY(mds_handler_bdw) + pushq %rax + pushq %rbx + pushq %rcx + pushq %rdi + pushq %rsi + + movq %cr0, %rax + testb $CR0_TS, %al + je 1f + clts +1: movq PCPU(MDS_BUF), %rbx + movdqa %xmm0, PCPU(MDS_TMP) + pxor %xmm0, %xmm0 + + movq %rbx, %rdi + movq %rbx, %rsi + movl $40, %ecx +2: movntdq %xmm0, (%rbx) + addq $16, %rbx + decl %ecx + jnz 2b + mfence + movl $1536, %ecx + rep; movsb + lfence + + movdqa PCPU(MDS_TMP),%xmm0 + testb $CR0_TS, %al + je 3f + movq %rax, %cr0 +3: popq %rsi + popq %rdi + popq %rcx + popq %rbx + popq %rax + retq +END(mds_handler_bdw) + +ENTRY(mds_handler_skl_sse) + pushq %rax + pushq %rdx + pushq %rcx + pushq %rdi + + movq %cr0, %rax + testb $CR0_TS, %al + je 1f + clts +1: movq PCPU(MDS_BUF), %rdi + movq PCPU(MDS_BUF64), %rdx + movdqa %xmm0, PCPU(MDS_TMP) + pxor %xmm0, %xmm0 + + lfence + orpd (%rdx), %xmm0 + orpd (%rdx), %xmm0 + xorl %eax, %eax +2: clflushopt 5376(%rdi, %rax, 8) + addl $8, %eax + cmpl $8 * 12, %eax + jb 2b + sfence + movl $6144, %ecx + xorl %eax, %eax + rep; stosb + mfence + + movdqa PCPU(MDS_TMP), %xmm0 + testb $CR0_TS, %al + je 3f + movq %rax, %cr0 +3: popq %rdi + popq %rcx + popq %rdx + popq %rax + retq +END(mds_handler_skl_sse) + +ENTRY(mds_handler_skl_avx) + pushq %rax + pushq %rdx + pushq %rcx + pushq %rdi + + movq %cr0, %rax + testb $CR0_TS, %al + je 1f + clts +1: movq PCPU(MDS_BUF), %rdi + movq PCPU(MDS_BUF64), %rdx + vmovdqa %ymm0, PCPU(MDS_TMP) + vpxor %ymm0, %ymm0, %ymm0 + + lfence + vorpd (%rdx), %ymm0, %ymm0 + vorpd (%rdx), %ymm0, %ymm0 + xorl %eax, %eax +2: clflushopt 5376(%rdi, %rax, 8) + addl $8, %eax + cmpl $8 * 12, %eax + jb 2b + sfence + movl $6144, %ecx + xorl %eax, %eax + rep; stosb + mfence + + vmovdqa PCPU(MDS_TMP), %ymm0 + testb $CR0_TS, %al + je 3f + movq %rax, %cr0 +3: popq %rdi + popq %rcx + popq %rdx + popq %rax + retq +END(mds_handler_skl_avx) + +ENTRY(mds_handler_skl_avx512) + pushq %rax + pushq %rdx + pushq %rcx + pushq %rdi + + movq %cr0, %rax + testb $CR0_TS, %al + je 1f + clts +1: movq PCPU(MDS_BUF), %rdi + movq PCPU(MDS_BUF64), %rdx + vmovdqa64 %zmm0, PCPU(MDS_TMP) + vpxor %zmm0, %zmm0, %zmm0 + + lfence + vorpd (%rdx), %zmm0, %zmm0 + vorpd (%rdx), %zmm0, %zmm0 + xorl %eax, %eax +2: clflushopt 5376(%rdi, %rax, 8) + addl $8, %eax + cmpl $8 * 12, %eax + jb 2b + sfence + movl $6144, %ecx + xorl %eax, %eax + rep; stosb + mfence + + vmovdqa64 PCPU(MDS_TMP), %zmm0 + testb $CR0_TS, %al + je 3f + movq %rax, %cr0 +3: popq %rdi + popq %rcx + popq %rdx + popq %rax + retq +END(mds_handler_skl_avx512) + +ENTRY(mds_handler_silvermont) + pushq %rax + pushq %rdx + pushq %rcx + + movq %cr0, %rax + testb $CR0_TS, %al + je 1f + clts +1: movq PCPU(MDS_BUF), %rdx + movdqa %xmm0, PCPU(MDS_TMP) + pxor %xmm0, %xmm0 + + movl $16, %ecx +2: movntdq %xmm0, (%rdx) + addq $16, %rdx + decl %ecx + jnz 2b + mfence + + movdqa PCPU(MDS_TMP),%xmm0 + testb $CR0_TS, %al + je 3f + movq %rax, %cr0 +3: popq %rcx + popq %rdx + popq %rax + retq +END(mds_handler_silvermont) Modified: stable/12/sys/amd64/include/pcpu.h ============================================================================== --- stable/12/sys/amd64/include/pcpu.h Tue May 14 17:02:20 2019 (r347566) +++ stable/12/sys/amd64/include/pcpu.h Tue May 14 17:04:00 2019 (r347567) @@ -76,7 +76,11 @@ uint32_t pc_pcid_gen; \ uint32_t pc_smp_tlb_done; /* TLB op acknowledgement */ \ uint32_t pc_ibpb_set; \ - char __pad[3288] /* pad to UMA_PCPU_ALLOC_SIZE */ + void *pc_mds_buf; \ + void *pc_mds_buf64; \ + uint32_t pc_pad[2]; \ + uint8_t pc_mds_tmp[64]; \ + char __pad[3176] /* pad to UMA_PCPU_ALLOC_SIZE */ #define PC_DBREG_CMD_NONE 0 #define PC_DBREG_CMD_LOAD 1 Modified: stable/12/sys/dev/cpuctl/cpuctl.c ============================================================================== --- stable/12/sys/dev/cpuctl/cpuctl.c Tue May 14 17:02:20 2019 (r347566) +++ stable/12/sys/dev/cpuctl/cpuctl.c Tue May 14 17:04:00 2019 (r347567) @@ -524,6 +524,7 @@ cpuctl_do_eval_cpu_features(int cpu, struct thread *td #ifdef __amd64__ amd64_syscall_ret_flush_l1d_recalc(); #endif + hw_mds_recalculate(); printcpuinfo(); return (0); } Modified: stable/12/sys/i386/i386/exception.s ============================================================================== --- stable/12/sys/i386/i386/exception.s Tue May 14 17:02:20 2019 (r347566) +++ stable/12/sys/i386/i386/exception.s Tue May 14 17:04:00 2019 (r347567) @@ -522,6 +522,8 @@ doreti_exit: 2: movl $handle_ibrs_exit,%eax pushl %ecx /* preserve enough call-used regs */ call *%eax + movl mds_handler,%eax + call *%eax popl %ecx movl %esp, %esi movl PCPU(TRAMPSTK), %edx Modified: stable/12/sys/i386/i386/genassym.c ============================================================================== --- stable/12/sys/i386/i386/genassym.c Tue May 14 17:02:20 2019 (r347566) +++ stable/12/sys/i386/i386/genassym.c Tue May 14 17:04:00 2019 (r347567) @@ -222,6 +222,9 @@ ASSYM(PC_KESP0, offsetof(struct pcpu, pc_kesp0)); ASSYM(PC_TRAMPSTK, offsetof(struct pcpu, pc_trampstk)); ASSYM(PC_COPYOUT_BUF, offsetof(struct pcpu, pc_copyout_buf)); ASSYM(PC_IBPB_SET, offsetof(struct pcpu, pc_ibpb_set)); +ASSYM(PC_MDS_TMP, offsetof(struct pcpu, pc_mds_tmp)); +ASSYM(PC_MDS_BUF, offsetof(struct pcpu, pc_mds_buf)); +ASSYM(PC_MDS_BUF64, offsetof(struct pcpu, pc_mds_buf64)); #ifdef DEV_APIC ASSYM(LA_EOI, LAPIC_EOI * LAPIC_MEM_MUL); Modified: stable/12/sys/i386/i386/initcpu.c ============================================================================== --- stable/12/sys/i386/i386/initcpu.c Tue May 14 17:02:20 2019 (r347566) +++ stable/12/sys/i386/i386/initcpu.c Tue May 14 17:04:00 2019 (r347567) @@ -754,6 +754,7 @@ initializecpu(void) elf32_nxstack = 1; } #endif + hw_mds_recalculate(); if ((amd_feature & AMDID_RDTSCP) != 0 || (cpu_stdext_feature2 & CPUID_STDEXT2_RDPID) != 0) wrmsr(MSR_TSC_AUX, PCPU_GET(cpuid)); Modified: stable/12/sys/i386/i386/support.s ============================================================================== --- stable/12/sys/i386/i386/support.s Tue May 14 17:02:20 2019 (r347566) +++ stable/12/sys/i386/i386/support.s Tue May 14 17:04:00 2019 (r347567) @@ -472,3 +472,187 @@ ENTRY(handle_ibrs_exit) movb $0,PCPU(IBPB_SET) 1: ret END(handle_ibrs_exit) + +ENTRY(mds_handler_void) + ret +END(mds_handler_void) + +ENTRY(mds_handler_verw) + subl $4, %esp + movw %ds, (%esp) + verw (%esp) + addl $4, %esp + ret +END(mds_handler_verw) + +ENTRY(mds_handler_ivb) + movl %cr0, %eax + testb $CR0_TS, %al + je 1f + clts +1: movl PCPU(MDS_BUF), %edx + movdqa %xmm0, PCPU(MDS_TMP) + pxor %xmm0, %xmm0 + + lfence + orpd (%edx), %xmm0 + orpd (%edx), %xmm0 + mfence + movl $40, %ecx + addl $16, %edx +2: movntdq %xmm0, (%edx) + addl $16, %edx + decl %ecx + jnz 2b + mfence + + movdqa PCPU(MDS_TMP),%xmm0 + testb $CR0_TS, %al + je 3f + movl %eax, %cr0 +3: ret +END(mds_handler_ivb) + +ENTRY(mds_handler_bdw) + movl %cr0, %eax + testb $CR0_TS, %al + je 1f + clts +1: movl PCPU(MDS_BUF), %ebx + movdqa %xmm0, PCPU(MDS_TMP) + pxor %xmm0, %xmm0 + + movl %ebx, %edi + movl %ebx, %esi + movl $40, %ecx +2: movntdq %xmm0, (%ebx) + addl $16, %ebx + decl %ecx + jnz 2b + mfence + movl $1536, %ecx + rep; movsb + lfence + + movdqa PCPU(MDS_TMP),%xmm0 + testb $CR0_TS, %al + je 3f + movl %eax, %cr0 +3: ret +END(mds_handler_bdw) + +ENTRY(mds_handler_skl_sse) + movl %cr0, %eax + testb $CR0_TS, %al + je 1f + clts +1: movl PCPU(MDS_BUF), %edi + movl PCPU(MDS_BUF64), %edx + movdqa %xmm0, PCPU(MDS_TMP) + pxor %xmm0, %xmm0 + + lfence + orpd (%edx), %xmm0 + orpd (%edx), %xmm0 + xorl %eax, %eax +2: clflushopt 5376(%edi, %eax, 8) + addl $8, %eax + cmpl $8 * 12, %eax + jb 2b + sfence + movl $6144, %ecx + xorl %eax, %eax + rep; stosb + mfence + + movdqa PCPU(MDS_TMP), %xmm0 + testb $CR0_TS, %al + je 3f + movl %eax, %cr0 +3: ret +END(mds_handler_skl_sse) + +ENTRY(mds_handler_skl_avx) + movl %cr0, %eax + testb $CR0_TS, %al + je 1f + clts +1: movl PCPU(MDS_BUF), %edi + movl PCPU(MDS_BUF64), %edx + vmovdqa %ymm0, PCPU(MDS_TMP) + vpxor %ymm0, %ymm0, %ymm0 + + lfence + vorpd (%edx), %ymm0, %ymm0 + vorpd (%edx), %ymm0, %ymm0 + xorl %eax, %eax +2: clflushopt 5376(%edi, %eax, 8) + addl $8, %eax + cmpl $8 * 12, %eax + jb 2b + sfence + movl $6144, %ecx + xorl %eax, %eax + rep; stosb + mfence + + vmovdqa PCPU(MDS_TMP), %ymm0 + testb $CR0_TS, %al + je 3f + movl %eax, %cr0 +3: ret +END(mds_handler_skl_avx) + +ENTRY(mds_handler_skl_avx512) + movl %cr0, %eax + testb $CR0_TS, %al + je 1f + clts +1: movl PCPU(MDS_BUF), %edi + movl PCPU(MDS_BUF64), %edx + vmovdqa64 %zmm0, PCPU(MDS_TMP) + vpxor %zmm0, %zmm0, %zmm0 + + lfence + vorpd (%edx), %zmm0, %zmm0 + vorpd (%edx), %zmm0, %zmm0 + xorl %eax, %eax +2: clflushopt 5376(%edi, %eax, 8) + addl $8, %eax + cmpl $8 * 12, %eax + jb 2b + sfence + movl $6144, %ecx + xorl %eax, %eax + rep; stosb + mfence + + vmovdqa64 PCPU(MDS_TMP), %zmm0 + testb $CR0_TS, %al + je 3f + movl %eax, %cr0 +3: ret +END(mds_handler_skl_avx512) + +ENTRY(mds_handler_silvermont) + movl %cr0, %eax + testb $CR0_TS, %al + je 1f + clts +1: movl PCPU(MDS_BUF), %edx + movdqa %xmm0, PCPU(MDS_TMP) + pxor %xmm0, %xmm0 + + movl $16, %ecx +2: movntdq %xmm0, (%edx) + addl $16, %edx + decl %ecx + jnz 2b + mfence + + movdqa PCPU(MDS_TMP),%xmm0 + testb $CR0_TS, %al + je 3f + movl %eax, %cr0 +3: ret +END(mds_handler_silvermont) Modified: stable/12/sys/i386/include/pcpu.h ============================================================================== --- stable/12/sys/i386/include/pcpu.h Tue May 14 17:02:20 2019 (r347566) +++ stable/12/sys/i386/include/pcpu.h Tue May 14 17:04:00 2019 (r347567) @@ -77,10 +77,14 @@ struct sx pc_copyout_slock; \ char *pc_copyout_buf; \ vm_offset_t pc_pmap_eh_va; \ - caddr_t pc_pmap_eh_ptep; \ + caddr_t pc_pmap_eh_ptep; \ uint32_t pc_smp_tlb_done; /* TLB op acknowledgement */ \ uint32_t pc_ibpb_set; \ - char __pad[3610] + void *pc_mds_buf; \ + void *pc_mds_buf64; \ + uint32_t pc_pad[4]; \ + uint8_t pc_mds_tmp[64]; \ + char __pad[3522] #ifdef _KERNEL Modified: stable/12/sys/x86/include/specialreg.h ============================================================================== --- stable/12/sys/x86/include/specialreg.h Tue May 14 17:02:20 2019 (r347566) +++ stable/12/sys/x86/include/specialreg.h Tue May 14 17:04:00 2019 (r347567) @@ -431,6 +431,7 @@ /* * CPUID instruction 7 Structured Extended Features, leaf 0 edx info */ +#define CPUID_STDEXT3_MD_CLEAR 0x00000400 #define CPUID_STDEXT3_TSXFA 0x00002000 #define CPUID_STDEXT3_IBPB 0x04000000 #define CPUID_STDEXT3_STIBP 0x08000000 @@ -445,6 +446,7 @@ #define IA32_ARCH_CAP_RSBA 0x00000004 #define IA32_ARCH_CAP_SKIP_L1DFL_VMENTRY 0x00000008 #define IA32_ARCH_CAP_SSB_NO 0x00000010 +#define IA32_ARCH_CAP_MDS_NO 0x00000020 /* * CPUID manufacturers identifiers Modified: stable/12/sys/x86/include/x86_var.h ============================================================================== --- stable/12/sys/x86/include/x86_var.h Tue May 14 17:02:20 2019 (r347566) +++ stable/12/sys/x86/include/x86_var.h Tue May 14 17:04:00 2019 (r347567) @@ -85,6 +85,7 @@ extern uint64_t xsave_mask; extern u_int max_apic_id; extern int pti; extern int hw_ibrs_active; +extern int hw_mds_disable; extern int hw_ssb_active; struct pcb; @@ -140,6 +141,7 @@ int isa_nmi(int cd); void handle_ibrs_entry(void); void handle_ibrs_exit(void); void hw_ibrs_recalculate(void); +void hw_mds_recalculate(void); void hw_ssb_recalculate(bool all_cpus); void nmi_call_kdb(u_int cpu, u_int type, struct trapframe *frame); void nmi_call_kdb_smp(u_int type, struct trapframe *frame); Modified: stable/12/sys/x86/x86/cpu_machdep.c ============================================================================== --- stable/12/sys/x86/x86/cpu_machdep.c Tue May 14 17:02:20 2019 (r347566) +++ stable/12/sys/x86/x86/cpu_machdep.c Tue May 14 17:04:00 2019 (r347567) @@ -61,6 +61,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include #include @@ -914,6 +915,203 @@ SYSCTL_PROC(_hw, OID_AUTO, spec_store_bypass_disable, CTLFLAG_RWTUN | CTLFLAG_NOFETCH | CTLFLAG_MPSAFE, NULL, 0, hw_ssb_disable_handler, "I", "Speculative Store Bypass Disable (0 - off, 1 - on, 2 - auto"); + +int hw_mds_disable; + +/* + * Handler for Microarchitectural Data Sampling issues. Really not a + * pointer to C function: on amd64 the code must not change any CPU + * architectural state except possibly %rflags. Also, it is always + * called with interrupts disabled. + */ +void (*mds_handler)(void); +void mds_handler_void(void); +void mds_handler_verw(void); +void mds_handler_ivb(void); +void mds_handler_bdw(void); +void mds_handler_skl_sse(void); +void mds_handler_skl_avx(void); +void mds_handler_skl_avx512(void); +void mds_handler_silvermont(void); + +static int +sysctl_hw_mds_disable_state_handler(SYSCTL_HANDLER_ARGS) +{ + const char *state; + + if (mds_handler == mds_handler_void) + state = "inactive"; + else if (mds_handler == mds_handler_verw) + state = "VERW"; + else if (mds_handler == mds_handler_ivb) + state = "software IvyBridge"; + else if (mds_handler == mds_handler_bdw) + state = "software Broadwell"; + else if (mds_handler == mds_handler_skl_sse) + state = "software Skylake SSE"; + else if (mds_handler == mds_handler_skl_avx) + state = "software Skylake AVX"; + else if (mds_handler == mds_handler_skl_avx512) + state = "software Skylake AVX512"; + else if (mds_handler == mds_handler_silvermont) + state = "software Silvermont"; + else + state = "unknown"; + return (SYSCTL_OUT(req, state, strlen(state))); +} + +SYSCTL_PROC(_hw, OID_AUTO, mds_disable_state, + CTLTYPE_STRING | CTLFLAG_RD | CTLFLAG_MPSAFE, NULL, 0, + sysctl_hw_mds_disable_state_handler, "A", + "Microarchitectural Data Sampling Mitigation state"); + +_Static_assert(__offsetof(struct pcpu, pc_mds_tmp) % 64 == 0, "MDS AVX512"); + +void +hw_mds_recalculate(void) +{ + struct pcpu *pc; + vm_offset_t b64; + u_long xcr0; + int i; + + /* + * Allow user to force VERW variant even if MD_CLEAR is not + * reported. For instance, hypervisor might unknowingly + * filter the cap out. + * For the similar reasons, and for testing, allow to enable + * mitigation even for RDCL_NO or MDS_NO caps. + */ + if (cpu_vendor_id != CPU_VENDOR_INTEL || hw_mds_disable == 0 || + ((cpu_ia32_arch_caps & (IA32_ARCH_CAP_RDCL_NO | + IA32_ARCH_CAP_MDS_NO)) != 0 && hw_mds_disable == 3)) { + mds_handler = mds_handler_void; + } else if (((cpu_stdext_feature3 & CPUID_STDEXT3_MD_CLEAR) != 0 && + hw_mds_disable == 3) || hw_mds_disable == 1) { + mds_handler = mds_handler_verw; + } else if (CPUID_TO_FAMILY(cpu_id) == 0x6 && + (CPUID_TO_MODEL(cpu_id) == 0x2e || CPUID_TO_MODEL(cpu_id) == 0x1e || + CPUID_TO_MODEL(cpu_id) == 0x1f || CPUID_TO_MODEL(cpu_id) == 0x1a || + CPUID_TO_MODEL(cpu_id) == 0x2f || CPUID_TO_MODEL(cpu_id) == 0x25 || + CPUID_TO_MODEL(cpu_id) == 0x2c || CPUID_TO_MODEL(cpu_id) == 0x2d || + CPUID_TO_MODEL(cpu_id) == 0x2a || CPUID_TO_MODEL(cpu_id) == 0x3e || + CPUID_TO_MODEL(cpu_id) == 0x3a) && + (hw_mds_disable == 2 || hw_mds_disable == 3)) { + /* + * Nehalem, SandyBridge, IvyBridge + */ + CPU_FOREACH(i) { + pc = pcpu_find(i); + if (pc->pc_mds_buf == NULL) { + pc->pc_mds_buf = malloc_domainset(672, M_TEMP, + DOMAINSET_PREF(pc->pc_domain), M_WAITOK); + bzero(pc->pc_mds_buf, 16); + } + } + mds_handler = mds_handler_ivb; + } else if (CPUID_TO_FAMILY(cpu_id) == 0x6 && + (CPUID_TO_MODEL(cpu_id) == 0x3f || CPUID_TO_MODEL(cpu_id) == 0x3c || + CPUID_TO_MODEL(cpu_id) == 0x45 || CPUID_TO_MODEL(cpu_id) == 0x46 || + CPUID_TO_MODEL(cpu_id) == 0x56 || CPUID_TO_MODEL(cpu_id) == 0x4f || + CPUID_TO_MODEL(cpu_id) == 0x47 || CPUID_TO_MODEL(cpu_id) == 0x3d) && + (hw_mds_disable == 2 || hw_mds_disable == 3)) { + /* + * Haswell, Broadwell + */ + CPU_FOREACH(i) { + pc = pcpu_find(i); + if (pc->pc_mds_buf == NULL) { + pc->pc_mds_buf = malloc_domainset(1536, M_TEMP, + DOMAINSET_PREF(pc->pc_domain), M_WAITOK); + bzero(pc->pc_mds_buf, 16); + } + } + mds_handler = mds_handler_bdw; + } else if (CPUID_TO_FAMILY(cpu_id) == 0x6 && + ((CPUID_TO_MODEL(cpu_id) == 0x55 && (cpu_id & + CPUID_STEPPING) <= 5) || + CPUID_TO_MODEL(cpu_id) == 0x4e || CPUID_TO_MODEL(cpu_id) == 0x5e || + (CPUID_TO_MODEL(cpu_id) == 0x8e && (cpu_id & + CPUID_STEPPING) <= 0xb) || + (CPUID_TO_MODEL(cpu_id) == 0x9e && (cpu_id & + CPUID_STEPPING) <= 0xc)) && + (hw_mds_disable == 2 || hw_mds_disable == 3)) { + /* + * Skylake, KabyLake, CoffeeLake, WhiskeyLake, + * CascadeLake + */ + CPU_FOREACH(i) { + pc = pcpu_find(i); + if (pc->pc_mds_buf == NULL) { + pc->pc_mds_buf = malloc_domainset(6 * 1024, + M_TEMP, DOMAINSET_PREF(pc->pc_domain), + M_WAITOK); + b64 = (vm_offset_t)malloc_domainset(64 + 63, + M_TEMP, DOMAINSET_PREF(pc->pc_domain), + M_WAITOK); + pc->pc_mds_buf64 = (void *)roundup2(b64, 64); + bzero(pc->pc_mds_buf64, 64); + } + } + xcr0 = rxcr(0); + if ((xcr0 & XFEATURE_ENABLED_ZMM_HI256) != 0 && + (cpu_stdext_feature2 & CPUID_STDEXT_AVX512DQ) != 0) + mds_handler = mds_handler_skl_avx512; + else if ((xcr0 & XFEATURE_ENABLED_AVX) != 0 && + (cpu_feature2 & CPUID2_AVX) != 0) + mds_handler = mds_handler_skl_avx; + else + mds_handler = mds_handler_skl_sse; + } else if (CPUID_TO_FAMILY(cpu_id) == 0x6 && + ((CPUID_TO_MODEL(cpu_id) == 0x37 || + CPUID_TO_MODEL(cpu_id) == 0x4a || + CPUID_TO_MODEL(cpu_id) == 0x4c || + CPUID_TO_MODEL(cpu_id) == 0x4d || + CPUID_TO_MODEL(cpu_id) == 0x5a || + CPUID_TO_MODEL(cpu_id) == 0x5d || + CPUID_TO_MODEL(cpu_id) == 0x6e || + CPUID_TO_MODEL(cpu_id) == 0x65 || + CPUID_TO_MODEL(cpu_id) == 0x75 || + CPUID_TO_MODEL(cpu_id) == 0x1c || + CPUID_TO_MODEL(cpu_id) == 0x26 || + CPUID_TO_MODEL(cpu_id) == 0x27 || + CPUID_TO_MODEL(cpu_id) == 0x35 || + CPUID_TO_MODEL(cpu_id) == 0x36 || + CPUID_TO_MODEL(cpu_id) == 0x7a))) { + /* Silvermont, Airmont */ + CPU_FOREACH(i) { + pc = pcpu_find(i); + if (pc->pc_mds_buf == NULL) + pc->pc_mds_buf = malloc(256, M_TEMP, M_WAITOK); + } + mds_handler = mds_handler_silvermont; + } else { + hw_mds_disable = 0; + mds_handler = mds_handler_void; + } +} + +static int +sysctl_mds_disable_handler(SYSCTL_HANDLER_ARGS) +{ + int error, val; + + val = hw_mds_disable; + error = sysctl_handle_int(oidp, &val, 0, req); + if (error != 0 || req->newptr == NULL) + return (error); + if (val < 0 || val > 3) + return (EINVAL); + hw_mds_disable = val; + hw_mds_recalculate(); + return (0); +} + +SYSCTL_PROC(_hw, OID_AUTO, mds_disable, CTLTYPE_INT | + CTLFLAG_RWTUN | CTLFLAG_NOFETCH | CTLFLAG_MPSAFE, NULL, 0, + sysctl_mds_disable_handler, "I", + "Microarchitectural Data Sampling Mitigation " + "(0 - off, 1 - on VERW, 2 - on SW, 3 - on AUTO"); /* * Enable and restore kernel text write permissions. From owner-svn-src-stable@freebsd.org Tue May 14 17:05:06 2019 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id CB6491593223; Tue, 14 May 2019 17:05:05 +0000 (UTC) (envelope-from kib@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 7D7F874B68; Tue, 14 May 2019 17:05:05 +0000 (UTC) (envelope-from kib@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 56C2823E44; Tue, 14 May 2019 17:05:05 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x4EH55ib064540; Tue, 14 May 2019 17:05:05 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x4EH52k9064526; Tue, 14 May 2019 17:05:02 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201905141705.x4EH52k9064526@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Tue, 14 May 2019 17:05:02 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r347568 - in stable/11/sys: amd64/amd64 amd64/include dev/cpuctl i386/i386 i386/include x86/include x86/x86 X-SVN-Group: stable-11 X-SVN-Commit-Author: kib X-SVN-Commit-Paths: in stable/11/sys: amd64/amd64 amd64/include dev/cpuctl i386/i386 i386/include x86/include x86/x86 X-SVN-Commit-Revision: 347568 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 7D7F874B68 X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.97 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.998,0]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; NEURAL_HAM_SHORT(-0.97)[-0.970,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US] X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 14 May 2019 17:05:06 -0000 Author: kib Date: Tue May 14 17:05:02 2019 New Revision: 347568 URL: https://svnweb.freebsd.org/changeset/base/347568 Log: MFC r347566: Mitigations for Microarchitectural Data Sampling. Reference: https://www.intel.com/content/www/us/en/security-center/advisory/intel-sa-00233.html Security: CVE-2018-12126, CVE-2018-12127, CVE-2018-12130, CVE-2019-11091 Security: FreeBSD-SA-19:07.mds Reviewed by: jhb Tested by: emaste, lwhsu Approved by: so (gtetlow) Modified: stable/11/sys/amd64/amd64/exception.S stable/11/sys/amd64/amd64/genassym.c stable/11/sys/amd64/amd64/initcpu.c stable/11/sys/amd64/amd64/machdep.c stable/11/sys/amd64/amd64/support.S stable/11/sys/amd64/include/pcpu.h stable/11/sys/dev/cpuctl/cpuctl.c stable/11/sys/i386/i386/exception.s stable/11/sys/i386/i386/genassym.c stable/11/sys/i386/i386/initcpu.c stable/11/sys/i386/i386/support.s stable/11/sys/i386/include/pcpu.h stable/11/sys/x86/include/specialreg.h stable/11/sys/x86/include/x86_var.h stable/11/sys/x86/x86/cpu_machdep.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/amd64/amd64/exception.S ============================================================================== --- stable/11/sys/amd64/amd64/exception.S Tue May 14 17:04:00 2019 (r347567) +++ stable/11/sys/amd64/amd64/exception.S Tue May 14 17:05:02 2019 (r347568) @@ -502,6 +502,7 @@ fast_syscall_common: testl $TDF_ASTPENDING | TDF_NEEDRESCHED,TD_FLAGS(%rax) jne 3f call handle_ibrs_exit + callq *mds_handler /* Restore preserved registers. */ MEXITCOUNT movq TF_RDI(%rsp),%rdi /* bonus; preserve arg 1 */ @@ -1139,6 +1140,7 @@ ld_regs: jz 2f /* keep running with kernel GS.base */ cli call handle_ibrs_exit_rs + callq *mds_handler cmpq $~0,PCPU(UCR3) je 1f pushq %rdx Modified: stable/11/sys/amd64/amd64/genassym.c ============================================================================== --- stable/11/sys/amd64/amd64/genassym.c Tue May 14 17:04:00 2019 (r347567) +++ stable/11/sys/amd64/amd64/genassym.c Tue May 14 17:05:02 2019 (r347568) @@ -231,6 +231,9 @@ ASSYM(PC_PTI_STACK, offsetof(struct pcpu, pc_pti_stack ASSYM(PC_PTI_STACK_SZ, PC_PTI_STACK_SZ); ASSYM(PC_PTI_RSP0, offsetof(struct pcpu, pc_pti_rsp0)); ASSYM(PC_IBPB_SET, offsetof(struct pcpu, pc_ibpb_set)); +ASSYM(PC_MDS_TMP, offsetof(struct pcpu, pc_mds_tmp)); +ASSYM(PC_MDS_BUF, offsetof(struct pcpu, pc_mds_buf)); +ASSYM(PC_MDS_BUF64, offsetof(struct pcpu, pc_mds_buf64)); ASSYM(LA_EOI, LAPIC_EOI * LAPIC_MEM_MUL); ASSYM(LA_ISR, LAPIC_ISR0 * LAPIC_MEM_MUL); Modified: stable/11/sys/amd64/amd64/initcpu.c ============================================================================== --- stable/11/sys/amd64/amd64/initcpu.c Tue May 14 17:04:00 2019 (r347567) +++ stable/11/sys/amd64/amd64/initcpu.c Tue May 14 17:05:02 2019 (r347568) @@ -247,6 +247,7 @@ initializecpu(void) } hw_ibrs_recalculate(); hw_ssb_recalculate(false); + hw_mds_recalculate(); switch (cpu_vendor_id) { case CPU_VENDOR_AMD: init_amd(); Modified: stable/11/sys/amd64/amd64/machdep.c ============================================================================== --- stable/11/sys/amd64/amd64/machdep.c Tue May 14 17:04:00 2019 (r347567) +++ stable/11/sys/amd64/amd64/machdep.c Tue May 14 17:05:02 2019 (r347568) @@ -1864,6 +1864,7 @@ hammer_time(u_int64_t modulep, u_int64_t physfree) TUNABLE_INT_FETCH("hw.ibrs_disable", &hw_ibrs_disable); TUNABLE_INT_FETCH("hw.spec_store_bypass_disable", &hw_ssb_disable); + TUNABLE_INT_FETCH("hw.mds_disable", &hw_mds_disable); /* Location of kernel stack for locore */ return ((u_int64_t)thread0.td_pcb); Modified: stable/11/sys/amd64/amd64/support.S ============================================================================== --- stable/11/sys/amd64/amd64/support.S Tue May 14 17:04:00 2019 (r347567) +++ stable/11/sys/amd64/amd64/support.S Tue May 14 17:05:02 2019 (r347568) @@ -1,8 +1,13 @@ /*- + * Copyright (c) 2018-2019 The FreeBSD Foundation * Copyright (c) 2003 Peter Wemm. * Copyright (c) 1993 The Regents of the University of California. * All rights reserved. * + * Portions of this software were developed by + * Konstantin Belousov under sponsorship from + * the FreeBSD Foundation. + * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: @@ -925,3 +930,239 @@ ENTRY(flush_l1d_sw) ret #undef L1D_FLUSH_SIZE END(flush_l1d_sw) + +ENTRY(mds_handler_void) + retq +END(mds_handler_void) + +ENTRY(mds_handler_verw) + subq $8, %rsp + movw %ds, (%rsp) + verw (%rsp) + addq $8, %rsp + retq +END(mds_handler_verw) + +ENTRY(mds_handler_ivb) + pushq %rax + pushq %rdx + pushq %rcx + + movq %cr0, %rax + testb $CR0_TS, %al + je 1f + clts +1: movq PCPU(MDS_BUF), %rdx + movdqa %xmm0, PCPU(MDS_TMP) + pxor %xmm0, %xmm0 + + lfence + orpd (%rdx), %xmm0 + orpd (%rdx), %xmm0 + mfence + movl $40, %ecx + addq $16, %rdx +2: movntdq %xmm0, (%rdx) + addq $16, %rdx + decl %ecx + jnz 2b + mfence + + movdqa PCPU(MDS_TMP),%xmm0 + testb $CR0_TS, %al + je 3f + movq %rax, %cr0 +3: popq %rcx + popq %rdx + popq %rax + retq +END(mds_handler_ivb) + +ENTRY(mds_handler_bdw) + pushq %rax + pushq %rbx + pushq %rcx + pushq %rdi + pushq %rsi + + movq %cr0, %rax + testb $CR0_TS, %al + je 1f + clts +1: movq PCPU(MDS_BUF), %rbx + movdqa %xmm0, PCPU(MDS_TMP) + pxor %xmm0, %xmm0 + + movq %rbx, %rdi + movq %rbx, %rsi + movl $40, %ecx +2: movntdq %xmm0, (%rbx) + addq $16, %rbx + decl %ecx + jnz 2b + mfence + movl $1536, %ecx + rep; movsb + lfence + + movdqa PCPU(MDS_TMP),%xmm0 + testb $CR0_TS, %al + je 3f + movq %rax, %cr0 +3: popq %rsi + popq %rdi + popq %rcx + popq %rbx + popq %rax + retq +END(mds_handler_bdw) + +ENTRY(mds_handler_skl_sse) + pushq %rax + pushq %rdx + pushq %rcx + pushq %rdi + + movq %cr0, %rax + testb $CR0_TS, %al + je 1f + clts +1: movq PCPU(MDS_BUF), %rdi + movq PCPU(MDS_BUF64), %rdx + movdqa %xmm0, PCPU(MDS_TMP) + pxor %xmm0, %xmm0 + + lfence + orpd (%rdx), %xmm0 + orpd (%rdx), %xmm0 + xorl %eax, %eax +2: clflushopt 5376(%rdi, %rax, 8) + addl $8, %eax + cmpl $8 * 12, %eax + jb 2b + sfence + movl $6144, %ecx + xorl %eax, %eax + rep; stosb + mfence + + movdqa PCPU(MDS_TMP), %xmm0 + testb $CR0_TS, %al + je 3f + movq %rax, %cr0 +3: popq %rdi + popq %rcx + popq %rdx + popq %rax + retq +END(mds_handler_skl_sse) + +ENTRY(mds_handler_skl_avx) + pushq %rax + pushq %rdx + pushq %rcx + pushq %rdi + + movq %cr0, %rax + testb $CR0_TS, %al + je 1f + clts +1: movq PCPU(MDS_BUF), %rdi + movq PCPU(MDS_BUF64), %rdx + vmovdqa %ymm0, PCPU(MDS_TMP) + vpxor %ymm0, %ymm0, %ymm0 + + lfence + vorpd (%rdx), %ymm0, %ymm0 + vorpd (%rdx), %ymm0, %ymm0 + xorl %eax, %eax +2: clflushopt 5376(%rdi, %rax, 8) + addl $8, %eax + cmpl $8 * 12, %eax + jb 2b + sfence + movl $6144, %ecx + xorl %eax, %eax + rep; stosb + mfence + + vmovdqa PCPU(MDS_TMP), %ymm0 + testb $CR0_TS, %al + je 3f + movq %rax, %cr0 +3: popq %rdi + popq %rcx + popq %rdx + popq %rax + retq +END(mds_handler_skl_avx) + +ENTRY(mds_handler_skl_avx512) + pushq %rax + pushq %rdx + pushq %rcx + pushq %rdi + + movq %cr0, %rax + testb $CR0_TS, %al + je 1f + clts +1: movq PCPU(MDS_BUF), %rdi + movq PCPU(MDS_BUF64), %rdx + vmovdqa64 %zmm0, PCPU(MDS_TMP) + vpxor %zmm0, %zmm0, %zmm0 + + lfence + vorpd (%rdx), %zmm0, %zmm0 + vorpd (%rdx), %zmm0, %zmm0 + xorl %eax, %eax +2: clflushopt 5376(%rdi, %rax, 8) + addl $8, %eax + cmpl $8 * 12, %eax + jb 2b + sfence + movl $6144, %ecx + xorl %eax, %eax + rep; stosb + mfence + + vmovdqa64 PCPU(MDS_TMP), %zmm0 + testb $CR0_TS, %al + je 3f + movq %rax, %cr0 +3: popq %rdi + popq %rcx + popq %rdx + popq %rax + retq +END(mds_handler_skl_avx512) + +ENTRY(mds_handler_silvermont) + pushq %rax + pushq %rdx + pushq %rcx + + movq %cr0, %rax + testb $CR0_TS, %al + je 1f + clts +1: movq PCPU(MDS_BUF), %rdx + movdqa %xmm0, PCPU(MDS_TMP) + pxor %xmm0, %xmm0 + + movl $16, %ecx +2: movntdq %xmm0, (%rdx) + addq $16, %rdx + decl %ecx + jnz 2b + mfence + + movdqa PCPU(MDS_TMP),%xmm0 + testb $CR0_TS, %al + je 3f + movq %rax, %cr0 +3: popq %rcx + popq %rdx + popq %rax + retq +END(mds_handler_silvermont) Modified: stable/11/sys/amd64/include/pcpu.h ============================================================================== --- stable/11/sys/amd64/include/pcpu.h Tue May 14 17:04:00 2019 (r347567) +++ stable/11/sys/amd64/include/pcpu.h Tue May 14 17:05:02 2019 (r347568) @@ -74,7 +74,11 @@ uint32_t pc_pcid_gen; \ uint32_t pc_smp_tlb_done; /* TLB op acknowledgement */ \ uint32_t pc_ibpb_set; \ - char __pad[88] /* be divisor of PAGE_SIZE \ + void *pc_mds_buf; \ + void *pc_mds_buf64; \ + uint32_t pc_pad[2]; \ + uint8_t pc_mds_tmp[64]; \ + char __pad[1024] /* be divisor of PAGE_SIZE \ after cache alignment */ #define PC_DBREG_CMD_NONE 0 Modified: stable/11/sys/dev/cpuctl/cpuctl.c ============================================================================== --- stable/11/sys/dev/cpuctl/cpuctl.c Tue May 14 17:04:00 2019 (r347567) +++ stable/11/sys/dev/cpuctl/cpuctl.c Tue May 14 17:05:02 2019 (r347568) @@ -530,6 +530,7 @@ cpuctl_do_eval_cpu_features(int cpu, struct thread *td hw_ibrs_recalculate(); restore_cpu(oldcpu, is_bound, td); hw_ssb_recalculate(true); + hw_mds_recalculate(); printcpuinfo(); return (0); } Modified: stable/11/sys/i386/i386/exception.s ============================================================================== --- stable/11/sys/i386/i386/exception.s Tue May 14 17:04:00 2019 (r347567) +++ stable/11/sys/i386/i386/exception.s Tue May 14 17:05:02 2019 (r347568) @@ -406,6 +406,7 @@ doreti_ast: */ doreti_exit: MEXITCOUNT + call *mds_handler .globl doreti_popl_fs doreti_popl_fs: Modified: stable/11/sys/i386/i386/genassym.c ============================================================================== --- stable/11/sys/i386/i386/genassym.c Tue May 14 17:04:00 2019 (r347567) +++ stable/11/sys/i386/i386/genassym.c Tue May 14 17:05:02 2019 (r347568) @@ -217,6 +217,9 @@ ASSYM(PC_CURRENTLDT, offsetof(struct pcpu, pc_currentl ASSYM(PC_CPUID, offsetof(struct pcpu, pc_cpuid)); ASSYM(PC_CURPMAP, offsetof(struct pcpu, pc_curpmap)); ASSYM(PC_PRIVATE_TSS, offsetof(struct pcpu, pc_private_tss)); +ASSYM(PC_MDS_TMP, offsetof(struct pcpu, pc_mds_tmp)); +ASSYM(PC_MDS_BUF, offsetof(struct pcpu, pc_mds_buf)); +ASSYM(PC_MDS_BUF64, offsetof(struct pcpu, pc_mds_buf64)); #ifdef DEV_APIC ASSYM(LA_EOI, LAPIC_EOI * LAPIC_MEM_MUL); Modified: stable/11/sys/i386/i386/initcpu.c ============================================================================== --- stable/11/sys/i386/i386/initcpu.c Tue May 14 17:04:00 2019 (r347567) +++ stable/11/sys/i386/i386/initcpu.c Tue May 14 17:05:02 2019 (r347568) @@ -769,6 +769,7 @@ initializecpu(void) elf32_nxstack = 1; } #endif + hw_mds_recalculate(); if ((amd_feature & AMDID_RDTSCP) != 0 || (cpu_stdext_feature2 & CPUID_STDEXT2_RDPID) != 0) wrmsr(MSR_TSC_AUX, PCPU_GET(cpuid)); Modified: stable/11/sys/i386/i386/support.s ============================================================================== --- stable/11/sys/i386/i386/support.s Tue May 14 17:04:00 2019 (r347567) +++ stable/11/sys/i386/i386/support.s Tue May 14 17:05:02 2019 (r347568) @@ -826,3 +826,187 @@ END(handle_ibrs_entry) ENTRY(handle_ibrs_exit) ret END(handle_ibrs_exit) + +ENTRY(mds_handler_void) + ret +END(mds_handler_void) + +ENTRY(mds_handler_verw) + subl $4, %esp + movw %ds, (%esp) + verw (%esp) + addl $4, %esp + ret +END(mds_handler_verw) + +ENTRY(mds_handler_ivb) + movl %cr0, %eax + testb $CR0_TS, %al + je 1f + clts +1: movl PCPU(MDS_BUF), %edx + movdqa %xmm0, PCPU(MDS_TMP) + pxor %xmm0, %xmm0 + + lfence + orpd (%edx), %xmm0 + orpd (%edx), %xmm0 + mfence + movl $40, %ecx + addl $16, %edx +2: movntdq %xmm0, (%edx) + addl $16, %edx + decl %ecx + jnz 2b + mfence + + movdqa PCPU(MDS_TMP),%xmm0 + testb $CR0_TS, %al + je 3f + movl %eax, %cr0 +3: ret +END(mds_handler_ivb) + +ENTRY(mds_handler_bdw) + movl %cr0, %eax + testb $CR0_TS, %al + je 1f + clts +1: movl PCPU(MDS_BUF), %ebx + movdqa %xmm0, PCPU(MDS_TMP) + pxor %xmm0, %xmm0 + + movl %ebx, %edi + movl %ebx, %esi + movl $40, %ecx +2: movntdq %xmm0, (%ebx) + addl $16, %ebx + decl %ecx + jnz 2b + mfence + movl $1536, %ecx + rep; movsb + lfence + + movdqa PCPU(MDS_TMP),%xmm0 + testb $CR0_TS, %al + je 3f + movl %eax, %cr0 +3: ret +END(mds_handler_bdw) + +ENTRY(mds_handler_skl_sse) + movl %cr0, %eax + testb $CR0_TS, %al + je 1f + clts +1: movl PCPU(MDS_BUF), %edi + movl PCPU(MDS_BUF64), %edx + movdqa %xmm0, PCPU(MDS_TMP) + pxor %xmm0, %xmm0 + + lfence + orpd (%edx), %xmm0 + orpd (%edx), %xmm0 + xorl %eax, %eax +2: clflushopt 5376(%edi, %eax, 8) + addl $8, %eax + cmpl $8 * 12, %eax + jb 2b + sfence + movl $6144, %ecx + xorl %eax, %eax + rep; stosb + mfence + + movdqa PCPU(MDS_TMP), %xmm0 + testb $CR0_TS, %al + je 3f + movl %eax, %cr0 +3: ret +END(mds_handler_skl_sse) + +ENTRY(mds_handler_skl_avx) + movl %cr0, %eax + testb $CR0_TS, %al + je 1f + clts +1: movl PCPU(MDS_BUF), %edi + movl PCPU(MDS_BUF64), %edx + vmovdqa %ymm0, PCPU(MDS_TMP) + vpxor %ymm0, %ymm0, %ymm0 + + lfence + vorpd (%edx), %ymm0, %ymm0 + vorpd (%edx), %ymm0, %ymm0 + xorl %eax, %eax +2: clflushopt 5376(%edi, %eax, 8) + addl $8, %eax + cmpl $8 * 12, %eax + jb 2b + sfence + movl $6144, %ecx + xorl %eax, %eax + rep; stosb + mfence + + vmovdqa PCPU(MDS_TMP), %ymm0 + testb $CR0_TS, %al + je 3f + movl %eax, %cr0 +3: ret +END(mds_handler_skl_avx) + +ENTRY(mds_handler_skl_avx512) + movl %cr0, %eax + testb $CR0_TS, %al + je 1f + clts +1: movl PCPU(MDS_BUF), %edi + movl PCPU(MDS_BUF64), %edx + vmovdqa64 %zmm0, PCPU(MDS_TMP) + vpxor %zmm0, %zmm0, %zmm0 + + lfence + vorpd (%edx), %zmm0, %zmm0 + vorpd (%edx), %zmm0, %zmm0 + xorl %eax, %eax +2: clflushopt 5376(%edi, %eax, 8) + addl $8, %eax + cmpl $8 * 12, %eax + jb 2b + sfence + movl $6144, %ecx + xorl %eax, %eax + rep; stosb + mfence + + vmovdqa64 PCPU(MDS_TMP), %zmm0 + testb $CR0_TS, %al + je 3f + movl %eax, %cr0 +3: ret +END(mds_handler_skl_avx512) + +ENTRY(mds_handler_silvermont) + movl %cr0, %eax + testb $CR0_TS, %al + je 1f + clts +1: movl PCPU(MDS_BUF), %edx + movdqa %xmm0, PCPU(MDS_TMP) + pxor %xmm0, %xmm0 + + movl $16, %ecx +2: movntdq %xmm0, (%edx) + addl $16, %edx + decl %ecx + jnz 2b + mfence + + movdqa PCPU(MDS_TMP),%xmm0 + testb $CR0_TS, %al + je 3f + movl %eax, %cr0 +3: ret +END(mds_handler_silvermont) Modified: stable/11/sys/i386/include/pcpu.h ============================================================================== --- stable/11/sys/i386/include/pcpu.h Tue May 14 17:04:00 2019 (r347567) +++ stable/11/sys/i386/include/pcpu.h Tue May 14 17:05:02 2019 (r347568) @@ -69,7 +69,11 @@ vm_offset_t pc_qmap_addr; /* KVA for temporary mappings */\ uint32_t pc_smp_tlb_done; /* TLB op acknowledgement */ \ uint32_t pc_ibpb_set; \ - char __pad[185] + void *pc_mds_buf; \ + void *pc_mds_buf64; \ + uint32_t pc_pad[12]; \ + uint8_t pc_mds_tmp[64]; \ + char __pad[153] #ifdef _KERNEL Modified: stable/11/sys/x86/include/specialreg.h ============================================================================== --- stable/11/sys/x86/include/specialreg.h Tue May 14 17:04:00 2019 (r347567) +++ stable/11/sys/x86/include/specialreg.h Tue May 14 17:05:02 2019 (r347568) @@ -390,6 +390,7 @@ /* * CPUID instruction 7 Structured Extended Features, leaf 0 edx info */ +#define CPUID_STDEXT3_MD_CLEAR 0x00000400 #define CPUID_STDEXT3_TSXFA 0x00002000 #define CPUID_STDEXT3_IBPB 0x04000000 #define CPUID_STDEXT3_STIBP 0x08000000 @@ -404,6 +405,7 @@ #define IA32_ARCH_CAP_RSBA 0x00000004 #define IA32_ARCH_CAP_SKIP_L1DFL_VMENTRY 0x00000008 #define IA32_ARCH_CAP_SSB_NO 0x00000010 +#define IA32_ARCH_CAP_MDS_NO 0x00000020 /* * CPUID manufacturers identifiers Modified: stable/11/sys/x86/include/x86_var.h ============================================================================== --- stable/11/sys/x86/include/x86_var.h Tue May 14 17:04:00 2019 (r347567) +++ stable/11/sys/x86/include/x86_var.h Tue May 14 17:05:02 2019 (r347568) @@ -83,6 +83,7 @@ extern int use_xsave; extern uint64_t xsave_mask; extern int pti; extern int hw_ibrs_active; +extern int hw_mds_disable; extern int hw_ssb_active; struct pcb; @@ -134,6 +135,7 @@ int isa_nmi(int cd); void handle_ibrs_entry(void); void handle_ibrs_exit(void); void hw_ibrs_recalculate(void); +void hw_mds_recalculate(void); void hw_ssb_recalculate(bool all_cpus); void nmi_call_kdb(u_int cpu, u_int type, struct trapframe *frame); void nmi_call_kdb_smp(u_int type, struct trapframe *frame); Modified: stable/11/sys/x86/x86/cpu_machdep.c ============================================================================== --- stable/11/sys/x86/x86/cpu_machdep.c Tue May 14 17:04:00 2019 (r347567) +++ stable/11/sys/x86/x86/cpu_machdep.c Tue May 14 17:05:02 2019 (r347568) @@ -945,3 +945,198 @@ SYSCTL_PROC(_hw, OID_AUTO, spec_store_bypass_disable, hw_ssb_disable_handler, "I", "Speculative Store Bypass Disable (0 - off, 1 - on, 2 - auto"); +int hw_mds_disable; + +/* + * Handler for Microarchitectural Data Sampling issues. Really not a + * pointer to C function: on amd64 the code must not change any CPU + * architectural state except possibly %rflags. Also, it is always + * called with interrupts disabled. + */ +void (*mds_handler)(void); +void mds_handler_void(void); +void mds_handler_verw(void); +void mds_handler_ivb(void); +void mds_handler_bdw(void); +void mds_handler_skl_sse(void); +void mds_handler_skl_avx(void); +void mds_handler_skl_avx512(void); +void mds_handler_silvermont(void); + +static int +sysctl_hw_mds_disable_state_handler(SYSCTL_HANDLER_ARGS) +{ + const char *state; + + if (mds_handler == mds_handler_void) + state = "inactive"; + else if (mds_handler == mds_handler_verw) + state = "VERW"; + else if (mds_handler == mds_handler_ivb) + state = "software IvyBridge"; + else if (mds_handler == mds_handler_bdw) + state = "software Broadwell"; + else if (mds_handler == mds_handler_skl_sse) + state = "software Skylake SSE"; + else if (mds_handler == mds_handler_skl_avx) + state = "software Skylake AVX"; + else if (mds_handler == mds_handler_skl_avx512) + state = "software Skylake AVX512"; + else if (mds_handler == mds_handler_silvermont) + state = "software Silvermont"; + else + state = "unknown"; + return (SYSCTL_OUT(req, state, strlen(state))); +} + +SYSCTL_PROC(_hw, OID_AUTO, mds_disable_state, + CTLTYPE_STRING | CTLFLAG_RD | CTLFLAG_MPSAFE, NULL, 0, + sysctl_hw_mds_disable_state_handler, "A", + "Microarchitectural Data Sampling Mitigation state"); + +_Static_assert(__offsetof(struct pcpu, pc_mds_tmp) % 64 == 0, "MDS AVX512"); + +void +hw_mds_recalculate(void) +{ + struct pcpu *pc; + vm_offset_t b64; + u_long xcr0; + int i; + + /* + * Allow user to force VERW variant even if MD_CLEAR is not + * reported. For instance, hypervisor might unknowingly + * filter the cap out. + * For the similar reasons, and for testing, allow to enable + * mitigation even for RDCL_NO or MDS_NO caps. + */ + if (cpu_vendor_id != CPU_VENDOR_INTEL || hw_mds_disable == 0 || + ((cpu_ia32_arch_caps & (IA32_ARCH_CAP_RDCL_NO | + IA32_ARCH_CAP_MDS_NO)) != 0 && hw_mds_disable == 3)) { + mds_handler = mds_handler_void; + } else if (((cpu_stdext_feature3 & CPUID_STDEXT3_MD_CLEAR) != 0 && + hw_mds_disable == 3) || hw_mds_disable == 1) { + mds_handler = mds_handler_verw; + } else if (CPUID_TO_FAMILY(cpu_id) == 0x6 && + (CPUID_TO_MODEL(cpu_id) == 0x2e || CPUID_TO_MODEL(cpu_id) == 0x1e || + CPUID_TO_MODEL(cpu_id) == 0x1f || CPUID_TO_MODEL(cpu_id) == 0x1a || + CPUID_TO_MODEL(cpu_id) == 0x2f || CPUID_TO_MODEL(cpu_id) == 0x25 || + CPUID_TO_MODEL(cpu_id) == 0x2c || CPUID_TO_MODEL(cpu_id) == 0x2d || + CPUID_TO_MODEL(cpu_id) == 0x2a || CPUID_TO_MODEL(cpu_id) == 0x3e || + CPUID_TO_MODEL(cpu_id) == 0x3a) && + (hw_mds_disable == 2 || hw_mds_disable == 3)) { + /* + * Nehalem, SandyBridge, IvyBridge + */ + CPU_FOREACH(i) { + pc = pcpu_find(i); + if (pc->pc_mds_buf == NULL) { + pc->pc_mds_buf = malloc(672, M_TEMP, + M_WAITOK); + bzero(pc->pc_mds_buf, 16); + } + } + mds_handler = mds_handler_ivb; + } else if (CPUID_TO_FAMILY(cpu_id) == 0x6 && + (CPUID_TO_MODEL(cpu_id) == 0x3f || CPUID_TO_MODEL(cpu_id) == 0x3c || + CPUID_TO_MODEL(cpu_id) == 0x45 || CPUID_TO_MODEL(cpu_id) == 0x46 || + CPUID_TO_MODEL(cpu_id) == 0x56 || CPUID_TO_MODEL(cpu_id) == 0x4f || + CPUID_TO_MODEL(cpu_id) == 0x47 || CPUID_TO_MODEL(cpu_id) == 0x3d) && + (hw_mds_disable == 2 || hw_mds_disable == 3)) { + /* + * Haswell, Broadwell + */ + CPU_FOREACH(i) { + pc = pcpu_find(i); + if (pc->pc_mds_buf == NULL) { + pc->pc_mds_buf = malloc(1536, M_TEMP, + M_WAITOK); + bzero(pc->pc_mds_buf, 16); + } + } + mds_handler = mds_handler_bdw; + } else if (CPUID_TO_FAMILY(cpu_id) == 0x6 && + ((CPUID_TO_MODEL(cpu_id) == 0x55 && (cpu_id & + CPUID_STEPPING) <= 5) || + CPUID_TO_MODEL(cpu_id) == 0x4e || CPUID_TO_MODEL(cpu_id) == 0x5e || + (CPUID_TO_MODEL(cpu_id) == 0x8e && (cpu_id & + CPUID_STEPPING) <= 0xb) || + (CPUID_TO_MODEL(cpu_id) == 0x9e && (cpu_id & + CPUID_STEPPING) <= 0xc)) && + (hw_mds_disable == 2 || hw_mds_disable == 3)) { + /* + * Skylake, KabyLake, CoffeeLake, WhiskeyLake, + * CascadeLake + */ + CPU_FOREACH(i) { + pc = pcpu_find(i); + if (pc->pc_mds_buf == NULL) { + pc->pc_mds_buf = malloc(6 * 1024, + M_TEMP, M_WAITOK); + b64 = (vm_offset_t)malloc(64 + 63, + M_TEMP, M_WAITOK); + pc->pc_mds_buf64 = (void *)roundup2(b64, 64); + bzero(pc->pc_mds_buf64, 64); + } + } + xcr0 = rxcr(0); + if ((xcr0 & XFEATURE_ENABLED_ZMM_HI256) != 0 && + (cpu_stdext_feature2 & CPUID_STDEXT_AVX512DQ) != 0) + mds_handler = mds_handler_skl_avx512; + else if ((xcr0 & XFEATURE_ENABLED_AVX) != 0 && + (cpu_feature2 & CPUID2_AVX) != 0) + mds_handler = mds_handler_skl_avx; + else + mds_handler = mds_handler_skl_sse; + } else if (CPUID_TO_FAMILY(cpu_id) == 0x6 && + ((CPUID_TO_MODEL(cpu_id) == 0x37 || + CPUID_TO_MODEL(cpu_id) == 0x4a || + CPUID_TO_MODEL(cpu_id) == 0x4c || + CPUID_TO_MODEL(cpu_id) == 0x4d || + CPUID_TO_MODEL(cpu_id) == 0x5a || + CPUID_TO_MODEL(cpu_id) == 0x5d || + CPUID_TO_MODEL(cpu_id) == 0x6e || + CPUID_TO_MODEL(cpu_id) == 0x65 || + CPUID_TO_MODEL(cpu_id) == 0x75 || + CPUID_TO_MODEL(cpu_id) == 0x1c || + CPUID_TO_MODEL(cpu_id) == 0x26 || + CPUID_TO_MODEL(cpu_id) == 0x27 || + CPUID_TO_MODEL(cpu_id) == 0x35 || + CPUID_TO_MODEL(cpu_id) == 0x36 || + CPUID_TO_MODEL(cpu_id) == 0x7a))) { + /* Silvermont, Airmont */ + CPU_FOREACH(i) { + pc = pcpu_find(i); + if (pc->pc_mds_buf == NULL) + pc->pc_mds_buf = malloc(256, M_TEMP, M_WAITOK); + } + mds_handler = mds_handler_silvermont; + } else { + hw_mds_disable = 0; + mds_handler = mds_handler_void; + } +} + +static int +sysctl_mds_disable_handler(SYSCTL_HANDLER_ARGS) +{ + int error, val; + + val = hw_mds_disable; + error = sysctl_handle_int(oidp, &val, 0, req); + if (error != 0 || req->newptr == NULL) + return (error); + if (val < 0 || val > 3) + return (EINVAL); + hw_mds_disable = val; + hw_mds_recalculate(); + return (0); +} + +SYSCTL_PROC(_hw, OID_AUTO, mds_disable, CTLTYPE_INT | + CTLFLAG_RWTUN | CTLFLAG_NOFETCH | CTLFLAG_MPSAFE, NULL, 0, + sysctl_mds_disable_handler, "I", + "Microarchitectural Data Sampling Mitigation " + "(0 - off, 1 - on VERW, 2 - on SW, 3 - on AUTO"); + From owner-svn-src-stable@freebsd.org Tue May 14 19:52:24 2019 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 4EB6C1596E3E; Tue, 14 May 2019 19:52:24 +0000 (UTC) (envelope-from trasz@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 0083B81E03; Tue, 14 May 2019 19:52:24 +0000 (UTC) (envelope-from trasz@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 D618625AA7; Tue, 14 May 2019 19:52:23 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x4EJqNib053261; Tue, 14 May 2019 19:52:23 GMT (envelope-from trasz@FreeBSD.org) Received: (from trasz@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x4EJqIYE053236; Tue, 14 May 2019 19:52:18 GMT (envelope-from trasz@FreeBSD.org) Message-Id: <201905141952.x4EJqIYE053236@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: trasz set sender to trasz@FreeBSD.org using -f From: Edward Tomasz Napierala Date: Tue, 14 May 2019 19:52:18 +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: r347571 - in stable/12/sys: amd64/amd64 amd64/cloudabi32 amd64/cloudabi64 amd64/linux amd64/linux32 arm/arm arm/cloudabi32 arm64/arm64 arm64/cloudabi32 arm64/cloudabi64 arm64/linux comp... X-SVN-Group: stable-12 X-SVN-Commit-Author: trasz X-SVN-Commit-Paths: in stable/12/sys: amd64/amd64 amd64/cloudabi32 amd64/cloudabi64 amd64/linux amd64/linux32 arm/arm arm/cloudabi32 arm64/arm64 arm64/cloudabi32 arm64/cloudabi64 arm64/linux compat/ia32 i386/cloudabi32 i... X-SVN-Commit-Revision: 347571 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 0083B81E03 X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.98 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.998,0]; NEURAL_HAM_SHORT(-0.98)[-0.982,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US]; NEURAL_HAM_LONG(-1.00)[-1.000,0] X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 14 May 2019 19:52:24 -0000 Author: trasz Date: Tue May 14 19:52:18 2019 New Revision: 347571 URL: https://svnweb.freebsd.org/changeset/base/347571 Log: MFC r344705: Remove sv_pagesize, originally introduced with r100384. In all of the architectures we have today, we always use PAGE_SIZE. While in theory one could define different things, none of the current architectures do, even the ones that have transitioned from 32-bit to 64-bit like i386 and arm. Some ancient mips binaries on other systems used 8k instead of 4k, but we don't support running those and likely never will due to their age and obscurity. Differently from the original commit, the merge leaves the struct member in place to preserve the ABI. Sponsored by: DARPA, AFRL Modified: stable/12/sys/amd64/amd64/elf_machdep.c stable/12/sys/amd64/cloudabi32/cloudabi32_sysvec.c stable/12/sys/amd64/cloudabi64/cloudabi64_sysvec.c stable/12/sys/amd64/linux/linux_sysvec.c stable/12/sys/amd64/linux32/linux32_sysvec.c stable/12/sys/arm/arm/elf_machdep.c stable/12/sys/arm/cloudabi32/cloudabi32_sysvec.c stable/12/sys/arm64/arm64/elf_machdep.c stable/12/sys/arm64/cloudabi32/cloudabi32_sysvec.c stable/12/sys/arm64/cloudabi64/cloudabi64_sysvec.c stable/12/sys/arm64/linux/linux_sysvec.c stable/12/sys/compat/ia32/ia32_sysvec.c stable/12/sys/i386/cloudabi32/cloudabi32_sysvec.c stable/12/sys/i386/i386/elf_machdep.c stable/12/sys/i386/linux/linux_sysvec.c stable/12/sys/kern/imgact_aout.c stable/12/sys/kern/imgact_elf.c stable/12/sys/kern/init_main.c stable/12/sys/mips/mips/elf_machdep.c stable/12/sys/mips/mips/freebsd32_machdep.c stable/12/sys/powerpc/powerpc/elf32_machdep.c stable/12/sys/powerpc/powerpc/elf64_machdep.c stable/12/sys/riscv/riscv/elf_machdep.c stable/12/sys/sparc64/sparc64/elf_machdep.c stable/12/sys/sys/sysent.h Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/amd64/amd64/elf_machdep.c ============================================================================== --- stable/12/sys/amd64/amd64/elf_machdep.c Tue May 14 18:26:39 2019 (r347570) +++ stable/12/sys/amd64/amd64/elf_machdep.c Tue May 14 19:52:18 2019 (r347571) @@ -64,7 +64,6 @@ struct sysentvec elf64_freebsd_sysvec = { .sv_coredump = __elfN(coredump), .sv_imgact_try = NULL, .sv_minsigstksz = MINSIGSTKSZ, - .sv_pagesize = PAGE_SIZE, .sv_minuser = VM_MIN_ADDRESS, .sv_maxuser = VM_MAXUSER_ADDRESS, .sv_usrstack = USRSTACK, Modified: stable/12/sys/amd64/cloudabi32/cloudabi32_sysvec.c ============================================================================== --- stable/12/sys/amd64/cloudabi32/cloudabi32_sysvec.c Tue May 14 18:26:39 2019 (r347570) +++ stable/12/sys/amd64/cloudabi32/cloudabi32_sysvec.c Tue May 14 19:52:18 2019 (r347571) @@ -210,7 +210,6 @@ static struct sysentvec cloudabi32_elf_sysvec = { .sv_fixup = cloudabi32_fixup_tcb, .sv_name = "CloudABI ELF32", .sv_coredump = elf32_coredump, - .sv_pagesize = IA32_PAGE_SIZE, .sv_minuser = FREEBSD32_MINUSER, .sv_maxuser = FREEBSD32_MAXUSER, .sv_stackprot = VM_PROT_READ | VM_PROT_WRITE, Modified: stable/12/sys/amd64/cloudabi64/cloudabi64_sysvec.c ============================================================================== --- stable/12/sys/amd64/cloudabi64/cloudabi64_sysvec.c Tue May 14 18:26:39 2019 (r347570) +++ stable/12/sys/amd64/cloudabi64/cloudabi64_sysvec.c Tue May 14 19:52:18 2019 (r347571) @@ -197,7 +197,6 @@ static struct sysentvec cloudabi64_elf_sysvec = { .sv_fixup = cloudabi64_fixup_tcb, .sv_name = "CloudABI ELF64", .sv_coredump = elf64_coredump, - .sv_pagesize = PAGE_SIZE, .sv_minuser = VM_MIN_ADDRESS, /* Keep top page reserved to work around AMD Ryzen stability issues. */ .sv_maxuser = VM_MAXUSER_ADDRESS - PAGE_SIZE, Modified: stable/12/sys/amd64/linux/linux_sysvec.c ============================================================================== --- stable/12/sys/amd64/linux/linux_sysvec.c Tue May 14 18:26:39 2019 (r347570) +++ stable/12/sys/amd64/linux/linux_sysvec.c Tue May 14 19:52:18 2019 (r347571) @@ -723,7 +723,6 @@ struct sysentvec elf_linux_sysvec = { .sv_coredump = elf64_coredump, .sv_imgact_try = linux_exec_imgact_try, .sv_minsigstksz = LINUX_MINSIGSTKSZ, - .sv_pagesize = PAGE_SIZE, .sv_minuser = VM_MIN_ADDRESS, .sv_maxuser = VM_MAXUSER_ADDRESS, .sv_usrstack = USRSTACK, Modified: stable/12/sys/amd64/linux32/linux32_sysvec.c ============================================================================== --- stable/12/sys/amd64/linux32/linux32_sysvec.c Tue May 14 18:26:39 2019 (r347570) +++ stable/12/sys/amd64/linux32/linux32_sysvec.c Tue May 14 19:52:18 2019 (r347571) @@ -921,7 +921,6 @@ struct sysentvec elf_linux_sysvec = { .sv_coredump = elf32_coredump, .sv_imgact_try = linux_exec_imgact_try, .sv_minsigstksz = LINUX_MINSIGSTKSZ, - .sv_pagesize = PAGE_SIZE, .sv_minuser = VM_MIN_ADDRESS, .sv_maxuser = LINUX32_MAXUSER, .sv_usrstack = LINUX32_USRSTACK, Modified: stable/12/sys/arm/arm/elf_machdep.c ============================================================================== --- stable/12/sys/arm/arm/elf_machdep.c Tue May 14 18:26:39 2019 (r347570) +++ stable/12/sys/arm/arm/elf_machdep.c Tue May 14 19:52:18 2019 (r347571) @@ -71,7 +71,6 @@ struct sysentvec elf32_freebsd_sysvec = { .sv_coredump = __elfN(coredump), .sv_imgact_try = NULL, .sv_minsigstksz = MINSIGSTKSZ, - .sv_pagesize = PAGE_SIZE, .sv_minuser = VM_MIN_ADDRESS, .sv_maxuser = VM_MAXUSER_ADDRESS, .sv_usrstack = USRSTACK, Modified: stable/12/sys/arm/cloudabi32/cloudabi32_sysvec.c ============================================================================== --- stable/12/sys/arm/cloudabi32/cloudabi32_sysvec.c Tue May 14 18:26:39 2019 (r347570) +++ stable/12/sys/arm/cloudabi32/cloudabi32_sysvec.c Tue May 14 19:52:18 2019 (r347571) @@ -174,7 +174,6 @@ static struct sysentvec cloudabi32_elf_sysvec = { .sv_fixup = cloudabi32_fixup, .sv_name = "CloudABI ELF32", .sv_coredump = elf32_coredump, - .sv_pagesize = PAGE_SIZE, .sv_minuser = VM_MIN_ADDRESS, .sv_maxuser = VM_MAXUSER_ADDRESS, .sv_stackprot = VM_PROT_READ | VM_PROT_WRITE, Modified: stable/12/sys/arm64/arm64/elf_machdep.c ============================================================================== --- stable/12/sys/arm64/arm64/elf_machdep.c Tue May 14 18:26:39 2019 (r347570) +++ stable/12/sys/arm64/arm64/elf_machdep.c Tue May 14 19:52:18 2019 (r347571) @@ -70,7 +70,6 @@ static struct sysentvec elf64_freebsd_sysvec = { .sv_coredump = __elfN(coredump), .sv_imgact_try = NULL, .sv_minsigstksz = MINSIGSTKSZ, - .sv_pagesize = PAGE_SIZE, .sv_minuser = VM_MIN_ADDRESS, .sv_maxuser = VM_MAXUSER_ADDRESS, .sv_usrstack = USRSTACK, Modified: stable/12/sys/arm64/cloudabi32/cloudabi32_sysvec.c ============================================================================== --- stable/12/sys/arm64/cloudabi32/cloudabi32_sysvec.c Tue May 14 18:26:39 2019 (r347570) +++ stable/12/sys/arm64/cloudabi32/cloudabi32_sysvec.c Tue May 14 19:52:18 2019 (r347571) @@ -182,7 +182,6 @@ static struct sysentvec cloudabi32_elf_sysvec = { .sv_fixup = cloudabi32_fixup, .sv_name = "CloudABI ELF32", .sv_coredump = elf32_coredump, - .sv_pagesize = PAGE_SIZE, .sv_minuser = VM_MIN_ADDRESS, .sv_maxuser = (uintmax_t)1 << 32, .sv_stackprot = VM_PROT_READ | VM_PROT_WRITE, Modified: stable/12/sys/arm64/cloudabi64/cloudabi64_sysvec.c ============================================================================== --- stable/12/sys/arm64/cloudabi64/cloudabi64_sysvec.c Tue May 14 18:26:39 2019 (r347570) +++ stable/12/sys/arm64/cloudabi64/cloudabi64_sysvec.c Tue May 14 19:52:18 2019 (r347571) @@ -166,7 +166,6 @@ static struct sysentvec cloudabi64_elf_sysvec = { .sv_fixup = cloudabi64_fixup, .sv_name = "CloudABI ELF64", .sv_coredump = elf64_coredump, - .sv_pagesize = PAGE_SIZE, .sv_minuser = VM_MIN_ADDRESS, .sv_maxuser = VM_MAXUSER_ADDRESS, .sv_stackprot = VM_PROT_READ | VM_PROT_WRITE, Modified: stable/12/sys/arm64/linux/linux_sysvec.c ============================================================================== --- stable/12/sys/arm64/linux/linux_sysvec.c Tue May 14 18:26:39 2019 (r347570) +++ stable/12/sys/arm64/linux/linux_sysvec.c Tue May 14 19:52:18 2019 (r347571) @@ -376,7 +376,6 @@ struct sysentvec elf_linux_sysvec = { .sv_coredump = elf64_coredump, .sv_imgact_try = linux_exec_imgact_try, .sv_minsigstksz = LINUX_MINSIGSTKSZ, - .sv_pagesize = PAGE_SIZE, .sv_minuser = VM_MIN_ADDRESS, .sv_maxuser = VM_MAXUSER_ADDRESS, .sv_usrstack = USRSTACK, Modified: stable/12/sys/compat/ia32/ia32_sysvec.c ============================================================================== --- stable/12/sys/compat/ia32/ia32_sysvec.c Tue May 14 18:26:39 2019 (r347570) +++ stable/12/sys/compat/ia32/ia32_sysvec.c Tue May 14 19:52:18 2019 (r347571) @@ -110,7 +110,6 @@ struct sysentvec ia32_freebsd_sysvec = { .sv_coredump = elf32_coredump, .sv_imgact_try = NULL, .sv_minsigstksz = MINSIGSTKSZ, - .sv_pagesize = IA32_PAGE_SIZE, .sv_minuser = FREEBSD32_MINUSER, .sv_maxuser = FREEBSD32_MAXUSER, .sv_usrstack = FREEBSD32_USRSTACK, Modified: stable/12/sys/i386/cloudabi32/cloudabi32_sysvec.c ============================================================================== --- stable/12/sys/i386/cloudabi32/cloudabi32_sysvec.c Tue May 14 18:26:39 2019 (r347570) +++ stable/12/sys/i386/cloudabi32/cloudabi32_sysvec.c Tue May 14 19:52:18 2019 (r347571) @@ -185,7 +185,6 @@ static struct sysentvec cloudabi32_elf_sysvec = { .sv_fixup = cloudabi32_fixup_tcb, .sv_name = "CloudABI ELF32", .sv_coredump = elf32_coredump, - .sv_pagesize = PAGE_SIZE, .sv_minuser = VM_MIN_ADDRESS, .sv_maxuser = VM_MAXUSER_ADDRESS, .sv_stackprot = VM_PROT_READ | VM_PROT_WRITE, Modified: stable/12/sys/i386/i386/elf_machdep.c ============================================================================== --- stable/12/sys/i386/i386/elf_machdep.c Tue May 14 18:26:39 2019 (r347570) +++ stable/12/sys/i386/i386/elf_machdep.c Tue May 14 19:52:18 2019 (r347571) @@ -66,7 +66,6 @@ struct sysentvec elf32_freebsd_sysvec = { .sv_coredump = __elfN(coredump), .sv_imgact_try = NULL, .sv_minsigstksz = MINSIGSTKSZ, - .sv_pagesize = PAGE_SIZE, .sv_minuser = VM_MIN_ADDRESS, .sv_maxuser = VM_MAXUSER_ADDRESS, .sv_usrstack = USRSTACK, Modified: stable/12/sys/i386/linux/linux_sysvec.c ============================================================================== --- stable/12/sys/i386/linux/linux_sysvec.c Tue May 14 18:26:39 2019 (r347570) +++ stable/12/sys/i386/linux/linux_sysvec.c Tue May 14 19:52:18 2019 (r347571) @@ -862,7 +862,6 @@ struct sysentvec linux_sysvec = { .sv_coredump = NULL, .sv_imgact_try = linux_exec_imgact_try, .sv_minsigstksz = LINUX_MINSIGSTKSZ, - .sv_pagesize = PAGE_SIZE, .sv_minuser = VM_MIN_ADDRESS, .sv_maxuser = VM_MAXUSER_ADDRESS, .sv_usrstack = LINUX_USRSTACK, @@ -899,7 +898,6 @@ struct sysentvec elf_linux_sysvec = { .sv_coredump = elf32_coredump, .sv_imgact_try = linux_exec_imgact_try, .sv_minsigstksz = LINUX_MINSIGSTKSZ, - .sv_pagesize = PAGE_SIZE, .sv_minuser = VM_MIN_ADDRESS, .sv_maxuser = VM_MAXUSER_ADDRESS, .sv_usrstack = LINUX_USRSTACK, Modified: stable/12/sys/kern/imgact_aout.c ============================================================================== --- stable/12/sys/kern/imgact_aout.c Tue May 14 18:26:39 2019 (r347570) +++ stable/12/sys/kern/imgact_aout.c Tue May 14 19:52:18 2019 (r347571) @@ -88,7 +88,6 @@ struct sysentvec aout_sysvec = { .sv_coredump = NULL, .sv_imgact_try = NULL, .sv_minsigstksz = MINSIGSTKSZ, - .sv_pagesize = PAGE_SIZE, .sv_minuser = VM_MIN_ADDRESS, .sv_maxuser = AOUT32_USRSTACK, .sv_usrstack = AOUT32_USRSTACK, @@ -131,7 +130,6 @@ struct sysentvec aout_sysvec = { .sv_coredump = NULL, .sv_imgact_try = NULL, .sv_minsigstksz = MINSIGSTKSZ, - .sv_pagesize = IA32_PAGE_SIZE, .sv_minuser = AOUT32_MINUSER, .sv_maxuser = AOUT32_USRSTACK, .sv_usrstack = AOUT32_USRSTACK, Modified: stable/12/sys/kern/imgact_elf.c ============================================================================== --- stable/12/sys/kern/imgact_elf.c Tue May 14 18:26:39 2019 (r347570) +++ stable/12/sys/kern/imgact_elf.c Tue May 14 19:52:18 2019 (r347571) @@ -90,10 +90,9 @@ static int __elfN(check_header)(const Elf_Ehdr *hdr); static Elf_Brandinfo *__elfN(get_brandinfo)(struct image_params *imgp, const char *interp, int interp_name_len, int32_t *osrel, uint32_t *fctl0); static int __elfN(load_file)(struct proc *p, const char *file, u_long *addr, - u_long *entry, size_t pagesize); + u_long *entry); static int __elfN(load_section)(struct image_params *imgp, vm_ooffset_t offset, - caddr_t vmaddr, size_t memsz, size_t filsz, vm_prot_t prot, - size_t pagesize); + caddr_t vmaddr, size_t memsz, size_t filsz, vm_prot_t prot); static int __CONCAT(exec_, __elfN(imgact))(struct image_params *imgp); static bool __elfN(freebsd_trans_osrel)(const Elf_Note *note, int32_t *osrel); @@ -542,8 +541,7 @@ __elfN(map_insert)(struct image_params *imgp, vm_map_t static int __elfN(load_section)(struct image_params *imgp, vm_ooffset_t offset, - caddr_t vmaddr, size_t memsz, size_t filsz, vm_prot_t prot, - size_t pagesize) + caddr_t vmaddr, size_t memsz, size_t filsz, vm_prot_t prot) { struct sf_buf *sf; size_t map_len; @@ -571,8 +569,8 @@ __elfN(load_section)(struct image_params *imgp, vm_oof object = imgp->object; map = &imgp->proc->p_vmspace->vm_map; - map_addr = trunc_page_ps((vm_offset_t)vmaddr, pagesize); - file_addr = trunc_page_ps(offset, pagesize); + map_addr = trunc_page_ps((vm_offset_t)vmaddr, PAGE_SIZE); + file_addr = trunc_page_ps(offset, PAGE_SIZE); /* * We have two choices. We can either clear the data in the last page @@ -583,9 +581,9 @@ __elfN(load_section)(struct image_params *imgp, vm_oof if (filsz == 0) map_len = 0; else if (memsz > filsz) - map_len = trunc_page_ps(offset + filsz, pagesize) - file_addr; + map_len = trunc_page_ps(offset + filsz, PAGE_SIZE) - file_addr; else - map_len = round_page_ps(offset + filsz, pagesize) - file_addr; + map_len = round_page_ps(offset + filsz, PAGE_SIZE) - file_addr; if (map_len != 0) { /* cow flags: don't dump readonly sections in core */ @@ -615,9 +613,9 @@ __elfN(load_section)(struct image_params *imgp, vm_oof * to try and save a page, but it's a pain in the behind to implement. */ copy_len = filsz == 0 ? 0 : (offset + filsz) - trunc_page_ps(offset + - filsz, pagesize); - map_addr = trunc_page_ps((vm_offset_t)vmaddr + filsz, pagesize); - map_len = round_page_ps((vm_offset_t)vmaddr + memsz, pagesize) - + filsz, PAGE_SIZE); + map_addr = trunc_page_ps((vm_offset_t)vmaddr + filsz, PAGE_SIZE); + map_len = round_page_ps((vm_offset_t)vmaddr + memsz, PAGE_SIZE) - map_addr; /* This had damn well better be true! */ @@ -634,7 +632,7 @@ __elfN(load_section)(struct image_params *imgp, vm_oof return (EIO); /* send the page fragment to user space */ - off = trunc_page_ps(offset + filsz, pagesize) - + off = trunc_page_ps(offset + filsz, PAGE_SIZE) - trunc_page(offset + filsz); error = copyout((caddr_t)sf_buf_kva(sf) + off, (caddr_t)map_addr, copy_len); @@ -668,7 +666,7 @@ __elfN(load_section)(struct image_params *imgp, vm_oof */ static int __elfN(load_file)(struct proc *p, const char *file, u_long *addr, - u_long *entry, size_t pagesize) + u_long *entry) { struct { struct nameidata nd; @@ -767,7 +765,7 @@ __elfN(load_file)(struct proc *p, const char *file, u_ prot = __elfN(trans_prot)(phdr[i].p_flags); error = __elfN(load_section)(imgp, phdr[i].p_offset, (caddr_t)(uintptr_t)phdr[i].p_vaddr + rbase, - phdr[i].p_memsz, phdr[i].p_filesz, prot, pagesize); + phdr[i].p_memsz, phdr[i].p_filesz, prot); if (error != 0) goto fail; /* @@ -1056,8 +1054,7 @@ __CONCAT(exec_, __elfN(imgact))(struct image_params *i prot = __elfN(trans_prot)(phdr[i].p_flags); error = __elfN(load_section)(imgp, phdr[i].p_offset, (caddr_t)(uintptr_t)phdr[i].p_vaddr + et_dyn_addr, - phdr[i].p_memsz, phdr[i].p_filesz, prot, - sv->sv_pagesize); + phdr[i].p_memsz, phdr[i].p_filesz, prot); if (error != 0) goto ret; @@ -1176,7 +1173,7 @@ __CONCAT(exec_, __elfN(imgact))(struct image_params *i snprintf(path, MAXPATHLEN, "%s%s", brand_info->emul_path, interp); error = __elfN(load_file)(imgp->proc, path, &addr, - &imgp->entry_addr, sv->sv_pagesize); + &imgp->entry_addr); free(path, M_TEMP); if (error == 0) have_interp = TRUE; @@ -1185,13 +1182,13 @@ __CONCAT(exec_, __elfN(imgact))(struct image_params *i (brand_info->interp_path == NULL || strcmp(interp, brand_info->interp_path) == 0)) { error = __elfN(load_file)(imgp->proc, newinterp, &addr, - &imgp->entry_addr, sv->sv_pagesize); + &imgp->entry_addr); if (error == 0) have_interp = TRUE; } if (!have_interp) { error = __elfN(load_file)(imgp->proc, interp, &addr, - &imgp->entry_addr, sv->sv_pagesize); + &imgp->entry_addr); } vn_lock(imgp->vp, LK_EXCLUSIVE | LK_RETRY); if (error != 0) { Modified: stable/12/sys/kern/init_main.c ============================================================================== --- stable/12/sys/kern/init_main.c Tue May 14 18:26:39 2019 (r347570) +++ stable/12/sys/kern/init_main.c Tue May 14 19:52:18 2019 (r347571) @@ -411,7 +411,6 @@ struct sysentvec null_sysvec = { .sv_coredump = NULL, .sv_imgact_try = NULL, .sv_minsigstksz = 0, - .sv_pagesize = PAGE_SIZE, .sv_minuser = VM_MIN_ADDRESS, .sv_maxuser = VM_MAXUSER_ADDRESS, .sv_usrstack = USRSTACK, Modified: stable/12/sys/mips/mips/elf_machdep.c ============================================================================== --- stable/12/sys/mips/mips/elf_machdep.c Tue May 14 18:26:39 2019 (r347570) +++ stable/12/sys/mips/mips/elf_machdep.c Tue May 14 19:52:18 2019 (r347571) @@ -67,7 +67,6 @@ struct sysentvec elf64_freebsd_sysvec = { .sv_coredump = __elfN(coredump), .sv_imgact_try = NULL, .sv_minsigstksz = MINSIGSTKSZ, - .sv_pagesize = PAGE_SIZE, .sv_minuser = VM_MIN_ADDRESS, .sv_maxuser = VM_MAXUSER_ADDRESS, .sv_usrstack = USRSTACK, @@ -123,7 +122,6 @@ struct sysentvec elf32_freebsd_sysvec = { .sv_coredump = __elfN(coredump), .sv_imgact_try = NULL, .sv_minsigstksz = MINSIGSTKSZ, - .sv_pagesize = PAGE_SIZE, .sv_minuser = VM_MIN_ADDRESS, .sv_maxuser = VM_MAXUSER_ADDRESS, .sv_usrstack = USRSTACK, Modified: stable/12/sys/mips/mips/freebsd32_machdep.c ============================================================================== --- stable/12/sys/mips/mips/freebsd32_machdep.c Tue May 14 18:26:39 2019 (r347570) +++ stable/12/sys/mips/mips/freebsd32_machdep.c Tue May 14 19:52:18 2019 (r347571) @@ -89,7 +89,6 @@ struct sysentvec elf32_freebsd_sysvec = { .sv_coredump = __elfN(coredump), .sv_imgact_try = NULL, .sv_minsigstksz = MINSIGSTKSZ, - .sv_pagesize = PAGE_SIZE, .sv_minuser = VM_MIN_ADDRESS, .sv_maxuser = ((vm_offset_t)0x80000000), .sv_usrstack = FREEBSD32_USRSTACK, Modified: stable/12/sys/powerpc/powerpc/elf32_machdep.c ============================================================================== --- stable/12/sys/powerpc/powerpc/elf32_machdep.c Tue May 14 18:26:39 2019 (r347570) +++ stable/12/sys/powerpc/powerpc/elf32_machdep.c Tue May 14 19:52:18 2019 (r347571) @@ -95,7 +95,6 @@ struct sysentvec elf32_freebsd_sysvec = { .sv_coredump = __elfN(coredump), .sv_imgact_try = NULL, .sv_minsigstksz = MINSIGSTKSZ, - .sv_pagesize = PAGE_SIZE, .sv_minuser = VM_MIN_ADDRESS, .sv_stackprot = VM_PROT_ALL, #ifdef __powerpc64__ Modified: stable/12/sys/powerpc/powerpc/elf64_machdep.c ============================================================================== --- stable/12/sys/powerpc/powerpc/elf64_machdep.c Tue May 14 18:26:39 2019 (r347570) +++ stable/12/sys/powerpc/powerpc/elf64_machdep.c Tue May 14 19:52:18 2019 (r347571) @@ -70,7 +70,6 @@ struct sysentvec elf64_freebsd_sysvec_v1 = { .sv_coredump = __elfN(coredump), .sv_imgact_try = NULL, .sv_minsigstksz = MINSIGSTKSZ, - .sv_pagesize = PAGE_SIZE, .sv_minuser = VM_MIN_ADDRESS, .sv_maxuser = VM_MAXUSER_ADDRESS, .sv_usrstack = USRSTACK, @@ -109,7 +108,6 @@ struct sysentvec elf64_freebsd_sysvec_v2 = { .sv_coredump = __elfN(coredump), .sv_imgact_try = NULL, .sv_minsigstksz = MINSIGSTKSZ, - .sv_pagesize = PAGE_SIZE, .sv_minuser = VM_MIN_ADDRESS, .sv_maxuser = VM_MAXUSER_ADDRESS, .sv_usrstack = USRSTACK, Modified: stable/12/sys/riscv/riscv/elf_machdep.c ============================================================================== --- stable/12/sys/riscv/riscv/elf_machdep.c Tue May 14 18:26:39 2019 (r347570) +++ stable/12/sys/riscv/riscv/elf_machdep.c Tue May 14 19:52:18 2019 (r347571) @@ -73,7 +73,6 @@ struct sysentvec elf64_freebsd_sysvec = { .sv_coredump = __elfN(coredump), .sv_imgact_try = NULL, .sv_minsigstksz = MINSIGSTKSZ, - .sv_pagesize = PAGE_SIZE, .sv_minuser = VM_MIN_ADDRESS, .sv_maxuser = VM_MAXUSER_ADDRESS, .sv_usrstack = USRSTACK, Modified: stable/12/sys/sparc64/sparc64/elf_machdep.c ============================================================================== --- stable/12/sys/sparc64/sparc64/elf_machdep.c Tue May 14 18:26:39 2019 (r347570) +++ stable/12/sys/sparc64/sparc64/elf_machdep.c Tue May 14 19:52:18 2019 (r347571) @@ -71,7 +71,6 @@ static struct sysentvec elf64_freebsd_sysvec = { .sv_coredump = __elfN(coredump), .sv_imgact_try = NULL, .sv_minsigstksz = MINSIGSTKSZ, - .sv_pagesize = PAGE_SIZE, .sv_minuser = VM_MIN_ADDRESS, .sv_maxuser = VM_MAXUSER_ADDRESS, .sv_usrstack = USRSTACK, Modified: stable/12/sys/sys/sysent.h ============================================================================== --- stable/12/sys/sys/sysent.h Tue May 14 18:26:39 2019 (r347570) +++ stable/12/sys/sys/sysent.h Tue May 14 19:52:18 2019 (r347571) @@ -111,7 +111,7 @@ struct sysentvec { /* function to dump core, or NULL */ int (*sv_imgact_try)(struct image_params *); int sv_minsigstksz; /* minimum signal stack size */ - int sv_pagesize; /* pagesize */ + int sv_pagesize; /* spare / no longer used */ vm_offset_t sv_minuser; /* VM_MIN_ADDRESS */ vm_offset_t sv_maxuser; /* VM_MAXUSER_ADDRESS */ vm_offset_t sv_usrstack; /* USRSTACK */ From owner-svn-src-stable@freebsd.org Tue May 14 20:03:21 2019 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 06DA115971D4; Tue, 14 May 2019 20:03:21 +0000 (UTC) (envelope-from trasz@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 A2878823B4; Tue, 14 May 2019 20:03:20 +0000 (UTC) (envelope-from trasz@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 6367C25C6B; Tue, 14 May 2019 20:03:20 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x4EK3Kbb058562; Tue, 14 May 2019 20:03:20 GMT (envelope-from trasz@FreeBSD.org) Received: (from trasz@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x4EK3KiL058561; Tue, 14 May 2019 20:03:20 GMT (envelope-from trasz@FreeBSD.org) Message-Id: <201905142003.x4EK3KiL058561@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: trasz set sender to trasz@FreeBSD.org using -f From: Edward Tomasz Napierala Date: Tue, 14 May 2019 20:03:20 +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: r347572 - stable/12/sys/kern X-SVN-Group: stable-12 X-SVN-Commit-Author: trasz X-SVN-Commit-Paths: stable/12/sys/kern X-SVN-Commit-Revision: 347572 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: A2878823B4 X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.98 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.998,0]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; NEURAL_HAM_SHORT(-0.98)[-0.979,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US] X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 14 May 2019 20:03:21 -0000 Author: trasz Date: Tue May 14 20:03:19 2019 New Revision: 347572 URL: https://svnweb.freebsd.org/changeset/base/347572 Log: MFC r345448: Remove trunc_page_ps() and round_page_ps() macros. This completes the undoing of r100384. Sponsored by: DARPA, AFRL Modified: stable/12/sys/kern/imgact_elf.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/kern/imgact_elf.c ============================================================================== --- stable/12/sys/kern/imgact_elf.c Tue May 14 19:52:18 2019 (r347571) +++ stable/12/sys/kern/imgact_elf.c Tue May 14 20:03:19 2019 (r347572) @@ -159,9 +159,7 @@ SYSCTL_INT(ASLR_NODE_OID, OID_AUTO, honor_sbrk, CTLFLA static Elf_Brandinfo *elf_brand_list[MAX_BRANDS]; -#define trunc_page_ps(va, ps) rounddown2(va, ps) -#define round_page_ps(va, ps) roundup2(va, ps) -#define aligned(a, t) (trunc_page_ps((u_long)(a), sizeof(t)) == (u_long)(a)) +#define aligned(a, t) (rounddown2((u_long)(a), sizeof(t)) == (u_long)(a)) static const char FREEBSD_ABI_VENDOR[] = "FreeBSD"; @@ -569,8 +567,8 @@ __elfN(load_section)(struct image_params *imgp, vm_oof object = imgp->object; map = &imgp->proc->p_vmspace->vm_map; - map_addr = trunc_page_ps((vm_offset_t)vmaddr, PAGE_SIZE); - file_addr = trunc_page_ps(offset, PAGE_SIZE); + map_addr = trunc_page((vm_offset_t)vmaddr); + file_addr = trunc_page(offset); /* * We have two choices. We can either clear the data in the last page @@ -581,9 +579,9 @@ __elfN(load_section)(struct image_params *imgp, vm_oof if (filsz == 0) map_len = 0; else if (memsz > filsz) - map_len = trunc_page_ps(offset + filsz, PAGE_SIZE) - file_addr; + map_len = trunc_page(offset + filsz) - file_addr; else - map_len = round_page_ps(offset + filsz, PAGE_SIZE) - file_addr; + map_len = round_page(offset + filsz) - file_addr; if (map_len != 0) { /* cow flags: don't dump readonly sections in core */ @@ -612,11 +610,10 @@ __elfN(load_section)(struct image_params *imgp, vm_oof * segment in the file is extended to provide bss. It's a neat idea * to try and save a page, but it's a pain in the behind to implement. */ - copy_len = filsz == 0 ? 0 : (offset + filsz) - trunc_page_ps(offset + - filsz, PAGE_SIZE); - map_addr = trunc_page_ps((vm_offset_t)vmaddr + filsz, PAGE_SIZE); - map_len = round_page_ps((vm_offset_t)vmaddr + memsz, PAGE_SIZE) - - map_addr; + copy_len = filsz == 0 ? 0 : (offset + filsz) - trunc_page(offset + + filsz); + map_addr = trunc_page((vm_offset_t)vmaddr + filsz); + map_len = round_page((vm_offset_t)vmaddr + memsz) - map_addr; /* This had damn well better be true! */ if (map_len != 0) { @@ -632,8 +629,7 @@ __elfN(load_section)(struct image_params *imgp, vm_oof return (EIO); /* send the page fragment to user space */ - off = trunc_page_ps(offset + filsz, PAGE_SIZE) - - trunc_page(offset + filsz); + off = trunc_page(offset + filsz) - trunc_page(offset + filsz); error = copyout((caddr_t)sf_buf_kva(sf) + off, (caddr_t)map_addr, copy_len); vm_imgact_unmap_page(sf); From owner-svn-src-stable@freebsd.org Tue May 14 20:19:30 2019 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 162C6159771C; Tue, 14 May 2019 20:19:30 +0000 (UTC) (envelope-from trasz@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 B046D82A4E; Tue, 14 May 2019 20:19:29 +0000 (UTC) (envelope-from trasz@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 86D6B25E16; Tue, 14 May 2019 20:19:29 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x4EKJT2r063792; Tue, 14 May 2019 20:19:29 GMT (envelope-from trasz@FreeBSD.org) Received: (from trasz@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x4EKJTlV063791; Tue, 14 May 2019 20:19:29 GMT (envelope-from trasz@FreeBSD.org) Message-Id: <201905142019.x4EKJTlV063791@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: trasz set sender to trasz@FreeBSD.org using -f From: Edward Tomasz Napierala Date: Tue, 14 May 2019 20:19:29 +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: r347573 - stable/12/sys/kern X-SVN-Group: stable-12 X-SVN-Commit-Author: trasz X-SVN-Commit-Paths: stable/12/sys/kern X-SVN-Commit-Revision: 347573 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: B046D82A4E X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.98 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.998,0]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; NEURAL_HAM_SHORT(-0.98)[-0.979,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US] X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 14 May 2019 20:19:30 -0000 Author: trasz Date: Tue May 14 20:19:29 2019 New Revision: 347573 URL: https://svnweb.freebsd.org/changeset/base/347573 Log: MFC r345547: Factor out resource limit enforcement code in the ELF loader. It makes the code slightly easier to follow, and might make it easier to fix the resouce accounting to also account for the interpreter. The PROC_UNLOCK() is moved earlier - I don't see anything it should protect; the lim_max() is a wrapper around lim_rlimit(), and that, differently from lim_rlimit_proc(), doesn't require the proc lock to be held. Sponsored by: DARPA, AFRL Modified: stable/12/sys/kern/imgact_elf.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/kern/imgact_elf.c ============================================================================== --- stable/12/sys/kern/imgact_elf.c Tue May 14 20:03:19 2019 (r347572) +++ stable/12/sys/kern/imgact_elf.c Tue May 14 20:19:29 2019 (r347573) @@ -813,6 +813,83 @@ __CONCAT(rnd_, __elfN(base))(vm_map_t map __unused, u_ return (res); } +static int +__elfN(enforce_limits)(struct image_params *imgp, const Elf_Ehdr *hdr, + const Elf_Phdr *phdr, u_long et_dyn_addr) +{ + struct vmspace *vmspace; + const char *err_str; + u_long text_size, data_size, total_size, text_addr, data_addr; + u_long seg_size, seg_addr; + int i; + + err_str = NULL; + text_size = data_size = total_size = text_addr = data_addr = 0; + + for (i = 0; i < hdr->e_phnum; i++) { + if (phdr[i].p_type != PT_LOAD || phdr[i].p_memsz == 0) + continue; + + seg_addr = trunc_page(phdr[i].p_vaddr + et_dyn_addr); + seg_size = round_page(phdr[i].p_memsz + + phdr[i].p_vaddr + et_dyn_addr - seg_addr); + + /* + * Make the largest executable segment the official + * text segment and all others data. + * + * Note that obreak() assumes that data_addr + data_size == end + * of data load area, and the ELF file format expects segments + * to be sorted by address. If multiple data segments exist, + * the last one will be used. + */ + + if ((phdr[i].p_flags & PF_X) != 0 && text_size < seg_size) { + text_size = seg_size; + text_addr = seg_addr; + } else { + data_size = seg_size; + data_addr = seg_addr; + } + total_size += seg_size; + } + + if (data_addr == 0 && data_size == 0) { + data_addr = text_addr; + data_size = text_size; + } + + /* + * Check limits. It should be safe to check the + * limits after loading the segments since we do + * not actually fault in all the segments pages. + */ + PROC_LOCK(imgp->proc); + if (data_size > lim_cur_proc(imgp->proc, RLIMIT_DATA)) + err_str = "Data segment size exceeds process limit"; + else if (text_size > maxtsiz) + err_str = "Text segment size exceeds system limit"; + else if (total_size > lim_cur_proc(imgp->proc, RLIMIT_VMEM)) + err_str = "Total segment size exceeds process limit"; + else if (racct_set(imgp->proc, RACCT_DATA, data_size) != 0) + err_str = "Data segment size exceeds resource limit"; + else if (racct_set(imgp->proc, RACCT_VMEM, total_size) != 0) + err_str = "Total segment size exceeds resource limit"; + PROC_UNLOCK(imgp->proc); + if (err_str != NULL) { + uprintf("%s\n", err_str); + return (ENOMEM); + } + + vmspace = imgp->proc->p_vmspace; + vmspace->vm_tsize = text_size >> PAGE_SHIFT; + vmspace->vm_taddr = (caddr_t)(uintptr_t)text_addr; + vmspace->vm_dsize = data_size >> PAGE_SHIFT; + vmspace->vm_daddr = (caddr_t)(uintptr_t)data_addr; + + return (0); +} + /* * Impossible et_dyn_addr initial value indicating that the real base * must be calculated later with some randomization applied. @@ -828,13 +905,12 @@ __CONCAT(exec_, __elfN(imgact))(struct image_params *i Elf_Auxargs *elf_auxargs; struct vmspace *vmspace; vm_map_t map; - const char *err_str, *newinterp; + const char *newinterp; char *interp, *interp_buf, *path; Elf_Brandinfo *brand_info; struct sysentvec *sv; vm_prot_t prot; - u_long text_size, data_size, total_size, text_addr, data_addr; - u_long seg_size, seg_addr, addr, baddr, et_dyn_addr, entry, proghdr; + u_long addr, baddr, et_dyn_addr, entry, proghdr; u_long maxalign, mapsz, maxv, maxv1; uint32_t fctl0; int32_t osrel; @@ -873,10 +949,9 @@ __CONCAT(exec_, __elfN(imgact))(struct image_params *i baddr = 0; osrel = 0; fctl0 = 0; - text_size = data_size = total_size = text_addr = data_addr = 0; entry = proghdr = 0; interp_name_len = 0; - err_str = newinterp = NULL; + newinterp = NULL; interp = interp_buf = NULL; td = curthread; maxalign = PAGE_SIZE; @@ -1065,30 +1140,6 @@ __CONCAT(exec_, __elfN(imgact))(struct image_params *i <= phdr[i].p_filesz) proghdr = phdr[i].p_vaddr + hdr->e_phoff + et_dyn_addr; - - seg_addr = trunc_page(phdr[i].p_vaddr + et_dyn_addr); - seg_size = round_page(phdr[i].p_memsz + - phdr[i].p_vaddr + et_dyn_addr - seg_addr); - - /* - * Make the largest executable segment the official - * text segment and all others data. - * - * Note that obreak() assumes that data_addr + - * data_size == end of data load area, and the ELF - * file format expects segments to be sorted by - * address. If multiple data segments exist, the - * last one will be used. - */ - - if (phdr[i].p_flags & PF_X && text_size < seg_size) { - text_size = seg_size; - text_addr = seg_addr; - } else { - data_size = seg_size; - data_addr = seg_addr; - } - total_size += seg_size; break; case PT_PHDR: /* Program header table info */ proghdr = phdr[i].p_vaddr + et_dyn_addr; @@ -1097,41 +1148,12 @@ __CONCAT(exec_, __elfN(imgact))(struct image_params *i break; } } - - if (data_addr == 0 && data_size == 0) { - data_addr = text_addr; - data_size = text_size; - } - entry = (u_long)hdr->e_entry + et_dyn_addr; - - /* - * Check limits. It should be safe to check the - * limits after loading the segments since we do - * not actually fault in all the segments pages. - */ - PROC_LOCK(imgp->proc); - if (data_size > lim_cur_proc(imgp->proc, RLIMIT_DATA)) - err_str = "Data segment size exceeds process limit"; - else if (text_size > maxtsiz) - err_str = "Text segment size exceeds system limit"; - else if (total_size > lim_cur_proc(imgp->proc, RLIMIT_VMEM)) - err_str = "Total segment size exceeds process limit"; - else if (racct_set(imgp->proc, RACCT_DATA, data_size) != 0) - err_str = "Data segment size exceeds resource limit"; - else if (racct_set(imgp->proc, RACCT_VMEM, total_size) != 0) - err_str = "Total segment size exceeds resource limit"; - if (err_str != NULL) { - PROC_UNLOCK(imgp->proc); - uprintf("%s\n", err_str); - error = ENOMEM; + error = __elfN(enforce_limits)(imgp, hdr, phdr, et_dyn_addr); + if (error != 0) goto ret; - } - vmspace->vm_tsize = text_size >> PAGE_SHIFT; - vmspace->vm_taddr = (caddr_t)(uintptr_t)text_addr; - vmspace->vm_dsize = data_size >> PAGE_SHIFT; - vmspace->vm_daddr = (caddr_t)(uintptr_t)data_addr; + entry = (u_long)hdr->e_entry + et_dyn_addr; /* * We load the dynamic linker where a userland call @@ -1149,7 +1171,6 @@ __CONCAT(exec_, __elfN(imgact))(struct image_params *i } else { map->anon_loc = addr; } - PROC_UNLOCK(imgp->proc); imgp->entry_addr = entry; From owner-svn-src-stable@freebsd.org Tue May 14 20:26:06 2019 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 9D55115979C4; Tue, 14 May 2019 20:26:06 +0000 (UTC) (envelope-from trasz@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 4360582EB6; Tue, 14 May 2019 20:26:06 +0000 (UTC) (envelope-from trasz@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 0F7E625FE0; Tue, 14 May 2019 20:26:06 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x4EKQ5Qp069024; Tue, 14 May 2019 20:26:05 GMT (envelope-from trasz@FreeBSD.org) Received: (from trasz@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x4EKQ5Ud069023; Tue, 14 May 2019 20:26:05 GMT (envelope-from trasz@FreeBSD.org) Message-Id: <201905142026.x4EKQ5Ud069023@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: trasz set sender to trasz@FreeBSD.org using -f From: Edward Tomasz Napierala Date: Tue, 14 May 2019 20:26:05 +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: r347574 - stable/12/sys/kern X-SVN-Group: stable-12 X-SVN-Commit-Author: trasz X-SVN-Commit-Paths: stable/12/sys/kern X-SVN-Commit-Revision: 347574 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 4360582EB6 X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.98 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.998,0]; NEURAL_HAM_SHORT(-0.98)[-0.979,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US]; NEURAL_HAM_LONG(-1.00)[-1.000,0] X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 14 May 2019 20:26:07 -0000 Author: trasz Date: Tue May 14 20:26:05 2019 New Revision: 347574 URL: https://svnweb.freebsd.org/changeset/base/347574 Log: MFC r345661: Factor out retrieving the interpreter path from the main ELF loader routine. MFC r345734 by kib: Fix branding after r345661. In particular, elf32 FreeBSD binaries were not executed on LP64 hosts. The interp_name_len value should account for the nul terminator. This is needed for strncmp()s in brand checking code to work. Sponsored by: DARPA, AFRL Modified: stable/12/sys/kern/imgact_elf.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/kern/imgact_elf.c ============================================================================== --- stable/12/sys/kern/imgact_elf.c Tue May 14 20:19:29 2019 (r347573) +++ stable/12/sys/kern/imgact_elf.c Tue May 14 20:26:05 2019 (r347574) @@ -88,7 +88,7 @@ __FBSDID("$FreeBSD$"); static int __elfN(check_header)(const Elf_Ehdr *hdr); static Elf_Brandinfo *__elfN(get_brandinfo)(struct image_params *imgp, - const char *interp, int interp_name_len, int32_t *osrel, uint32_t *fctl0); + const char *interp, int32_t *osrel, uint32_t *fctl0); static int __elfN(load_file)(struct proc *p, const char *file, u_long *addr, u_long *entry); static int __elfN(load_section)(struct image_params *imgp, vm_ooffset_t offset, @@ -273,13 +273,15 @@ __elfN(brand_inuse)(Elf_Brandinfo *entry) static Elf_Brandinfo * __elfN(get_brandinfo)(struct image_params *imgp, const char *interp, - int interp_name_len, int32_t *osrel, uint32_t *fctl0) + int32_t *osrel, uint32_t *fctl0) { const Elf_Ehdr *hdr = (const Elf_Ehdr *)imgp->image_header; Elf_Brandinfo *bi, *bi_m; boolean_t ret; - int i; + int i, interp_name_len; + interp_name_len = interp != NULL ? strlen(interp) + 1 : 0; + /* * We support four types of branding -- (1) the ELF EI_OSABI field * that SCO added to the ELF spec, (2) FreeBSD 3.x's traditional string @@ -890,6 +892,60 @@ __elfN(enforce_limits)(struct image_params *imgp, cons return (0); } +static int +__elfN(get_interp)(struct image_params *imgp, const Elf_Phdr *phdr, + char **interpp, bool *free_interpp) +{ + struct thread *td; + char *interp; + int error, interp_name_len; + + KASSERT(phdr->p_type == PT_INTERP, + ("%s: p_type %u != PT_INTERP", __func__, phdr->p_type)); + KASSERT(VOP_ISLOCKED(imgp->vp), + ("%s: vp %p is not locked", __func__, imgp->vp)); + + td = curthread; + + /* Path to interpreter */ + if (phdr->p_filesz < 2 || phdr->p_filesz > MAXPATHLEN) { + uprintf("Invalid PT_INTERP\n"); + return (ENOEXEC); + } + + interp_name_len = phdr->p_filesz; + if (phdr->p_offset > PAGE_SIZE || + interp_name_len > PAGE_SIZE - phdr->p_offset) { + VOP_UNLOCK(imgp->vp, 0); + interp = malloc(interp_name_len + 1, M_TEMP, M_WAITOK); + vn_lock(imgp->vp, LK_EXCLUSIVE | LK_RETRY); + error = vn_rdwr(UIO_READ, imgp->vp, interp, + interp_name_len, phdr->p_offset, + UIO_SYSSPACE, IO_NODELOCKED, td->td_ucred, + NOCRED, NULL, td); + if (error != 0) { + free(interp, M_TEMP); + uprintf("i/o error PT_INTERP %d\n", error); + return (error); + } + interp[interp_name_len] = '\0'; + + *interpp = interp; + *free_interpp = true; + return (0); + } + + interp = __DECONST(char *, imgp->image_header) + phdr->p_offset; + if (interp[interp_name_len - 1] != '\0') { + uprintf("Invalid PT_INTERP\n"); + return (ENOEXEC); + } + + *interpp = interp; + *free_interpp = false; + return (0); +} + /* * Impossible et_dyn_addr initial value indicating that the real base * must be calculated later with some randomization applied. @@ -906,7 +962,7 @@ __CONCAT(exec_, __elfN(imgact))(struct image_params *i struct vmspace *vmspace; vm_map_t map; const char *newinterp; - char *interp, *interp_buf, *path; + char *interp, *path; Elf_Brandinfo *brand_info; struct sysentvec *sv; vm_prot_t prot; @@ -914,7 +970,8 @@ __CONCAT(exec_, __elfN(imgact))(struct image_params *i u_long maxalign, mapsz, maxv, maxv1; uint32_t fctl0; int32_t osrel; - int error, i, n, interp_name_len, have_interp; + bool free_interp; + int error, i, n, have_interp; hdr = (const Elf_Ehdr *)imgp->image_header; @@ -950,9 +1007,8 @@ __CONCAT(exec_, __elfN(imgact))(struct image_params *i osrel = 0; fctl0 = 0; entry = proghdr = 0; - interp_name_len = 0; - newinterp = NULL; - interp = interp_buf = NULL; + newinterp = interp = NULL; + free_interp = false; td = curthread; maxalign = PAGE_SIZE; mapsz = 0; @@ -969,44 +1025,15 @@ __CONCAT(exec_, __elfN(imgact))(struct image_params *i break; case PT_INTERP: /* Path to interpreter */ - if (phdr[i].p_filesz < 2 || - phdr[i].p_filesz > MAXPATHLEN) { - uprintf("Invalid PT_INTERP\n"); - error = ENOEXEC; - goto ret; - } if (interp != NULL) { uprintf("Multiple PT_INTERP headers\n"); error = ENOEXEC; goto ret; } - interp_name_len = phdr[i].p_filesz; - if (phdr[i].p_offset > PAGE_SIZE || - interp_name_len > PAGE_SIZE - phdr[i].p_offset) { - VOP_UNLOCK(imgp->vp, 0); - interp_buf = malloc(interp_name_len + 1, M_TEMP, - M_WAITOK); - vn_lock(imgp->vp, LK_EXCLUSIVE | LK_RETRY); - error = vn_rdwr(UIO_READ, imgp->vp, interp_buf, - interp_name_len, phdr[i].p_offset, - UIO_SYSSPACE, IO_NODELOCKED, td->td_ucred, - NOCRED, NULL, td); - if (error != 0) { - uprintf("i/o error PT_INTERP %d\n", - error); - goto ret; - } - interp_buf[interp_name_len] = '\0'; - interp = interp_buf; - } else { - interp = __DECONST(char *, imgp->image_header) + - phdr[i].p_offset; - if (interp[interp_name_len - 1] != '\0') { - uprintf("Invalid PT_INTERP\n"); - error = ENOEXEC; - goto ret; - } - } + error = __elfN(get_interp)(imgp, &phdr[i], &interp, + &free_interp); + if (error != 0) + goto ret; break; case PT_GNU_STACK: if (__elfN(nxstack)) @@ -1017,8 +1044,7 @@ __CONCAT(exec_, __elfN(imgact))(struct image_params *i } } - brand_info = __elfN(get_brandinfo)(imgp, interp, interp_name_len, - &osrel, &fctl0); + brand_info = __elfN(get_brandinfo)(imgp, interp, &osrel, &fctl0); if (brand_info == NULL) { uprintf("ELF binary type \"%u\" not known.\n", hdr->e_ident[EI_OSABI]); @@ -1239,7 +1265,8 @@ __CONCAT(exec_, __elfN(imgact))(struct image_params *i imgp->proc->p_elf_flags = hdr->e_flags; ret: - free(interp_buf, M_TEMP); + if (free_interp) + free(interp, M_TEMP); return (error); } From owner-svn-src-stable@freebsd.org Tue May 14 20:27:47 2019 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 3E8031597AAA; Tue, 14 May 2019 20:27:47 +0000 (UTC) (envelope-from trasz@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 D366C8307B; Tue, 14 May 2019 20:27:46 +0000 (UTC) (envelope-from trasz@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 69E3525FE1; Tue, 14 May 2019 20:27:46 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x4EKRkmM069145; Tue, 14 May 2019 20:27:46 GMT (envelope-from trasz@FreeBSD.org) Received: (from trasz@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x4EKRkY1069144; Tue, 14 May 2019 20:27:46 GMT (envelope-from trasz@FreeBSD.org) Message-Id: <201905142027.x4EKRkY1069144@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: trasz set sender to trasz@FreeBSD.org using -f From: Edward Tomasz Napierala Date: Tue, 14 May 2019 20:27:46 +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: r347575 - stable/12/sys/kern X-SVN-Group: stable-12 X-SVN-Commit-Author: trasz X-SVN-Commit-Paths: stable/12/sys/kern X-SVN-Commit-Revision: 347575 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: D366C8307B X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.98 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.998,0]; NEURAL_HAM_SHORT(-0.98)[-0.979,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US]; NEURAL_HAM_LONG(-1.00)[-1.000,0] X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 14 May 2019 20:27:47 -0000 Author: trasz Date: Tue May 14 20:27:45 2019 New Revision: 347575 URL: https://svnweb.freebsd.org/changeset/base/347575 Log: MFC r346030: Refactor ELF interpreter loading into a separate function. Sponsored by: DARPA, AFRL Modified: stable/12/sys/kern/imgact_elf.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/kern/imgact_elf.c ============================================================================== --- stable/12/sys/kern/imgact_elf.c Tue May 14 20:26:05 2019 (r347574) +++ stable/12/sys/kern/imgact_elf.c Tue May 14 20:27:45 2019 (r347575) @@ -946,6 +946,41 @@ __elfN(get_interp)(struct image_params *imgp, const El return (0); } +static int +__elfN(load_interp)(struct image_params *imgp, const Elf_Brandinfo *brand_info, + const char *interp, u_long *addr, u_long *entry) +{ + char *path; + int error; + + if (brand_info->emul_path != NULL && + brand_info->emul_path[0] != '\0') { + path = malloc(MAXPATHLEN, M_TEMP, M_WAITOK); + snprintf(path, MAXPATHLEN, "%s%s", + brand_info->emul_path, interp); + error = __elfN(load_file)(imgp->proc, path, addr, entry); + free(path, M_TEMP); + if (error == 0) + return (0); + } + + if (brand_info->interp_newpath != NULL && + (brand_info->interp_path == NULL || + strcmp(interp, brand_info->interp_path) == 0)) { + error = __elfN(load_file)(imgp->proc, + brand_info->interp_newpath, addr, entry); + if (error == 0) + return (0); + } + + error = __elfN(load_file)(imgp->proc, interp, addr, entry); + if (error == 0) + return (0); + + uprintf("ELF interpreter %s not found, error %d\n", interp, error); + return (error); +} + /* * Impossible et_dyn_addr initial value indicating that the real base * must be calculated later with some randomization applied. @@ -961,8 +996,7 @@ __CONCAT(exec_, __elfN(imgact))(struct image_params *i Elf_Auxargs *elf_auxargs; struct vmspace *vmspace; vm_map_t map; - const char *newinterp; - char *interp, *path; + char *interp; Elf_Brandinfo *brand_info; struct sysentvec *sv; vm_prot_t prot; @@ -971,7 +1005,7 @@ __CONCAT(exec_, __elfN(imgact))(struct image_params *i uint32_t fctl0; int32_t osrel; bool free_interp; - int error, i, n, have_interp; + int error, i, n; hdr = (const Elf_Ehdr *)imgp->image_header; @@ -1007,7 +1041,7 @@ __CONCAT(exec_, __elfN(imgact))(struct image_params *i osrel = 0; fctl0 = 0; entry = proghdr = 0; - newinterp = interp = NULL; + interp = NULL; free_interp = false; td = curthread; maxalign = PAGE_SIZE; @@ -1075,8 +1109,6 @@ __CONCAT(exec_, __elfN(imgact))(struct image_params *i et_dyn_addr = ET_DYN_LOAD_ADDR; } } - if (interp != NULL && brand_info->interp_newpath != NULL) - newinterp = brand_info->interp_newpath; /* * Avoid a possible deadlock if the current address space is destroyed @@ -1201,7 +1233,6 @@ __CONCAT(exec_, __elfN(imgact))(struct image_params *i imgp->entry_addr = entry; if (interp != NULL) { - have_interp = FALSE; VOP_UNLOCK(imgp->vp, 0); if ((map->flags & MAP_ASLR) != 0) { /* Assume that interpeter fits into 1/4 of AS */ @@ -1210,35 +1241,11 @@ __CONCAT(exec_, __elfN(imgact))(struct image_params *i addr = __CONCAT(rnd_, __elfN(base))(map, addr, maxv1, PAGE_SIZE); } - if (brand_info->emul_path != NULL && - brand_info->emul_path[0] != '\0') { - path = malloc(MAXPATHLEN, M_TEMP, M_WAITOK); - snprintf(path, MAXPATHLEN, "%s%s", - brand_info->emul_path, interp); - error = __elfN(load_file)(imgp->proc, path, &addr, - &imgp->entry_addr); - free(path, M_TEMP); - if (error == 0) - have_interp = TRUE; - } - if (!have_interp && newinterp != NULL && - (brand_info->interp_path == NULL || - strcmp(interp, brand_info->interp_path) == 0)) { - error = __elfN(load_file)(imgp->proc, newinterp, &addr, - &imgp->entry_addr); - if (error == 0) - have_interp = TRUE; - } - if (!have_interp) { - error = __elfN(load_file)(imgp->proc, interp, &addr, - &imgp->entry_addr); - } + error = __elfN(load_interp)(imgp, brand_info, interp, &addr, + &imgp->entry_addr); vn_lock(imgp->vp, LK_EXCLUSIVE | LK_RETRY); - if (error != 0) { - uprintf("ELF interpreter %s not found, error %d\n", - interp, error); + if (error != 0) goto ret; - } } else addr = et_dyn_addr; From owner-svn-src-stable@freebsd.org Tue May 14 20:29:13 2019 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 6D6301597BAE; Tue, 14 May 2019 20:29:13 +0000 (UTC) (envelope-from trasz@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 113BD8324E; Tue, 14 May 2019 20:29:13 +0000 (UTC) (envelope-from trasz@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 C5EAC25FE2; Tue, 14 May 2019 20:29:12 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x4EKTCjW069257; Tue, 14 May 2019 20:29:12 GMT (envelope-from trasz@FreeBSD.org) Received: (from trasz@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x4EKTCDW069256; Tue, 14 May 2019 20:29:12 GMT (envelope-from trasz@FreeBSD.org) Message-Id: <201905142029.x4EKTCDW069256@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: trasz set sender to trasz@FreeBSD.org using -f From: Edward Tomasz Napierala Date: Tue, 14 May 2019 20:29:12 +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: r347576 - stable/12/sys/kern X-SVN-Group: stable-12 X-SVN-Commit-Author: trasz X-SVN-Commit-Paths: stable/12/sys/kern X-SVN-Commit-Revision: 347576 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 113BD8324E X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.98 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.998,0]; NEURAL_HAM_SHORT(-0.98)[-0.979,0]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US] X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 14 May 2019 20:29:13 -0000 Author: trasz Date: Tue May 14 20:29:12 2019 New Revision: 347576 URL: https://svnweb.freebsd.org/changeset/base/347576 Log: MFC r346053: Factor out section loading into a separate function. Sponsored by: DARPA, AFRL Modified: stable/12/sys/kern/imgact_elf.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/kern/imgact_elf.c ============================================================================== --- stable/12/sys/kern/imgact_elf.c Tue May 14 20:27:45 2019 (r347575) +++ stable/12/sys/kern/imgact_elf.c Tue May 14 20:29:12 2019 (r347576) @@ -650,6 +650,45 @@ __elfN(load_section)(struct image_params *imgp, vm_oof return (0); } +static int +__elfN(load_sections)(struct image_params *imgp, const Elf_Ehdr *hdr, + const Elf_Phdr *phdr, u_long rbase, u_long *base_addrp) +{ + vm_prot_t prot; + u_long base_addr; + bool first; + int error, i; + + base_addr = 0; + first = true; + + for (i = 0; i < hdr->e_phnum; i++) { + if (phdr[i].p_type != PT_LOAD || phdr[i].p_memsz == 0) + continue; + + /* Loadable segment */ + prot = __elfN(trans_prot)(phdr[i].p_flags); + error = __elfN(load_section)(imgp, phdr[i].p_offset, + (caddr_t)(uintptr_t)phdr[i].p_vaddr + rbase, + phdr[i].p_memsz, phdr[i].p_filesz, prot); + if (error != 0) + return (error); + + /* + * Establish the base address if this is the first segment. + */ + if (first) { + base_addr = trunc_page(phdr[i].p_vaddr + rbase); + first = false; + } + } + + if (base_addrp != NULL) + *base_addrp = base_addr; + + return (0); +} + /* * Load the file "file" into memory. It may be either a shared object * or an executable. @@ -676,10 +715,9 @@ __elfN(load_file)(struct proc *p, const char *file, u_ struct nameidata *nd; struct vattr *attr; struct image_params *imgp; - vm_prot_t prot; u_long rbase; u_long base_addr = 0; - int error, i, numsegs; + int error; #ifdef CAPABILITY_MODE /* @@ -757,25 +795,10 @@ __elfN(load_file)(struct proc *p, const char *file, u_ goto fail; } - for (i = 0, numsegs = 0; i < hdr->e_phnum; i++) { - if (phdr[i].p_type == PT_LOAD && phdr[i].p_memsz != 0) { - /* Loadable segment */ - prot = __elfN(trans_prot)(phdr[i].p_flags); - error = __elfN(load_section)(imgp, phdr[i].p_offset, - (caddr_t)(uintptr_t)phdr[i].p_vaddr + rbase, - phdr[i].p_memsz, phdr[i].p_filesz, prot); - if (error != 0) - goto fail; - /* - * Establish the base address if this is the - * first segment. - */ - if (numsegs == 0) - base_addr = trunc_page(phdr[i].p_vaddr + - rbase); - numsegs++; - } - } + error = __elfN(load_sections)(imgp, hdr, phdr, rbase, &base_addr); + if (error != 0) + goto fail; + *addr = base_addr; *entry = (unsigned long)hdr->e_entry + rbase; @@ -999,7 +1022,6 @@ __CONCAT(exec_, __elfN(imgact))(struct image_params *i char *interp; Elf_Brandinfo *brand_info; struct sysentvec *sv; - vm_prot_t prot; u_long addr, baddr, et_dyn_addr, entry, proghdr; u_long maxalign, mapsz, maxv, maxv1; uint32_t fctl0; @@ -1056,6 +1078,17 @@ __CONCAT(exec_, __elfN(imgact))(struct image_params *i maxalign = phdr[i].p_align; mapsz += phdr[i].p_memsz; n++; + + /* + * If this segment contains the program headers, + * remember their virtual address for the AT_PHDR + * aux entry. Static binaries don't usually include + * a PT_PHDR entry. + */ + if (phdr[i].p_offset == 0 && + hdr->e_phoff + hdr->e_phnum * hdr->e_phentsize + <= phdr[i].p_filesz) + proghdr = phdr[i].p_vaddr + hdr->e_phoff; break; case PT_INTERP: /* Path to interpreter */ @@ -1075,6 +1108,9 @@ __CONCAT(exec_, __elfN(imgact))(struct image_params *i __elfN(trans_prot)(phdr[i].p_flags); imgp->stack_sz = phdr[i].p_memsz; break; + case PT_PHDR: /* Program header table info */ + proghdr = phdr[i].p_vaddr; + break; } } @@ -1175,38 +1211,10 @@ __CONCAT(exec_, __elfN(imgact))(struct image_params *i if (error != 0) goto ret; - for (i = 0; i < hdr->e_phnum; i++) { - switch (phdr[i].p_type) { - case PT_LOAD: /* Loadable segment */ - if (phdr[i].p_memsz == 0) - break; - prot = __elfN(trans_prot)(phdr[i].p_flags); - error = __elfN(load_section)(imgp, phdr[i].p_offset, - (caddr_t)(uintptr_t)phdr[i].p_vaddr + et_dyn_addr, - phdr[i].p_memsz, phdr[i].p_filesz, prot); - if (error != 0) - goto ret; + error = __elfN(load_sections)(imgp, hdr, phdr, et_dyn_addr, NULL); + if (error != 0) + goto ret; - /* - * If this segment contains the program headers, - * remember their virtual address for the AT_PHDR - * aux entry. Static binaries don't usually include - * a PT_PHDR entry. - */ - if (phdr[i].p_offset == 0 && - hdr->e_phoff + hdr->e_phnum * hdr->e_phentsize - <= phdr[i].p_filesz) - proghdr = phdr[i].p_vaddr + hdr->e_phoff + - et_dyn_addr; - break; - case PT_PHDR: /* Program header table info */ - proghdr = phdr[i].p_vaddr + et_dyn_addr; - break; - default: - break; - } - } - error = __elfN(enforce_limits)(imgp, hdr, phdr, et_dyn_addr); if (error != 0) goto ret; @@ -1254,7 +1262,7 @@ __CONCAT(exec_, __elfN(imgact))(struct image_params *i */ elf_auxargs = malloc(sizeof(Elf_Auxargs), M_TEMP, M_WAITOK); elf_auxargs->execfd = -1; - elf_auxargs->phdr = proghdr; + elf_auxargs->phdr = proghdr + et_dyn_addr; elf_auxargs->phent = hdr->e_phentsize; elf_auxargs->phnum = hdr->e_phnum; elf_auxargs->pagesz = PAGE_SIZE; From owner-svn-src-stable@freebsd.org Tue May 14 20:31:07 2019 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 3C2081597DCE; Tue, 14 May 2019 20:31:07 +0000 (UTC) (envelope-from trasz@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 D56628353C; Tue, 14 May 2019 20:31:06 +0000 (UTC) (envelope-from trasz@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 B05F42601F; Tue, 14 May 2019 20:31:06 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x4EKV6c9073413; Tue, 14 May 2019 20:31:06 GMT (envelope-from trasz@FreeBSD.org) Received: (from trasz@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x4EKV6eO073412; Tue, 14 May 2019 20:31:06 GMT (envelope-from trasz@FreeBSD.org) Message-Id: <201905142031.x4EKV6eO073412@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: trasz set sender to trasz@FreeBSD.org using -f From: Edward Tomasz Napierala Date: Tue, 14 May 2019 20:31: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: r347577 - stable/12/sys/kern X-SVN-Group: stable-12 X-SVN-Commit-Author: trasz X-SVN-Commit-Paths: stable/12/sys/kern X-SVN-Commit-Revision: 347577 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: D56628353C X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.98 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.998,0]; NEURAL_HAM_SHORT(-0.98)[-0.978,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US]; NEURAL_HAM_LONG(-1.00)[-1.000,0] X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 14 May 2019 20:31:07 -0000 Author: trasz Date: Tue May 14 20:31:06 2019 New Revision: 347577 URL: https://svnweb.freebsd.org/changeset/base/347577 Log: MFC r346076: Improve vnode lock assertions. Sponsored by: DARPA, AFRL Modified: stable/12/sys/kern/imgact_elf.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/kern/imgact_elf.c ============================================================================== --- stable/12/sys/kern/imgact_elf.c Tue May 14 20:29:12 2019 (r347576) +++ stable/12/sys/kern/imgact_elf.c Tue May 14 20:31:06 2019 (r347577) @@ -659,6 +659,8 @@ __elfN(load_sections)(struct image_params *imgp, const bool first; int error, i; + ASSERT_VOP_LOCKED(imgp->vp, __func__); + base_addr = 0; first = true; @@ -925,8 +927,7 @@ __elfN(get_interp)(struct image_params *imgp, const El KASSERT(phdr->p_type == PT_INTERP, ("%s: p_type %u != PT_INTERP", __func__, phdr->p_type)); - KASSERT(VOP_ISLOCKED(imgp->vp), - ("%s: vp %p is not locked", __func__, imgp->vp)); + ASSERT_VOP_LOCKED(imgp->vp, __func__); td = curthread; From owner-svn-src-stable@freebsd.org Tue May 14 20:41:25 2019 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 4FDB115984F0; Tue, 14 May 2019 20:41:25 +0000 (UTC) (envelope-from trasz@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 EB8C783DB3; Tue, 14 May 2019 20:41:24 +0000 (UTC) (envelope-from trasz@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 C5876262D8; Tue, 14 May 2019 20:41:24 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x4EKfOEJ078704; Tue, 14 May 2019 20:41:24 GMT (envelope-from trasz@FreeBSD.org) Received: (from trasz@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x4EKfO7v078703; Tue, 14 May 2019 20:41:24 GMT (envelope-from trasz@FreeBSD.org) Message-Id: <201905142041.x4EKfO7v078703@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: trasz set sender to trasz@FreeBSD.org using -f From: Edward Tomasz Napierala Date: Tue, 14 May 2019 20:41:24 +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: r347579 - stable/12/sys/kern X-SVN-Group: stable-12 X-SVN-Commit-Author: trasz X-SVN-Commit-Paths: stable/12/sys/kern X-SVN-Commit-Revision: 347579 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: EB8C783DB3 X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.98 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.998,0]; NEURAL_HAM_SHORT(-0.98)[-0.978,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US]; NEURAL_HAM_LONG(-1.00)[-1.000,0] X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 14 May 2019 20:41:25 -0000 Author: trasz Date: Tue May 14 20:41:24 2019 New Revision: 347579 URL: https://svnweb.freebsd.org/changeset/base/347579 Log: MFC r346120: Use shared vnode locks for the ELF interpreter. Sponsored by: DARPA, AFRL Modified: stable/12/sys/kern/imgact_elf.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/kern/imgact_elf.c ============================================================================== --- stable/12/sys/kern/imgact_elf.c Tue May 14 20:32:29 2019 (r347578) +++ stable/12/sys/kern/imgact_elf.c Tue May 14 20:41:24 2019 (r347579) @@ -717,7 +717,7 @@ __elfN(load_file)(struct proc *p, const char *file, u_ struct nameidata *nd; struct vattr *attr; struct image_params *imgp; - u_long rbase; + u_long flags, rbase; u_long base_addr = 0; int error; @@ -745,7 +745,10 @@ __elfN(load_file)(struct proc *p, const char *file, u_ imgp->object = NULL; imgp->execlabel = NULL; - NDINIT(nd, LOOKUP, LOCKLEAF | FOLLOW, UIO_SYSSPACE, file, curthread); + flags = FOLLOW | LOCKSHARED | LOCKLEAF; + +again: + NDINIT(nd, LOOKUP, flags, UIO_SYSSPACE, file, curthread); if ((error = namei(nd)) != 0) { nd->ni_vp = NULL; goto fail; @@ -760,15 +763,30 @@ __elfN(load_file)(struct proc *p, const char *file, u_ if (error) goto fail; + /* + * Also make certain that the interpreter stays the same, + * so set its VV_TEXT flag, too. Since this function is only + * used to load the interpreter, the VV_TEXT is almost always + * already set. + */ + if (VOP_IS_TEXT(nd->ni_vp) == 0) { + if (VOP_ISLOCKED(nd->ni_vp) != LK_EXCLUSIVE) { + /* + * LK_UPGRADE could have resulted in dropping + * the lock. Just try again from the start, + * this time with exclusive vnode lock. + */ + vput(nd->ni_vp); + flags &= ~LOCKSHARED; + goto again; + } + + VOP_SET_TEXT(nd->ni_vp); + } + error = exec_map_first_page(imgp); if (error) goto fail; - - /* - * Also make certain that the interpreter stays the same, so set - * its VV_TEXT flag, too. - */ - VOP_SET_TEXT(nd->ni_vp); imgp->object = nd->ni_vp->v_object; From owner-svn-src-stable@freebsd.org Tue May 14 21:11:16 2019 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 3D5021598DBD; Tue, 14 May 2019 21:11:16 +0000 (UTC) (envelope-from kib@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 D7AF284D18; Tue, 14 May 2019 21:11:15 +0000 (UTC) (envelope-from kib@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 7626926809; Tue, 14 May 2019 21:11:15 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x4ELBFUt091372; Tue, 14 May 2019 21:11:15 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x4ELBFsZ091371; Tue, 14 May 2019 21:11:15 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201905142111.x4ELBFsZ091371@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Tue, 14 May 2019 21:11:15 +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: r347581 - stable/12/sys/kern X-SVN-Group: stable-12 X-SVN-Commit-Author: kib X-SVN-Commit-Paths: stable/12/sys/kern X-SVN-Commit-Revision: 347581 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: D7AF284D18 X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.95 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.998,0]; NEURAL_HAM_SHORT(-0.95)[-0.953,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US]; NEURAL_HAM_LONG(-1.00)[-1.000,0] X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 14 May 2019 21:11:16 -0000 Author: kib Date: Tue May 14 21:11:15 2019 New Revision: 347581 URL: https://svnweb.freebsd.org/changeset/base/347581 Log: MFC r347148: imgact_elf: do not relock the text vnode if possible. Modified: stable/12/sys/kern/imgact_elf.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/kern/imgact_elf.c ============================================================================== --- stable/12/sys/kern/imgact_elf.c Tue May 14 20:59:44 2019 (r347580) +++ stable/12/sys/kern/imgact_elf.c Tue May 14 21:11:15 2019 (r347581) @@ -958,9 +958,12 @@ __elfN(get_interp)(struct image_params *imgp, const El interp_name_len = phdr->p_filesz; if (phdr->p_offset > PAGE_SIZE || interp_name_len > PAGE_SIZE - phdr->p_offset) { - VOP_UNLOCK(imgp->vp, 0); - interp = malloc(interp_name_len + 1, M_TEMP, M_WAITOK); - vn_lock(imgp->vp, LK_EXCLUSIVE | LK_RETRY); + interp = malloc(interp_name_len + 1, M_TEMP, M_NOWAIT); + if (interp == NULL) { + VOP_UNLOCK(imgp->vp, 0); + interp = malloc(interp_name_len + 1, M_TEMP, M_WAITOK); + vn_lock(imgp->vp, LK_EXCLUSIVE | LK_RETRY); + } error = vn_rdwr(UIO_READ, imgp->vp, interp, interp_name_len, phdr->p_offset, UIO_SYSSPACE, IO_NODELOCKED, td->td_ucred, @@ -1279,7 +1282,12 @@ __CONCAT(exec_, __elfN(imgact))(struct image_params *i /* * Construct auxargs table (used by the fixup routine) */ - elf_auxargs = malloc(sizeof(Elf_Auxargs), M_TEMP, M_WAITOK); + elf_auxargs = malloc(sizeof(Elf_Auxargs), M_TEMP, M_NOWAIT); + if (elf_auxargs == NULL) { + VOP_UNLOCK(imgp->vp, 0); + elf_auxargs = malloc(sizeof(Elf_Auxargs), M_TEMP, M_WAITOK); + vn_lock(imgp->vp, LK_EXCLUSIVE | LK_RETRY); + } elf_auxargs->execfd = -1; elf_auxargs->phdr = proghdr + et_dyn_addr; elf_auxargs->phent = hdr->e_phentsize; @@ -2559,9 +2567,12 @@ __elfN(parse_notes)(struct image_params *imgp, Elf_Not ASSERT_VOP_LOCKED(imgp->vp, "parse_notes"); if (pnote->p_offset > PAGE_SIZE || pnote->p_filesz > PAGE_SIZE - pnote->p_offset) { - VOP_UNLOCK(imgp->vp, 0); - buf = malloc(pnote->p_filesz, M_TEMP, M_WAITOK); - vn_lock(imgp->vp, LK_EXCLUSIVE | LK_RETRY); + buf = malloc(pnote->p_filesz, M_TEMP, M_NOWAIT); + if (buf == NULL) { + VOP_UNLOCK(imgp->vp, 0); + buf = malloc(pnote->p_filesz, M_TEMP, M_WAITOK); + vn_lock(imgp->vp, LK_EXCLUSIVE | LK_RETRY); + } error = vn_rdwr(UIO_READ, imgp->vp, buf, pnote->p_filesz, pnote->p_offset, UIO_SYSSPACE, IO_NODELOCKED, curthread->td_ucred, NOCRED, NULL, curthread); From owner-svn-src-stable@freebsd.org Wed May 15 01:38:35 2019 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id C07BF15A4D66; Wed, 15 May 2019 01:38:35 +0000 (UTC) (envelope-from mav@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 65BC16B1E2; Wed, 15 May 2019 01:38:35 +0000 (UTC) (envelope-from mav@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 3E1461514; Wed, 15 May 2019 01:38:35 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x4F1cZoh033515; Wed, 15 May 2019 01:38:35 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x4F1cZx4033514; Wed, 15 May 2019 01:38:35 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201905150138.x4F1cZx4033514@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Wed, 15 May 2019 01:38:35 +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: r347604 - stable/12/cddl/contrib/opensolaris/cmd/zfs X-SVN-Group: stable-12 X-SVN-Commit-Author: mav X-SVN-Commit-Paths: stable/12/cddl/contrib/opensolaris/cmd/zfs X-SVN-Commit-Revision: 347604 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 65BC16B1E2 X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.89 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.997,0]; NEURAL_HAM_SHORT(-0.89)[-0.892,0]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US] X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 15 May 2019 01:38:35 -0000 Author: mav Date: Wed May 15 01:38:34 2019 New Revision: 347604 URL: https://svnweb.freebsd.org/changeset/base/347604 Log: MFC r347240: Fix dataset name comparison in zfs_compare(). The code never returned match comparing two datasets (not snapshots). As result, uu_avl_find(), called from zfs_callback(), never succeeded, allowing to add same dataset into the list multiple times, for example: # zfs get name pers pers pers@z pers@z NAME PROPERTY VALUE SOURCE pers name pers - pers name pers - pers@z name pers@z - With the patch: # zfs get name pers pers pers@z pers@z NAME PROPERTY VALUE SOURCE pers name pers - pers@z name pers@z - Modified: stable/12/cddl/contrib/opensolaris/cmd/zfs/zfs_iter.c Directory Properties: stable/12/ (props changed) Modified: stable/12/cddl/contrib/opensolaris/cmd/zfs/zfs_iter.c ============================================================================== --- stable/12/cddl/contrib/opensolaris/cmd/zfs/zfs_iter.c Wed May 15 00:38:52 2019 (r347603) +++ stable/12/cddl/contrib/opensolaris/cmd/zfs/zfs_iter.c Wed May 15 01:38:34 2019 (r347604) @@ -225,7 +225,7 @@ zfs_compare(const void *larg, const void *rarg, void * *rat = '\0'; ret = strcmp(lname, rname); - if (ret == 0) { + if (ret == 0 && (lat != NULL || rat != NULL)) { /* * If we're comparing a dataset to one of its snapshots, we * always make the full dataset first. From owner-svn-src-stable@freebsd.org Wed May 15 01:40:41 2019 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 3F86515A4F36; Wed, 15 May 2019 01:40:41 +0000 (UTC) (envelope-from mav@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 D73E26B399; Wed, 15 May 2019 01:40:40 +0000 (UTC) (envelope-from mav@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 9EDFD1521; Wed, 15 May 2019 01:40:40 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x4F1eeLN033691; Wed, 15 May 2019 01:40:40 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x4F1eeVr033690; Wed, 15 May 2019 01:40:40 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201905150140.x4F1eeVr033690@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Wed, 15 May 2019 01:40:40 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r347605 - stable/11/cddl/contrib/opensolaris/cmd/zfs X-SVN-Group: stable-11 X-SVN-Commit-Author: mav X-SVN-Commit-Paths: stable/11/cddl/contrib/opensolaris/cmd/zfs X-SVN-Commit-Revision: 347605 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: D73E26B399 X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.93 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.997,0]; NEURAL_HAM_SHORT(-0.93)[-0.935,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US]; NEURAL_HAM_LONG(-1.00)[-1.000,0] X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 15 May 2019 01:40:41 -0000 Author: mav Date: Wed May 15 01:40:40 2019 New Revision: 347605 URL: https://svnweb.freebsd.org/changeset/base/347605 Log: MFC r347240: Fix dataset name comparison in zfs_compare(). The code never returned match comparing two datasets (not snapshots). As result, uu_avl_find(), called from zfs_callback(), never succeeded, allowing to add same dataset into the list multiple times, for example: # zfs get name pers pers pers@z pers@z NAME PROPERTY VALUE SOURCE pers name pers - pers name pers - pers@z name pers@z - With the patch: # zfs get name pers pers pers@z pers@z NAME PROPERTY VALUE SOURCE pers name pers - pers@z name pers@z - Modified: stable/11/cddl/contrib/opensolaris/cmd/zfs/zfs_iter.c Directory Properties: stable/11/ (props changed) Modified: stable/11/cddl/contrib/opensolaris/cmd/zfs/zfs_iter.c ============================================================================== --- stable/11/cddl/contrib/opensolaris/cmd/zfs/zfs_iter.c Wed May 15 01:38:34 2019 (r347604) +++ stable/11/cddl/contrib/opensolaris/cmd/zfs/zfs_iter.c Wed May 15 01:40:40 2019 (r347605) @@ -225,7 +225,7 @@ zfs_compare(const void *larg, const void *rarg, void * *rat = '\0'; ret = strcmp(lname, rname); - if (ret == 0) { + if (ret == 0 && (lat != NULL || rat != NULL)) { /* * If we're comparing a dataset to one of its snapshots, we * always make the full dataset first. From owner-svn-src-stable@freebsd.org Wed May 15 07:51:31 2019 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 4577E15AE64C; Wed, 15 May 2019 07:51:31 +0000 (UTC) (envelope-from ngie@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 DE1B380148; Wed, 15 May 2019 07:51:30 +0000 (UTC) (envelope-from ngie@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 B8BA26AFC; Wed, 15 May 2019 07:51:30 +0000 (UTC) (envelope-from ngie@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x4F7pUp6031427; Wed, 15 May 2019 07:51:30 GMT (envelope-from ngie@FreeBSD.org) Received: (from ngie@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x4F7pUMh031426; Wed, 15 May 2019 07:51:30 GMT (envelope-from ngie@FreeBSD.org) Message-Id: <201905150751.x4F7pUMh031426@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ngie set sender to ngie@FreeBSD.org using -f From: Enji Cooper Date: Wed, 15 May 2019 07:51:30 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r347610 - in stable/11/usr.sbin/lpr: common_source lpc X-SVN-Group: stable-11 X-SVN-Commit-Author: ngie X-SVN-Commit-Paths: in stable/11/usr.sbin/lpr: common_source lpc X-SVN-Commit-Revision: 347610 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: DE1B380148 X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.96 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.997,0]; NEURAL_HAM_SHORT(-0.96)[-0.959,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US]; NEURAL_HAM_LONG(-1.00)[-1.000,0] X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 15 May 2019 07:51:31 -0000 Author: ngie Date: Wed May 15 07:51:30 2019 New Revision: 347610 URL: https://svnweb.freebsd.org/changeset/base/347610 Log: MFC r320009,r347075: r320009 (by sbruno): Quiesce clang warning while building lpc. usr.sbin/lpr/lpc/lpc.c Warning passing 'char *[20]' to parameter of type 'const char **' discards qualifiers in nested pointer types [-Wincompatible-pointer-types-discards-qualifiers] Fix: Explicitly cast the variable "margv" to const char ** only for it's use as a parameter to suppress the error r347075: Fix `clang -Wcast-qual` issues Remove unnecessary `char*` casting for arguments passed to `cget*(3)`, and deconst `_PATH_PRINTCAP` before passing it to `cget*` via the `printcapdb` variable. This unblocks ^/projects/runtime-coverage-v2 from building cleanly on universe13a.freebsd.org. I suspect the issue was introduced through some changes to `bsd.*.mk` inclusion on the branch, which I will continue to investigate/isolate. Tested with: clang 8 (arm64) Modified: stable/11/usr.sbin/lpr/common_source/printcap.c stable/11/usr.sbin/lpr/lpc/lpc.c Directory Properties: stable/11/ (props changed) Modified: stable/11/usr.sbin/lpr/common_source/printcap.c ============================================================================== --- stable/11/usr.sbin/lpr/common_source/printcap.c Wed May 15 07:46:17 2019 (r347609) +++ stable/11/usr.sbin/lpr/common_source/printcap.c Wed May 15 07:51:30 2019 (r347610) @@ -60,7 +60,7 @@ __FBSDID("$FreeBSD$"); /* * Routines and data used in processing the printcap file. */ -static char *printcapdb[2] = { _PATH_PRINTCAP, 0 }; /* list for cget* */ +static char *printcapdb[] = { __DECONST(char *, _PATH_PRINTCAP), NULL }; static char *capdb_canonical_name(const char *_bp); static int capdb_getaltlog(char *_bp, const char *_shrt, @@ -97,15 +97,9 @@ int getprintcap(const char *printer, struct printer *pp) { int status; - char *XXX; char *bp; - /* - * A bug in the declaration of cgetent(3) means that we have - * to hide the constness of its third argument. - */ - XXX = (char *)printer; - if ((status = cgetent(&bp, printcapdb, XXX)) < 0) + if ((status = cgetent(&bp, printcapdb, printer)) < 0) return status; status = getprintcap_int(bp, pp); free(bp); @@ -378,10 +372,10 @@ capdb_getaltstr(char *bp, const char *shrt, const char { int status; - status = cgetstr(bp, (char *)/*XXX*/lng, result); + status = cgetstr(bp, lng, result); if (status >= 0 || status == PCAPERR_OSERR) return status; - status = cgetstr(bp, (char *)/*XXX*/shrt, result); + status = cgetstr(bp, shrt, result); if (status >= 0 || status == PCAPERR_OSERR) return status; if (dflt) { @@ -402,10 +396,10 @@ capdb_getaltnum(char *bp, const char *shrt, const char { int status; - status = cgetnum(bp, (char *)/*XXX*/lng, result); + status = cgetnum(bp, lng, result); if (status >= 0) return status; - status = cgetnum(bp, (char *)/*XXX*/shrt, result); + status = cgetnum(bp, shrt, result); if (status >= 0) return status; *result = dflt; @@ -419,9 +413,9 @@ capdb_getaltnum(char *bp, const char *shrt, const char static int capdb_getaltlog(char *bp, const char *shrt, const char *lng) { - if (cgetcap(bp, (char *)/*XXX*/lng, ':')) + if (cgetcap(bp, lng, ':')) return 1; - if (cgetcap(bp, (char *)/*XXX*/shrt, ':')) + if (cgetcap(bp, shrt, ':')) return 1; return 0; } Modified: stable/11/usr.sbin/lpr/lpc/lpc.c ============================================================================== --- stable/11/usr.sbin/lpr/lpc/lpc.c Wed May 15 07:46:17 2019 (r347609) +++ stable/11/usr.sbin/lpr/lpc/lpc.c Wed May 15 07:51:30 2019 (r347610) @@ -197,7 +197,7 @@ cmdscanner(void) makeargv(); if (margc == 0) continue; - if (el != NULL && el_parse(el, margc, margv) != -1) + if (el != NULL && el_parse(el, margc, (const char **)margv) != -1) continue; c = getcmd(margv[0]); From owner-svn-src-stable@freebsd.org Wed May 15 07:51:38 2019 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id EE1AD15AE67C; Wed, 15 May 2019 07:51:37 +0000 (UTC) (envelope-from ngie@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 8FF97801B6; Wed, 15 May 2019 07:51:37 +0000 (UTC) (envelope-from ngie@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 5D1096B02; Wed, 15 May 2019 07:51:36 +0000 (UTC) (envelope-from ngie@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x4F7paMP032287; Wed, 15 May 2019 07:51:36 GMT (envelope-from ngie@FreeBSD.org) Received: (from ngie@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x4F7paVH032286; Wed, 15 May 2019 07:51:36 GMT (envelope-from ngie@FreeBSD.org) Message-Id: <201905150751.x4F7paVH032286@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ngie set sender to ngie@FreeBSD.org using -f From: Enji Cooper Date: Wed, 15 May 2019 07:51:36 +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: r347611 - stable/12/usr.sbin/lpr/common_source X-SVN-Group: stable-12 X-SVN-Commit-Author: ngie X-SVN-Commit-Paths: stable/12/usr.sbin/lpr/common_source X-SVN-Commit-Revision: 347611 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 8FF97801B6 X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.96 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.997,0]; NEURAL_HAM_SHORT(-0.96)[-0.959,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US]; NEURAL_HAM_LONG(-1.00)[-1.000,0] X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 15 May 2019 07:51:38 -0000 Author: ngie Date: Wed May 15 07:51:35 2019 New Revision: 347611 URL: https://svnweb.freebsd.org/changeset/base/347611 Log: MFC r347075: Fix `clang -Wcast-qual` issues Remove unnecessary `char*` casting for arguments passed to `cget*(3)`, and deconst `_PATH_PRINTCAP` before passing it to `cget*` via the `printcapdb` variable. This unblocks ^/projects/runtime-coverage-v2 from building cleanly on universe13a.freebsd.org. I suspect the issue was introduced through some changes to `bsd.*.mk` inclusion on the branch, which I will continue to investigate/isolate. Tested with: clang 8 (arm64) Modified: stable/12/usr.sbin/lpr/common_source/printcap.c Directory Properties: stable/12/ (props changed) Modified: stable/12/usr.sbin/lpr/common_source/printcap.c ============================================================================== --- stable/12/usr.sbin/lpr/common_source/printcap.c Wed May 15 07:51:30 2019 (r347610) +++ stable/12/usr.sbin/lpr/common_source/printcap.c Wed May 15 07:51:35 2019 (r347611) @@ -62,7 +62,7 @@ __FBSDID("$FreeBSD$"); /* * Routines and data used in processing the printcap file. */ -static char *printcapdb[2] = { _PATH_PRINTCAP, 0 }; /* list for cget* */ +static char *printcapdb[] = { __DECONST(char *, _PATH_PRINTCAP), NULL }; static char *capdb_canonical_name(const char *_bp); static int capdb_getaltlog(char *_bp, const char *_shrt, @@ -99,15 +99,9 @@ int getprintcap(const char *printer, struct printer *pp) { int status; - char *XXX; char *bp; - /* - * A bug in the declaration of cgetent(3) means that we have - * to hide the constness of its third argument. - */ - XXX = (char *)printer; - if ((status = cgetent(&bp, printcapdb, XXX)) < 0) + if ((status = cgetent(&bp, printcapdb, printer)) < 0) return status; status = getprintcap_int(bp, pp); free(bp); @@ -380,10 +374,10 @@ capdb_getaltstr(char *bp, const char *shrt, const char { int status; - status = cgetstr(bp, (char *)/*XXX*/lng, result); + status = cgetstr(bp, lng, result); if (status >= 0 || status == PCAPERR_OSERR) return status; - status = cgetstr(bp, (char *)/*XXX*/shrt, result); + status = cgetstr(bp, shrt, result); if (status >= 0 || status == PCAPERR_OSERR) return status; if (dflt) { @@ -404,10 +398,10 @@ capdb_getaltnum(char *bp, const char *shrt, const char { int status; - status = cgetnum(bp, (char *)/*XXX*/lng, result); + status = cgetnum(bp, lng, result); if (status >= 0) return status; - status = cgetnum(bp, (char *)/*XXX*/shrt, result); + status = cgetnum(bp, shrt, result); if (status >= 0) return status; *result = dflt; @@ -421,9 +415,9 @@ capdb_getaltnum(char *bp, const char *shrt, const char static int capdb_getaltlog(char *bp, const char *shrt, const char *lng) { - if (cgetcap(bp, (char *)/*XXX*/lng, ':')) + if (cgetcap(bp, lng, ':')) return 1; - if (cgetcap(bp, (char *)/*XXX*/shrt, ':')) + if (cgetcap(bp, shrt, ':')) return 1; return 0; } From owner-svn-src-stable@freebsd.org Wed May 15 08:15:45 2019 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 8262815AF2A9; Wed, 15 May 2019 08:15:45 +0000 (UTC) (envelope-from kib@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 28E2A8114C; Wed, 15 May 2019 08:15:45 +0000 (UTC) (envelope-from kib@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 1B3C06EC2; Wed, 15 May 2019 08:15:45 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x4F8Fixj046235; Wed, 15 May 2019 08:15:44 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x4F8Fi5s046234; Wed, 15 May 2019 08:15:44 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201905150815.x4F8Fi5s046234@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Wed, 15 May 2019 08:15:44 +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: r347612 - stable/12/sys/dev/cpuctl X-SVN-Group: stable-12 X-SVN-Commit-Author: kib X-SVN-Commit-Paths: stable/12/sys/dev/cpuctl X-SVN-Commit-Revision: 347612 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 28E2A8114C X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.97 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.997,0]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; NEURAL_HAM_SHORT(-0.97)[-0.971,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US] X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 15 May 2019 08:15:45 -0000 Author: kib Date: Wed May 15 08:15:44 2019 New Revision: 347612 URL: https://svnweb.freebsd.org/changeset/base/347612 Log: MFC r347368: x86: Put other CPUs into tight loop when updating Intel microcode from loaded OS. Modified: stable/12/sys/dev/cpuctl/cpuctl.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/dev/cpuctl/cpuctl.c ============================================================================== --- stable/12/sys/dev/cpuctl/cpuctl.c Wed May 15 07:51:35 2019 (r347611) +++ stable/12/sys/dev/cpuctl/cpuctl.c Wed May 15 08:15:44 2019 (r347612) @@ -330,9 +330,26 @@ cpuctl_do_update(int cpu, cpuctl_update_args_t *data, return (ret); } +struct ucode_update_data { + void *ptr; + int cpu; + int ret; +}; + +static void +ucode_intel_load_rv(void *arg) +{ + struct ucode_update_data *d; + + d = arg; + if (PCPU_GET(cpuid) == d->cpu) + d->ret = ucode_intel_load(d->ptr, true, NULL, NULL); +} + static int update_intel(int cpu, cpuctl_update_args_t *args, struct thread *td) { + struct ucode_update_data d; void *ptr; int is_bound, oldcpu, ret; @@ -360,12 +377,11 @@ update_intel(int cpu, cpuctl_update_args_t *args, stru oldcpu = td->td_oncpu; is_bound = cpu_sched_is_bound(td); set_cpu(cpu, td); - critical_enter(); - - ret = ucode_intel_load(ptr, true, NULL, NULL); - - critical_exit(); + d.ptr = ptr; + d.cpu = cpu; + smp_rendezvous(NULL, ucode_intel_load_rv, NULL, &d); restore_cpu(oldcpu, is_bound, td); + ret = d.ret; /* * Replace any existing update. This ensures that the new update From owner-svn-src-stable@freebsd.org Wed May 15 08:39:17 2019 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id C012F15AFC31; Wed, 15 May 2019 08:39:17 +0000 (UTC) (envelope-from tuexen@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 3669E81FB0; Wed, 15 May 2019 08:39:17 +0000 (UTC) (envelope-from tuexen@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 0C9B071FF; Wed, 15 May 2019 08:39:17 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x4F8dGE0056322; Wed, 15 May 2019 08:39:16 GMT (envelope-from tuexen@FreeBSD.org) Received: (from tuexen@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x4F8dGTi056321; Wed, 15 May 2019 08:39:16 GMT (envelope-from tuexen@FreeBSD.org) Message-Id: <201905150839.x4F8dGTi056321@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: tuexen set sender to tuexen@FreeBSD.org using -f From: Michael Tuexen Date: Wed, 15 May 2019 08:39:16 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r347613 - stable/11/sys/netinet6 X-SVN-Group: stable-11 X-SVN-Commit-Author: tuexen X-SVN-Commit-Paths: stable/11/sys/netinet6 X-SVN-Commit-Revision: 347613 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 3669E81FB0 X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.97 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.997,0]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; NEURAL_HAM_SHORT(-0.97)[-0.971,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US] X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 15 May 2019 08:39:17 -0000 Author: tuexen Date: Wed May 15 08:39:16 2019 New Revision: 347613 URL: https://svnweb.freebsd.org/changeset/base/347613 Log: MFC r337738: Use a macro to set the assoc state. Modified: stable/11/sys/netinet6/sctp6_usrreq.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/netinet6/sctp6_usrreq.c ============================================================================== --- stable/11/sys/netinet6/sctp6_usrreq.c Wed May 15 08:15:44 2019 (r347612) +++ stable/11/sys/netinet6/sctp6_usrreq.c Wed May 15 08:39:16 2019 (r347613) @@ -924,7 +924,7 @@ sctp6_connect(struct socket *so, struct sockaddr *addr /* Set the connected flag so we can queue data */ soisconnecting(so); } - stcb->asoc.state = SCTP_STATE_COOKIE_WAIT; + SCTP_SET_STATE(stcb, SCTP_STATE_COOKIE_WAIT); (void)SCTP_GETTIME_TIMEVAL(&stcb->asoc.time_entered); /* initialize authentication parameters for the assoc */ From owner-svn-src-stable@freebsd.org Wed May 15 15:03:56 2019 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id ACDCB1594D4D; Wed, 15 May 2019 15:03:56 +0000 (UTC) (envelope-from gjb@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 4E2538F521; Wed, 15 May 2019 15:03:56 +0000 (UTC) (envelope-from gjb@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 0B926B2E9; Wed, 15 May 2019 15:03:56 +0000 (UTC) (envelope-from gjb@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x4FF3tRB060780; Wed, 15 May 2019 15:03:55 GMT (envelope-from gjb@FreeBSD.org) Received: (from gjb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x4FF3tq9060777; Wed, 15 May 2019 15:03:55 GMT (envelope-from gjb@FreeBSD.org) Message-Id: <201905151503.x4FF3tq9060777@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: gjb set sender to gjb@FreeBSD.org using -f From: Glen Barber Date: Wed, 15 May 2019 15:03:55 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r347614 - stable/11/release/doc/share/xml X-SVN-Group: stable-11 X-SVN-Commit-Author: gjb X-SVN-Commit-Paths: stable/11/release/doc/share/xml X-SVN-Commit-Revision: 347614 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 4E2538F521 X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.92 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.997,0]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; NEURAL_HAM_SHORT(-0.92)[-0.922,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US] X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 15 May 2019 15:03:56 -0000 Author: gjb Date: Wed May 15 15:03:55 2019 New Revision: 347614 URL: https://svnweb.freebsd.org/changeset/base/347614 Log: Document EN-19:08 through EN-19:10, SA-19:03 through SA-19:07. Sponsored by: The FreeBSD Foundation Modified: stable/11/release/doc/share/xml/errata.xml stable/11/release/doc/share/xml/security.xml Modified: stable/11/release/doc/share/xml/errata.xml ============================================================================== --- stable/11/release/doc/share/xml/errata.xml Wed May 15 08:39:16 2019 (r347613) +++ stable/11/release/doc/share/xml/errata.xml Wed May 15 15:03:55 2019 (r347614) @@ -126,6 +126,22 @@ kqueue race condition and kernel panic + + + FreeBSD-EN-19:08.tzdata + 14 May 2019 + Timezone database information + update + + + + FreeBSD-EN-19:09.xinstall + 14 May 2019 + &man.install.1; broken with partially matching + relative paths + Modified: stable/11/release/doc/share/xml/security.xml ============================================================================== --- stable/11/release/doc/share/xml/security.xml Wed May 15 08:39:16 2019 (r347613) +++ stable/11/release/doc/share/xml/security.xml Wed May 15 15:03:55 2019 (r347614) @@ -92,6 +92,44 @@ File description reference count leak + + + FreeBSD-SA-19:03.wpa + 14 May 2019 + Multiple vulnerabilities + + + + FreeBSD-SA-19:04.ntp + 14 May 2019 + Authenticated denial of service in + &man.ntpd.8; + + + + FreeBSD-SA-19:05.pf + 14 May 2019 + IPv6 fragment reassembly panic in + &man.pf.4; + + + + FreeBSD-SA-19:06.pf + 14 May 2019 + ICMP/ICMP6 packet filter bypass in + &man.pf.4; + + + + FreeBSD-SA-19:07.mds + 14 May 2019 + Microarchitectural Data Sampling + From owner-svn-src-stable@freebsd.org Wed May 15 15:49:30 2019 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id CB70A159633A; Wed, 15 May 2019 15:49:30 +0000 (UTC) (envelope-from markj@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 71BEA9122B; Wed, 15 May 2019 15:49:30 +0000 (UTC) (envelope-from markj@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 4A7EBB9E0; Wed, 15 May 2019 15:49:30 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x4FFnUJg081776; Wed, 15 May 2019 15:49:30 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x4FFnT1Z081774; Wed, 15 May 2019 15:49:29 GMT (envelope-from markj@FreeBSD.org) Message-Id: <201905151549.x4FFnT1Z081774@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Wed, 15 May 2019 15:49:29 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r347616 - in stable/11/sys: amd64/amd64 i386/i386 X-SVN-Group: stable-11 X-SVN-Commit-Author: markj X-SVN-Commit-Paths: in stable/11/sys: amd64/amd64 i386/i386 X-SVN-Commit-Revision: 347616 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 71BEA9122B X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.96 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.997,0]; NEURAL_HAM_SHORT(-0.97)[-0.968,0]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US] X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 15 May 2019 15:49:31 -0000 Author: markj Date: Wed May 15 15:49:29 2019 New Revision: 347616 URL: https://svnweb.freebsd.org/changeset/base/347616 Log: MFC r339046, r339073: Count bootstrap data as resident in the kernel pmap. Modified: stable/11/sys/amd64/amd64/pmap.c stable/11/sys/i386/i386/pmap.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/amd64/amd64/pmap.c ============================================================================== --- stable/11/sys/amd64/amd64/pmap.c Wed May 15 15:11:49 2019 (r347615) +++ stable/11/sys/amd64/amd64/pmap.c Wed May 15 15:49:29 2019 (r347616) @@ -1016,9 +1016,11 @@ pmap_bootstrap(vm_paddr_t *firstaddr) { vm_offset_t va; pt_entry_t *pte; + u_long res; int i; KERNend = *firstaddr; + res = atop(KERNend - (vm_paddr_t)kernphys); if (!pti) pg_g = X86_PG_G; @@ -1038,10 +1040,8 @@ pmap_bootstrap(vm_paddr_t *firstaddr) vm_phys_add_seg(KPTphys, KPTphys + ptoa(nkpt)); virtual_avail = (vm_offset_t) KERNBASE + *firstaddr; - virtual_end = VM_MAX_KERNEL_ADDRESS; - /* XXX do %cr0 as well */ load_cr4(rcr4() | CR4_PGE); load_cr3(KPML4phys); @@ -1050,6 +1050,8 @@ pmap_bootstrap(vm_paddr_t *firstaddr) /* * Initialize the kernel pmap (which is statically allocated). + * Count bootstrap data as being resident in case any of this data is + * later unmapped (using pmap_remove()) and freed. */ PMAP_LOCK_INIT(kernel_pmap); kernel_pmap->pm_pml4 = (pdp_entry_t *)PHYS_TO_DMAP(KPML4phys); @@ -1057,6 +1059,7 @@ pmap_bootstrap(vm_paddr_t *firstaddr) kernel_pmap->pm_ucr3 = PMAP_NO_CR3; CPU_FILL(&kernel_pmap->pm_active); /* don't allow deactivation */ TAILQ_INIT(&kernel_pmap->pm_pvchunk); + kernel_pmap->pm_stats.resident_count = res; kernel_pmap->pm_flags = pmap_flags; /* Modified: stable/11/sys/i386/i386/pmap.c ============================================================================== --- stable/11/sys/i386/i386/pmap.c Wed May 15 15:11:49 2019 (r347615) +++ stable/11/sys/i386/i386/pmap.c Wed May 15 15:49:29 2019 (r347616) @@ -377,8 +377,11 @@ pmap_bootstrap(vm_paddr_t firstaddr) vm_offset_t va; pt_entry_t *pte, *unused; struct pcpu *pc; + u_long res; int i; + res = atop(firstaddr - (vm_paddr_t)KERNLOAD); + /* * Add a physical memory segment (vm_phys_seg) corresponding to the * preallocated kernel page table pages so that vm_page structures @@ -396,11 +399,12 @@ pmap_bootstrap(vm_paddr_t firstaddr) * unused virtual address in addition to "firstaddr". */ virtual_avail = (vm_offset_t) KERNBASE + firstaddr; - virtual_end = VM_MAX_KERNEL_ADDRESS; /* * Initialize the kernel pmap (which is statically allocated). + * Count bootstrap data as being resident in case any of this data is + * later unmapped (using pmap_remove()) and freed. */ PMAP_LOCK_INIT(kernel_pmap); kernel_pmap->pm_pdir = (pd_entry_t *) (KERNBASE + (u_int)IdlePTD); @@ -408,6 +412,7 @@ pmap_bootstrap(vm_paddr_t firstaddr) kernel_pmap->pm_pdpt = (pdpt_entry_t *) (KERNBASE + (u_int)IdlePDPT); #endif CPU_FILL(&kernel_pmap->pm_active); /* don't allow deactivation */ + kernel_pmap->pm_stats.resident_count = res; TAILQ_INIT(&kernel_pmap->pm_pvchunk); /* From owner-svn-src-stable@freebsd.org Wed May 15 17:50:18 2019 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 4E0D3159A9BE; Wed, 15 May 2019 17:50:18 +0000 (UTC) (envelope-from ian@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 E802C9741F; Wed, 15 May 2019 17:50:17 +0000 (UTC) (envelope-from ian@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 A5134CFE3; Wed, 15 May 2019 17:50:17 +0000 (UTC) (envelope-from ian@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x4FHoHaP048044; Wed, 15 May 2019 17:50:17 GMT (envelope-from ian@FreeBSD.org) Received: (from ian@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x4FHoH10048043; Wed, 15 May 2019 17:50:17 GMT (envelope-from ian@FreeBSD.org) Message-Id: <201905151750.x4FHoH10048043@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ian set sender to ian@FreeBSD.org using -f From: Ian Lepore Date: Wed, 15 May 2019 17:50:17 +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: r347624 - stable/12/sys/dev/dcons X-SVN-Group: stable-12 X-SVN-Commit-Author: ian X-SVN-Commit-Paths: stable/12/sys/dev/dcons X-SVN-Commit-Revision: 347624 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: E802C9741F X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.96 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.997,0]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; NEURAL_HAM_SHORT(-0.96)[-0.963,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US] X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 15 May 2019 17:50:18 -0000 Author: ian Date: Wed May 15 17:50:17 2019 New Revision: 347624 URL: https://svnweb.freebsd.org/changeset/base/347624 Log: MFC r347422: Allow dcons(4) to be unloaded when loaded as a module. When the module is unloaded, the tty devices are destroyed. That requires implementing the tsw_free callback to avoid a panic. This driver requires no particular cleanup to be done from the callback, but the module itself must remain in memory until the deferred tsw_free callbacks are invoked. These changes implement that by incrementing a reference count variable in the detach routine, and decrementing it in the tsw_free callback. The MOD_UNLOAD event handler doesn't return until the count drops to zero. PR: 237758 Modified: stable/12/sys/dev/dcons/dcons_os.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/dev/dcons/dcons_os.c ============================================================================== --- stable/12/sys/dev/dcons/dcons_os.c Wed May 15 17:48:11 2019 (r347623) +++ stable/12/sys/dev/dcons/dcons_os.c Wed May 15 17:50:17 2019 (r347624) @@ -52,6 +52,7 @@ #include #include +#include #include #include @@ -135,12 +136,16 @@ extern struct gdb_dbgport *gdb_cur; #endif static tsw_outwakeup_t dcons_outwakeup; +static tsw_free_t dcons_free; static struct ttydevsw dcons_ttydevsw = { .tsw_flags = TF_NOPREFIX, .tsw_outwakeup = dcons_outwakeup, + .tsw_free = dcons_free, }; +static int dcons_close_refs; + #if (defined(GDB) || defined(DDB)) static int dcons_check_break(struct dcons_softc *dc, int c) @@ -198,6 +203,14 @@ dcons_os_putc(struct dcons_softc *dc, int c) } static void +dcons_free(void *xsc __unused) +{ + + /* Our deferred free has arrived, now we're waiting for one fewer. */ + atomic_subtract_rel_int(&dcons_close_refs, 1); +} + +static void dcons_outwakeup(struct tty *tp) { struct dcons_softc *dc; @@ -396,6 +409,8 @@ dcons_detach(int port) dc = &sc[port]; tp = dc->tty; + /* tty_rel_gone() schedules a deferred free callback, count it. */ + atomic_add_int(&dcons_close_refs, 1); tty_lock(tp); tty_rel_gone(tp); @@ -430,6 +445,9 @@ dcons_modevent(module_t mode, int type, void *data) contigfree(dg.buf, DCONS_BUF_SIZE, M_DEVBUF); } + /* Wait for tty deferred free callbacks to complete. */ + while (atomic_load_acq_int(&dcons_close_refs) > 0) + pause_sbt("dcunld", mstosbt(50), mstosbt(10), 0); break; case MOD_SHUTDOWN: #if 0 /* Keep connection after halt */ From owner-svn-src-stable@freebsd.org Wed May 15 17:58:10 2019 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id F1832159AEC0; Wed, 15 May 2019 17:58:09 +0000 (UTC) (envelope-from ian@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 950DD97C4E; Wed, 15 May 2019 17:58:09 +0000 (UTC) (envelope-from ian@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 6E944D19A; Wed, 15 May 2019 17:58:09 +0000 (UTC) (envelope-from ian@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x4FHw9NM053149; Wed, 15 May 2019 17:58:09 GMT (envelope-from ian@FreeBSD.org) Received: (from ian@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x4FHw9Rl053148; Wed, 15 May 2019 17:58:09 GMT (envelope-from ian@FreeBSD.org) Message-Id: <201905151758.x4FHw9Rl053148@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ian set sender to ian@FreeBSD.org using -f From: Ian Lepore Date: Wed, 15 May 2019 17:58:09 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r347627 - stable/11/sys/dev/dcons X-SVN-Group: stable-11 X-SVN-Commit-Author: ian X-SVN-Commit-Paths: stable/11/sys/dev/dcons X-SVN-Commit-Revision: 347627 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 950DD97C4E X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.96 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.997,0]; NEURAL_HAM_SHORT(-0.96)[-0.963,0]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US] X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 15 May 2019 17:58:10 -0000 Author: ian Date: Wed May 15 17:58:08 2019 New Revision: 347627 URL: https://svnweb.freebsd.org/changeset/base/347627 Log: MFC r347422: Allow dcons(4) to be unloaded when loaded as a module. When the module is unloaded, the tty devices are destroyed. That requires implementing the tsw_free callback to avoid a panic. This driver requires no particular cleanup to be done from the callback, but the module itself must remain in memory until the deferred tsw_free callbacks are invoked. These changes implement that by incrementing a reference count variable in the detach routine, and decrementing it in the tsw_free callback. The MOD_UNLOAD event handler doesn't return until the count drops to zero. PR: 237758 Modified: stable/11/sys/dev/dcons/dcons_os.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/dev/dcons/dcons_os.c ============================================================================== --- stable/11/sys/dev/dcons/dcons_os.c Wed May 15 17:57:06 2019 (r347626) +++ stable/11/sys/dev/dcons/dcons_os.c Wed May 15 17:58:08 2019 (r347627) @@ -50,6 +50,7 @@ #include #include +#include #include #include @@ -133,12 +134,16 @@ extern struct gdb_dbgport *gdb_cur; #endif static tsw_outwakeup_t dcons_outwakeup; +static tsw_free_t dcons_free; static struct ttydevsw dcons_ttydevsw = { .tsw_flags = TF_NOPREFIX, .tsw_outwakeup = dcons_outwakeup, + .tsw_free = dcons_free, }; +static int dcons_close_refs; + #if (defined(GDB) || defined(DDB)) static int dcons_check_break(struct dcons_softc *dc, int c) @@ -196,6 +201,14 @@ dcons_os_putc(struct dcons_softc *dc, int c) } static void +dcons_free(void *xsc __unused) +{ + + /* Our deferred free has arrived, now we're waiting for one fewer. */ + atomic_subtract_rel_int(&dcons_close_refs, 1); +} + +static void dcons_outwakeup(struct tty *tp) { struct dcons_softc *dc; @@ -389,6 +402,8 @@ dcons_detach(int port) dc = &sc[port]; tp = dc->tty; + /* tty_rel_gone() schedules a deferred free callback, count it. */ + atomic_add_int(&dcons_close_refs, 1); tty_lock(tp); tty_rel_gone(tp); @@ -423,6 +438,9 @@ dcons_modevent(module_t mode, int type, void *data) contigfree(dg.buf, DCONS_BUF_SIZE, M_DEVBUF); } + /* Wait for tty deferred free callbacks to complete. */ + while (atomic_load_acq_int(&dcons_close_refs) > 0) + pause_sbt("dcunld", mstosbt(50), mstosbt(10), 0); break; case MOD_SHUTDOWN: #if 0 /* Keep connection after halt */ From owner-svn-src-stable@freebsd.org Wed May 15 18:56:43 2019 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id A7074159DD47; Wed, 15 May 2019 18:56:43 +0000 (UTC) (envelope-from gonzo@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 4B2376C125; Wed, 15 May 2019 18:56:43 +0000 (UTC) (envelope-from gonzo@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 200FCDB98; Wed, 15 May 2019 18:56:43 +0000 (UTC) (envelope-from gonzo@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x4FIugvp084477; Wed, 15 May 2019 18:56:42 GMT (envelope-from gonzo@FreeBSD.org) Received: (from gonzo@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x4FIugL7084476; Wed, 15 May 2019 18:56:42 GMT (envelope-from gonzo@FreeBSD.org) Message-Id: <201905151856.x4FIugL7084476@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: gonzo set sender to gonzo@FreeBSD.org using -f From: Oleksandr Tymoshenko Date: Wed, 15 May 2019 18:56:42 +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: r347629 - stable/12/sys/kern X-SVN-Group: stable-12 X-SVN-Commit-Author: gonzo X-SVN-Commit-Paths: stable/12/sys/kern X-SVN-Commit-Revision: 347629 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 4B2376C125 X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.93 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.998,0]; NEURAL_HAM_SHORT(-0.94)[-0.935,0]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US] X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 15 May 2019 18:56:43 -0000 Author: gonzo Date: Wed May 15 18:56:42 2019 New Revision: 347629 URL: https://svnweb.freebsd.org/changeset/base/347629 Log: MFC r345550: Change default value of kern.bootfile to reflect reality In most cases kernel.bootfile is populated from the information provided by loader(8). There are certain scenarios when loader is not available, for instance when kernel is loaded by u-boot or some other BootROM directly. In this case the default value "/kernel" points to invalid location and breaks some functinality, like using installkernel on self-hosted system or dtrace's CTF lookup. This can be fixed by setting the value manually but the default that reflects correct location is better than default that points to invalid one. Current default was set around FreeBSD 1, when "/kernel" was the actual path. Transition to /boot/kernel/kernel happened circa FreeBSD 3. PR: 221550 Reviewed by: ian, imp Differential Revision: https://reviews.freebsd.org/D18902 Modified: stable/12/sys/kern/kern_mib.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/kern/kern_mib.c ============================================================================== --- stable/12/sys/kern/kern_mib.c Wed May 15 18:13:43 2019 (r347628) +++ stable/12/sys/kern/kern_mib.c Wed May 15 18:56:42 2019 (r347629) @@ -136,7 +136,7 @@ SYSCTL_INT(_kern, KERN_SAVED_IDS, saved_ids, CTLFLAG_R SYSCTL_NULL_INT_PTR, 0, "Whether saved set-group/user ID is available"); #endif -char kernelname[MAXPATHLEN] = "/kernel"; /* XXX bloat */ +char kernelname[MAXPATHLEN] = "/boot/kernel/kernel"; /* XXX bloat */ SYSCTL_STRING(_kern, KERN_BOOTFILE, bootfile, CTLFLAG_RW | CTLFLAG_MPSAFE, kernelname, sizeof kernelname, "Name of kernel file booted"); From owner-svn-src-stable@freebsd.org Wed May 15 21:52:44 2019 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 46DBF15A389B; Wed, 15 May 2019 21:52:44 +0000 (UTC) (envelope-from gonzo@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 DBDAD733DD; Wed, 15 May 2019 21:52:43 +0000 (UTC) (envelope-from gonzo@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 9B386FA3D; Wed, 15 May 2019 21:52:43 +0000 (UTC) (envelope-from gonzo@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x4FLqhU6081588; Wed, 15 May 2019 21:52:43 GMT (envelope-from gonzo@FreeBSD.org) Received: (from gonzo@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x4FLqh9J081587; Wed, 15 May 2019 21:52:43 GMT (envelope-from gonzo@FreeBSD.org) Message-Id: <201905152152.x4FLqh9J081587@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: gonzo set sender to gonzo@FreeBSD.org using -f From: Oleksandr Tymoshenko Date: Wed, 15 May 2019 21:52:43 +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: r347634 - stable/12/sys/dev/acpi_support X-SVN-Group: stable-12 X-SVN-Commit-Author: gonzo X-SVN-Commit-Paths: stable/12/sys/dev/acpi_support X-SVN-Commit-Revision: 347634 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: DBDAD733DD X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.97 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.998,0]; NEURAL_HAM_SHORT(-0.97)[-0.971,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US]; NEURAL_HAM_LONG(-1.00)[-1.000,0] X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 15 May 2019 21:52:44 -0000 Author: gonzo Date: Wed May 15 21:52:43 2019 New Revision: 347634 URL: https://svnweb.freebsd.org/changeset/base/347634 Log: MFC r346647: [acpi_ibm] Add support for newer Thinkpad models Add support for newer Thinkpad models with id LEN0268. Was tested on Thinkpad T480 and ThinkPad X1 Yoga 2nd gen. PR: 229120 Submitted by: Ali Abdallah Modified: stable/12/sys/dev/acpi_support/acpi_ibm.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/dev/acpi_support/acpi_ibm.c ============================================================================== --- stable/12/sys/dev/acpi_support/acpi_ibm.c Wed May 15 21:25:44 2019 (r347633) +++ stable/12/sys/dev/acpi_support/acpi_ibm.c Wed May 15 21:52:43 2019 (r347634) @@ -349,7 +349,7 @@ static devclass_t acpi_ibm_devclass; DRIVER_MODULE(acpi_ibm, acpi, acpi_ibm_driver, acpi_ibm_devclass, 0, 0); MODULE_DEPEND(acpi_ibm, acpi, 1, 1, 1); -static char *ibm_ids[] = {"IBM0068", "LEN0068", NULL}; +static char *ibm_ids[] = {"IBM0068", "LEN0068", "LEN0268", NULL}; static void ibm_led(void *softc, int onoff) @@ -425,9 +425,14 @@ static int acpi_ibm_attach(device_t dev) { int i; + int hkey; struct acpi_ibm_softc *sc; char *maker, *product; - devclass_t ec_devclass; + ACPI_OBJECT_LIST input; + ACPI_OBJECT params[1]; + ACPI_OBJECT out_obj; + ACPI_BUFFER result; + devclass_t ec_devclass; ACPI_FUNCTION_TRACE((char *)(uintptr_t) __func__); @@ -462,15 +467,42 @@ acpi_ibm_attach(device_t dev) "initialmask", CTLFLAG_RD, &sc->events_initialmask, 0, "Initial eventmask"); - /* The availmask is the bitmask of supported events */ - if (ACPI_FAILURE(acpi_GetInteger(sc->handle, - IBM_NAME_EVENTS_AVAILMASK, &sc->events_availmask))) + if (ACPI_SUCCESS (acpi_GetInteger(sc->handle, "MHKV", &hkey))) { + device_printf(dev, "Firmware version is 0x%X\n", hkey); + switch(hkey >> 8) + { + case 1: + /* The availmask is the bitmask of supported events */ + if (ACPI_FAILURE(acpi_GetInteger(sc->handle, + IBM_NAME_EVENTS_AVAILMASK, &sc->events_availmask))) + sc->events_availmask = 0xffffffff; + break; + + case 2: + result.Length = sizeof(out_obj); + result.Pointer = &out_obj; + params[0].Type = ACPI_TYPE_INTEGER; + params[0].Integer.Value = 1; + input.Pointer = params; + input.Count = 1; + + sc->events_availmask = 0xffffffff; + + if (ACPI_SUCCESS(AcpiEvaluateObject (sc->handle, + IBM_NAME_EVENTS_AVAILMASK, &input, &result))) + sc->events_availmask = out_obj.Integer.Value; + break; + default: + device_printf(dev, "Unknown firmware version 0x%x\n", hkey); + break; + } + } else sc->events_availmask = 0xffffffff; SYSCTL_ADD_UINT(sc->sysctl_ctx, - SYSCTL_CHILDREN(sc->sysctl_tree), OID_AUTO, - "availmask", CTLFLAG_RD, - &sc->events_availmask, 0, "Mask of supported events"); + SYSCTL_CHILDREN(sc->sysctl_tree), OID_AUTO, + "availmask", CTLFLAG_RD, + &sc->events_availmask, 0, "Mask of supported events"); } /* Hook up proc nodes */ From owner-svn-src-stable@freebsd.org Thu May 16 00:51:31 2019 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 0473315A7B1D; Thu, 16 May 2019 00:51:31 +0000 (UTC) (envelope-from gonzo@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 9A41C80889; Thu, 16 May 2019 00:51:30 +0000 (UTC) (envelope-from gonzo@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 897AD196F1; Thu, 16 May 2019 00:51:30 +0000 (UTC) (envelope-from gonzo@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x4G0pUfG073873; Thu, 16 May 2019 00:51:30 GMT (envelope-from gonzo@FreeBSD.org) Received: (from gonzo@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x4G0pU5A073872; Thu, 16 May 2019 00:51:30 GMT (envelope-from gonzo@FreeBSD.org) Message-Id: <201905160051.x4G0pU5A073872@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: gonzo set sender to gonzo@FreeBSD.org using -f From: Oleksandr Tymoshenko Date: Thu, 16 May 2019 00:51:30 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r347636 - stable/11/sys/dev/acpi_support X-SVN-Group: stable-11 X-SVN-Commit-Author: gonzo X-SVN-Commit-Paths: stable/11/sys/dev/acpi_support X-SVN-Commit-Revision: 347636 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 9A41C80889 X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.96 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.998,0]; NEURAL_HAM_SHORT(-0.96)[-0.964,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US]; NEURAL_HAM_LONG(-1.00)[-1.000,0] X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 16 May 2019 00:51:31 -0000 Author: gonzo Date: Thu May 16 00:51:30 2019 New Revision: 347636 URL: https://svnweb.freebsd.org/changeset/base/347636 Log: MFC r346647: [acpi_ibm] Add support for newer Thinkpad models Add support for newer Thinkpad models with id LEN0268. Was tested on Thinkpad T480 and ThinkPad X1 Yoga 2nd gen. PR: 229120 Submitted by: Ali Abdallah Modified: stable/11/sys/dev/acpi_support/acpi_ibm.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/dev/acpi_support/acpi_ibm.c ============================================================================== --- stable/11/sys/dev/acpi_support/acpi_ibm.c Wed May 15 22:51:25 2019 (r347635) +++ stable/11/sys/dev/acpi_support/acpi_ibm.c Thu May 16 00:51:30 2019 (r347636) @@ -340,7 +340,7 @@ static devclass_t acpi_ibm_devclass; DRIVER_MODULE(acpi_ibm, acpi, acpi_ibm_driver, acpi_ibm_devclass, 0, 0); MODULE_DEPEND(acpi_ibm, acpi, 1, 1, 1); -static char *ibm_ids[] = {"IBM0068", "LEN0068", NULL}; +static char *ibm_ids[] = {"IBM0068", "LEN0068", "LEN0268", NULL}; static void ibm_led(void *softc, int onoff) @@ -387,9 +387,14 @@ static int acpi_ibm_attach(device_t dev) { int i; + int hkey; struct acpi_ibm_softc *sc; char *maker, *product; - devclass_t ec_devclass; + ACPI_OBJECT_LIST input; + ACPI_OBJECT params[1]; + ACPI_OBJECT out_obj; + ACPI_BUFFER result; + devclass_t ec_devclass; ACPI_FUNCTION_TRACE((char *)(uintptr_t) __func__); @@ -424,15 +429,42 @@ acpi_ibm_attach(device_t dev) "initialmask", CTLFLAG_RD, &sc->events_initialmask, 0, "Initial eventmask"); - /* The availmask is the bitmask of supported events */ - if (ACPI_FAILURE(acpi_GetInteger(sc->handle, - IBM_NAME_EVENTS_AVAILMASK, &sc->events_availmask))) + if (ACPI_SUCCESS (acpi_GetInteger(sc->handle, "MHKV", &hkey))) { + device_printf(dev, "Firmware version is 0x%X\n", hkey); + switch(hkey >> 8) + { + case 1: + /* The availmask is the bitmask of supported events */ + if (ACPI_FAILURE(acpi_GetInteger(sc->handle, + IBM_NAME_EVENTS_AVAILMASK, &sc->events_availmask))) + sc->events_availmask = 0xffffffff; + break; + + case 2: + result.Length = sizeof(out_obj); + result.Pointer = &out_obj; + params[0].Type = ACPI_TYPE_INTEGER; + params[0].Integer.Value = 1; + input.Pointer = params; + input.Count = 1; + + sc->events_availmask = 0xffffffff; + + if (ACPI_SUCCESS(AcpiEvaluateObject (sc->handle, + IBM_NAME_EVENTS_AVAILMASK, &input, &result))) + sc->events_availmask = out_obj.Integer.Value; + break; + default: + device_printf(dev, "Unknown firmware version 0x%x\n", hkey); + break; + } + } else sc->events_availmask = 0xffffffff; SYSCTL_ADD_UINT(sc->sysctl_ctx, - SYSCTL_CHILDREN(sc->sysctl_tree), OID_AUTO, - "availmask", CTLFLAG_RD, - &sc->events_availmask, 0, "Mask of supported events"); + SYSCTL_CHILDREN(sc->sysctl_tree), OID_AUTO, + "availmask", CTLFLAG_RD, + &sc->events_availmask, 0, "Mask of supported events"); } /* Hook up proc nodes */ From owner-svn-src-stable@freebsd.org Thu May 16 00:53:55 2019 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id A1E2115A7C83; Thu, 16 May 2019 00:53:55 +0000 (UTC) (envelope-from gonzo@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 47B2380E5D; Thu, 16 May 2019 00:53:55 +0000 (UTC) (envelope-from gonzo@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 207AE1984E; Thu, 16 May 2019 00:53:55 +0000 (UTC) (envelope-from gonzo@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x4G0rt6i075309; Thu, 16 May 2019 00:53:55 GMT (envelope-from gonzo@FreeBSD.org) Received: (from gonzo@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x4G0rsUg075308; Thu, 16 May 2019 00:53:54 GMT (envelope-from gonzo@FreeBSD.org) Message-Id: <201905160053.x4G0rsUg075308@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: gonzo set sender to gonzo@FreeBSD.org using -f From: Oleksandr Tymoshenko Date: Thu, 16 May 2019 00:53:54 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r347637 - stable/11/sys/kern X-SVN-Group: stable-11 X-SVN-Commit-Author: gonzo X-SVN-Commit-Paths: stable/11/sys/kern X-SVN-Commit-Revision: 347637 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 47B2380E5D X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.96 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.998,0]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; NEURAL_HAM_SHORT(-0.96)[-0.963,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US] X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 16 May 2019 00:53:55 -0000 Author: gonzo Date: Thu May 16 00:53:54 2019 New Revision: 347637 URL: https://svnweb.freebsd.org/changeset/base/347637 Log: MFC r345550: Change default value of kern.bootfile to reflect reality In most cases kernel.bootfile is populated from the information provided by loader(8). There are certain scenarios when loader is not available, for instance when kernel is loaded by u-boot or some other BootROM directly. In this case the default value "/kernel" points to invalid location and breaks some functinality, like using installkernel on self-hosted system or dtrace's CTF lookup. This can be fixed by setting the value manually but the default that reflects correct location is better than default that points to invalid one. Current default was set around FreeBSD 1, when "/kernel" was the actual path. Transition to /boot/kernel/kernel happened circa FreeBSD 3. PR: 221550 Reviewed by: ian, imp Differential Revision: https://reviews.freebsd.org/D18902 Modified: stable/11/sys/kern/kern_mib.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/kern/kern_mib.c ============================================================================== --- stable/11/sys/kern/kern_mib.c Thu May 16 00:51:30 2019 (r347636) +++ stable/11/sys/kern/kern_mib.c Thu May 16 00:53:54 2019 (r347637) @@ -135,7 +135,7 @@ SYSCTL_INT(_kern, KERN_SAVED_IDS, saved_ids, CTLFLAG_R SYSCTL_NULL_INT_PTR, 0, "Whether saved set-group/user ID is available"); #endif -char kernelname[MAXPATHLEN] = "/kernel"; /* XXX bloat */ +char kernelname[MAXPATHLEN] = "/boot/kernel/kernel"; /* XXX bloat */ SYSCTL_STRING(_kern, KERN_BOOTFILE, bootfile, CTLFLAG_RW | CTLFLAG_MPSAFE, kernelname, sizeof kernelname, "Name of kernel file booted"); From owner-svn-src-stable@freebsd.org Thu May 16 03:24:09 2019 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id A7A3815AB590; Thu, 16 May 2019 03:24:09 +0000 (UTC) (envelope-from asomers@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 4ED40868DC; Thu, 16 May 2019 03:24:09 +0000 (UTC) (envelope-from asomers@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 104A21B1F6; Thu, 16 May 2019 03:24:09 +0000 (UTC) (envelope-from asomers@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x4G3O8f9055056; Thu, 16 May 2019 03:24:08 GMT (envelope-from asomers@FreeBSD.org) Received: (from asomers@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x4G3O8Eu055055; Thu, 16 May 2019 03:24:08 GMT (envelope-from asomers@FreeBSD.org) Message-Id: <201905160324.x4G3O8Eu055055@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: asomers set sender to asomers@FreeBSD.org using -f From: Alan Somers Date: Thu, 16 May 2019 03:24:08 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r347643 - stable/11/tools/regression/fsx X-SVN-Group: stable-11 X-SVN-Commit-Author: asomers X-SVN-Commit-Paths: stable/11/tools/regression/fsx X-SVN-Commit-Revision: 347643 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 4ED40868DC X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.96 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.998,0]; NEURAL_HAM_SHORT(-0.96)[-0.963,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US]; NEURAL_HAM_LONG(-1.00)[-1.000,0] X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 16 May 2019 03:24:10 -0000 Author: asomers Date: Thu May 16 03:24:08 2019 New Revision: 347643 URL: https://svnweb.freebsd.org/changeset/base/347643 Log: MFC r346847: fsx: seed more randomly with the -S0 option When using -S0, seed the PRNG with the current time in nanoseconds, not seconds, so consecutive runs don't accidentally use the same seed. Also, rename some variables for clarity. Reviewed by: ngie Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D20078 Modified: stable/11/tools/regression/fsx/fsx.c Directory Properties: stable/11/ (props changed) Modified: stable/11/tools/regression/fsx/fsx.c ============================================================================== --- stable/11/tools/regression/fsx/fsx.c Thu May 16 02:41:25 2019 (r347642) +++ stable/11/tools/regression/fsx/fsx.c Thu May 16 03:24:08 2019 (r347643) @@ -48,6 +48,7 @@ # include # include #endif +#include #include #include #ifndef MAP_FILE @@ -274,16 +275,22 @@ logdump(void) prt("\t***RRRR***"); break; case OP_WRITE: - prt("WRITE\t0x%x thru 0x%x\t(0x%x bytes)", - lp->args[0], lp->args[0] + lp->args[1] - 1, - lp->args[1]); - if (lp->args[0] > lp->args[2]) - prt(" HOLE"); - else if (lp->args[0] + lp->args[1] > lp->args[2]) - prt(" EXTEND"); - if ((badoff >= lp->args[0] || badoff >=lp->args[2]) && - badoff < lp->args[0] + lp->args[1]) - prt("\t***WWWW"); + { + int offset = lp->args[0]; + int len = lp->args[1]; + int oldlen = lp->args[2]; + + prt("WRITE\t0x%x thru 0x%x\t(0x%x bytes)", + offset, offset + len - 1, + len); + if (offset > oldlen) + prt(" HOLE"); + else if (offset + len > oldlen) + prt(" EXTEND"); + if ((badoff >= offset || badoff >=oldlen) && + badoff < offset + len) + prt("\t***WWWW"); + } break; case OP_TRUNCATE: down = lp->args[0] < lp->args[1]; @@ -993,6 +1000,7 @@ main(int argc, char **argv) char *endp; char goodfile[1024]; char logfile[1024]; + struct timespec now; goodfile[0] = 0; logfile[0] = 0; @@ -1115,8 +1123,11 @@ main(int argc, char **argv) break; case 'S': seed = getnum(optarg, &endp); - if (seed == 0) - seed = time(0) % 10000; + if (seed == 0) { + if (clock_gettime(CLOCK_REALTIME, &now) != 0) + err(1, "clock_gettime"); + seed = now.tv_nsec % 10000; + } if (!quiet) fprintf(stdout, "Seed set to %d\n", seed); if (seed < 0) @@ -1206,7 +1217,7 @@ main(int argc, char **argv) prterr(fname); warn("main: error on write"); } else - warn("main: short write, 0x%x bytes instead of 0x%x\n", + warn("main: short write, 0x%x bytes instead of 0x%lx\n", (unsigned)written, maxfilelen); exit(98); } From owner-svn-src-stable@freebsd.org Thu May 16 03:30:37 2019 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id AD0D015AB88D; Thu, 16 May 2019 03:30:37 +0000 (UTC) (envelope-from asomers@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 533F986CA6; Thu, 16 May 2019 03:30:37 +0000 (UTC) (envelope-from asomers@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 2F39D1B205; Thu, 16 May 2019 03:30:37 +0000 (UTC) (envelope-from asomers@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x4G3Uaw9055393; Thu, 16 May 2019 03:30:36 GMT (envelope-from asomers@FreeBSD.org) Received: (from asomers@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x4G3Ua0V055392; Thu, 16 May 2019 03:30:36 GMT (envelope-from asomers@FreeBSD.org) Message-Id: <201905160330.x4G3Ua0V055392@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: asomers set sender to asomers@FreeBSD.org using -f From: Alan Somers Date: Thu, 16 May 2019 03:30:36 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r347644 - stable/11/lib/libc/gen X-SVN-Group: stable-11 X-SVN-Commit-Author: asomers X-SVN-Commit-Paths: stable/11/lib/libc/gen X-SVN-Commit-Revision: 347644 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 533F986CA6 X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.96 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.998,0]; NEURAL_HAM_SHORT(-0.96)[-0.960,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US]; NEURAL_HAM_LONG(-1.00)[-1.000,0] X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 16 May 2019 03:30:37 -0000 Author: asomers Date: Thu May 16 03:30:36 2019 New Revision: 347644 URL: https://svnweb.freebsd.org/changeset/base/347644 Log: MFC r347032 (except for the part about d_off): directory.3: add a STANDARDS section Reviewed by: jilles, ngie Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D20111 Modified: stable/11/lib/libc/gen/directory.3 Directory Properties: stable/11/ (props changed) Modified: stable/11/lib/libc/gen/directory.3 ============================================================================== --- stable/11/lib/libc/gen/directory.3 Thu May 16 03:24:08 2019 (r347643) +++ stable/11/lib/libc/gen/directory.3 Thu May 16 03:30:36 2019 (r347644) @@ -28,7 +28,7 @@ .\" @(#)directory.3 8.1 (Berkeley) 6/4/93 .\" $FreeBSD$ .\" -.Dd August 31, 2016 +.Dd April 30, 2019 .Dt DIRECTORY 3 .Os .Sh NAME @@ -264,6 +264,29 @@ return (NOT_FOUND); .Xr open 2 , .Xr read 2 , .Xr dir 5 +.Sh STANDARDS +The +.Fn closedir , +.Fn dirfd , +.Fn fdopendir , +.Fn opendir , +.Fn readdir , +.Fn readdir_r , +.Fn rewinddir , +.Fn seekdir +and +.Fn telldir +functions are expected to conform to +.St -p1003.1-2008 . +The +.Fn fdclosedir +function and the +.Fa d_reclen +and +.Fa d_type +fields of +.Vt struct dirent +are non-standard, and should not be used in portable programs. .Sh HISTORY The .Fn opendir , From owner-svn-src-stable@freebsd.org Thu May 16 08:15:55 2019 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 349B81588268; Thu, 16 May 2019 08:15:55 +0000 (UTC) (envelope-from tuexen@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 CAD688E8CC; Thu, 16 May 2019 08:15:54 +0000 (UTC) (envelope-from tuexen@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 A064B1E2B4; Thu, 16 May 2019 08:15:54 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x4G8FsxS007281; Thu, 16 May 2019 08:15:54 GMT (envelope-from tuexen@FreeBSD.org) Received: (from tuexen@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x4G8FsXD007280; Thu, 16 May 2019 08:15:54 GMT (envelope-from tuexen@FreeBSD.org) Message-Id: <201905160815.x4G8FsXD007280@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: tuexen set sender to tuexen@FreeBSD.org using -f From: Michael Tuexen Date: Thu, 16 May 2019 08:15:54 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r347647 - stable/11/sys/netinet X-SVN-Group: stable-11 X-SVN-Commit-Author: tuexen X-SVN-Commit-Paths: stable/11/sys/netinet X-SVN-Commit-Revision: 347647 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: CAD688E8CC X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.94 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.998,0]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; NEURAL_HAM_SHORT(-0.94)[-0.942,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US] X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 16 May 2019 08:15:55 -0000 Author: tuexen Date: Thu May 16 08:15:54 2019 New Revision: 347647 URL: https://svnweb.freebsd.org/changeset/base/347647 Log: MFC r339022: Increment the corresponding UDP stats counter (udps_opackets) when sending UDP encapsulated SCTP packets. This is consistent with the behaviour that when such packets are received, the corresponding UDP stats counter (udps_ipackets) is incremented. Thanks to Peter Lei for making me aware of this inconsistency. Modified: stable/11/sys/netinet/sctp_output.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/netinet/sctp_output.c ============================================================================== --- stable/11/sys/netinet/sctp_output.c Thu May 16 05:29:54 2019 (r347646) +++ stable/11/sys/netinet/sctp_output.c Thu May 16 08:15:54 2019 (r347647) @@ -4259,6 +4259,9 @@ sctp_lowlevel_chunk_output(struct sctp_inpcb *inp, atomic_subtract_int(&stcb->asoc.refcnt, 1); } #endif + if (port) { + UDPSTAT_INC(udps_opackets); + } SCTP_STAT_INCR(sctps_sendpackets); SCTP_STAT_INCR_COUNTER64(sctps_outpackets); if (ret) @@ -4598,6 +4601,9 @@ sctp_lowlevel_chunk_output(struct sctp_inpcb *inp, sin6->sin6_port = prev_port; } SCTPDBG(SCTP_DEBUG_OUTPUT3, "return from send is %d\n", ret); + if (port) { + UDPSTAT_INC(udps_opackets); + } SCTP_STAT_INCR(sctps_sendpackets); SCTP_STAT_INCR_COUNTER64(sctps_outpackets); if (ret) { @@ -11284,6 +11290,9 @@ sctp_send_resp_msg(struct sockaddr *src, struct sockad return; } SCTPDBG(SCTP_DEBUG_OUTPUT3, "return from send is %d\n", ret); + if (port) { + UDPSTAT_INC(udps_opackets); + } SCTP_STAT_INCR(sctps_sendpackets); SCTP_STAT_INCR_COUNTER64(sctps_outpackets); SCTP_STAT_INCR_COUNTER64(sctps_outcontrolchunks); From owner-svn-src-stable@freebsd.org Thu May 16 08:17:33 2019 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id CE98E1588291; Thu, 16 May 2019 08:17:33 +0000 (UTC) (envelope-from tuexen@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 72CF98E9CC; Thu, 16 May 2019 08:17:33 +0000 (UTC) (envelope-from tuexen@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 4B19D1E2B6; Thu, 16 May 2019 08:17:33 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x4G8HXFB007400; Thu, 16 May 2019 08:17:33 GMT (envelope-from tuexen@FreeBSD.org) Received: (from tuexen@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x4G8HXGS007399; Thu, 16 May 2019 08:17:33 GMT (envelope-from tuexen@FreeBSD.org) Message-Id: <201905160817.x4G8HXGS007399@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: tuexen set sender to tuexen@FreeBSD.org using -f From: Michael Tuexen Date: Thu, 16 May 2019 08:17:33 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r347648 - stable/11/sys/netinet X-SVN-Group: stable-11 X-SVN-Commit-Author: tuexen X-SVN-Commit-Paths: stable/11/sys/netinet X-SVN-Commit-Revision: 347648 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 72CF98E9CC X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.94 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.998,0]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; NEURAL_HAM_SHORT(-0.94)[-0.943,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US] X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 16 May 2019 08:17:34 -0000 Author: tuexen Date: Thu May 16 08:17:32 2019 New Revision: 347648 URL: https://svnweb.freebsd.org/changeset/base/347648 Log: MFC r339024: Fix the handling of ancillary data for SCTP socket. Implement sctp_process_cmsgs_for_init() and sctp_findassociation_cmsgs() similar to sctp_find_cmsg() to improve consistency and avoid the signed/unsigned issues in sctp_process_cmsgs_for_init() and sctp_findassociation_cmsgs(). Thanks to andrew@ for reporting the problem he found using syzcaller. Modified: stable/11/sys/netinet/sctp_output.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/netinet/sctp_output.c ============================================================================== --- stable/11/sys/netinet/sctp_output.c Thu May 16 08:15:54 2019 (r347647) +++ stable/11/sys/netinet/sctp_output.c Thu May 16 08:17:32 2019 (r347648) @@ -3569,7 +3569,6 @@ static int sctp_process_cmsgs_for_init(struct sctp_tcb *stcb, struct mbuf *control, int *error) { struct cmsghdr cmh; - int tlen, at; struct sctp_initmsg initmsg; #ifdef INET struct sockaddr_in sin; @@ -3577,34 +3576,37 @@ sctp_process_cmsgs_for_init(struct sctp_tcb *stcb, str #ifdef INET6 struct sockaddr_in6 sin6; #endif + int tot_len, rem_len, cmsg_data_len, cmsg_data_off, off; - tlen = SCTP_BUF_LEN(control); - at = 0; - while (at < tlen) { - if ((tlen - at) < (int)CMSG_ALIGN(sizeof(cmh))) { + tot_len = SCTP_BUF_LEN(control); + for (off = 0; off < tot_len; off += CMSG_ALIGN(cmh.cmsg_len)) { + rem_len = tot_len - off; + if (rem_len < (int)CMSG_ALIGN(sizeof(cmh))) { /* There is not enough room for one more. */ *error = EINVAL; return (1); } - m_copydata(control, at, sizeof(cmh), (caddr_t)&cmh); + m_copydata(control, off, sizeof(cmh), (caddr_t)&cmh); if (cmh.cmsg_len < CMSG_ALIGN(sizeof(cmh))) { /* We dont't have a complete CMSG header. */ *error = EINVAL; return (1); } - if (((int)cmh.cmsg_len + at) > tlen) { + if ((cmh.cmsg_len > INT_MAX) || ((int)cmh.cmsg_len > rem_len)) { /* We don't have the complete CMSG. */ *error = EINVAL; return (1); } + cmsg_data_len = (int)cmh.cmsg_len - CMSG_ALIGN(sizeof(cmh)); + cmsg_data_off = off + CMSG_ALIGN(sizeof(cmh)); if (cmh.cmsg_level == IPPROTO_SCTP) { switch (cmh.cmsg_type) { case SCTP_INIT: - if ((size_t)(cmh.cmsg_len - CMSG_ALIGN(sizeof(cmh))) < sizeof(struct sctp_initmsg)) { + if (cmsg_data_len < (int)sizeof(struct sctp_initmsg)) { *error = EINVAL; return (1); } - m_copydata(control, at + CMSG_ALIGN(sizeof(cmh)), sizeof(struct sctp_initmsg), (caddr_t)&initmsg); + m_copydata(control, cmsg_data_off, sizeof(struct sctp_initmsg), (caddr_t)&initmsg); if (initmsg.sinit_max_attempts) stcb->asoc.max_init_times = initmsg.sinit_max_attempts; if (initmsg.sinit_num_ostreams) @@ -3659,7 +3661,7 @@ sctp_process_cmsgs_for_init(struct sctp_tcb *stcb, str break; #ifdef INET case SCTP_DSTADDRV4: - if ((size_t)(cmh.cmsg_len - CMSG_ALIGN(sizeof(cmh))) < sizeof(struct in_addr)) { + if (cmsg_data_len < (int)sizeof(struct in_addr)) { *error = EINVAL; return (1); } @@ -3667,7 +3669,7 @@ sctp_process_cmsgs_for_init(struct sctp_tcb *stcb, str sin.sin_family = AF_INET; sin.sin_len = sizeof(struct sockaddr_in); sin.sin_port = stcb->rport; - m_copydata(control, at + CMSG_ALIGN(sizeof(cmh)), sizeof(struct in_addr), (caddr_t)&sin.sin_addr); + m_copydata(control, cmsg_data_off, sizeof(struct in_addr), (caddr_t)&sin.sin_addr); if ((sin.sin_addr.s_addr == INADDR_ANY) || (sin.sin_addr.s_addr == INADDR_BROADCAST) || IN_MULTICAST(ntohl(sin.sin_addr.s_addr))) { @@ -3683,7 +3685,7 @@ sctp_process_cmsgs_for_init(struct sctp_tcb *stcb, str #endif #ifdef INET6 case SCTP_DSTADDRV6: - if ((size_t)(cmh.cmsg_len - CMSG_ALIGN(sizeof(cmh))) < sizeof(struct in6_addr)) { + if (cmsg_data_len < (int)sizeof(struct in6_addr)) { *error = EINVAL; return (1); } @@ -3691,7 +3693,7 @@ sctp_process_cmsgs_for_init(struct sctp_tcb *stcb, str sin6.sin6_family = AF_INET6; sin6.sin6_len = sizeof(struct sockaddr_in6); sin6.sin6_port = stcb->rport; - m_copydata(control, at + CMSG_ALIGN(sizeof(cmh)), sizeof(struct in6_addr), (caddr_t)&sin6.sin6_addr); + m_copydata(control, cmsg_data_off, sizeof(struct in6_addr), (caddr_t)&sin6.sin6_addr); if (IN6_IS_ADDR_UNSPECIFIED(&sin6.sin6_addr) || IN6_IS_ADDR_MULTICAST(&sin6.sin6_addr)) { *error = EINVAL; @@ -3724,7 +3726,6 @@ sctp_process_cmsgs_for_init(struct sctp_tcb *stcb, str break; } } - at += CMSG_ALIGN(cmh.cmsg_len); } return (0); } @@ -3737,7 +3738,6 @@ sctp_findassociation_cmsgs(struct sctp_inpcb **inp_p, int *error) { struct cmsghdr cmh; - int tlen, at; struct sctp_tcb *stcb; struct sockaddr *addr; #ifdef INET @@ -3746,31 +3746,34 @@ sctp_findassociation_cmsgs(struct sctp_inpcb **inp_p, #ifdef INET6 struct sockaddr_in6 sin6; #endif + int tot_len, rem_len, cmsg_data_len, cmsg_data_off, off; - tlen = SCTP_BUF_LEN(control); - at = 0; - while (at < tlen) { - if ((tlen - at) < (int)CMSG_ALIGN(sizeof(cmh))) { + tot_len = SCTP_BUF_LEN(control); + for (off = 0; off < tot_len; off += CMSG_ALIGN(cmh.cmsg_len)) { + rem_len = tot_len - off; + if (rem_len < (int)CMSG_ALIGN(sizeof(cmh))) { /* There is not enough room for one more. */ *error = EINVAL; return (NULL); } - m_copydata(control, at, sizeof(cmh), (caddr_t)&cmh); + m_copydata(control, off, sizeof(cmh), (caddr_t)&cmh); if (cmh.cmsg_len < CMSG_ALIGN(sizeof(cmh))) { /* We dont't have a complete CMSG header. */ *error = EINVAL; return (NULL); } - if (((int)cmh.cmsg_len + at) > tlen) { + if ((cmh.cmsg_len > INT_MAX) || ((int)cmh.cmsg_len > rem_len)) { /* We don't have the complete CMSG. */ *error = EINVAL; return (NULL); } + cmsg_data_len = (int)cmh.cmsg_len - CMSG_ALIGN(sizeof(cmh)); + cmsg_data_off = off + CMSG_ALIGN(sizeof(cmh)); if (cmh.cmsg_level == IPPROTO_SCTP) { switch (cmh.cmsg_type) { #ifdef INET case SCTP_DSTADDRV4: - if ((size_t)(cmh.cmsg_len - CMSG_ALIGN(sizeof(cmh))) < sizeof(struct in_addr)) { + if (cmsg_data_len < (int)sizeof(struct in_addr)) { *error = EINVAL; return (NULL); } @@ -3778,13 +3781,13 @@ sctp_findassociation_cmsgs(struct sctp_inpcb **inp_p, sin.sin_family = AF_INET; sin.sin_len = sizeof(struct sockaddr_in); sin.sin_port = port; - m_copydata(control, at + CMSG_ALIGN(sizeof(cmh)), sizeof(struct in_addr), (caddr_t)&sin.sin_addr); + m_copydata(control, cmsg_data_off, sizeof(struct in_addr), (caddr_t)&sin.sin_addr); addr = (struct sockaddr *)&sin; break; #endif #ifdef INET6 case SCTP_DSTADDRV6: - if ((size_t)(cmh.cmsg_len - CMSG_ALIGN(sizeof(cmh))) < sizeof(struct in6_addr)) { + if (cmsg_data_len < (int)sizeof(struct in6_addr)) { *error = EINVAL; return (NULL); } @@ -3792,7 +3795,7 @@ sctp_findassociation_cmsgs(struct sctp_inpcb **inp_p, sin6.sin6_family = AF_INET6; sin6.sin6_len = sizeof(struct sockaddr_in6); sin6.sin6_port = port; - m_copydata(control, at + CMSG_ALIGN(sizeof(cmh)), sizeof(struct in6_addr), (caddr_t)&sin6.sin6_addr); + m_copydata(control, cmsg_data_off, sizeof(struct in6_addr), (caddr_t)&sin6.sin6_addr); #ifdef INET if (IN6_IS_ADDR_V4MAPPED(&sin6.sin6_addr)) { in6_sin6_2_sin(&sin, &sin6); @@ -3813,7 +3816,6 @@ sctp_findassociation_cmsgs(struct sctp_inpcb **inp_p, } } } - at += CMSG_ALIGN(cmh.cmsg_len); } return (NULL); } From owner-svn-src-stable@freebsd.org Thu May 16 08:21:02 2019 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id DD1121588461; Thu, 16 May 2019 08:21:02 +0000 (UTC) (envelope-from tuexen@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 8445B8ED40; Thu, 16 May 2019 08:21:02 +0000 (UTC) (envelope-from tuexen@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 5EB371E2E4; Thu, 16 May 2019 08:21:02 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x4G8L2bO011625; Thu, 16 May 2019 08:21:02 GMT (envelope-from tuexen@FreeBSD.org) Received: (from tuexen@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x4G8L2SX011624; Thu, 16 May 2019 08:21:02 GMT (envelope-from tuexen@FreeBSD.org) Message-Id: <201905160821.x4G8L2SX011624@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: tuexen set sender to tuexen@FreeBSD.org using -f From: Michael Tuexen Date: Thu, 16 May 2019 08:21:02 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r347650 - stable/11/sys/netinet X-SVN-Group: stable-11 X-SVN-Commit-Author: tuexen X-SVN-Commit-Paths: stable/11/sys/netinet X-SVN-Commit-Revision: 347650 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 8445B8ED40 X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.94 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.998,0]; NEURAL_HAM_SHORT(-0.94)[-0.942,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US]; NEURAL_HAM_LONG(-1.00)[-1.000,0] X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 16 May 2019 08:21:03 -0000 Author: tuexen Date: Thu May 16 08:21:01 2019 New Revision: 347650 URL: https://svnweb.freebsd.org/changeset/base/347650 Log: MFC r339028: Plug mbuf leak in the SCTP input path in an error case. Modified: stable/11/sys/netinet/sctp_asconf.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/netinet/sctp_asconf.c ============================================================================== --- stable/11/sys/netinet/sctp_asconf.c Thu May 16 08:19:23 2019 (r347649) +++ stable/11/sys/netinet/sctp_asconf.c Thu May 16 08:21:01 2019 (r347650) @@ -668,6 +668,7 @@ sctp_handle_asconf(struct mbuf *m, unsigned int offset SCTPDBG(SCTP_DEBUG_ASCONF1, "handle_asconf: couldn't get lookup addr!\n"); /* respond with a missing/invalid mandatory parameter error */ + sctp_m_freem(m_ack); return; } /* param_length is already validated in process_control... */ From owner-svn-src-stable@freebsd.org Thu May 16 08:19:24 2019 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 46DD615883A0; Thu, 16 May 2019 08:19:24 +0000 (UTC) (envelope-from tuexen@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 E27FD8EB79; Thu, 16 May 2019 08:19:23 +0000 (UTC) (envelope-from tuexen@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 B96271E2B7; Thu, 16 May 2019 08:19:23 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x4G8JNlT007522; Thu, 16 May 2019 08:19:23 GMT (envelope-from tuexen@FreeBSD.org) Received: (from tuexen@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x4G8JN6Y007521; Thu, 16 May 2019 08:19:23 GMT (envelope-from tuexen@FreeBSD.org) Message-Id: <201905160819.x4G8JN6Y007521@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: tuexen set sender to tuexen@FreeBSD.org using -f From: Michael Tuexen Date: Thu, 16 May 2019 08:19:23 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r347649 - stable/11/sys/netinet X-SVN-Group: stable-11 X-SVN-Commit-Author: tuexen X-SVN-Commit-Paths: stable/11/sys/netinet X-SVN-Commit-Revision: 347649 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: E27FD8EB79 X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.94 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.998,0]; NEURAL_HAM_SHORT(-0.94)[-0.942,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US]; NEURAL_HAM_LONG(-1.00)[-1.000,0] X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 16 May 2019 08:19:24 -0000 Author: tuexen Date: Thu May 16 08:19:23 2019 New Revision: 347649 URL: https://svnweb.freebsd.org/changeset/base/347649 Log: MFC r339027: Plug mbuf leaks in the SCTP output path in error cases. Modified: stable/11/sys/netinet/sctp_output.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/netinet/sctp_output.c ============================================================================== --- stable/11/sys/netinet/sctp_output.c Thu May 16 08:17:32 2019 (r347648) +++ stable/11/sys/netinet/sctp_output.c Thu May 16 08:19:23 2019 (r347649) @@ -4363,6 +4363,7 @@ sctp_lowlevel_chunk_output(struct sctp_inpcb *inp, /* KAME hack: embed scopeid */ if (sa6_embedscope(sin6, MODULE_GLOBAL(ip6_use_defzone)) != 0) { SCTP_LTRACE_ERR_RET_PKT(m, inp, stcb, net, SCTP_FROM_SCTP_OUTPUT, EINVAL); + sctp_m_freem(m); return (EINVAL); } if (net == NULL) { @@ -4427,6 +4428,7 @@ sctp_lowlevel_chunk_output(struct sctp_inpcb *inp, /* KAME hack: embed scopeid */ if (sa6_embedscope(sin6, MODULE_GLOBAL(ip6_use_defzone)) != 0) { SCTP_LTRACE_ERR_RET_PKT(m, inp, stcb, net, SCTP_FROM_SCTP_OUTPUT, EINVAL); + sctp_m_freem(m); return (EINVAL); } /* Cache the source address */ @@ -4453,6 +4455,7 @@ sctp_lowlevel_chunk_output(struct sctp_inpcb *inp, /* KAME hack: embed scopeid */ if (sa6_embedscope(sin6, MODULE_GLOBAL(ip6_use_defzone)) != 0) { SCTP_LTRACE_ERR_RET_PKT(m, inp, stcb, net, SCTP_FROM_SCTP_OUTPUT, EINVAL); + sctp_m_freem(m); return (EINVAL); } if (over_addr == NULL) { From owner-svn-src-stable@freebsd.org Thu May 16 08:22:52 2019 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id E730F1588685; Thu, 16 May 2019 08:22:51 +0000 (UTC) (envelope-from tuexen@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 6E3668F09A; Thu, 16 May 2019 08:22:51 +0000 (UTC) (envelope-from tuexen@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 499221E45B; Thu, 16 May 2019 08:22:51 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x4G8MpTN012705; Thu, 16 May 2019 08:22:51 GMT (envelope-from tuexen@FreeBSD.org) Received: (from tuexen@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x4G8MpcC012704; Thu, 16 May 2019 08:22:51 GMT (envelope-from tuexen@FreeBSD.org) Message-Id: <201905160822.x4G8MpcC012704@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: tuexen set sender to tuexen@FreeBSD.org using -f From: Michael Tuexen Date: Thu, 16 May 2019 08:22:51 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r347651 - stable/11/sys/netinet X-SVN-Group: stable-11 X-SVN-Commit-Author: tuexen X-SVN-Commit-Paths: stable/11/sys/netinet X-SVN-Commit-Revision: 347651 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 6E3668F09A X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.94 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.998,0]; NEURAL_HAM_SHORT(-0.94)[-0.942,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US]; NEURAL_HAM_LONG(-1.00)[-1.000,0] X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 16 May 2019 08:22:52 -0000 Author: tuexen Date: Thu May 16 08:22:50 2019 New Revision: 347651 URL: https://svnweb.freebsd.org/changeset/base/347651 Log: MFC r339040: After allocating chunks set the fields in a consistent way. This removes two assignments for the flags field being done twice and adds one, which was missing. Thanks to Felix Weinrank for reporting the issue he found by using fuzz testing of the userland stack. Modified: stable/11/sys/netinet/sctp_output.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/netinet/sctp_output.c ============================================================================== --- stable/11/sys/netinet/sctp_output.c Thu May 16 08:21:01 2019 (r347650) +++ stable/11/sys/netinet/sctp_output.c Thu May 16 08:22:50 2019 (r347651) @@ -8971,14 +8971,15 @@ sctp_queue_op_err(struct sctp_tcb *stcb, struct mbuf * return; } chk->copy_by_ref = 0; + chk->rec.chunk_id.id = SCTP_OPERATION_ERROR; + chk->rec.chunk_id.can_take_data = 0; + chk->flags = 0; chk->send_size = (uint16_t)chunk_length; chk->sent = SCTP_DATAGRAM_UNSENT; chk->snd_count = 0; chk->asoc = &stcb->asoc; chk->data = op_err; chk->whoTo = NULL; - chk->rec.chunk_id.id = SCTP_OPERATION_ERROR; - chk->rec.chunk_id.can_take_data = 0; hdr = mtod(op_err, struct sctp_chunkhdr *); hdr->chunk_type = SCTP_OPERATION_ERROR; hdr->chunk_flags = 0; @@ -9200,7 +9201,6 @@ sctp_send_shutdown_ack(struct sctp_tcb *stcb, struct s chk->send_size = sizeof(struct sctp_chunkhdr); chk->sent = SCTP_DATAGRAM_UNSENT; chk->snd_count = 0; - chk->flags = 0; chk->asoc = &stcb->asoc; chk->data = m_shutdown_ack; chk->whoTo = net; @@ -9255,7 +9255,6 @@ sctp_send_shutdown(struct sctp_tcb *stcb, struct sctp_ chk->send_size = sizeof(struct sctp_shutdown_chunk); chk->sent = SCTP_DATAGRAM_UNSENT; chk->snd_count = 0; - chk->flags = 0; chk->asoc = &stcb->asoc; chk->data = m_shutdown; chk->whoTo = net; @@ -12162,7 +12161,6 @@ sctp_send_str_reset_req(struct sctp_tcb *stcb, chk->book_size = sizeof(struct sctp_chunkhdr); chk->send_size = SCTP_SIZE32(chk->book_size); chk->book_size_scale = 0; - chk->data = sctp_get_mbuf_for_msg(MCLBYTES, 0, M_NOWAIT, 1, MT_DATA); if (chk->data == NULL) { sctp_free_a_chunk(stcb, chk, SCTP_SO_LOCKED); From owner-svn-src-stable@freebsd.org Thu May 16 08:24:54 2019 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id F3B5A15887B4; Thu, 16 May 2019 08:24:53 +0000 (UTC) (envelope-from tuexen@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 9757E8F25D; Thu, 16 May 2019 08:24:53 +0000 (UTC) (envelope-from tuexen@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 71EDD1E45D; Thu, 16 May 2019 08:24:53 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x4G8OrRM012845; Thu, 16 May 2019 08:24:53 GMT (envelope-from tuexen@FreeBSD.org) Received: (from tuexen@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x4G8OrO2012844; Thu, 16 May 2019 08:24:53 GMT (envelope-from tuexen@FreeBSD.org) Message-Id: <201905160824.x4G8OrO2012844@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: tuexen set sender to tuexen@FreeBSD.org using -f From: Michael Tuexen Date: Thu, 16 May 2019 08:24:53 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r347652 - stable/11/sys/netinet X-SVN-Group: stable-11 X-SVN-Commit-Author: tuexen X-SVN-Commit-Paths: stable/11/sys/netinet X-SVN-Commit-Revision: 347652 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 9757E8F25D X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.94 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.998,0]; NEURAL_HAM_SHORT(-0.94)[-0.942,0]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US] X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 16 May 2019 08:24:54 -0000 Author: tuexen Date: Thu May 16 08:24:53 2019 New Revision: 347652 URL: https://svnweb.freebsd.org/changeset/base/347652 Log: MFC r339219: Ensure that the ips_localout counter is incremented for locally generated SCTP packets sent over IPv4. This make the behaviour consistent with IPv6. Modified: stable/11/sys/netinet/ip_output.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/netinet/ip_output.c ============================================================================== --- stable/11/sys/netinet/ip_output.c Thu May 16 08:22:50 2019 (r347651) +++ stable/11/sys/netinet/ip_output.c Thu May 16 08:24:53 2019 (r347652) @@ -262,11 +262,12 @@ ip_output(struct mbuf *m, struct mbuf *opt, struct rou ip->ip_v = IPVERSION; ip->ip_hl = hlen >> 2; ip_fillid(ip); - IPSTAT_INC(ips_localout); } else { /* Header already set, fetch hlen from there */ hlen = ip->ip_hl << 2; } + if ((flags & IP_FORWARDING) == 0) + IPSTAT_INC(ips_localout); /* * dst/gw handling: From owner-svn-src-stable@freebsd.org Thu May 16 08:26:46 2019 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id D4480158892E; Thu, 16 May 2019 08:26:45 +0000 (UTC) (envelope-from tuexen@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 7C1D88F445; Thu, 16 May 2019 08:26:45 +0000 (UTC) (envelope-from tuexen@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 580D81E45F; Thu, 16 May 2019 08:26:45 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x4G8Qj7V012987; Thu, 16 May 2019 08:26:45 GMT (envelope-from tuexen@FreeBSD.org) Received: (from tuexen@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x4G8Qj7R012986; Thu, 16 May 2019 08:26:45 GMT (envelope-from tuexen@FreeBSD.org) Message-Id: <201905160826.x4G8Qj7R012986@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: tuexen set sender to tuexen@FreeBSD.org using -f From: Michael Tuexen Date: Thu, 16 May 2019 08:26:45 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r347653 - stable/11/sys/netinet X-SVN-Group: stable-11 X-SVN-Commit-Author: tuexen X-SVN-Commit-Paths: stable/11/sys/netinet X-SVN-Commit-Revision: 347653 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 7C1D88F445 X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.94 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.998,0]; NEURAL_HAM_SHORT(-0.94)[-0.943,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US]; NEURAL_HAM_LONG(-1.00)[-1.000,0] X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 16 May 2019 08:26:46 -0000 Author: tuexen Date: Thu May 16 08:26:44 2019 New Revision: 347653 URL: https://svnweb.freebsd.org/changeset/base/347653 Log: MFC r339221: Avoid truncating unrecognised parameters when reporting them. This resulted in sending malformed packets. Modified: stable/11/sys/netinet/sctp_output.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/netinet/sctp_output.c ============================================================================== --- stable/11/sys/netinet/sctp_output.c Thu May 16 08:24:53 2019 (r347652) +++ stable/11/sys/netinet/sctp_output.c Thu May 16 08:26:44 2019 (r347653) @@ -4978,7 +4978,6 @@ sctp_arethere_unrecognized_parameters(struct mbuf *in_ struct sctp_paramhdr *phdr, params; struct mbuf *mat, *op_err; - char tempbuf[SCTP_PARAM_BUFFER_SIZE]; int at, limit, pad_needed; uint16_t ptype, plen, padded_size; int err_at; @@ -5118,15 +5117,13 @@ sctp_arethere_unrecognized_parameters(struct mbuf *in_ l_len = SCTP_MIN_V4_OVERHEAD; #endif l_len += sizeof(struct sctp_chunkhdr); - l_len += plen; - l_len += sizeof(struct sctp_paramhdr); + l_len += sizeof(struct sctp_gen_error_cause); op_err = sctp_get_mbuf_for_msg(l_len, 0, M_NOWAIT, 1, MT_DATA); if (op_err) { SCTP_BUF_LEN(op_err) = 0; /* - * pre-reserve space for ip - * and sctp header and - * chunk hdr + * Pre-reserve space for IP, + * SCTP, and chunk header. */ #ifdef INET6 SCTP_BUF_RESV_UF(op_err, sizeof(struct ip6_hdr)); @@ -5139,7 +5136,7 @@ sctp_arethere_unrecognized_parameters(struct mbuf *in_ } if (op_err) { /* If we have space */ - struct sctp_paramhdr s; + struct sctp_gen_error_cause cause; if (err_at % 4) { uint32_t cpthis = 0; @@ -5148,26 +5145,15 @@ sctp_arethere_unrecognized_parameters(struct mbuf *in_ m_copyback(op_err, err_at, pad_needed, (caddr_t)&cpthis); err_at += pad_needed; } - s.param_type = htons(SCTP_CAUSE_UNRESOLVABLE_ADDR); - s.param_length = htons(sizeof(s) + plen); - m_copyback(op_err, err_at, sizeof(s), (caddr_t)&s); - err_at += sizeof(s); - if (plen > sizeof(tempbuf)) { - plen = sizeof(tempbuf); - } - phdr = sctp_get_next_param(mat, at, (struct sctp_paramhdr *)tempbuf, plen); - if (phdr == NULL) { + cause.code = htons(SCTP_CAUSE_UNRESOLVABLE_ADDR); + cause.length = htons((uint16_t)(sizeof(struct sctp_gen_error_cause) + plen)); + m_copyback(op_err, err_at, sizeof(struct sctp_gen_error_cause), (caddr_t)&cause); + err_at += sizeof(struct sctp_gen_error_cause); + SCTP_BUF_NEXT(op_err) = SCTP_M_COPYM(mat, at, plen, M_NOWAIT); + if (SCTP_BUF_NEXT(op_err) == NULL) { sctp_m_freem(op_err); - /* - * we are out of memory but - * we still need to have a - * look at what to do (the - * system is in trouble - * though). - */ return (NULL); } - m_copyback(op_err, err_at, plen, (caddr_t)phdr); } return (op_err); break; @@ -5191,7 +5177,6 @@ sctp_arethere_unrecognized_parameters(struct mbuf *in_ l_len = SCTP_MIN_V4_OVERHEAD; #endif l_len += sizeof(struct sctp_chunkhdr); - l_len += plen; l_len += sizeof(struct sctp_paramhdr); op_err = sctp_get_mbuf_for_msg(l_len, 0, M_NOWAIT, 1, MT_DATA); if (op_err) { @@ -5217,14 +5202,11 @@ sctp_arethere_unrecognized_parameters(struct mbuf *in_ err_at += pad_needed; } s.param_type = htons(SCTP_UNRECOG_PARAM); - s.param_length = htons(sizeof(s) + plen); - m_copyback(op_err, err_at, sizeof(s), (caddr_t)&s); - err_at += sizeof(s); - if (plen > sizeof(tempbuf)) { - plen = sizeof(tempbuf); - } - phdr = sctp_get_next_param(mat, at, (struct sctp_paramhdr *)tempbuf, plen); - if (phdr == NULL) { + s.param_length = htons((uint16_t)sizeof(struct sctp_paramhdr) + plen); + m_copyback(op_err, err_at, sizeof(struct sctp_paramhdr), (caddr_t)&s); + err_at += sizeof(struct sctp_paramhdr); + SCTP_BUF_NEXT(op_err) = SCTP_M_COPYM(mat, at, plen, M_NOWAIT); + if (SCTP_BUF_NEXT(op_err) == NULL) { sctp_m_freem(op_err); /* * we are out of memory but @@ -5236,7 +5218,6 @@ sctp_arethere_unrecognized_parameters(struct mbuf *in_ op_err = NULL; goto more_processing; } - m_copyback(op_err, err_at, plen, (caddr_t)phdr); err_at += plen; } } From owner-svn-src-stable@freebsd.org Thu May 16 08:38:21 2019 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 0BD38158A053; Thu, 16 May 2019 08:38:21 +0000 (UTC) (envelope-from tuexen@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 A3BC08FC27; Thu, 16 May 2019 08:38:20 +0000 (UTC) (envelope-from tuexen@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 7A0741E600; Thu, 16 May 2019 08:38:20 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x4G8cKV1018366; Thu, 16 May 2019 08:38:20 GMT (envelope-from tuexen@FreeBSD.org) Received: (from tuexen@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x4G8cKaJ018365; Thu, 16 May 2019 08:38:20 GMT (envelope-from tuexen@FreeBSD.org) Message-Id: <201905160838.x4G8cKaJ018365@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: tuexen set sender to tuexen@FreeBSD.org using -f From: Michael Tuexen Date: Thu, 16 May 2019 08:38:20 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r347654 - stable/11/sys/netinet X-SVN-Group: stable-11 X-SVN-Commit-Author: tuexen X-SVN-Commit-Paths: stable/11/sys/netinet X-SVN-Commit-Revision: 347654 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: A3BC08FC27 X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.97 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.998,0]; NEURAL_HAM_SHORT(-0.97)[-0.974,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US]; NEURAL_HAM_LONG(-1.00)[-1.000,0] X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 16 May 2019 08:38:21 -0000 Author: tuexen Date: Thu May 16 08:38:20 2019 New Revision: 347654 URL: https://svnweb.freebsd.org/changeset/base/347654 Log: MFC r343769: Fix an off-by-one error in the input validation of the SCTP_RESET_STREAMS socketoption. This was found by running syzkaller. Modified: stable/11/sys/netinet/sctp_usrreq.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/netinet/sctp_usrreq.c ============================================================================== --- stable/11/sys/netinet/sctp_usrreq.c Thu May 16 08:26:44 2019 (r347653) +++ stable/11/sys/netinet/sctp_usrreq.c Thu May 16 08:38:20 2019 (r347654) @@ -4654,13 +4654,13 @@ sctp_setopt(struct socket *so, int optname, void *optv } for (i = 0; i < strrst->srs_number_streams; i++) { if ((send_in) && - (strrst->srs_stream_list[i] > stcb->asoc.streamincnt)) { + (strrst->srs_stream_list[i] >= stcb->asoc.streamincnt)) { SCTP_LTRACE_ERR_RET(inp, NULL, NULL, SCTP_FROM_SCTP_USRREQ, EINVAL); error = EINVAL; break; } if ((send_out) && - (strrst->srs_stream_list[i] > stcb->asoc.streamoutcnt)) { + (strrst->srs_stream_list[i] >= stcb->asoc.streamoutcnt)) { SCTP_LTRACE_ERR_RET(inp, NULL, NULL, SCTP_FROM_SCTP_USRREQ, EINVAL); error = EINVAL; break; From owner-svn-src-stable@freebsd.org Thu May 16 08:40:12 2019 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id F1D4F158A10C; Thu, 16 May 2019 08:40:11 +0000 (UTC) (envelope-from tuexen@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 970FE8FD6D; Thu, 16 May 2019 08:40:11 +0000 (UTC) (envelope-from tuexen@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 6E8051E604; Thu, 16 May 2019 08:40:11 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x4G8eBSU018534; Thu, 16 May 2019 08:40:11 GMT (envelope-from tuexen@FreeBSD.org) Received: (from tuexen@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x4G8eBCu018533; Thu, 16 May 2019 08:40:11 GMT (envelope-from tuexen@FreeBSD.org) Message-Id: <201905160840.x4G8eBCu018533@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: tuexen set sender to tuexen@FreeBSD.org using -f From: Michael Tuexen Date: Thu, 16 May 2019 08:40:11 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r347655 - stable/11/sys/netinet X-SVN-Group: stable-11 X-SVN-Commit-Author: tuexen X-SVN-Commit-Paths: stable/11/sys/netinet X-SVN-Commit-Revision: 347655 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 970FE8FD6D X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.97 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.998,0]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; NEURAL_HAM_SHORT(-0.97)[-0.974,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US] X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 16 May 2019 08:40:12 -0000 Author: tuexen Date: Thu May 16 08:40:10 2019 New Revision: 347655 URL: https://svnweb.freebsd.org/changeset/base/347655 Log: MFC r343770: Only reduce the PMTU after the send call. The only way to increase it, is via PMTUD. This fixes an MTU issue reported by Timo Voelker. Modified: stable/11/sys/netinet/sctp_output.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/netinet/sctp_output.c ============================================================================== --- stable/11/sys/netinet/sctp_output.c Thu May 16 08:38:20 2019 (r347654) +++ stable/11/sys/netinet/sctp_output.c Thu May 16 08:40:10 2019 (r347655) @@ -4283,10 +4283,12 @@ sctp_lowlevel_chunk_output(struct sctp_inpcb *inp, if (net->port) { mtu -= sizeof(struct udphdr); } - if ((stcb != NULL) && (stcb->asoc.smallest_mtu > mtu)) { - sctp_mtu_size_reset(inp, &stcb->asoc, mtu); + if (mtu < net->mtu) { + if ((stcb != NULL) && (stcb->asoc.smallest_mtu > mtu)) { + sctp_mtu_size_reset(inp, &stcb->asoc, mtu); + } + net->mtu = mtu; } - net->mtu = mtu; } } else if (ro->ro_rt == NULL) { /* route was freed */ @@ -4640,10 +4642,12 @@ sctp_lowlevel_chunk_output(struct sctp_inpcb *inp, if (net->port) { mtu -= sizeof(struct udphdr); } - if ((stcb != NULL) && (stcb->asoc.smallest_mtu > mtu)) { - sctp_mtu_size_reset(inp, &stcb->asoc, mtu); + if (mtu < net->mtu) { + if ((stcb != NULL) && (stcb->asoc.smallest_mtu > mtu)) { + sctp_mtu_size_reset(inp, &stcb->asoc, mtu); + } + net->mtu = mtu; } - net->mtu = mtu; } } else if (ifp) { if (ND_IFINFO(ifp)->linkmtu && From owner-svn-src-stable@freebsd.org Thu May 16 08:42:21 2019 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 65152158A36A; Thu, 16 May 2019 08:42:21 +0000 (UTC) (envelope-from tuexen@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 08F5568134; Thu, 16 May 2019 08:42:21 +0000 (UTC) (envelope-from tuexen@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 D040B1E7A9; Thu, 16 May 2019 08:42:20 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x4G8gKPa022452; Thu, 16 May 2019 08:42:20 GMT (envelope-from tuexen@FreeBSD.org) Received: (from tuexen@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x4G8gKHd022451; Thu, 16 May 2019 08:42:20 GMT (envelope-from tuexen@FreeBSD.org) Message-Id: <201905160842.x4G8gKHd022451@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: tuexen set sender to tuexen@FreeBSD.org using -f From: Michael Tuexen Date: Thu, 16 May 2019 08:42:20 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r347656 - stable/11/sys/netinet X-SVN-Group: stable-11 X-SVN-Commit-Author: tuexen X-SVN-Commit-Paths: stable/11/sys/netinet X-SVN-Commit-Revision: 347656 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 08F5568134 X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.97 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.998,0]; NEURAL_HAM_SHORT(-0.97)[-0.974,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US]; NEURAL_HAM_LONG(-1.00)[-1.000,0] X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 16 May 2019 08:42:21 -0000 Author: tuexen Date: Thu May 16 08:42:20 2019 New Revision: 347656 URL: https://svnweb.freebsd.org/changeset/base/347656 Log: MFC r343951: Fix locking for IPPROTO_SCTP level SCTP_DEFAULT_PRINFO socket option. This problem occurred when calling setsockopt() will invalid parameters. This issue was found by running syzkaller. Modified: stable/11/sys/netinet/sctp_usrreq.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/netinet/sctp_usrreq.c ============================================================================== --- stable/11/sys/netinet/sctp_usrreq.c Thu May 16 08:40:10 2019 (r347655) +++ stable/11/sys/netinet/sctp_usrreq.c Thu May 16 08:42:20 2019 (r347656) @@ -6209,6 +6209,9 @@ sctp_setopt(struct socket *so, int optname, void *optv SCTP_FIND_STCB(inp, stcb, info->pr_assoc_id); if (info->pr_policy > SCTP_PR_SCTP_MAX) { + if (stcb) { + SCTP_TCB_UNLOCK(stcb); + } SCTP_LTRACE_ERR_RET(inp, NULL, NULL, SCTP_FROM_SCTP_USRREQ, EINVAL); error = EINVAL; break; From owner-svn-src-stable@freebsd.org Thu May 16 08:44:13 2019 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 83935158A44C; Thu, 16 May 2019 08:44:13 +0000 (UTC) (envelope-from tuexen@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 2BF1968327; Thu, 16 May 2019 08:44:13 +0000 (UTC) (envelope-from tuexen@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 0626D1E7B6; Thu, 16 May 2019 08:44:13 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x4G8iC1C023338; Thu, 16 May 2019 08:44:12 GMT (envelope-from tuexen@FreeBSD.org) Received: (from tuexen@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x4G8iCqa023337; Thu, 16 May 2019 08:44:12 GMT (envelope-from tuexen@FreeBSD.org) Message-Id: <201905160844.x4G8iCqa023337@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: tuexen set sender to tuexen@FreeBSD.org using -f From: Michael Tuexen Date: Thu, 16 May 2019 08:44:12 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r347657 - stable/11/sys/netinet X-SVN-Group: stable-11 X-SVN-Commit-Author: tuexen X-SVN-Commit-Paths: stable/11/sys/netinet X-SVN-Commit-Revision: 347657 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 2BF1968327 X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.97 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.998,0]; NEURAL_HAM_SHORT(-0.97)[-0.974,0]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US] X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 16 May 2019 08:44:13 -0000 Author: tuexen Date: Thu May 16 08:44:12 2019 New Revision: 347657 URL: https://svnweb.freebsd.org/changeset/base/347657 Log: MFC r343954: Fix a locking bug in the IPPROTO_SCTP level SCTP_EVENT socket option. This occurs when call setsockopt() with invalid parameters. This issue was found by syzkaller. Modified: stable/11/sys/netinet/sctp_usrreq.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/netinet/sctp_usrreq.c ============================================================================== --- stable/11/sys/netinet/sctp_usrreq.c Thu May 16 08:42:20 2019 (r347656) +++ stable/11/sys/netinet/sctp_usrreq.c Thu May 16 08:44:12 2019 (r347657) @@ -6115,6 +6115,10 @@ sctp_setopt(struct socket *so, int optname, void *optv SCTP_INP_RUNLOCK(inp); } } + } else { + if (stcb) { + SCTP_TCB_UNLOCK(stcb); + } } break; } From owner-svn-src-stable@freebsd.org Thu May 16 08:45:55 2019 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id A840B158A581; Thu, 16 May 2019 08:45:55 +0000 (UTC) (envelope-from tuexen@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 4E76268507; Thu, 16 May 2019 08:45:55 +0000 (UTC) (envelope-from tuexen@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 287171E7BD; Thu, 16 May 2019 08:45:55 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x4G8jt75023475; Thu, 16 May 2019 08:45:55 GMT (envelope-from tuexen@FreeBSD.org) Received: (from tuexen@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x4G8jteO023474; Thu, 16 May 2019 08:45:55 GMT (envelope-from tuexen@FreeBSD.org) Message-Id: <201905160845.x4G8jteO023474@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: tuexen set sender to tuexen@FreeBSD.org using -f From: Michael Tuexen Date: Thu, 16 May 2019 08:45:55 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r347658 - stable/11/sys/netinet X-SVN-Group: stable-11 X-SVN-Commit-Author: tuexen X-SVN-Commit-Paths: stable/11/sys/netinet X-SVN-Commit-Revision: 347658 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 4E76268507 X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.97 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.998,0]; NEURAL_HAM_SHORT(-0.97)[-0.974,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US]; NEURAL_HAM_LONG(-1.00)[-1.000,0] X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 16 May 2019 08:45:55 -0000 Author: tuexen Date: Thu May 16 08:45:54 2019 New Revision: 347658 URL: https://svnweb.freebsd.org/changeset/base/347658 Log: MFC r343960: Fix a locking issue in the IPPROTO_SCTP level SCTP_PEER_ADDR_THLDS socket option. The problem affects only setsockopt with invalid parameters. This issue was found by syzkaller. Modified: stable/11/sys/netinet/sctp_usrreq.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/netinet/sctp_usrreq.c ============================================================================== --- stable/11/sys/netinet/sctp_usrreq.c Thu May 16 08:44:12 2019 (r347657) +++ stable/11/sys/netinet/sctp_usrreq.c Thu May 16 08:45:54 2019 (r347658) @@ -6335,6 +6335,9 @@ sctp_setopt(struct socket *so, int optname, void *optv } } if (thlds->spt_pathcpthld != 0xffff) { + if (stcb != NULL) { + SCTP_TCB_UNLOCK(stcb); + } error = EINVAL; SCTP_LTRACE_ERR_RET(inp, NULL, NULL, SCTP_FROM_SCTP_USRREQ, error); break; From owner-svn-src-stable@freebsd.org Thu May 16 08:47:29 2019 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 725BE158A6C2; Thu, 16 May 2019 08:47:29 +0000 (UTC) (envelope-from tuexen@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 1895569A23; Thu, 16 May 2019 08:47:29 +0000 (UTC) (envelope-from tuexen@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 E649B1E7C0; Thu, 16 May 2019 08:47:28 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x4G8lS4C023618; Thu, 16 May 2019 08:47:28 GMT (envelope-from tuexen@FreeBSD.org) Received: (from tuexen@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x4G8lSD4023617; Thu, 16 May 2019 08:47:28 GMT (envelope-from tuexen@FreeBSD.org) Message-Id: <201905160847.x4G8lSD4023617@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: tuexen set sender to tuexen@FreeBSD.org using -f From: Michael Tuexen Date: Thu, 16 May 2019 08:47:28 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r347659 - stable/11/sys/netinet X-SVN-Group: stable-11 X-SVN-Commit-Author: tuexen X-SVN-Commit-Paths: stable/11/sys/netinet X-SVN-Commit-Revision: 347659 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 1895569A23 X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.97 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.998,0]; NEURAL_HAM_SHORT(-0.97)[-0.974,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US]; NEURAL_HAM_LONG(-1.00)[-1.000,0] X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 16 May 2019 08:47:29 -0000 Author: tuexen Date: Thu May 16 08:47:28 2019 New Revision: 347659 URL: https://svnweb.freebsd.org/changeset/base/347659 Log: MFC r343961: Fix a locking issue when reporing outbount messages. Modified: stable/11/sys/netinet/sctputil.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/netinet/sctputil.c ============================================================================== --- stable/11/sys/netinet/sctputil.c Thu May 16 08:45:54 2019 (r347658) +++ stable/11/sys/netinet/sctputil.c Thu May 16 08:47:28 2019 (r347659) @@ -3942,7 +3942,7 @@ sctp_report_all_outbound(struct sctp_tcb *stcb, uint16 TAILQ_FOREACH_SAFE(sp, &outs->outqueue, next, nsp) { atomic_subtract_int(&asoc->stream_queue_cnt, 1); TAILQ_REMOVE(&outs->outqueue, sp, next); - stcb->asoc.ss_functions.sctp_ss_remove_from_stream(stcb, asoc, outs, sp, holds_lock); + stcb->asoc.ss_functions.sctp_ss_remove_from_stream(stcb, asoc, outs, sp, 1); sctp_free_spbufspace(stcb, asoc, sp); if (sp->data) { sctp_ulp_notify(SCTP_NOTIFY_SPECIAL_SP_FAIL, stcb, From owner-svn-src-stable@freebsd.org Thu May 16 08:50:26 2019 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 2DE63158AA3D; Thu, 16 May 2019 08:50:26 +0000 (UTC) (envelope-from tuexen@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 C75C769DD8; Thu, 16 May 2019 08:50:25 +0000 (UTC) (envelope-from tuexen@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 A291F1E7C6; Thu, 16 May 2019 08:50:25 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x4G8oPdw023881; Thu, 16 May 2019 08:50:25 GMT (envelope-from tuexen@FreeBSD.org) Received: (from tuexen@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x4G8oPW7023880; Thu, 16 May 2019 08:50:25 GMT (envelope-from tuexen@FreeBSD.org) Message-Id: <201905160850.x4G8oPW7023880@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: tuexen set sender to tuexen@FreeBSD.org using -f From: Michael Tuexen Date: Thu, 16 May 2019 08:50:25 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r347660 - stable/11/sys/netinet X-SVN-Group: stable-11 X-SVN-Commit-Author: tuexen X-SVN-Commit-Paths: stable/11/sys/netinet X-SVN-Commit-Revision: 347660 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: C75C769DD8 X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.97 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.998,0]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; NEURAL_HAM_SHORT(-0.97)[-0.974,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US] X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 16 May 2019 08:50:26 -0000 Author: tuexen Date: Thu May 16 08:50:25 2019 New Revision: 347660 URL: https://svnweb.freebsd.org/changeset/base/347660 Log: MFC r344048: Improve input validation for raw IPv4 socket using the IP_HDRINCL option. This issue was found by running syzkaller on OpenBSD. Greg Steuck made me aware that the problem might also exist on FreeBSD. Modified: stable/11/sys/netinet/raw_ip.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/netinet/raw_ip.c ============================================================================== --- stable/11/sys/netinet/raw_ip.c Thu May 16 08:47:28 2019 (r347659) +++ stable/11/sys/netinet/raw_ip.c Thu May 16 08:50:25 2019 (r347660) @@ -439,6 +439,8 @@ rip_output(struct mbuf *m, struct socket *so, ...) u_long dst; int flags = ((so->so_options & SO_DONTROUTE) ? IP_ROUTETOIF : 0) | IP_ALLOWBROADCAST; + int cnt; + u_char opttype, optlen, *cp; va_start(ap, so); dst = va_arg(ap, u_long); @@ -512,6 +514,34 @@ rip_output(struct mbuf *m, struct socket *so, ...) INP_RUNLOCK(inp); m_freem(m); return (EINVAL); + } + /* + * Don't allow IP options which do not have the required + * structure as specified in section 3.1 of RFC 791 on + * pages 15-23. + */ + cp = (u_char *)(ip + 1); + cnt = (ip->ip_hl << 2) - sizeof (struct ip); + for (; cnt > 0; cnt -= optlen, cp += optlen) { + opttype = cp[IPOPT_OPTVAL]; + if (opttype == IPOPT_EOL) + break; + if (opttype == IPOPT_NOP) { + optlen = 1; + continue; + } + if (cnt < IPOPT_OLEN + sizeof(u_char)) { + INP_RUNLOCK(inp); + m_freem(m); + return (EINVAL); + } + optlen = cp[IPOPT_OLEN]; + if (optlen < IPOPT_OLEN + sizeof(u_char) || + optlen > cnt) { + INP_RUNLOCK(inp); + m_freem(m); + return (EINVAL); + } } /* * This doesn't allow application to specify ID of zero, From owner-svn-src-stable@freebsd.org Thu May 16 08:53:56 2019 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 19E91158AF2D; Thu, 16 May 2019 08:53:56 +0000 (UTC) (envelope-from tuexen@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 B52546A39B; Thu, 16 May 2019 08:53:55 +0000 (UTC) (envelope-from tuexen@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 8A0681E962; Thu, 16 May 2019 08:53:55 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x4G8rtfb029044; Thu, 16 May 2019 08:53:55 GMT (envelope-from tuexen@FreeBSD.org) Received: (from tuexen@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x4G8rt2X029043; Thu, 16 May 2019 08:53:55 GMT (envelope-from tuexen@FreeBSD.org) Message-Id: <201905160853.x4G8rt2X029043@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: tuexen set sender to tuexen@FreeBSD.org using -f From: Michael Tuexen Date: Thu, 16 May 2019 08:53:55 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r347661 - stable/11/sys/netinet X-SVN-Group: stable-11 X-SVN-Commit-Author: tuexen X-SVN-Commit-Paths: stable/11/sys/netinet X-SVN-Commit-Revision: 347661 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: B52546A39B X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.97 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.998,0]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; NEURAL_HAM_SHORT(-0.97)[-0.974,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US] X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 16 May 2019 08:53:56 -0000 Author: tuexen Date: Thu May 16 08:53:55 2019 New Revision: 347661 URL: https://svnweb.freebsd.org/changeset/base/347661 Log: MFC r344704: mprove consistency, not functional change. Modified: stable/11/sys/netinet/sctp_usrreq.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/netinet/sctp_usrreq.c ============================================================================== --- stable/11/sys/netinet/sctp_usrreq.c Thu May 16 08:50:25 2019 (r347660) +++ stable/11/sys/netinet/sctp_usrreq.c Thu May 16 08:53:55 2019 (r347661) @@ -1128,10 +1128,10 @@ sctp_fill_up_addresses_vrf(struct sctp_inpcb *inp, actual += sizeof(struct sockaddr_in6); } else { #endif - memcpy(sas, sin, sizeof(*sin)); + memcpy(sas, sin, sizeof(struct sockaddr_in)); ((struct sockaddr_in *)sas)->sin_port = inp->sctp_lport; - sas = (struct sockaddr_storage *)((caddr_t)sas + sizeof(*sin)); - actual += sizeof(*sin); + sas = (struct sockaddr_storage *)((caddr_t)sas + sizeof(struct sockaddr_in)); + actual += sizeof(struct sockaddr_in); #ifdef INET6 } #endif @@ -1182,10 +1182,10 @@ sctp_fill_up_addresses_vrf(struct sctp_inpcb *inp, (IN6_IS_ADDR_SITELOCAL(&sin6->sin6_addr))) { continue; } - memcpy(sas, sin6, sizeof(*sin6)); + memcpy(sas, sin6, sizeof(struct sockaddr_in6)); ((struct sockaddr_in6 *)sas)->sin6_port = inp->sctp_lport; - sas = (struct sockaddr_storage *)((caddr_t)sas + sizeof(*sin6)); - actual += sizeof(*sin6); + sas = (struct sockaddr_storage *)((caddr_t)sas + sizeof(struct sockaddr_in6)); + actual += sizeof(struct sockaddr_in6); if (actual >= limit) { return (actual); } From owner-svn-src-stable@freebsd.org Thu May 16 08:57:10 2019 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id BC677158B145; Thu, 16 May 2019 08:57:09 +0000 (UTC) (envelope-from tuexen@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 2FFA66A6BB; Thu, 16 May 2019 08:57:09 +0000 (UTC) (envelope-from tuexen@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 1C1E41E964; Thu, 16 May 2019 08:57:09 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x4G8v8jX029247; Thu, 16 May 2019 08:57:08 GMT (envelope-from tuexen@FreeBSD.org) Received: (from tuexen@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x4G8v8O2029246; Thu, 16 May 2019 08:57:08 GMT (envelope-from tuexen@FreeBSD.org) Message-Id: <201905160857.x4G8v8O2029246@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: tuexen set sender to tuexen@FreeBSD.org using -f From: Michael Tuexen Date: Thu, 16 May 2019 08:57:08 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r347662 - stable/11/sys/netinet X-SVN-Group: stable-11 X-SVN-Commit-Author: tuexen X-SVN-Commit-Paths: stable/11/sys/netinet X-SVN-Commit-Revision: 347662 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 2FFA66A6BB X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.97 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_SHORT(-0.98)[-0.975,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US]; NEURAL_HAM_MEDIUM(-1.00)[-0.998,0]; NEURAL_HAM_LONG(-1.00)[-1.000,0] X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 16 May 2019 08:57:10 -0000 Author: tuexen Date: Thu May 16 08:57:08 2019 New Revision: 347662 URL: https://svnweb.freebsd.org/changeset/base/347662 Log: MFC r344708: Honor the memory limits provided when processing the IPPROTO_SCTP level socket option SCTP_GET_LOCAL_ADDRESSES in a getsockopt() call. Thanks to Thomas Barabosch for reporting the issue which was found by running syzkaller. Modified: stable/11/sys/netinet/sctp_usrreq.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/netinet/sctp_usrreq.c ============================================================================== --- stable/11/sys/netinet/sctp_usrreq.c Thu May 16 08:53:55 2019 (r347661) +++ stable/11/sys/netinet/sctp_usrreq.c Thu May 16 08:57:08 2019 (r347662) @@ -1122,12 +1122,18 @@ sctp_fill_up_addresses_vrf(struct sctp_inpcb *inp, } #ifdef INET6 if (sctp_is_feature_on(inp, SCTP_PCB_FLAGS_NEEDS_MAPPED_V4)) { + if (actual + sizeof(struct sockaddr_in6) > limit) { + return (actual); + } in6_sin_2_v4mapsin6(sin, (struct sockaddr_in6 *)sas); ((struct sockaddr_in6 *)sas)->sin6_port = inp->sctp_lport; sas = (struct sockaddr_storage *)((caddr_t)sas + sizeof(struct sockaddr_in6)); actual += sizeof(struct sockaddr_in6); } else { #endif + if (actual + sizeof(struct sockaddr_in) > limit) { + return (actual); + } memcpy(sas, sin, sizeof(struct sockaddr_in)); ((struct sockaddr_in *)sas)->sin_port = inp->sctp_lport; sas = (struct sockaddr_storage *)((caddr_t)sas + sizeof(struct sockaddr_in)); @@ -1135,9 +1141,6 @@ sctp_fill_up_addresses_vrf(struct sctp_inpcb *inp, #ifdef INET6 } #endif - if (actual >= limit) { - return (actual); - } } else { continue; } @@ -1182,13 +1185,13 @@ sctp_fill_up_addresses_vrf(struct sctp_inpcb *inp, (IN6_IS_ADDR_SITELOCAL(&sin6->sin6_addr))) { continue; } + if (actual + sizeof(struct sockaddr_in6) > limit) { + return (actual); + } memcpy(sas, sin6, sizeof(struct sockaddr_in6)); ((struct sockaddr_in6 *)sas)->sin6_port = inp->sctp_lport; sas = (struct sockaddr_storage *)((caddr_t)sas + sizeof(struct sockaddr_in6)); actual += sizeof(struct sockaddr_in6); - if (actual >= limit) { - return (actual); - } } else { continue; } @@ -1202,6 +1205,7 @@ sctp_fill_up_addresses_vrf(struct sctp_inpcb *inp, } } else { struct sctp_laddr *laddr; + size_t sa_len; LIST_FOREACH(laddr, &inp->sctp_addr_list, sctp_nxt_addr) { if (stcb) { @@ -1209,6 +1213,10 @@ sctp_fill_up_addresses_vrf(struct sctp_inpcb *inp, continue; } } + sa_len = laddr->ifa->address.sa.sa_len; + if (actual + sa_len > limit) { + return (actual); + } if (sctp_fill_user_address(sas, &laddr->ifa->address.sa)) continue; switch (laddr->ifa->address.sa.sa_family) { @@ -1226,12 +1234,8 @@ sctp_fill_up_addresses_vrf(struct sctp_inpcb *inp, /* TSNH */ break; } - sas = (struct sockaddr_storage *)((caddr_t)sas + - laddr->ifa->address.sa.sa_len); - actual += laddr->ifa->address.sa.sa_len; - if (actual >= limit) { - return (actual); - } + sas = (struct sockaddr_storage *)((caddr_t)sas + sa_len); + actual += sa_len; } } return (actual); From owner-svn-src-stable@freebsd.org Thu May 16 09:02:31 2019 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id CED5E158B6BC; Thu, 16 May 2019 09:02:31 +0000 (UTC) (envelope-from tuexen@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 732F96ABD2; Thu, 16 May 2019 09:02:31 +0000 (UTC) (envelope-from tuexen@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 4244F1EB03; Thu, 16 May 2019 09:02:31 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x4G92VX3034280; Thu, 16 May 2019 09:02:31 GMT (envelope-from tuexen@FreeBSD.org) Received: (from tuexen@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x4G92VBx034279; Thu, 16 May 2019 09:02:31 GMT (envelope-from tuexen@FreeBSD.org) Message-Id: <201905160902.x4G92VBx034279@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: tuexen set sender to tuexen@FreeBSD.org using -f From: Michael Tuexen Date: Thu, 16 May 2019 09:02:31 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r347663 - stable/11/sys/netinet X-SVN-Group: stable-11 X-SVN-Commit-Author: tuexen X-SVN-Commit-Paths: stable/11/sys/netinet X-SVN-Commit-Revision: 347663 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 732F96ABD2 X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.98 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.998,0]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; NEURAL_HAM_SHORT(-0.98)[-0.979,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US] X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 16 May 2019 09:02:32 -0000 Author: tuexen Date: Thu May 16 09:02:30 2019 New Revision: 347663 URL: https://svnweb.freebsd.org/changeset/base/347663 Log: MFC r344721: Report the correct length when using the IPPROTO_SCTP level socket options SCTP_GET_PEER_ADDRESSES and SCTP_GET_LOCAL_ADDRESSES. Modified: stable/11/sys/netinet/sctp_usrreq.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/netinet/sctp_usrreq.c ============================================================================== --- stable/11/sys/netinet/sctp_usrreq.c Thu May 16 08:57:08 2019 (r347662) +++ stable/11/sys/netinet/sctp_usrreq.c Thu May 16 09:02:30 2019 (r347663) @@ -2240,8 +2240,8 @@ flags_out: SCTP_FIND_STCB(inp, stcb, saddr->sget_assoc_id); if (stcb) { - left = (*optsize) - sizeof(struct sctp_getaddresses); - *optsize = sizeof(struct sctp_getaddresses); + left = (*optsize) - sizeof(sctp_assoc_t); + *optsize = sizeof(sctp_assoc_t); sas = (struct sockaddr_storage *)&saddr->addr[0]; TAILQ_FOREACH(net, &stcb->asoc.nets, sctp_next) { @@ -2315,7 +2315,7 @@ flags_out: if (stcb) { SCTP_TCB_UNLOCK(stcb); } - *optsize = sizeof(struct sockaddr_storage) + actual; + *optsize = sizeof(sctp_assoc_t) + actual; break; } case SCTP_PEER_ADDR_PARAMS: From owner-svn-src-stable@freebsd.org Thu May 16 09:03:49 2019 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 41A59158B75C; Thu, 16 May 2019 09:03:49 +0000 (UTC) (envelope-from tuexen@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 DA46C6AD56; Thu, 16 May 2019 09:03:48 +0000 (UTC) (envelope-from tuexen@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 B2EC81EB08; Thu, 16 May 2019 09:03:48 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x4G93msf034389; Thu, 16 May 2019 09:03:48 GMT (envelope-from tuexen@FreeBSD.org) Received: (from tuexen@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x4G93mbe034388; Thu, 16 May 2019 09:03:48 GMT (envelope-from tuexen@FreeBSD.org) Message-Id: <201905160903.x4G93mbe034388@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: tuexen set sender to tuexen@FreeBSD.org using -f From: Michael Tuexen Date: Thu, 16 May 2019 09:03:48 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r347664 - stable/11/lib/libc/net X-SVN-Group: stable-11 X-SVN-Commit-Author: tuexen X-SVN-Commit-Paths: stable/11/lib/libc/net X-SVN-Commit-Revision: 347664 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: DA46C6AD56 X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.98 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.998,0]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; NEURAL_HAM_SHORT(-0.98)[-0.979,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US] X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 16 May 2019 09:03:49 -0000 Author: tuexen Date: Thu May 16 09:03:48 2019 New Revision: 347664 URL: https://svnweb.freebsd.org/changeset/base/347664 Log: MFC r344722: Use correct buffer sizes in sctp_get[lp]addrs(). Modified: stable/11/lib/libc/net/sctp_sys_calls.c Directory Properties: stable/11/ (props changed) Modified: stable/11/lib/libc/net/sctp_sys_calls.c ============================================================================== --- stable/11/lib/libc/net/sctp_sys_calls.c Thu May 16 09:02:30 2019 (r347663) +++ stable/11/lib/libc/net/sctp_sys_calls.c Thu May 16 09:03:48 2019 (r347664) @@ -413,7 +413,7 @@ sctp_getpaddrs(int sd, sctp_assoc_t id, struct sockadd return (-1); } /* size required is returned in 'asoc' */ - opt_len = (socklen_t) ((size_t)asoc + sizeof(struct sctp_getaddresses)); + opt_len = (socklen_t) ((size_t)asoc + sizeof(sctp_assoc_t)); addrs = calloc(1, (size_t)opt_len); if (addrs == NULL) { errno = ENOMEM; @@ -473,9 +473,7 @@ sctp_getladdrs(int sd, sctp_assoc_t id, struct sockadd errno = ENOTCONN; return (-1); } - opt_len = (socklen_t) (size_of_addresses + - sizeof(struct sockaddr_storage) + - sizeof(struct sctp_getaddresses)); + opt_len = (socklen_t) (size_of_addresses + sizeof(sctp_assoc_t)); addrs = calloc(1, (size_t)opt_len); if (addrs == NULL) { errno = ENOMEM; From owner-svn-src-stable@freebsd.org Thu May 16 09:05:17 2019 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id DFE10158B7EC; Thu, 16 May 2019 09:05:16 +0000 (UTC) (envelope-from tuexen@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 86F9B6AE9A; Thu, 16 May 2019 09:05:16 +0000 (UTC) (envelope-from tuexen@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 60D171EB09; Thu, 16 May 2019 09:05:16 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x4G95G7C034509; Thu, 16 May 2019 09:05:16 GMT (envelope-from tuexen@FreeBSD.org) Received: (from tuexen@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x4G95GFE034508; Thu, 16 May 2019 09:05:16 GMT (envelope-from tuexen@FreeBSD.org) Message-Id: <201905160905.x4G95GFE034508@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: tuexen set sender to tuexen@FreeBSD.org using -f From: Michael Tuexen Date: Thu, 16 May 2019 09:05:16 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r347665 - stable/11/sys/netinet X-SVN-Group: stable-11 X-SVN-Commit-Author: tuexen X-SVN-Commit-Paths: stable/11/sys/netinet X-SVN-Commit-Revision: 347665 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 86F9B6AE9A X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.98 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.998,0]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; NEURAL_HAM_SHORT(-0.98)[-0.980,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US] X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 16 May 2019 09:05:17 -0000 Author: tuexen Date: Thu May 16 09:05:15 2019 New Revision: 347665 URL: https://svnweb.freebsd.org/changeset/base/347665 Log: MFC r344723: Handle the case when calling the IPPROTO_SCTP level socket option SCTP_STATUS on an association with no primary path (early state). This issue was found by running syzkaller. Modified: stable/11/sys/netinet/sctp_usrreq.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/netinet/sctp_usrreq.c ============================================================================== --- stable/11/sys/netinet/sctp_usrreq.c Thu May 16 09:03:48 2019 (r347664) +++ stable/11/sys/netinet/sctp_usrreq.c Thu May 16 09:05:15 2019 (r347665) @@ -2644,42 +2644,47 @@ flags_out: sstat->sstat_instrms = stcb->asoc.streamincnt; sstat->sstat_outstrms = stcb->asoc.streamoutcnt; sstat->sstat_fragmentation_point = sctp_get_frag_point(stcb, &stcb->asoc); - memcpy(&sstat->sstat_primary.spinfo_address, - &stcb->asoc.primary_destination->ro._l_addr, - ((struct sockaddr *)(&stcb->asoc.primary_destination->ro._l_addr))->sa_len); net = stcb->asoc.primary_destination; - ((struct sockaddr_in *)&sstat->sstat_primary.spinfo_address)->sin_port = stcb->rport; - /* - * Again the user can get info from sctp_constants.h - * for what the state of the network is. - */ - if (net->dest_state & SCTP_ADDR_UNCONFIRMED) { - /* It's unconfirmed */ - sstat->sstat_primary.spinfo_state = SCTP_UNCONFIRMED; - } else if (net->dest_state & SCTP_ADDR_REACHABLE) { - /* It's active */ - sstat->sstat_primary.spinfo_state = SCTP_ACTIVE; - } else { - /* It's inactive */ - sstat->sstat_primary.spinfo_state = SCTP_INACTIVE; - } - sstat->sstat_primary.spinfo_cwnd = net->cwnd; - sstat->sstat_primary.spinfo_srtt = net->lastsa >> SCTP_RTT_SHIFT; - sstat->sstat_primary.spinfo_rto = net->RTO; - sstat->sstat_primary.spinfo_mtu = net->mtu; - switch (stcb->asoc.primary_destination->ro._l_addr.sa.sa_family) { + if (net != NULL) { + memcpy(&sstat->sstat_primary.spinfo_address, + &stcb->asoc.primary_destination->ro._l_addr, + ((struct sockaddr *)(&stcb->asoc.primary_destination->ro._l_addr))->sa_len); + ((struct sockaddr_in *)&sstat->sstat_primary.spinfo_address)->sin_port = stcb->rport; + /* + * Again the user can get info from + * sctp_constants.h for what the state of + * the network is. + */ + if (net->dest_state & SCTP_ADDR_UNCONFIRMED) { + /* It's unconfirmed */ + sstat->sstat_primary.spinfo_state = SCTP_UNCONFIRMED; + } else if (net->dest_state & SCTP_ADDR_REACHABLE) { + /* It's active */ + sstat->sstat_primary.spinfo_state = SCTP_ACTIVE; + } else { + /* It's inactive */ + sstat->sstat_primary.spinfo_state = SCTP_INACTIVE; + } + sstat->sstat_primary.spinfo_cwnd = net->cwnd; + sstat->sstat_primary.spinfo_srtt = net->lastsa >> SCTP_RTT_SHIFT; + sstat->sstat_primary.spinfo_rto = net->RTO; + sstat->sstat_primary.spinfo_mtu = net->mtu; + switch (stcb->asoc.primary_destination->ro._l_addr.sa.sa_family) { #if defined(INET) - case AF_INET: - sstat->sstat_primary.spinfo_mtu -= SCTP_MIN_V4_OVERHEAD; - break; + case AF_INET: + sstat->sstat_primary.spinfo_mtu -= SCTP_MIN_V4_OVERHEAD; + break; #endif #if defined(INET6) - case AF_INET6: - sstat->sstat_primary.spinfo_mtu -= SCTP_MIN_OVERHEAD; - break; + case AF_INET6: + sstat->sstat_primary.spinfo_mtu -= SCTP_MIN_OVERHEAD; + break; #endif - default: - break; + default: + break; + } + } else { + memset(&sstat->sstat_primary, 0, sizeof(struct sctp_paddrinfo)); } sstat->sstat_primary.spinfo_assoc_id = sctp_get_associd(stcb); SCTP_TCB_UNLOCK(stcb); From owner-svn-src-stable@freebsd.org Thu May 16 09:07:13 2019 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 03A33158B8F1; Thu, 16 May 2019 09:07:13 +0000 (UTC) (envelope-from tuexen@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 9E1DA6B04B; Thu, 16 May 2019 09:07:12 +0000 (UTC) (envelope-from tuexen@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 7242F1EB0A; Thu, 16 May 2019 09:07:12 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x4G97CgU034638; Thu, 16 May 2019 09:07:12 GMT (envelope-from tuexen@FreeBSD.org) Received: (from tuexen@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x4G97CCb034637; Thu, 16 May 2019 09:07:12 GMT (envelope-from tuexen@FreeBSD.org) Message-Id: <201905160907.x4G97CCb034637@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: tuexen set sender to tuexen@FreeBSD.org using -f From: Michael Tuexen Date: Thu, 16 May 2019 09:07:12 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r347666 - stable/11/sys/netinet X-SVN-Group: stable-11 X-SVN-Commit-Author: tuexen X-SVN-Commit-Paths: stable/11/sys/netinet X-SVN-Commit-Revision: 347666 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 9E1DA6B04B X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.98 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.998,0]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; NEURAL_HAM_SHORT(-0.98)[-0.979,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US] X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 16 May 2019 09:07:13 -0000 Author: tuexen Date: Thu May 16 09:07:11 2019 New Revision: 347666 URL: https://svnweb.freebsd.org/changeset/base/347666 Log: MFC r344724: Allow SCTP stream reconfiguration operations only in ESTABLISHED state. This issue was found by running syzkaller. Modified: stable/11/sys/netinet/sctp_usrreq.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/netinet/sctp_usrreq.c ============================================================================== --- stable/11/sys/netinet/sctp_usrreq.c Thu May 16 09:05:15 2019 (r347665) +++ stable/11/sys/netinet/sctp_usrreq.c Thu May 16 09:07:11 2019 (r347666) @@ -4631,6 +4631,12 @@ sctp_setopt(struct socket *so, int optname, void *optv SCTP_TCB_UNLOCK(stcb); break; } + if (SCTP_GET_STATE(stcb) != SCTP_STATE_OPEN) { + SCTP_LTRACE_ERR_RET(inp, NULL, NULL, SCTP_FROM_SCTP_USRREQ, EINVAL); + error = EINVAL; + SCTP_TCB_UNLOCK(stcb); + break; + } if (sizeof(struct sctp_reset_streams) + strrst->srs_number_streams * sizeof(uint16_t) > optsize) { error = EINVAL; @@ -4745,6 +4751,12 @@ sctp_setopt(struct socket *so, int optname, void *optv SCTP_TCB_UNLOCK(stcb); break; } + if (SCTP_GET_STATE(stcb) != SCTP_STATE_OPEN) { + SCTP_LTRACE_ERR_RET(inp, NULL, NULL, SCTP_FROM_SCTP_USRREQ, EINVAL); + error = EINVAL; + SCTP_TCB_UNLOCK(stcb); + break; + } if (stcb->asoc.stream_reset_outstanding) { SCTP_LTRACE_ERR_RET(inp, NULL, NULL, SCTP_FROM_SCTP_USRREQ, EALREADY); error = EALREADY; @@ -4812,6 +4824,12 @@ sctp_setopt(struct socket *so, int optname, void *optv */ SCTP_LTRACE_ERR_RET(inp, NULL, NULL, SCTP_FROM_SCTP_USRREQ, EOPNOTSUPP); error = EOPNOTSUPP; + SCTP_TCB_UNLOCK(stcb); + break; + } + if (SCTP_GET_STATE(stcb) != SCTP_STATE_OPEN) { + SCTP_LTRACE_ERR_RET(inp, NULL, NULL, SCTP_FROM_SCTP_USRREQ, EINVAL); + error = EINVAL; SCTP_TCB_UNLOCK(stcb); break; } From owner-svn-src-stable@freebsd.org Thu May 16 09:10:15 2019 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id D810C158B9E1; Thu, 16 May 2019 09:10:15 +0000 (UTC) (envelope-from tuexen@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 7CAF56B1C1; Thu, 16 May 2019 09:10:15 +0000 (UTC) (envelope-from tuexen@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 3E4211EB0F; Thu, 16 May 2019 09:10:15 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x4G9AFtF034840; Thu, 16 May 2019 09:10:15 GMT (envelope-from tuexen@FreeBSD.org) Received: (from tuexen@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x4G9AFKB034839; Thu, 16 May 2019 09:10:15 GMT (envelope-from tuexen@FreeBSD.org) Message-Id: <201905160910.x4G9AFKB034839@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: tuexen set sender to tuexen@FreeBSD.org using -f From: Michael Tuexen Date: Thu, 16 May 2019 09:10:15 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r347667 - stable/11/sys/netinet X-SVN-Group: stable-11 X-SVN-Commit-Author: tuexen X-SVN-Commit-Paths: stable/11/sys/netinet X-SVN-Commit-Revision: 347667 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 7CAF56B1C1 X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.98 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.998,0]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; NEURAL_HAM_SHORT(-0.98)[-0.979,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US] X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 16 May 2019 09:10:16 -0000 Author: tuexen Date: Thu May 16 09:10:14 2019 New Revision: 347667 URL: https://svnweb.freebsd.org/changeset/base/347667 Log: MFC r344726: Remove debug output. Modified: stable/11/sys/netinet/sctp_usrreq.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/netinet/sctp_usrreq.c ============================================================================== --- stable/11/sys/netinet/sctp_usrreq.c Thu May 16 09:07:11 2019 (r347666) +++ stable/11/sys/netinet/sctp_usrreq.c Thu May 16 09:10:14 2019 (r347667) @@ -628,7 +628,6 @@ connected_type: /* now what about control */ if (control) { if (inp->control) { - SCTP_PRINTF("huh? control set?\n"); sctp_m_freem(inp->control); inp->control = NULL; } @@ -3751,13 +3750,11 @@ sctp_setopt(struct socket *so, int optname, void *optv uint32_t vrf_id; if (optval == NULL) { - SCTP_PRINTF("optval is NULL\n"); SCTP_LTRACE_ERR_RET(inp, NULL, NULL, SCTP_FROM_SCTP_USRREQ, EINVAL); return (EINVAL); } inp = (struct sctp_inpcb *)so->so_pcb; if (inp == NULL) { - SCTP_PRINTF("inp is NULL?\n"); SCTP_LTRACE_ERR_RET(inp, NULL, NULL, SCTP_FROM_SCTP_USRREQ, EINVAL); return (EINVAL); } From owner-svn-src-stable@freebsd.org Thu May 16 09:12:14 2019 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id B1F4F158BCAA; Thu, 16 May 2019 09:12:14 +0000 (UTC) (envelope-from tuexen@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 55CBD6B5AF; Thu, 16 May 2019 09:12:14 +0000 (UTC) (envelope-from tuexen@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 2EFA51ECB1; Thu, 16 May 2019 09:12:14 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x4G9CDfG039733; Thu, 16 May 2019 09:12:13 GMT (envelope-from tuexen@FreeBSD.org) Received: (from tuexen@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x4G9CDts039732; Thu, 16 May 2019 09:12:13 GMT (envelope-from tuexen@FreeBSD.org) Message-Id: <201905160912.x4G9CDts039732@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: tuexen set sender to tuexen@FreeBSD.org using -f From: Michael Tuexen Date: Thu, 16 May 2019 09:12:13 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r347668 - stable/11/sys/netinet X-SVN-Group: stable-11 X-SVN-Commit-Author: tuexen X-SVN-Commit-Paths: stable/11/sys/netinet X-SVN-Commit-Revision: 347668 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 55CBD6B5AF X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.98 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.998,0]; NEURAL_HAM_SHORT(-0.98)[-0.979,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US]; NEURAL_HAM_LONG(-1.00)[-1.000,0] X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 16 May 2019 09:12:15 -0000 Author: tuexen Date: Thu May 16 09:12:13 2019 New Revision: 347668 URL: https://svnweb.freebsd.org/changeset/base/347668 Log: MFC r344742: Allocate an assocition id and register the stcb with holding the lock. This avoids a race where stcbs can be found, which are not completely initialized. This was found by running syzkaller. Modified: stable/11/sys/netinet/sctp_pcb.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/netinet/sctp_pcb.c ============================================================================== --- stable/11/sys/netinet/sctp_pcb.c Thu May 16 09:10:14 2019 (r347667) +++ stable/11/sys/netinet/sctp_pcb.c Thu May 16 09:12:13 2019 (r347668) @@ -4156,11 +4156,9 @@ sctp_aloc_a_assoc_id(struct sctp_inpcb *inp, struct sc struct sctpasochead *head; struct sctp_tcb *lstcb; - SCTP_INP_WLOCK(inp); try_again: if (inp->sctp_flags & SCTP_PCB_FLAGS_SOCKET_ALLGONE) { /* TSNH */ - SCTP_INP_WUNLOCK(inp); return (0); } /* @@ -4179,8 +4177,7 @@ try_again: head = &inp->sctp_asocidhash[SCTP_PCBHASH_ASOC(id, inp->hashasocidmark)]; LIST_INSERT_HEAD(head, stcb, sctp_tcbasocidhash); stcb->asoc.in_asocid_hash = 1; - SCTP_INP_WUNLOCK(inp); - return id; + return (id); } /* @@ -4343,7 +4340,6 @@ sctp_aloc_assoc(struct sctp_inpcb *inp, struct sockadd memset(stcb, 0, sizeof(*stcb)); asoc = &stcb->asoc; - asoc->assoc_id = sctp_aloc_a_assoc_id(inp, stcb); SCTP_TCB_LOCK_INIT(stcb); SCTP_TCB_SEND_LOCK_INIT(stcb); stcb->rport = rport; @@ -4354,7 +4350,6 @@ sctp_aloc_assoc(struct sctp_inpcb *inp, struct sockadd /* failed */ SCTP_TCB_LOCK_DESTROY(stcb); SCTP_TCB_SEND_LOCK_DESTROY(stcb); - LIST_REMOVE(stcb, sctp_tcbasocidhash); SCTP_ZONE_FREE(SCTP_BASE_INFO(ipi_zone_asoc), stcb); SCTP_DECR_ASOC_COUNT(); *error = err; @@ -4367,7 +4362,6 @@ sctp_aloc_assoc(struct sctp_inpcb *inp, struct sockadd /* inpcb freed while alloc going on */ SCTP_TCB_LOCK_DESTROY(stcb); SCTP_TCB_SEND_LOCK_DESTROY(stcb); - LIST_REMOVE(stcb, sctp_tcbasocidhash); SCTP_ZONE_FREE(SCTP_BASE_INFO(ipi_zone_asoc), stcb); SCTP_INP_WUNLOCK(inp); SCTP_INP_INFO_WUNLOCK(); @@ -4378,6 +4372,7 @@ sctp_aloc_assoc(struct sctp_inpcb *inp, struct sockadd } SCTP_TCB_LOCK(stcb); + asoc->assoc_id = sctp_aloc_a_assoc_id(inp, stcb); /* now that my_vtag is set, add it to the hash */ head = &SCTP_BASE_INFO(sctp_asochash)[SCTP_PCBHASH_ASOC(stcb->asoc.my_vtag, SCTP_BASE_INFO(hashasocmark))]; /* put it in the bucket in the vtag hash of assoc's for the system */ From owner-svn-src-stable@freebsd.org Thu May 16 09:13:42 2019 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id AD960158BE45; Thu, 16 May 2019 09:13:42 +0000 (UTC) (envelope-from tuexen@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 51F7D6B87D; Thu, 16 May 2019 09:13:42 +0000 (UTC) (envelope-from tuexen@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 2BDFA1ECC4; Thu, 16 May 2019 09:13:42 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x4G9DgmJ039842; Thu, 16 May 2019 09:13:42 GMT (envelope-from tuexen@FreeBSD.org) Received: (from tuexen@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x4G9DgKF039841; Thu, 16 May 2019 09:13:42 GMT (envelope-from tuexen@FreeBSD.org) Message-Id: <201905160913.x4G9DgKF039841@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: tuexen set sender to tuexen@FreeBSD.org using -f From: Michael Tuexen Date: Thu, 16 May 2019 09:13:42 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r347669 - stable/11/sys/netinet X-SVN-Group: stable-11 X-SVN-Commit-Author: tuexen X-SVN-Commit-Paths: stable/11/sys/netinet X-SVN-Commit-Revision: 347669 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 51F7D6B87D X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.98 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.998,0]; NEURAL_HAM_SHORT(-0.98)[-0.979,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US]; NEURAL_HAM_LONG(-1.00)[-1.000,0] X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 16 May 2019 09:13:42 -0000 Author: tuexen Date: Thu May 16 09:13:41 2019 New Revision: 347669 URL: https://svnweb.freebsd.org/changeset/base/347669 Log: MFC r344872: After removing an entry from the stream scheduler list, set the pointers to NULL, since we are checking for it in case the element gets inserted again. This issue was found by running syzkaller. Modified: stable/11/sys/netinet/sctp_ss_functions.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/netinet/sctp_ss_functions.c ============================================================================== --- stable/11/sys/netinet/sctp_ss_functions.c Thu May 16 09:12:13 2019 (r347668) +++ stable/11/sys/netinet/sctp_ss_functions.c Thu May 16 09:13:41 2019 (r347669) @@ -76,9 +76,10 @@ sctp_ss_default_clear(struct sctp_tcb *stcb, struct sc SCTP_TCB_SEND_LOCK(stcb); } while (!TAILQ_EMPTY(&asoc->ss_data.out.wheel)) { - struct sctp_stream_out *strq = TAILQ_FIRST(&asoc->ss_data.out.wheel); + struct sctp_stream_out *strq; - TAILQ_REMOVE(&asoc->ss_data.out.wheel, TAILQ_FIRST(&asoc->ss_data.out.wheel), ss_params.rr.next_spoke); + strq = TAILQ_FIRST(&asoc->ss_data.out.wheel); + TAILQ_REMOVE(&asoc->ss_data.out.wheel, strq, ss_params.rr.next_spoke); strq->ss_params.rr.next_spoke.tqe_next = NULL; strq->ss_params.rr.next_spoke.tqe_prev = NULL; } @@ -791,12 +792,17 @@ static void sctp_ss_fcfs_clear(struct sctp_tcb *stcb, struct sctp_association *asoc, int clear_values, int holds_lock) { + struct sctp_stream_queue_pending *sp; + if (clear_values) { if (holds_lock == 0) { SCTP_TCB_SEND_LOCK(stcb); } while (!TAILQ_EMPTY(&asoc->ss_data.out.list)) { - TAILQ_REMOVE(&asoc->ss_data.out.list, TAILQ_FIRST(&asoc->ss_data.out.list), ss_next); + sp = TAILQ_FIRST(&asoc->ss_data.out.list); + TAILQ_REMOVE(&asoc->ss_data.out.list, sp, ss_next); + sp->ss_next.tqe_next = NULL; + sp->ss_next.tqe_prev = NULL; } if (holds_lock == 0) { SCTP_TCB_SEND_UNLOCK(stcb); @@ -859,6 +865,8 @@ sctp_ss_fcfs_remove(struct sctp_tcb *stcb, struct sctp ((sp->ss_next.tqe_next != NULL) || (sp->ss_next.tqe_prev != NULL))) { TAILQ_REMOVE(&asoc->ss_data.out.list, sp, ss_next); + sp->ss_next.tqe_next = NULL; + sp->ss_next.tqe_prev = NULL; } if (holds_lock == 0) { SCTP_TCB_SEND_UNLOCK(stcb); From owner-svn-src-stable@freebsd.org Thu May 16 09:15:20 2019 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id E226C158E002; Thu, 16 May 2019 09:15:19 +0000 (UTC) (envelope-from tuexen@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 851416BA61; Thu, 16 May 2019 09:15:19 +0000 (UTC) (envelope-from tuexen@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 6049F1ECC5; Thu, 16 May 2019 09:15:19 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x4G9FJp4039971; Thu, 16 May 2019 09:15:19 GMT (envelope-from tuexen@FreeBSD.org) Received: (from tuexen@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x4G9FJjf039970; Thu, 16 May 2019 09:15:19 GMT (envelope-from tuexen@FreeBSD.org) Message-Id: <201905160915.x4G9FJjf039970@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: tuexen set sender to tuexen@FreeBSD.org using -f From: Michael Tuexen Date: Thu, 16 May 2019 09:15:19 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r347670 - stable/11/sys/netinet X-SVN-Group: stable-11 X-SVN-Commit-Author: tuexen X-SVN-Commit-Paths: stable/11/sys/netinet X-SVN-Commit-Revision: 347670 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 851416BA61 X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.98 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.998,0]; NEURAL_HAM_SHORT(-0.98)[-0.980,0]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US] X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 16 May 2019 09:15:20 -0000 Author: tuexen Date: Thu May 16 09:15:18 2019 New Revision: 347670 URL: https://svnweb.freebsd.org/changeset/base/347670 Log: MFC r344924: Some cleanup and consistency improvements. Modified: stable/11/sys/netinet/sctp_ss_functions.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/netinet/sctp_ss_functions.c ============================================================================== --- stable/11/sys/netinet/sctp_ss_functions.c Thu May 16 09:13:41 2019 (r347669) +++ stable/11/sys/netinet/sctp_ss_functions.c Thu May 16 09:15:18 2019 (r347670) @@ -52,6 +52,9 @@ sctp_ss_default_init(struct sctp_tcb *stcb, struct sct { uint16_t i; + if (holds_lock == 0) { + SCTP_TCB_SEND_LOCK(stcb); + } asoc->ss_data.locked_on_sending = NULL; asoc->ss_data.last_out_stream = NULL; TAILQ_INIT(&asoc->ss_data.out.wheel); @@ -63,8 +66,11 @@ sctp_ss_default_init(struct sctp_tcb *stcb, struct sct for (i = 0; i < stcb->asoc.streamoutcnt; i++) { stcb->asoc.ss_functions.sctp_ss_add_to_stream(stcb, &stcb->asoc, &stcb->asoc.strmout[i], - NULL, holds_lock); + NULL, 1); } + if (holds_lock == 0) { + SCTP_TCB_SEND_UNLOCK(stcb); + } return; } @@ -394,12 +400,13 @@ sctp_ss_prio_clear(struct sctp_tcb *stcb, struct sctp_ SCTP_TCB_SEND_LOCK(stcb); } while (!TAILQ_EMPTY(&asoc->ss_data.out.wheel)) { - struct sctp_stream_out *strq = TAILQ_FIRST(&asoc->ss_data.out.wheel); + struct sctp_stream_out *strq; + strq = TAILQ_FIRST(&asoc->ss_data.out.wheel); if (clear_values) { strq->ss_params.prio.priority = 0; } - TAILQ_REMOVE(&asoc->ss_data.out.wheel, TAILQ_FIRST(&asoc->ss_data.out.wheel), ss_params.prio.next_spoke); + TAILQ_REMOVE(&asoc->ss_data.out.wheel, strq, ss_params.prio.next_spoke); strq->ss_params.prio.next_spoke.tqe_next = NULL; strq->ss_params.prio.next_spoke.tqe_prev = NULL; @@ -584,12 +591,13 @@ sctp_ss_fb_clear(struct sctp_tcb *stcb, struct sctp_as SCTP_TCB_SEND_LOCK(stcb); } while (!TAILQ_EMPTY(&asoc->ss_data.out.wheel)) { - struct sctp_stream_out *strq = TAILQ_FIRST(&asoc->ss_data.out.wheel); + struct sctp_stream_out *strq; + strq = TAILQ_FIRST(&asoc->ss_data.out.wheel); if (clear_values) { strq->ss_params.fb.rounds = -1; } - TAILQ_REMOVE(&asoc->ss_data.out.wheel, TAILQ_FIRST(&asoc->ss_data.out.wheel), ss_params.fb.next_spoke); + TAILQ_REMOVE(&asoc->ss_data.out.wheel, strq, ss_params.fb.next_spoke); strq->ss_params.fb.next_spoke.tqe_next = NULL; strq->ss_params.fb.next_spoke.tqe_prev = NULL; } @@ -762,6 +770,9 @@ sctp_ss_fcfs_init(struct sctp_tcb *stcb, struct sctp_a struct sctp_stream_queue_pending *sp; uint16_t i; + if (holds_lock == 0) { + SCTP_TCB_SEND_LOCK(stcb); + } TAILQ_INIT(&asoc->ss_data.out.list); /* * If there is data in the stream queues already, the scheduler of @@ -779,11 +790,14 @@ sctp_ss_fcfs_init(struct sctp_tcb *stcb, struct sctp_a x++; } if (sp != NULL) { - sctp_ss_fcfs_add(stcb, &stcb->asoc, &stcb->asoc.strmout[i], sp, holds_lock); + sctp_ss_fcfs_add(stcb, &stcb->asoc, &stcb->asoc.strmout[i], sp, 1); add_more = 1; } } n++; + } + if (holds_lock == 0) { + SCTP_TCB_SEND_UNLOCK(stcb); } return; } From owner-svn-src-stable@freebsd.org Thu May 16 09:16:48 2019 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 579AC158E0FF; Thu, 16 May 2019 09:16:48 +0000 (UTC) (envelope-from tuexen@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 EFFFB6BBB2; Thu, 16 May 2019 09:16:47 +0000 (UTC) (envelope-from tuexen@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 CA8D61ECC6; Thu, 16 May 2019 09:16:47 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x4G9GlgJ040096; Thu, 16 May 2019 09:16:47 GMT (envelope-from tuexen@FreeBSD.org) Received: (from tuexen@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x4G9GlMM040095; Thu, 16 May 2019 09:16:47 GMT (envelope-from tuexen@FreeBSD.org) Message-Id: <201905160916.x4G9GlMM040095@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: tuexen set sender to tuexen@FreeBSD.org using -f From: Michael Tuexen Date: Thu, 16 May 2019 09:16:47 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r347671 - stable/11/sys/netinet X-SVN-Group: stable-11 X-SVN-Commit-Author: tuexen X-SVN-Commit-Paths: stable/11/sys/netinet X-SVN-Commit-Revision: 347671 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: EFFFB6BBB2 X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.98 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.998,0]; NEURAL_HAM_SHORT(-0.98)[-0.979,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US]; NEURAL_HAM_LONG(-1.00)[-1.000,0] X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 16 May 2019 09:16:48 -0000 Author: tuexen Date: Thu May 16 09:16:47 2019 New Revision: 347671 URL: https://svnweb.freebsd.org/changeset/base/347671 Log: MFC r344925: Fix locking bug. Modified: stable/11/sys/netinet/sctp_usrreq.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/netinet/sctp_usrreq.c ============================================================================== --- stable/11/sys/netinet/sctp_usrreq.c Thu May 16 09:15:18 2019 (r347670) +++ stable/11/sys/netinet/sctp_usrreq.c Thu May 16 09:16:47 2019 (r347671) @@ -4069,10 +4069,12 @@ sctp_setopt(struct socket *so, int optname, void *optv } SCTP_FIND_STCB(inp, stcb, av->assoc_id); if (stcb) { + SCTP_TCB_SEND_LOCK(stcb); stcb->asoc.ss_functions.sctp_ss_clear(stcb, &stcb->asoc, 1, 1); stcb->asoc.ss_functions = sctp_ss_functions[av->assoc_value]; stcb->asoc.stream_scheduling_module = av->assoc_value; stcb->asoc.ss_functions.sctp_ss_init(stcb, &stcb->asoc, 1); + SCTP_TCB_SEND_UNLOCK(stcb); SCTP_TCB_UNLOCK(stcb); } else { if ((inp->sctp_flags & SCTP_PCB_FLAGS_TCPTYPE) || @@ -4088,10 +4090,12 @@ sctp_setopt(struct socket *so, int optname, void *optv SCTP_INP_RLOCK(inp); LIST_FOREACH(stcb, &inp->sctp_asoc_list, sctp_tcblist) { SCTP_TCB_LOCK(stcb); + SCTP_TCB_SEND_LOCK(stcb); stcb->asoc.ss_functions.sctp_ss_clear(stcb, &stcb->asoc, 1, 1); stcb->asoc.ss_functions = sctp_ss_functions[av->assoc_value]; stcb->asoc.stream_scheduling_module = av->assoc_value; stcb->asoc.ss_functions.sctp_ss_init(stcb, &stcb->asoc, 1); + SCTP_TCB_SEND_UNLOCK(stcb); SCTP_TCB_UNLOCK(stcb); } SCTP_INP_RUNLOCK(inp); From owner-svn-src-stable@freebsd.org Thu May 16 09:19:00 2019 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 05C04158E289; Thu, 16 May 2019 09:19:00 +0000 (UTC) (envelope-from tuexen@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 9F5AF6BDDC; Thu, 16 May 2019 09:18:59 +0000 (UTC) (envelope-from tuexen@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 77E351ECC8; Thu, 16 May 2019 09:18:59 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x4G9Ixk9040275; Thu, 16 May 2019 09:18:59 GMT (envelope-from tuexen@FreeBSD.org) Received: (from tuexen@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x4G9Ixam040274; Thu, 16 May 2019 09:18:59 GMT (envelope-from tuexen@FreeBSD.org) Message-Id: <201905160918.x4G9Ixam040274@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: tuexen set sender to tuexen@FreeBSD.org using -f From: Michael Tuexen Date: Thu, 16 May 2019 09:18:59 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r347672 - stable/11/sys/netinet X-SVN-Group: stable-11 X-SVN-Commit-Author: tuexen X-SVN-Commit-Paths: stable/11/sys/netinet X-SVN-Commit-Revision: 347672 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 9F5AF6BDDC X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.98 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.998,0]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; NEURAL_HAM_SHORT(-0.98)[-0.979,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US] X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 16 May 2019 09:19:00 -0000 Author: tuexen Date: Thu May 16 09:18:59 2019 New Revision: 347672 URL: https://svnweb.freebsd.org/changeset/base/347672 Log: MFC r345460: Limit the number of bytes which can be queued for SCTP sockets. This is joint work with rrs@. Modified: stable/11/sys/netinet/sctp_output.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/netinet/sctp_output.c ============================================================================== --- stable/11/sys/netinet/sctp_output.c Thu May 16 09:16:47 2019 (r347671) +++ stable/11/sys/netinet/sctp_output.c Thu May 16 09:18:59 2019 (r347672) @@ -13016,12 +13016,7 @@ sctp_lower_sosend(struct socket *so, /* Calculate the maximum we can send */ inqueue_bytes = stcb->asoc.total_output_queue_size - (stcb->asoc.chunks_on_out_queue * SCTP_DATA_CHUNK_OVERHEAD(stcb)); if (SCTP_SB_LIMIT_SND(so) > inqueue_bytes) { - if (non_blocking) { - /* we already checked for non-blocking above. */ - max_len = sndlen; - } else { - max_len = SCTP_SB_LIMIT_SND(so) - inqueue_bytes; - } + max_len = SCTP_SB_LIMIT_SND(so) - inqueue_bytes; } else { max_len = 0; } From owner-svn-src-stable@freebsd.org Thu May 16 09:20:55 2019 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 5852F158E4F4; Thu, 16 May 2019 09:20:55 +0000 (UTC) (envelope-from tuexen@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 F2CDE6BFE6; Thu, 16 May 2019 09:20:54 +0000 (UTC) (envelope-from tuexen@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 B1E531ECE4; Thu, 16 May 2019 09:20:54 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x4G9Ks5Z041248; Thu, 16 May 2019 09:20:54 GMT (envelope-from tuexen@FreeBSD.org) Received: (from tuexen@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x4G9Kssc041246; Thu, 16 May 2019 09:20:54 GMT (envelope-from tuexen@FreeBSD.org) Message-Id: <201905160920.x4G9Kssc041246@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: tuexen set sender to tuexen@FreeBSD.org using -f From: Michael Tuexen Date: Thu, 16 May 2019 09:20:54 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r347673 - stable/11/sys/netinet X-SVN-Group: stable-11 X-SVN-Commit-Author: tuexen X-SVN-Commit-Paths: stable/11/sys/netinet X-SVN-Commit-Revision: 347673 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: F2CDE6BFE6 X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.98 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.998,0]; NEURAL_HAM_SHORT(-0.98)[-0.980,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US]; NEURAL_HAM_LONG(-1.00)[-1.000,0] X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 16 May 2019 09:20:55 -0000 Author: tuexen Date: Thu May 16 09:20:54 2019 New Revision: 347673 URL: https://svnweb.freebsd.org/changeset/base/347673 Log: MFC r345461: Limit the size of messages sent on 1-to-many style SCTP sockets with the SCTP_SENDALL flag. Allow also only one operation per SCTP endpoint. This fixes an issue found by running syzkaller and is joint work with rrs@. Modified: stable/11/sys/netinet/sctp.h stable/11/sys/netinet/sctp_output.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/netinet/sctp.h ============================================================================== --- stable/11/sys/netinet/sctp.h Thu May 16 09:18:59 2019 (r347672) +++ stable/11/sys/netinet/sctp.h Thu May 16 09:20:54 2019 (r347673) @@ -489,6 +489,7 @@ struct sctp_error_auth_invalid_hmac { * time */ #define SCTP_SAT_NETWORK_BURST_INCR 2 /* how many times to multiply maxburst * in sat */ +#define SCTP_MAX_SENDALL_LIMIT 1024 /* Data Chuck Specific Flags */ #define SCTP_DATA_FRAG_MASK 0x03 @@ -514,6 +515,7 @@ struct sctp_error_auth_invalid_hmac { #define SCTP_PCB_FLAGS_BOUNDALL 0x00000004 #define SCTP_PCB_FLAGS_ACCEPTING 0x00000008 #define SCTP_PCB_FLAGS_UNBOUND 0x00000010 +#define SCTP_PCB_FLAGS_SND_ITERATOR_UP 0x00000020 #define SCTP_PCB_FLAGS_CLOSE_IP 0x00040000 #define SCTP_PCB_FLAGS_WAS_CONNECTED 0x00080000 #define SCTP_PCB_FLAGS_WAS_ABORTED 0x00100000 Modified: stable/11/sys/netinet/sctp_output.c ============================================================================== --- stable/11/sys/netinet/sctp_output.c Thu May 16 09:18:59 2019 (r347672) +++ stable/11/sys/netinet/sctp_output.c Thu May 16 09:20:54 2019 (r347673) @@ -6798,6 +6798,10 @@ sctp_sendall_completes(void *ptr, uint32_t val SCTP_UN */ /* now free everything */ + if (ca->inp) { + /* Lets clear the flag to allow others to run. */ + ca->inp->sctp_flags &= ~SCTP_PCB_FLAGS_SND_ITERATOR_UP; + } sctp_m_freem(ca->m); SCTP_FREE(ca, SCTP_M_COPYAL); } @@ -6851,6 +6855,14 @@ sctp_sendall(struct sctp_inpcb *inp, struct uio *uio, int ret; struct sctp_copy_all *ca; + if (inp->sctp_flags & SCTP_PCB_FLAGS_SND_ITERATOR_UP) { + /* There is another. */ + return (EBUSY); + } + if (uio->uio_resid > SCTP_MAX_SENDALL_LIMIT) { + /* You must be less than the max! */ + return (EMSGSIZE); + } SCTP_MALLOC(ca, struct sctp_copy_all *, sizeof(struct sctp_copy_all), SCTP_M_COPYAL); if (ca == NULL) { @@ -6887,6 +6899,7 @@ sctp_sendall(struct sctp_inpcb *inp, struct uio *uio, ca->sndlen += SCTP_BUF_LEN(mat); } } + inp->sctp_flags |= SCTP_PCB_FLAGS_SND_ITERATOR_UP; ret = sctp_initiate_iterator(NULL, sctp_sendall_iterator, NULL, SCTP_PCB_ANY_FLAGS, SCTP_PCB_ANY_FEATURES, SCTP_ASOC_ANY_STATE, From owner-svn-src-stable@freebsd.org Thu May 16 09:22:38 2019 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id D6BE4158E63F; Thu, 16 May 2019 09:22:38 +0000 (UTC) (envelope-from tuexen@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 7BE196C3D4; Thu, 16 May 2019 09:22:38 +0000 (UTC) (envelope-from tuexen@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 573BF1EE66; Thu, 16 May 2019 09:22:38 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x4G9McxN045295; Thu, 16 May 2019 09:22:38 GMT (envelope-from tuexen@FreeBSD.org) Received: (from tuexen@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x4G9McVn045294; Thu, 16 May 2019 09:22:38 GMT (envelope-from tuexen@FreeBSD.org) Message-Id: <201905160922.x4G9McVn045294@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: tuexen set sender to tuexen@FreeBSD.org using -f From: Michael Tuexen Date: Thu, 16 May 2019 09:22:38 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r347674 - stable/11/sys/netinet X-SVN-Group: stable-11 X-SVN-Commit-Author: tuexen X-SVN-Commit-Paths: stable/11/sys/netinet X-SVN-Commit-Revision: 347674 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 7BE196C3D4 X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.98 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.998,0]; NEURAL_HAM_SHORT(-0.98)[-0.979,0]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US] X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 16 May 2019 09:22:39 -0000 Author: tuexen Date: Thu May 16 09:22:37 2019 New Revision: 347674 URL: https://svnweb.freebsd.org/changeset/base/347674 Log: MFC r345465: Fix a signed/unsigned bug when receiving SCTP messages. This is joint work with rrs@. Modified: stable/11/sys/netinet/sctputil.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/netinet/sctputil.c ============================================================================== --- stable/11/sys/netinet/sctputil.c Thu May 16 09:20:54 2019 (r347673) +++ stable/11/sys/netinet/sctputil.c Thu May 16 09:22:37 2019 (r347674) @@ -5215,8 +5215,9 @@ sctp_sorecvmsg(struct socket *so, * */ struct sctp_inpcb *inp = NULL; - int my_len = 0; - int cp_len = 0, error = 0; + size_t my_len = 0; + size_t cp_len = 0; + int error = 0; struct sctp_queued_to_read *control = NULL, *ctl = NULL, *nxt = NULL; struct mbuf *m = NULL; struct sctp_tcb *stcb = NULL; @@ -5724,8 +5725,8 @@ get_more_data: m = control->data; while (m) { /* Move out all we can */ - cp_len = (int)uio->uio_resid; - my_len = (int)SCTP_BUF_LEN(m); + cp_len = uio->uio_resid; + my_len = SCTP_BUF_LEN(m); if (cp_len > my_len) { /* not enough in this buf */ cp_len = my_len; From owner-svn-src-stable@freebsd.org Thu May 16 09:24:12 2019 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 55484158E716; Thu, 16 May 2019 09:24:12 +0000 (UTC) (envelope-from tuexen@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 EEE7E6C515; Thu, 16 May 2019 09:24:11 +0000 (UTC) (envelope-from tuexen@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 C8F6F1EE68; Thu, 16 May 2019 09:24:11 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x4G9OBwx045411; Thu, 16 May 2019 09:24:11 GMT (envelope-from tuexen@FreeBSD.org) Received: (from tuexen@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x4G9OBPZ045409; Thu, 16 May 2019 09:24:11 GMT (envelope-from tuexen@FreeBSD.org) Message-Id: <201905160924.x4G9OBPZ045409@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: tuexen set sender to tuexen@FreeBSD.org using -f From: Michael Tuexen Date: Thu, 16 May 2019 09:24:11 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r347675 - stable/11/sys/netinet X-SVN-Group: stable-11 X-SVN-Commit-Author: tuexen X-SVN-Commit-Paths: stable/11/sys/netinet X-SVN-Commit-Revision: 347675 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: EEE7E6C515 X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.98 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.998,0]; NEURAL_HAM_SHORT(-0.98)[-0.980,0]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US] X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 16 May 2019 09:24:12 -0000 Author: tuexen Date: Thu May 16 09:24:11 2019 New Revision: 347675 URL: https://svnweb.freebsd.org/changeset/base/347675 Log: MFC r345466: Fix more signed unsigned issues. This time on the send path. This is joint work with rrs@ and was found by running syzkaller. Modified: stable/11/sys/netinet/sctp_output.c stable/11/sys/netinet/sctp_structs.h Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/netinet/sctp_output.c ============================================================================== --- stable/11/sys/netinet/sctp_output.c Thu May 16 09:22:37 2019 (r347674) +++ stable/11/sys/netinet/sctp_output.c Thu May 16 09:24:11 2019 (r347675) @@ -6883,7 +6883,7 @@ sctp_sendall(struct sctp_inpcb *inp, struct uio *uio, ca->sndrcv.sinfo_flags &= ~SCTP_SENDALL; /* get length and mbuf chain */ if (uio) { - ca->sndlen = (int)uio->uio_resid; + ca->sndlen = uio->uio_resid; ca->m = sctp_copy_out_all(uio, ca->sndlen); if (ca->m == NULL) { SCTP_FREE(ca, SCTP_M_COPYAL); @@ -12525,7 +12525,7 @@ sctp_lower_sosend(struct socket *so, struct thread *p ) { - unsigned int sndlen = 0, max_len; + size_t sndlen = 0, max_len; int error, len; struct mbuf *top = NULL; int queue_only = 0, queue_only_for_init = 0; @@ -12577,12 +12577,12 @@ sctp_lower_sosend(struct socket *so, SCTP_LTRACE_ERR_RET(inp, stcb, net, SCTP_FROM_SCTP_OUTPUT, EINVAL); return (EINVAL); } - sndlen = (unsigned int)uio->uio_resid; + sndlen = uio->uio_resid; } else { top = SCTP_HEADER_TO_CHAIN(i_pak); sndlen = SCTP_HEADER_LEN(i_pak); } - SCTPDBG(SCTP_DEBUG_OUTPUT1, "Send called addr:%p send length %d\n", + SCTPDBG(SCTP_DEBUG_OUTPUT1, "Send called addr:%p send length %zu\n", (void *)addr, sndlen); if ((inp->sctp_flags & SCTP_PCB_FLAGS_TCPTYPE) && @@ -12934,7 +12934,7 @@ sctp_lower_sosend(struct socket *so, /* Are we aborting? */ if (srcv->sinfo_flags & SCTP_ABORT) { struct mbuf *mm; - int tot_demand, tot_out = 0, max_out; + size_t tot_demand, tot_out = 0, max_out; SCTP_STAT_INCR(sctps_sends_with_abort); if ((SCTP_GET_STATE(stcb) == SCTP_STATE_COOKIE_WAIT) || @@ -12990,7 +12990,7 @@ sctp_lower_sosend(struct socket *so, ph++; SCTP_BUF_LEN(mm) = tot_out + sizeof(struct sctp_paramhdr); if (top == NULL) { - error = uiomove((caddr_t)ph, (int)tot_out, uio); + error = uiomove((caddr_t)ph, tot_out, uio); if (error) { /*- * Here if we can't get his data we @@ -13219,7 +13219,7 @@ skip_preblock: if ((max_len > SCTP_BASE_SYSCTL(sctp_add_more_threshold)) || (max_len && (SCTP_SB_LIMIT_SND(so) < SCTP_BASE_SYSCTL(sctp_add_more_threshold))) || - (uio->uio_resid && (uio->uio_resid <= (int)max_len))) { + (uio->uio_resid && (uio->uio_resid <= max_len))) { sndout = 0; new_tail = NULL; if (hold_tcblock) { Modified: stable/11/sys/netinet/sctp_structs.h ============================================================================== --- stable/11/sys/netinet/sctp_structs.h Thu May 16 09:22:37 2019 (r347674) +++ stable/11/sys/netinet/sctp_structs.h Thu May 16 09:24:11 2019 (r347675) @@ -164,7 +164,7 @@ struct sctp_copy_all { struct sctp_inpcb *inp; /* ep */ struct mbuf *m; struct sctp_sndrcvinfo sndrcv; - int sndlen; + size_t sndlen; int cnt_sent; int cnt_failed; }; From owner-svn-src-stable@freebsd.org Thu May 16 09:25:51 2019 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 22B72158E829; Thu, 16 May 2019 09:25:51 +0000 (UTC) (envelope-from tuexen@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 BCF696C6C3; Thu, 16 May 2019 09:25:50 +0000 (UTC) (envelope-from tuexen@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 90D7D1EE69; Thu, 16 May 2019 09:25:50 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x4G9Pome045540; Thu, 16 May 2019 09:25:50 GMT (envelope-from tuexen@FreeBSD.org) Received: (from tuexen@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x4G9Pnrt045536; Thu, 16 May 2019 09:25:49 GMT (envelope-from tuexen@FreeBSD.org) Message-Id: <201905160925.x4G9Pnrt045536@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: tuexen set sender to tuexen@FreeBSD.org using -f From: Michael Tuexen Date: Thu, 16 May 2019 09:25:49 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r347676 - stable/11/sys/netinet X-SVN-Group: stable-11 X-SVN-Commit-Author: tuexen X-SVN-Commit-Paths: stable/11/sys/netinet X-SVN-Commit-Revision: 347676 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: BCF696C6C3 X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.98 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.998,0]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; NEURAL_HAM_SHORT(-0.98)[-0.981,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US] X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 16 May 2019 09:25:51 -0000 Author: tuexen Date: Thu May 16 09:25:49 2019 New Revision: 347676 URL: https://svnweb.freebsd.org/changeset/base/347676 Log: MFC r345467: Fix build issue for the userland stack. Joint work with rrs@. Modified: stable/11/sys/netinet/sctp_output.c stable/11/sys/netinet/sctp_structs.h stable/11/sys/netinet/sctputil.c stable/11/sys/netinet/sctputil.h Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/netinet/sctp_output.c ============================================================================== --- stable/11/sys/netinet/sctp_output.c Thu May 16 09:24:11 2019 (r347675) +++ stable/11/sys/netinet/sctp_output.c Thu May 16 09:25:49 2019 (r347676) @@ -6807,10 +6807,10 @@ sctp_sendall_completes(void *ptr, uint32_t val SCTP_UN } static struct mbuf * -sctp_copy_out_all(struct uio *uio, int len) +sctp_copy_out_all(struct uio *uio, ssize_t len) { struct mbuf *ret, *at; - int left, willcpy, cancpy, error; + ssize_t left, willcpy, cancpy, error; ret = sctp_get_mbuf_for_msg(MCLBYTES, 0, M_WAITOK, 1, MT_DATA); if (ret == NULL) { @@ -6825,17 +6825,17 @@ sctp_copy_out_all(struct uio *uio, int len) at = ret; while (left > 0) { /* Align data to the end */ - error = uiomove(mtod(at, caddr_t), willcpy, uio); + error = uiomove(mtod(at, caddr_t), (int)willcpy, uio); if (error) { err_out_now: sctp_m_freem(at); return (NULL); } - SCTP_BUF_LEN(at) = willcpy; + SCTP_BUF_LEN(at) = (int)willcpy; SCTP_BUF_NEXT_PKT(at) = SCTP_BUF_NEXT(at) = 0; left -= willcpy; if (left > 0) { - SCTP_BUF_NEXT(at) = sctp_get_mbuf_for_msg(left, 0, M_WAITOK, 1, MT_DATA); + SCTP_BUF_NEXT(at) = sctp_get_mbuf_for_msg((unsigned int)left, 0, M_WAITOK, 1, MT_DATA); if (SCTP_BUF_NEXT(at) == NULL) { goto err_out_now; } @@ -12379,7 +12379,7 @@ sctp_copy_it_in(struct sctp_tcb *stcb, struct sctp_sndrcvinfo *srcv, struct uio *uio, struct sctp_nets *net, - int max_send_len, + ssize_t max_send_len, int user_marks_eor, int *error) { @@ -12525,7 +12525,7 @@ sctp_lower_sosend(struct socket *so, struct thread *p ) { - size_t sndlen = 0, max_len; + ssize_t sndlen = 0, max_len; int error, len; struct mbuf *top = NULL; int queue_only = 0, queue_only_for_init = 0; @@ -12547,7 +12547,8 @@ sctp_lower_sosend(struct socket *so, int got_all_of_the_send = 0; int hold_tcblock = 0; int non_blocking = 0; - uint32_t local_add_more, local_soresv = 0; + uint32_t local_add_more; + ssize_t local_soresv = 0; uint16_t port; uint16_t sinfo_flags; sctp_assoc_t sinfo_assoc_id; @@ -12849,7 +12850,7 @@ sctp_lower_sosend(struct socket *so, } /* would we block? */ if (non_blocking) { - uint32_t amount; + ssize_t amount; if (hold_tcblock == 0) { SCTP_TCB_LOCK(stcb); @@ -12870,7 +12871,7 @@ sctp_lower_sosend(struct socket *so, error = EWOULDBLOCK; goto out_unlocked; } - stcb->asoc.sb_send_resv += sndlen; + stcb->asoc.sb_send_resv += (uint32_t)sndlen; SCTP_TCB_UNLOCK(stcb); hold_tcblock = 0; } else { @@ -12934,7 +12935,7 @@ sctp_lower_sosend(struct socket *so, /* Are we aborting? */ if (srcv->sinfo_flags & SCTP_ABORT) { struct mbuf *mm; - size_t tot_demand, tot_out = 0, max_out; + ssize_t tot_demand, tot_out = 0, max_out; SCTP_STAT_INCR(sctps_sends_with_abort); if ((SCTP_GET_STATE(stcb) == SCTP_STATE_COOKIE_WAIT) || @@ -12968,7 +12969,7 @@ sctp_lower_sosend(struct socket *so, error = EMSGSIZE; goto out; } - mm = sctp_get_mbuf_for_msg(tot_demand, 0, M_WAITOK, 1, MT_DATA); + mm = sctp_get_mbuf_for_msg((unsigned int)tot_demand, 0, M_WAITOK, 1, MT_DATA); } if (mm == NULL) { SCTP_LTRACE_ERR_RET(NULL, stcb, net, SCTP_FROM_SCTP_OUTPUT, ENOMEM); @@ -12988,9 +12989,9 @@ sctp_lower_sosend(struct socket *so, ph->param_type = htons(SCTP_CAUSE_USER_INITIATED_ABT); ph->param_length = htons((uint16_t)(sizeof(struct sctp_paramhdr) + tot_out)); ph++; - SCTP_BUF_LEN(mm) = tot_out + sizeof(struct sctp_paramhdr); + SCTP_BUF_LEN(mm) = (int)(tot_out + sizeof(struct sctp_paramhdr)); if (top == NULL) { - error = uiomove((caddr_t)ph, tot_out, uio); + error = uiomove((caddr_t)ph, (int)tot_out, uio); if (error) { /*- * Here if we can't get his data we @@ -13069,7 +13070,7 @@ sctp_lower_sosend(struct socket *so, * For non-eeor the whole message must fit in * the socket send buffer. */ - local_add_more = sndlen; + local_add_more = (uint32_t)sndlen; } len = 0; if (non_blocking) { @@ -13226,7 +13227,7 @@ skip_preblock: SCTP_TCB_UNLOCK(stcb); hold_tcblock = 0; } - mm = sctp_copy_resume(uio, max_len, user_marks_eor, &error, &sndout, &new_tail); + mm = sctp_copy_resume(uio, (int)max_len, user_marks_eor, &error, &sndout, &new_tail); if ((mm == NULL) || error) { if (mm) { sctp_m_freem(mm); @@ -13289,7 +13290,7 @@ skip_preblock: SCTP_TCB_LOCK(stcb); hold_tcblock = 1; } - sctp_prune_prsctp(stcb, asoc, srcv, sndlen); + sctp_prune_prsctp(stcb, asoc, srcv, (int)sndlen); inqueue_bytes = stcb->asoc.total_output_queue_size - (stcb->asoc.chunks_on_out_queue * SCTP_DATA_CHUNK_OVERHEAD(stcb)); if (SCTP_SB_LIMIT_SND(so) > inqueue_bytes) max_len = SCTP_SB_LIMIT_SND(so) - inqueue_bytes; @@ -13411,7 +13412,7 @@ skip_preblock: min(SCTP_BASE_SYSCTL(sctp_add_more_threshold), SCTP_SB_LIMIT_SND(so)))) { if (SCTP_BASE_SYSCTL(sctp_logging_level) & SCTP_BLK_LOGGING_ENABLE) { sctp_log_block(SCTP_BLOCK_LOG_INTO_BLK, - asoc, (size_t)uio->uio_resid); + asoc, uio->uio_resid); } be.error = 0; stcb->block_entry = &be; Modified: stable/11/sys/netinet/sctp_structs.h ============================================================================== --- stable/11/sys/netinet/sctp_structs.h Thu May 16 09:24:11 2019 (r347675) +++ stable/11/sys/netinet/sctp_structs.h Thu May 16 09:25:49 2019 (r347676) @@ -164,7 +164,7 @@ struct sctp_copy_all { struct sctp_inpcb *inp; /* ep */ struct mbuf *m; struct sctp_sndrcvinfo sndrcv; - size_t sndlen; + ssize_t sndlen; int cnt_sent; int cnt_failed; }; Modified: stable/11/sys/netinet/sctputil.c ============================================================================== --- stable/11/sys/netinet/sctputil.c Thu May 16 09:24:11 2019 (r347675) +++ stable/11/sys/netinet/sctputil.c Thu May 16 09:25:49 2019 (r347676) @@ -543,7 +543,7 @@ sctp_wakeup_log(struct sctp_tcb *stcb, uint32_t wake_c } void -sctp_log_block(uint8_t from, struct sctp_association *asoc, size_t sendlen) +sctp_log_block(uint8_t from, struct sctp_association *asoc, ssize_t sendlen) { #if defined(SCTP_LOCAL_TRACE_BUF) struct sctp_cwnd_log sctp_clog; @@ -5215,8 +5215,8 @@ sctp_sorecvmsg(struct socket *so, * */ struct sctp_inpcb *inp = NULL; - size_t my_len = 0; - size_t cp_len = 0; + ssize_t my_len = 0; + ssize_t cp_len = 0; int error = 0; struct sctp_queued_to_read *control = NULL, *ctl = NULL, *nxt = NULL; struct mbuf *m = NULL; @@ -5226,7 +5226,7 @@ sctp_sorecvmsg(struct socket *so, int out_flags = 0, in_flags = 0; int block_allowed = 1; uint32_t freed_so_far = 0; - uint32_t copied_so_far = 0; + ssize_t copied_so_far = 0; int in_eeor_mode = 0; int no_rcv_needed = 0; uint32_t rwnd_req = 0; @@ -5570,7 +5570,7 @@ found_one: * will go to the sctp_user_rcvd() that will not * lock until it KNOWs it MUST send a WUP-SACK. */ - freed_so_far = stcb->freed_by_sorcv_sincelast; + freed_so_far = (uint32_t)stcb->freed_by_sorcv_sincelast; stcb->freed_by_sorcv_sincelast = 0; } } @@ -5736,7 +5736,7 @@ get_more_data: hold_rlock = 0; } if (cp_len > 0) - error = uiomove(mtod(m, char *), cp_len, uio); + error = uiomove(mtod(m, char *), (int)cp_len, uio); /* re-read */ if (inp->sctp_flags & SCTP_PCB_FLAGS_SOCKET_GONE) { goto release; @@ -5781,7 +5781,7 @@ get_more_data: control->do_not_ref_stcb ? NULL : stcb, SCTP_LOG_SBRESULT, 0); } copied_so_far += cp_len; - freed_so_far += cp_len; + freed_so_far += (uint32_t)cp_len; freed_so_far += MSIZE; atomic_subtract_int(&control->length, cp_len); control->data = sctp_m_free(m); @@ -5821,9 +5821,9 @@ get_more_data: } if ((in_flags & MSG_PEEK) == 0) { SCTP_BUF_RESV_UF(m, cp_len); - SCTP_BUF_LEN(m) -= cp_len; + SCTP_BUF_LEN(m) -= (int)cp_len; if (SCTP_BASE_SYSCTL(sctp_logging_level) & SCTP_SB_LOGGING_ENABLE) { - sctp_sblog(&so->so_rcv, control->do_not_ref_stcb ? NULL : stcb, SCTP_LOG_SBFREE, cp_len); + sctp_sblog(&so->so_rcv, control->do_not_ref_stcb ? NULL : stcb, SCTP_LOG_SBFREE, (int)cp_len); } atomic_subtract_int(&so->so_rcv.sb_cc, cp_len); if ((control->do_not_ref_stcb == 0) && @@ -5831,7 +5831,7 @@ get_more_data: atomic_subtract_int(&stcb->asoc.sb_cc, cp_len); } copied_so_far += cp_len; - freed_so_far += cp_len; + freed_so_far += (uint32_t)cp_len; freed_so_far += MSIZE; if (SCTP_BASE_SYSCTL(sctp_logging_level) & SCTP_SB_LOGGING_ENABLE) { sctp_sblog(&so->so_rcv, control->do_not_ref_stcb ? NULL : stcb, @@ -6059,7 +6059,7 @@ wait_some_more: control->do_not_ref_stcb ? NULL : stcb, SCTP_LOG_SBFREE, SCTP_BUF_LEN(m)); } sctp_sbfree(control, stcb, &so->so_rcv, m); - freed_so_far += SCTP_BUF_LEN(m); + freed_so_far += (uint32_t)SCTP_BUF_LEN(m); freed_so_far += MSIZE; if (SCTP_BASE_SYSCTL(sctp_logging_level) & SCTP_SB_LOGGING_ENABLE) { sctp_sblog(&so->so_rcv, Modified: stable/11/sys/netinet/sctputil.h ============================================================================== --- stable/11/sys/netinet/sctputil.h Thu May 16 09:24:11 2019 (r347675) +++ stable/11/sys/netinet/sctputil.h Thu May 16 09:25:49 2019 (r347676) @@ -365,7 +365,7 @@ void sctp_log_closing(struct sctp_inpcb *inp, struct s void sctp_log_lock(struct sctp_inpcb *inp, struct sctp_tcb *stcb, uint8_t from); void sctp_log_maxburst(struct sctp_tcb *stcb, struct sctp_nets *, int, int, uint8_t); -void sctp_log_block(uint8_t, struct sctp_association *, size_t); +void sctp_log_block(uint8_t, struct sctp_association *, ssize_t); void sctp_log_rwnd(uint8_t, uint32_t, uint32_t, uint32_t); void sctp_log_rwnd_set(uint8_t, uint32_t, uint32_t, uint32_t, uint32_t); int sctp_fill_stat_log(void *, size_t *); From owner-svn-src-stable@freebsd.org Thu May 16 09:27:14 2019 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id C8BE7158E915; Thu, 16 May 2019 09:27:14 +0000 (UTC) (envelope-from tuexen@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 6CA7A6C8E9; Thu, 16 May 2019 09:27:14 +0000 (UTC) (envelope-from tuexen@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 4806A1EE6B; Thu, 16 May 2019 09:27:14 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x4G9RERT045903; Thu, 16 May 2019 09:27:14 GMT (envelope-from tuexen@FreeBSD.org) Received: (from tuexen@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x4G9RE84045902; Thu, 16 May 2019 09:27:14 GMT (envelope-from tuexen@FreeBSD.org) Message-Id: <201905160927.x4G9RE84045902@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: tuexen set sender to tuexen@FreeBSD.org using -f From: Michael Tuexen Date: Thu, 16 May 2019 09:27:14 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r347677 - stable/11/sys/netinet X-SVN-Group: stable-11 X-SVN-Commit-Author: tuexen X-SVN-Commit-Paths: stable/11/sys/netinet X-SVN-Commit-Revision: 347677 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 6CA7A6C8E9 X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.98 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.998,0]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; NEURAL_HAM_SHORT(-0.98)[-0.979,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US] X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 16 May 2019 09:27:15 -0000 Author: tuexen Date: Thu May 16 09:27:13 2019 New Revision: 347677 URL: https://svnweb.freebsd.org/changeset/base/347677 Log: MFC r345494: Fix the handling of fragmented unordered messages when using DATA chunks and FORWARD-TSN. This bug was reported in https://github.com/sctplab/usrsctp/issues/286 for the userland stack. This is joint work with rrs@. Modified: stable/11/sys/netinet/sctp_indata.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/netinet/sctp_indata.c ============================================================================== --- stable/11/sys/netinet/sctp_indata.c Thu May 16 09:25:49 2019 (r347676) +++ stable/11/sys/netinet/sctp_indata.c Thu May 16 09:27:13 2019 (r347677) @@ -945,6 +945,15 @@ sctp_inject_old_unordered_data(struct sctp_tcb *stcb, SCTPDBG(SCTP_DEBUG_XXX, "chunk is a first fsn: %u becomes fsn_included\n", chk->rec.data.fsn); + at = TAILQ_FIRST(&control->reasm); + if (at && SCTP_TSN_GT(chk->rec.data.fsn, at->rec.data.fsn)) { + /* + * The first chunk in the reassembly is a smaller + * TSN than this one, even though this has a first, + * it must be from a subsequent msg. + */ + goto place_chunk; + } if (control->first_frag_seen) { /* * In old un-ordered we can reassembly on one From owner-svn-src-stable@freebsd.org Thu May 16 09:28:35 2019 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 210EF158E9CF; Thu, 16 May 2019 09:28:35 +0000 (UTC) (envelope-from tuexen@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 B6FBC6CA43; Thu, 16 May 2019 09:28:34 +0000 (UTC) (envelope-from tuexen@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 8CAF81EE6C; Thu, 16 May 2019 09:28:34 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x4G9SYUQ046012; Thu, 16 May 2019 09:28:34 GMT (envelope-from tuexen@FreeBSD.org) Received: (from tuexen@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x4G9SY6n046011; Thu, 16 May 2019 09:28:34 GMT (envelope-from tuexen@FreeBSD.org) Message-Id: <201905160928.x4G9SY6n046011@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: tuexen set sender to tuexen@FreeBSD.org using -f From: Michael Tuexen Date: Thu, 16 May 2019 09:28:34 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r347678 - stable/11/sys/netinet X-SVN-Group: stable-11 X-SVN-Commit-Author: tuexen X-SVN-Commit-Paths: stable/11/sys/netinet X-SVN-Commit-Revision: 347678 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: B6FBC6CA43 X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.98 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.998,0]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; NEURAL_HAM_SHORT(-0.98)[-0.979,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US] X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 16 May 2019 09:28:35 -0000 Author: tuexen Date: Thu May 16 09:28:34 2019 New Revision: 347678 URL: https://svnweb.freebsd.org/changeset/base/347678 Log: MFC r345504: Improve locking when tearing down an SCTP association. This is joint work with rrs@ and the issue was found by syzkaller. Modified: stable/11/sys/netinet/sctp_pcb.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/netinet/sctp_pcb.c ============================================================================== --- stable/11/sys/netinet/sctp_pcb.c Thu May 16 09:27:13 2019 (r347677) +++ stable/11/sys/netinet/sctp_pcb.c Thu May 16 09:28:34 2019 (r347678) @@ -4981,6 +4981,7 @@ sctp_free_assoc(struct sctp_inpcb *inp, struct sctp_tc * in case. */ /* anything on the wheel needs to be removed */ + SCTP_TCB_SEND_LOCK(stcb); for (i = 0; i < asoc->streamoutcnt; i++) { struct sctp_stream_out *outs; @@ -4989,7 +4990,7 @@ sctp_free_assoc(struct sctp_inpcb *inp, struct sctp_tc TAILQ_FOREACH_SAFE(sp, &outs->outqueue, next, nsp) { atomic_subtract_int(&asoc->stream_queue_cnt, 1); TAILQ_REMOVE(&outs->outqueue, sp, next); - stcb->asoc.ss_functions.sctp_ss_remove_from_stream(stcb, asoc, outs, sp, 0); + stcb->asoc.ss_functions.sctp_ss_remove_from_stream(stcb, asoc, outs, sp, 1); sctp_free_spbufspace(stcb, asoc, sp); if (sp->data) { if (so) { @@ -5011,6 +5012,7 @@ sctp_free_assoc(struct sctp_inpcb *inp, struct sctp_tc sctp_free_a_strmoq(stcb, sp, SCTP_SO_LOCKED); } } + SCTP_TCB_SEND_UNLOCK(stcb); /* sa_ignore FREED_MEMORY */ TAILQ_FOREACH_SAFE(strrst, &asoc->resetHead, next_resp, nstrrst) { TAILQ_REMOVE(&asoc->resetHead, strrst, next_resp); From owner-svn-src-stable@freebsd.org Thu May 16 09:29:50 2019 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id C618E158EA7E; Thu, 16 May 2019 09:29:50 +0000 (UTC) (envelope-from tuexen@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 6B5216CB8C; Thu, 16 May 2019 09:29:50 +0000 (UTC) (envelope-from tuexen@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 419C81EE6D; Thu, 16 May 2019 09:29:50 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x4G9Tofq046117; Thu, 16 May 2019 09:29:50 GMT (envelope-from tuexen@FreeBSD.org) Received: (from tuexen@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x4G9TokR046116; Thu, 16 May 2019 09:29:50 GMT (envelope-from tuexen@FreeBSD.org) Message-Id: <201905160929.x4G9TokR046116@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: tuexen set sender to tuexen@FreeBSD.org using -f From: Michael Tuexen Date: Thu, 16 May 2019 09:29:50 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r347679 - stable/11/sys/netinet X-SVN-Group: stable-11 X-SVN-Commit-Author: tuexen X-SVN-Commit-Paths: stable/11/sys/netinet X-SVN-Commit-Revision: 347679 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 6B5216CB8C X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.98 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.998,0]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; NEURAL_HAM_SHORT(-0.98)[-0.979,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US] X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 16 May 2019 09:29:51 -0000 Author: tuexen Date: Thu May 16 09:29:49 2019 New Revision: 347679 URL: https://svnweb.freebsd.org/changeset/base/347679 Log: MFC r345505: Initialize scheduler specific data for the FCFS scheduler. This is joint work with rrs@. The issue was reported by using syzkaller. Modified: stable/11/sys/netinet/sctp_ss_functions.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/netinet/sctp_ss_functions.c ============================================================================== --- stable/11/sys/netinet/sctp_ss_functions.c Thu May 16 09:28:34 2019 (r347678) +++ stable/11/sys/netinet/sctp_ss_functions.c Thu May 16 09:29:49 2019 (r347679) @@ -836,6 +836,8 @@ sctp_ss_fcfs_init_stream(struct sctp_tcb *stcb, struct stcb->asoc.ss_data.last_out_stream = strq; } } + strq->ss_params.fb.next_spoke.tqe_next = NULL; + strq->ss_params.fb.next_spoke.tqe_prev = NULL; return; } From owner-svn-src-stable@freebsd.org Thu May 16 09:32:02 2019 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id E7125158ED4B; Thu, 16 May 2019 09:32:01 +0000 (UTC) (envelope-from tuexen@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 8A4FF6D0D3; Thu, 16 May 2019 09:32:01 +0000 (UTC) (envelope-from tuexen@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 64AA61EEE5; Thu, 16 May 2019 09:32:01 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x4G9W1Vu048053; Thu, 16 May 2019 09:32:01 GMT (envelope-from tuexen@FreeBSD.org) Received: (from tuexen@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x4G9W1ju048052; Thu, 16 May 2019 09:32:01 GMT (envelope-from tuexen@FreeBSD.org) Message-Id: <201905160932.x4G9W1ju048052@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: tuexen set sender to tuexen@FreeBSD.org using -f From: Michael Tuexen Date: Thu, 16 May 2019 09:32:01 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r347680 - stable/11/sys/netinet X-SVN-Group: stable-11 X-SVN-Commit-Author: tuexen X-SVN-Commit-Paths: stable/11/sys/netinet X-SVN-Commit-Revision: 347680 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 8A4FF6D0D3 X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.98 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.998,0]; NEURAL_HAM_SHORT(-0.98)[-0.979,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US]; NEURAL_HAM_LONG(-1.00)[-1.000,0] X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 16 May 2019 09:32:02 -0000 Author: tuexen Date: Thu May 16 09:32:00 2019 New Revision: 347680 URL: https://svnweb.freebsd.org/changeset/base/347680 Log: MFC r345525: Fix a double free of an SCTP association in an error path. This is joint work with rrs@. The issue was found by running syzkaller. Modified: stable/11/sys/netinet/sctp_usrreq.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/netinet/sctp_usrreq.c ============================================================================== --- stable/11/sys/netinet/sctp_usrreq.c Thu May 16 09:29:49 2019 (r347679) +++ stable/11/sys/netinet/sctp_usrreq.c Thu May 16 09:32:00 2019 (r347680) @@ -1481,8 +1481,6 @@ sctp_do_connect_x(struct socket *so, struct sctp_inpcb sctp_connectx_helper_add(stcb, sa, (totaddr - 1), &error); /* Fill in the return id */ if (error) { - (void)sctp_free_assoc(inp, stcb, SCTP_PCBFREE_FORCE, - SCTP_FROM_SCTP_USRREQ + SCTP_LOC_7); goto out_now; } a_id = (sctp_assoc_t *)optval; From owner-svn-src-stable@freebsd.org Thu May 16 09:33:39 2019 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 30E81158EE17; Thu, 16 May 2019 09:33:39 +0000 (UTC) (envelope-from tuexen@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 CAFA16D2B2; Thu, 16 May 2019 09:33:38 +0000 (UTC) (envelope-from tuexen@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 9B0001F00E; Thu, 16 May 2019 09:33:38 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x4G9Xc3M051397; Thu, 16 May 2019 09:33:38 GMT (envelope-from tuexen@FreeBSD.org) Received: (from tuexen@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x4G9Xci2051396; Thu, 16 May 2019 09:33:38 GMT (envelope-from tuexen@FreeBSD.org) Message-Id: <201905160933.x4G9Xci2051396@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: tuexen set sender to tuexen@FreeBSD.org using -f From: Michael Tuexen Date: Thu, 16 May 2019 09:33:38 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r347681 - stable/11/sys/netinet X-SVN-Group: stable-11 X-SVN-Commit-Author: tuexen X-SVN-Commit-Paths: stable/11/sys/netinet X-SVN-Commit-Revision: 347681 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: CAFA16D2B2 X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.98 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.998,0]; NEURAL_HAM_SHORT(-0.98)[-0.982,0]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US] X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 16 May 2019 09:33:39 -0000 Author: tuexen Date: Thu May 16 09:33:38 2019 New Revision: 347681 URL: https://svnweb.freebsd.org/changeset/base/347681 Log: MFC r346134: Fix an SCTP related locking issue. Don't report that the TCB_SEND_LOCK is owned, when it is not. This issue was found by running syzkaller. Modified: stable/11/sys/netinet/sctputil.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/netinet/sctputil.c ============================================================================== --- stable/11/sys/netinet/sctputil.c Thu May 16 09:32:00 2019 (r347680) +++ stable/11/sys/netinet/sctputil.c Thu May 16 09:33:38 2019 (r347681) @@ -3991,7 +3991,7 @@ sctp_abort_notification(struct sctp_tcb *stcb, uint8_t return; } /* Tell them we lost the asoc */ - sctp_report_all_outbound(stcb, error, 1, so_locked); + sctp_report_all_outbound(stcb, error, 0, so_locked); if (from_peer) { sctp_ulp_notify(SCTP_NOTIFY_ASSOC_REM_ABORTED, stcb, error, abort, so_locked); } else { From owner-svn-src-stable@freebsd.org Thu May 16 10:41:31 2019 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id E47B41590A98; Thu, 16 May 2019 10:41:30 +0000 (UTC) (envelope-from dchagin@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 8A7EF6F57E; Thu, 16 May 2019 10:41:30 +0000 (UTC) (envelope-from dchagin@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 654A51FB54; Thu, 16 May 2019 10:41:30 +0000 (UTC) (envelope-from dchagin@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x4GAfUi9086277; Thu, 16 May 2019 10:41:30 GMT (envelope-from dchagin@FreeBSD.org) Received: (from dchagin@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x4GAfUdg086276; Thu, 16 May 2019 10:41:30 GMT (envelope-from dchagin@FreeBSD.org) Message-Id: <201905161041.x4GAfUdg086276@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: dchagin set sender to dchagin@FreeBSD.org using -f From: Dmitry Chagin Date: Thu, 16 May 2019 10:41:30 +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: r347683 - stable/12/sys/compat/linsysfs X-SVN-Group: stable-12 X-SVN-Commit-Author: dchagin X-SVN-Commit-Paths: stable/12/sys/compat/linsysfs X-SVN-Commit-Revision: 347683 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 8A7EF6F57E X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.96 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.998,0]; NEURAL_HAM_SHORT(-0.96)[-0.964,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US]; NEURAL_HAM_LONG(-1.00)[-1.000,0] X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 16 May 2019 10:41:31 -0000 Author: dchagin Date: Thu May 16 10:41:29 2019 New Revision: 347683 URL: https://svnweb.freebsd.org/changeset/base/347683 Log: MFC r347016: Remove unneeded includes. Modified: stable/12/sys/compat/linsysfs/linsysfs.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/compat/linsysfs/linsysfs.c ============================================================================== --- stable/12/sys/compat/linsysfs/linsysfs.c Thu May 16 09:49:19 2019 (r347682) +++ stable/12/sys/compat/linsysfs/linsysfs.c Thu May 16 10:41:29 2019 (r347683) @@ -31,22 +31,12 @@ __FBSDID("$FreeBSD$"); #include #include -#include -#include -#include -#include -#include #include -#include #include #include -#include -#include -#include #include #include #include -#include #include #include @@ -55,17 +45,6 @@ __FBSDID("$FreeBSD$"); #include -#include -#include -#include -#include -#include -#include - -#include - -#include -#include #include #include From owner-svn-src-stable@freebsd.org Thu May 16 10:43:53 2019 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id D483F1590CDE; Thu, 16 May 2019 10:43:53 +0000 (UTC) (envelope-from dchagin@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 760376F7A1; Thu, 16 May 2019 10:43:53 +0000 (UTC) (envelope-from dchagin@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 4EE141FBA7; Thu, 16 May 2019 10:43:53 +0000 (UTC) (envelope-from dchagin@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x4GAhr3L088307; Thu, 16 May 2019 10:43:53 GMT (envelope-from dchagin@FreeBSD.org) Received: (from dchagin@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x4GAhro6088306; Thu, 16 May 2019 10:43:53 GMT (envelope-from dchagin@FreeBSD.org) Message-Id: <201905161043.x4GAhro6088306@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: dchagin set sender to dchagin@FreeBSD.org using -f From: Dmitry Chagin Date: Thu, 16 May 2019 10:43:53 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r347684 - stable/11/sys/compat/linsysfs X-SVN-Group: stable-11 X-SVN-Commit-Author: dchagin X-SVN-Commit-Paths: stable/11/sys/compat/linsysfs X-SVN-Commit-Revision: 347684 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 760376F7A1 X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.96 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.998,0]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; NEURAL_HAM_SHORT(-0.96)[-0.964,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US] X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 16 May 2019 10:43:54 -0000 Author: dchagin Date: Thu May 16 10:43:52 2019 New Revision: 347684 URL: https://svnweb.freebsd.org/changeset/base/347684 Log: MFC r347016: Remove unneeded includes. Modified: stable/11/sys/compat/linsysfs/linsysfs.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/compat/linsysfs/linsysfs.c ============================================================================== --- stable/11/sys/compat/linsysfs/linsysfs.c Thu May 16 10:41:29 2019 (r347683) +++ stable/11/sys/compat/linsysfs/linsysfs.c Thu May 16 10:43:52 2019 (r347684) @@ -29,22 +29,13 @@ __FBSDID("$FreeBSD$"); #include #include -#include -#include -#include -#include -#include #include -#include #include #include -#include #include -#include #include #include #include -#include #include #include @@ -53,17 +44,6 @@ __FBSDID("$FreeBSD$"); #include -#include -#include -#include -#include -#include -#include - -#include - -#include -#include #include #include From owner-svn-src-stable@freebsd.org Thu May 16 11:09:54 2019 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 660061591506; Thu, 16 May 2019 11:09:54 +0000 (UTC) (envelope-from tuexen@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 038A7701F1; Thu, 16 May 2019 11:09:54 +0000 (UTC) (envelope-from tuexen@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 C52A11FF21; Thu, 16 May 2019 11:09:53 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x4GB9rVX098675; Thu, 16 May 2019 11:09:53 GMT (envelope-from tuexen@FreeBSD.org) Received: (from tuexen@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x4GB9rxb098674; Thu, 16 May 2019 11:09:53 GMT (envelope-from tuexen@FreeBSD.org) Message-Id: <201905161109.x4GB9rxb098674@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: tuexen set sender to tuexen@FreeBSD.org using -f From: Michael Tuexen Date: Thu, 16 May 2019 11:09:53 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r347685 - stable/11/sys/netinet X-SVN-Group: stable-11 X-SVN-Commit-Author: tuexen X-SVN-Commit-Paths: stable/11/sys/netinet X-SVN-Commit-Revision: 347685 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 038A7701F1 X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.97 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.998,0]; NEURAL_HAM_SHORT(-0.97)[-0.975,0]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US] X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 16 May 2019 11:09:54 -0000 Author: tuexen Date: Thu May 16 11:09:53 2019 New Revision: 347685 URL: https://svnweb.freebsd.org/changeset/base/347685 Log: MFC r346182: When sending IPv4 packets on a SOCK_RAW socket using the IP_HDRINCL option, ensure that the ip_hl field is valid. Furthermore, ensure that the complete IPv4 header is contained in the first mbuf. Finally, move the length checks before relying on them when accessing fields of the IPv4 header. Modified: stable/11/sys/netinet/raw_ip.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/netinet/raw_ip.c ============================================================================== --- stable/11/sys/netinet/raw_ip.c Thu May 16 10:43:52 2019 (r347684) +++ stable/11/sys/netinet/raw_ip.c Thu May 16 11:09:53 2019 (r347685) @@ -439,7 +439,7 @@ rip_output(struct mbuf *m, struct socket *so, ...) u_long dst; int flags = ((so->so_options & SO_DONTROUTE) ? IP_ROUTETOIF : 0) | IP_ALLOWBROADCAST; - int cnt; + int cnt, hlen; u_char opttype, optlen, *cp; va_start(ap, so); @@ -495,33 +495,40 @@ rip_output(struct mbuf *m, struct socket *so, ...) m_freem(m); return(EMSGSIZE); } - INP_RLOCK(inp); ip = mtod(m, struct ip *); - error = prison_check_ip4(inp->inp_cred, &ip->ip_src); - if (error != 0) { - INP_RUNLOCK(inp); - m_freem(m); - return (error); + hlen = ip->ip_hl << 2; + if (m->m_len < hlen) { + m = m_pullup(m, hlen); + if (m == NULL) + return (EINVAL); + ip = mtod(m, struct ip *); } + INP_RLOCK(inp); /* * Don't allow both user specified and setsockopt options, * and don't allow packet length sizes that will crash. */ - if (((ip->ip_hl != (sizeof (*ip) >> 2)) && inp->inp_options) - || (ntohs(ip->ip_len) != m->m_pkthdr.len) - || (ntohs(ip->ip_len) < (ip->ip_hl << 2))) { + if ((hlen < sizeof (*ip)) + || ((hlen > sizeof (*ip)) && inp->inp_options) + || (ntohs(ip->ip_len) != m->m_pkthdr.len)) { INP_RUNLOCK(inp); m_freem(m); return (EINVAL); } + error = prison_check_ip4(inp->inp_cred, &ip->ip_src); + if (error != 0) { + INP_RUNLOCK(inp); + m_freem(m); + return (error); + } /* * Don't allow IP options which do not have the required * structure as specified in section 3.1 of RFC 791 on * pages 15-23. */ cp = (u_char *)(ip + 1); - cnt = (ip->ip_hl << 2) - sizeof (struct ip); + cnt = hlen - sizeof (struct ip); for (; cnt > 0; cnt -= optlen, cp += optlen) { opttype = cp[IPOPT_OPTVAL]; if (opttype == IPOPT_EOL) From owner-svn-src-stable@freebsd.org Thu May 16 11:14:09 2019 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 75C661591859; Thu, 16 May 2019 11:14:09 +0000 (UTC) (envelope-from tuexen@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 1665D70678; Thu, 16 May 2019 11:14:09 +0000 (UTC) (envelope-from tuexen@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 E5726200BF; Thu, 16 May 2019 11:14:08 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x4GBE87E003823; Thu, 16 May 2019 11:14:08 GMT (envelope-from tuexen@FreeBSD.org) Received: (from tuexen@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x4GBE8Fj003822; Thu, 16 May 2019 11:14:08 GMT (envelope-from tuexen@FreeBSD.org) Message-Id: <201905161114.x4GBE8Fj003822@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: tuexen set sender to tuexen@FreeBSD.org using -f From: Michael Tuexen Date: Thu, 16 May 2019 11:14:08 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r347686 - stable/11/sys/netinet6 X-SVN-Group: stable-11 X-SVN-Commit-Author: tuexen X-SVN-Commit-Paths: stable/11/sys/netinet6 X-SVN-Commit-Revision: 347686 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 1665D70678 X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.97 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.998,0]; NEURAL_HAM_SHORT(-0.97)[-0.975,0]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US] X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 16 May 2019 11:14:09 -0000 Author: tuexen Date: Thu May 16 11:14:08 2019 New Revision: 347686 URL: https://svnweb.freebsd.org/changeset/base/347686 Log: MFC r346400: Improve input validation for the socket option IPV6_CHECKSUM. When using the IPPROTO_IPV6 level socket option IPV6_CHECKSUM on a raw IPv6 socket, ensure that the value is either -1 or a non-negative even number. Modified: stable/11/sys/netinet6/ip6_output.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/netinet6/ip6_output.c ============================================================================== --- stable/11/sys/netinet6/ip6_output.c Thu May 16 11:09:53 2019 (r347685) +++ stable/11/sys/netinet6/ip6_output.c Thu May 16 11:14:08 2019 (r347686) @@ -2168,8 +2168,11 @@ ip6_raw_ctloutput(struct socket *so, struct sockopt *s sizeof(optval)); if (error) break; - if ((optval % 2) != 0) { - /* the API assumes even offset values */ + if (optval < -1 || (optval % 2) != 0) { + /* + * The API assumes non-negative even offset + * values or -1 as a special value. + */ error = EINVAL; } else if (so->so_proto->pr_protocol == IPPROTO_ICMPV6) { From owner-svn-src-stable@freebsd.org Thu May 16 11:18:51 2019 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 562D11591B5F; Thu, 16 May 2019 11:18:51 +0000 (UTC) (envelope-from tuexen@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 BD9DC70956; Thu, 16 May 2019 11:18:50 +0000 (UTC) (envelope-from tuexen@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 AC45C200C0; Thu, 16 May 2019 11:18:50 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x4GBIob8004057; Thu, 16 May 2019 11:18:50 GMT (envelope-from tuexen@FreeBSD.org) Received: (from tuexen@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x4GBIoBS004056; Thu, 16 May 2019 11:18:50 GMT (envelope-from tuexen@FreeBSD.org) Message-Id: <201905161118.x4GBIoBS004056@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: tuexen set sender to tuexen@FreeBSD.org using -f From: Michael Tuexen Date: Thu, 16 May 2019 11:18:50 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r347687 - stable/11/sys/netinet6 X-SVN-Group: stable-11 X-SVN-Commit-Author: tuexen X-SVN-Commit-Paths: stable/11/sys/netinet6 X-SVN-Commit-Revision: 347687 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: BD9DC70956 X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.97 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.998,0]; NEURAL_HAM_SHORT(-0.97)[-0.975,0]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US] X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 16 May 2019 11:18:51 -0000 Author: tuexen Date: Thu May 16 11:18:50 2019 New Revision: 347687 URL: https://svnweb.freebsd.org/changeset/base/347687 Log: MFC r346401: Avoid a buffer overwrite in rip6_output() when computing the checksum as requested by the user via the IPPROTO_IPV6 level socket option IPV6_CHECKSUM. The check if there are enough bytes in the packet to store the checksum at the requested offset was wrong by 1. Modified: stable/11/sys/netinet6/raw_ip6.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/netinet6/raw_ip6.c ============================================================================== --- stable/11/sys/netinet6/raw_ip6.c Thu May 16 11:14:08 2019 (r347686) +++ stable/11/sys/netinet6/raw_ip6.c Thu May 16 11:18:50 2019 (r347687) @@ -498,7 +498,7 @@ rip6_output(struct mbuf *m, struct socket *so, ...) off = offsetof(struct icmp6_hdr, icmp6_cksum); else off = in6p->in6p_cksum; - if (plen < off + 1) { + if (plen < off + 2) { error = EINVAL; goto bad; } From owner-svn-src-stable@freebsd.org Thu May 16 11:20:03 2019 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 903E01591BE8; Thu, 16 May 2019 11:20:03 +0000 (UTC) (envelope-from tuexen@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 37A5170A9A; Thu, 16 May 2019 11:20:03 +0000 (UTC) (envelope-from tuexen@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 124DB200C4; Thu, 16 May 2019 11:20:03 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x4GBK2Os004191; Thu, 16 May 2019 11:20:02 GMT (envelope-from tuexen@FreeBSD.org) Received: (from tuexen@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x4GBK2Xv004190; Thu, 16 May 2019 11:20:02 GMT (envelope-from tuexen@FreeBSD.org) Message-Id: <201905161120.x4GBK2Xv004190@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: tuexen set sender to tuexen@FreeBSD.org using -f From: Michael Tuexen Date: Thu, 16 May 2019 11:20:02 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r347688 - stable/11/sys/netinet6 X-SVN-Group: stable-11 X-SVN-Commit-Author: tuexen X-SVN-Commit-Paths: stable/11/sys/netinet6 X-SVN-Commit-Revision: 347688 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 37A5170A9A X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.97 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.998,0]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; NEURAL_HAM_SHORT(-0.97)[-0.975,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US] X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 16 May 2019 11:20:03 -0000 Author: tuexen Date: Thu May 16 11:20:02 2019 New Revision: 347688 URL: https://svnweb.freebsd.org/changeset/base/347688 Log: MFC r346402: When a checksum has to be computed for a received IPv6 packet because it is requested by the application using the IPPROTO_IPV6 level socket option IPV6_CHECKSUM on a raw socket, ensure that the packet contains enough bytes to contain the checksum at the specified offset. Modified: stable/11/sys/netinet6/raw_ip6.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/netinet6/raw_ip6.c ============================================================================== --- stable/11/sys/netinet6/raw_ip6.c Thu May 16 11:18:50 2019 (r347687) +++ stable/11/sys/netinet6/raw_ip6.c Thu May 16 11:20:02 2019 (r347688) @@ -198,7 +198,8 @@ rip6_input(struct mbuf **mp, int *offp, int proto) INP_RLOCK(in6p); if (in6p->in6p_cksum != -1) { RIP6STAT_INC(rip6s_isum); - if (in6_cksum(m, proto, *offp, + if (m->m_pkthdr.len - (*offp + in6p->in6p_cksum) < 2 || + in6_cksum(m, proto, *offp, m->m_pkthdr.len - *offp)) { INP_RUNLOCK(in6p); RIP6STAT_INC(rip6s_badsum); From owner-svn-src-stable@freebsd.org Thu May 16 14:39:49 2019 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id ADDF815987CC; Thu, 16 May 2019 14:39:49 +0000 (UTC) (envelope-from kib@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 4D79D80FD3; Thu, 16 May 2019 14:39:49 +0000 (UTC) (envelope-from kib@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 0A501222C5; Thu, 16 May 2019 14:39:49 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x4GEdm4x008867; Thu, 16 May 2019 14:39:48 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x4GEdmB0008866; Thu, 16 May 2019 14:39:48 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201905161439.x4GEdmB0008866@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Thu, 16 May 2019 14:39:48 +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: r347699 - stable/12/sys/kern X-SVN-Group: stable-12 X-SVN-Commit-Author: kib X-SVN-Commit-Paths: stable/12/sys/kern X-SVN-Commit-Revision: 347699 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 4D79D80FD3 X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.98 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.998,0]; NEURAL_HAM_SHORT(-0.98)[-0.979,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US]; NEURAL_HAM_LONG(-1.00)[-1.000,0] X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 16 May 2019 14:39:49 -0000 Author: kib Date: Thu May 16 14:39:48 2019 New Revision: 347699 URL: https://svnweb.freebsd.org/changeset/base/347699 Log: MFC r343985, r344133, r345273 (by bde): Prevent overflow for usertime/systime in caclru1(). PR: 76972 Modified: stable/12/sys/kern/kern_resource.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/kern/kern_resource.c ============================================================================== --- stable/12/sys/kern/kern_resource.c Thu May 16 14:33:32 2019 (r347698) +++ stable/12/sys/kern/kern_resource.c Thu May 16 14:39:48 2019 (r347699) @@ -863,6 +863,90 @@ rufetchtd(struct thread *td, struct rusage *ru) calcru1(p, &td->td_rux, &ru->ru_utime, &ru->ru_stime); } +/* XXX: the MI version is too slow to use: */ +#ifndef __HAVE_INLINE_FLSLL +#define flsll(x) (fls((x) >> 32) != 0 ? fls((x) >> 32) + 32 : fls(x)) +#endif + +static uint64_t +mul64_by_fraction(uint64_t a, uint64_t b, uint64_t c) +{ + uint64_t acc, bh, bl; + int i, s, sa, sb; + + /* + * Calculate (a * b) / c accurately enough without overflowing. c + * must be nonzero, and its top bit must be 0. a or b must be + * <= c, and the implementation is tuned for b <= c. + * + * The comments about times are for use in calcru1() with units of + * microseconds for 'a' and stathz ticks at 128 Hz for b and c. + * + * Let n be the number of top zero bits in c. Each iteration + * either returns, or reduces b by right shifting it by at least n. + * The number of iterations is at most 1 + 64 / n, and the error is + * at most the number of iterations. + * + * It is very unusual to need even 2 iterations. Previous + * implementations overflowed essentially by returning early in the + * first iteration, with n = 38 giving overflow at 105+ hours and + * n = 32 giving overlow at at 388+ days despite a more careful + * calculation. 388 days is a reasonable uptime, and the calculation + * needs to work for the uptime times the number of CPUs since 'a' + * is per-process. + */ + if (a >= (uint64_t)1 << 63) + return (0); /* Unsupported arg -- can't happen. */ + acc = 0; + for (i = 0; i < 128; i++) { + sa = flsll(a); + sb = flsll(b); + if (sa + sb <= 64) + /* Up to 105 hours on first iteration. */ + return (acc + (a * b) / c); + if (a >= c) { + /* + * This reduction is based on a = q * c + r, with the + * remainder r < c. 'a' may be large to start, and + * moving bits from b into 'a' at the end of the loop + * sets the top bit of 'a', so the reduction makes + * significant progress. + */ + acc += (a / c) * b; + a %= c; + sa = flsll(a); + if (sa + sb <= 64) + /* Up to 388 days on first iteration. */ + return (acc + (a * b) / c); + } + + /* + * This step writes a * b as a * ((bh << s) + bl) = + * a * (bh << s) + a * bl = (a << s) * bh + a * bl. The 2 + * additive terms are handled separately. Splitting in + * this way is linear except for rounding errors. + * + * s = 64 - sa is the maximum such that a << s fits in 64 + * bits. Since a < c and c has at least 1 zero top bit, + * sa < 64 and s > 0. Thus this step makes progress by + * reducing b (it increases 'a', but taking remainders on + * the next iteration completes the reduction). + * + * Finally, the choice for s is just what is needed to keep + * a * bl from overflowing, so we don't need complications + * like a recursive call mul64_by_fraction(a, bl, c) to + * handle the second additive term. + */ + s = 64 - sa; + bh = b >> s; + bl = b - (bh << s); + acc += (a * bl) / c; + a <<= s; + b = bh; + } + return (0); /* Algorithm failure -- can't happen. */ +} + static void calcru1(struct proc *p, struct rusage_ext *ruxp, struct timeval *up, struct timeval *sp) @@ -887,15 +971,23 @@ calcru1(struct proc *p, struct rusage_ext *ruxp, struc tu = ruxp->rux_tu; } + /* Subdivide tu. Avoid overflow in the multiplications. */ + if (__predict_true(tu <= ((uint64_t)1 << 38) && tt <= (1 << 26))) { + /* Up to 76 hours when stathz is 128. */ + uu = (tu * ut) / tt; + su = (tu * st) / tt; + } else { + uu = mul64_by_fraction(tu, ut, tt); + su = mul64_by_fraction(tu, st, tt); + } + if (tu >= ruxp->rux_tu) { /* * The normal case, time increased. * Enforce monotonicity of bucketed numbers. */ - uu = (tu * ut) / tt; if (uu < ruxp->rux_uu) uu = ruxp->rux_uu; - su = (tu * st) / tt; if (su < ruxp->rux_su) su = ruxp->rux_su; } else if (tu + 3 > ruxp->rux_tu || 101 * tu > 100 * ruxp->rux_tu) { @@ -924,8 +1016,6 @@ calcru1(struct proc *p, struct rusage_ext *ruxp, struc "to %ju usec for pid %d (%s)\n", (uintmax_t)ruxp->rux_tu, (uintmax_t)tu, p->p_pid, p->p_comm); - uu = (tu * ut) / tt; - su = (tu * st) / tt; } ruxp->rux_uu = uu; From owner-svn-src-stable@freebsd.org Thu May 16 14:42:20 2019 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id D4CEF1598918; Thu, 16 May 2019 14:42:19 +0000 (UTC) (envelope-from markj@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 86356813BF; Thu, 16 May 2019 14:42:19 +0000 (UTC) (envelope-from markj@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 6152522457; Thu, 16 May 2019 14:42:19 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x4GEgJRY013205; Thu, 16 May 2019 14:42:19 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x4GEgHRd013192; Thu, 16 May 2019 14:42:17 GMT (envelope-from markj@FreeBSD.org) Message-Id: <201905161442.x4GEgHRd013192@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Thu, 16 May 2019 14:42:17 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r347700 - in stable/11: stand/defaults sys/amd64/amd64 sys/conf sys/dev/cpuctl sys/i386/i386 sys/x86/acpica sys/x86/include sys/x86/x86 X-SVN-Group: stable-11 X-SVN-Commit-Author: markj X-SVN-Commit-Paths: in stable/11: stand/defaults sys/amd64/amd64 sys/conf sys/dev/cpuctl sys/i386/i386 sys/x86/acpica sys/x86/include sys/x86/x86 X-SVN-Commit-Revision: 347700 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 86356813BF X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.98 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.998,0]; NEURAL_HAM_SHORT(-0.98)[-0.980,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US]; NEURAL_HAM_LONG(-1.00)[-1.000,0] X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 16 May 2019 14:42:20 -0000 Author: markj Date: Thu May 16 14:42:16 2019 New Revision: 347700 URL: https://svnweb.freebsd.org/changeset/base/347700 Log: MFC r337715, r337751, r337754, r337758, r337813, r338354, r338687, r339124, r341821: Add support for boot-time Intel microcode loading. Added: stable/11/sys/x86/include/ucode.h - copied, changed from r337715, head/sys/x86/include/ucode.h stable/11/sys/x86/x86/ucode.c - copied, changed from r337715, head/sys/x86/x86/ucode.c Modified: stable/11/stand/defaults/loader.conf.5 stable/11/sys/amd64/amd64/machdep.c stable/11/sys/amd64/amd64/mp_machdep.c stable/11/sys/conf/files.amd64 stable/11/sys/conf/files.i386 stable/11/sys/dev/cpuctl/cpuctl.c stable/11/sys/i386/i386/locore.s stable/11/sys/i386/i386/machdep.c stable/11/sys/i386/i386/mp_machdep.c stable/11/sys/x86/acpica/acpi_wakeup.c stable/11/sys/x86/x86/mp_x86.c Directory Properties: stable/11/ (props changed) Modified: stable/11/stand/defaults/loader.conf.5 ============================================================================== --- stable/11/stand/defaults/loader.conf.5 Thu May 16 14:39:48 2019 (r347699) +++ stable/11/stand/defaults/loader.conf.5 Thu May 16 14:42:16 2019 (r347700) @@ -23,7 +23,7 @@ .\" SUCH DAMAGE. .\" .\" $FreeBSD$ -.Dd February 16, 2019 +.Dd May 16, 2019 .Dt LOADER.CONF 5 .Os .Sh NAME @@ -285,6 +285,29 @@ See the entropy entries in .Pq Dq /boot/entropy The name of the very early boot-time entropy cache file. +.It Va cpu_microcode_load +.Pq Dq NO +If set to +.Dq YES , +the microcode update file specified by +.Va cpu_microcode_name +will be loaded and applied very early during boot. +This provides functionality similar to +.Xr cpucontrol 8 +but ensures that CPU features enabled by microcode updates can be +used by the kernel. +The update will be re-applied automatically when resuming from an +ACPI sleep state. +If the update file contains updates for multiple processor models, +the kernel will search for and extract a matching update. +Currently this setting is supported only on Intel +.Dv i386 +and +.Dv amd64 +processors. +It has no effect on other processor types. +.It Va cpu_microcode_name +A path to a microcode update file. .El .Sh OTHER SETTINGS Other settings that may be used in @@ -315,6 +338,7 @@ machine-specific settings for sites with a common load .Sh SEE ALSO .Xr rc.conf 5 , .Xr boot 8 , +.Xr cpucontrol 8 , .Xr loader 8 , .Xr loader.4th 8 .Sh HISTORY Modified: stable/11/sys/amd64/amd64/machdep.c ============================================================================== --- stable/11/sys/amd64/amd64/machdep.c Thu May 16 14:39:48 2019 (r347699) +++ stable/11/sys/amd64/amd64/machdep.c Thu May 16 14:42:16 2019 (r347700) @@ -131,6 +131,7 @@ __FBSDID("$FreeBSD$"); #include #endif #include +#include #ifdef SMP #include #endif @@ -1577,6 +1578,9 @@ hammer_time(u_int64_t modulep, u_int64_t physfree) int late_console; kmdp = init_ops.parse_preload_data(modulep); + + physfree += ucode_load_bsp(physfree + KERNBASE); + physfree = roundup2(physfree, PAGE_SIZE); identify_cpu1(); identify_hypervisor(); Modified: stable/11/sys/amd64/amd64/mp_machdep.c ============================================================================== --- stable/11/sys/amd64/amd64/mp_machdep.c Thu May 16 14:39:48 2019 (r347699) +++ stable/11/sys/amd64/amd64/mp_machdep.c Thu May 16 14:42:16 2019 (r347700) @@ -69,6 +69,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include @@ -211,6 +212,9 @@ init_secondary(void) /* Set by the startup code for us to use */ cpu = bootAP; + + /* Update microcode before doing anything else. */ + ucode_load_ap(cpu); /* Init tss */ common_tss[cpu] = common_tss[0]; Modified: stable/11/sys/conf/files.amd64 ============================================================================== --- stable/11/sys/conf/files.amd64 Thu May 16 14:39:48 2019 (r347699) +++ stable/11/sys/conf/files.amd64 Thu May 16 14:42:16 2019 (r347700) @@ -725,6 +725,7 @@ x86/x86/nexus.c standard x86/x86/pvclock.c standard x86/x86/stack_machdep.c optional ddb | stack x86/x86/tsc.c standard +x86/x86/ucode.c standard x86/x86/delay.c standard x86/xen/hvm.c optional xenhvm x86/xen/xen_intr.c optional xenhvm Modified: stable/11/sys/conf/files.i386 ============================================================================== --- stable/11/sys/conf/files.i386 Thu May 16 14:39:48 2019 (r347699) +++ stable/11/sys/conf/files.i386 Thu May 16 14:42:16 2019 (r347700) @@ -643,6 +643,7 @@ x86/x86/msi.c optional apic pci x86/x86/nexus.c standard x86/x86/stack_machdep.c optional ddb | stack x86/x86/tsc.c standard +x86/x86/ucode.c standard x86/x86/pvclock.c standard x86/x86/delay.c standard x86/xen/hvm.c optional xenhvm Modified: stable/11/sys/dev/cpuctl/cpuctl.c ============================================================================== --- stable/11/sys/dev/cpuctl/cpuctl.c Thu May 16 14:39:48 2019 (r347699) +++ stable/11/sys/dev/cpuctl/cpuctl.c Thu May 16 14:42:16 2019 (r347700) @@ -51,6 +51,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include static d_open_t cpuctl_open; static d_ioctl_t cpuctl_ioctl; @@ -331,11 +332,7 @@ static int update_intel(int cpu, cpuctl_update_args_t *args, struct thread *td) { void *ptr; - uint64_t rev0, rev1; - uint32_t tmp[4]; - int is_bound; - int oldcpu; - int ret; + int is_bound, oldcpu, ret; if (args->size == 0 || args->data == NULL) { DPRINTF("[cpuctl,%d]: zero-sized firmware image", __LINE__); @@ -356,34 +353,26 @@ update_intel(int cpu, cpuctl_update_args_t *args, stru DPRINTF("[cpuctl,%d]: copyin %p->%p of %zd bytes failed", __LINE__, args->data, ptr, args->size); ret = EFAULT; - goto fail; + goto out; } oldcpu = td->td_oncpu; is_bound = cpu_sched_is_bound(td); set_cpu(cpu, td); critical_enter(); - rdmsr_safe(MSR_BIOS_SIGN, &rev0); /* Get current microcode revision. */ - /* - * Perform update. Flush caches first to work around seemingly - * undocumented errata applying to some Broadwell CPUs. - */ - wbinvd(); - wrmsr_safe(MSR_BIOS_UPDT_TRIG, (uintptr_t)(ptr)); - wrmsr_safe(MSR_BIOS_SIGN, 0); + ret = ucode_intel_load(ptr, true, NULL, NULL); - /* - * Serialize instruction flow. - */ - do_cpuid(0, tmp); critical_exit(); - rdmsr_safe(MSR_BIOS_SIGN, &rev1); /* Get new microcode revision. */ restore_cpu(oldcpu, is_bound, td); - if (rev1 > rev0) - ret = 0; - else - ret = EEXIST; -fail: + + /* + * Replace any existing update. This ensures that the new update + * will be reloaded automatically during ACPI resume. + */ + if (ret == 0) + ptr = ucode_update(ptr); + +out: free(ptr, M_CPUCTL); return (ret); } Modified: stable/11/sys/i386/i386/locore.s ============================================================================== --- stable/11/sys/i386/i386/locore.s Thu May 16 14:39:48 2019 (r347699) +++ stable/11/sys/i386/i386/locore.s Thu May 16 14:42:16 2019 (r347700) @@ -486,8 +486,10 @@ olddiskboot: * Identify the CPU and initialize anything special about it * */ -identify_cpu: +ENTRY(identify_cpu) + pushl %ebx + /* Try to toggle alignment check flag; does not exist on 386. */ pushfl popl %eax @@ -607,7 +609,9 @@ trycpuid: /* Use the `cpuid' instruction. */ /* Greater than Pentium...call it a Pentium Pro */ movl $CPU_686,R(cpu) 3: + popl %ebx ret +END(identify_cpu) /********************************************************************** Modified: stable/11/sys/i386/i386/machdep.c ============================================================================== --- stable/11/sys/i386/i386/machdep.c Thu May 16 14:39:48 2019 (r347699) +++ stable/11/sys/i386/i386/machdep.c Thu May 16 14:42:16 2019 (r347700) @@ -133,6 +133,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include #ifdef PERFMON @@ -165,6 +166,7 @@ CTASSERT(offsetof(struct pcpu, pc_curthread) == 0); extern register_t init386(int first); extern void dblfault_handler(void); +void identify_cpu(void); static void cpu_startup(void *); static void fpstate_drop(struct thread *td); @@ -2454,6 +2456,7 @@ init386(int first) struct pcpu *pc; struct xstate_hdr *xhdr; caddr_t kmdp; + size_t ucode_len; int late_console; thread0.td_kstack = proc0kstack; @@ -2484,6 +2487,15 @@ init386(int first) init_static_kenv((char *)bootinfo.bi_envp + KERNBASE, 0); else init_static_kenv(NULL, 0); + + /* + * Re-evaluate CPU features if we loaded a microcode update. + */ + ucode_len = ucode_load_bsp(first); + if (ucode_len != 0) { + identify_cpu(); + first = roundup2(first + ucode_len, PAGE_SIZE); + } identify_hypervisor(); Modified: stable/11/sys/i386/i386/mp_machdep.c ============================================================================== --- stable/11/sys/i386/i386/mp_machdep.c Thu May 16 14:39:48 2019 (r347699) +++ stable/11/sys/i386/i386/mp_machdep.c Thu May 16 14:42:16 2019 (r347700) @@ -71,6 +71,7 @@ __FBSDID("$FreeBSD$"); #include #include +#include #include #include #include @@ -78,7 +79,7 @@ __FBSDID("$FreeBSD$"); #include #include #include -#include +#include #define WARMBOOT_TARGET 0 #define WARMBOOT_OFF (KERNBASE + 0x0467) @@ -228,6 +229,9 @@ init_secondary(void) /* bootAP is set in start_ap() to our ID. */ myid = bootAP; + + /* Update microcode before doing anything else. */ + ucode_load_ap(myid); /* Get per-cpu data */ pc = &__pcpu[myid]; Modified: stable/11/sys/x86/acpica/acpi_wakeup.c ============================================================================== --- stable/11/sys/x86/acpica/acpi_wakeup.c Thu May 16 14:39:48 2019 (r347699) +++ stable/11/sys/x86/acpica/acpi_wakeup.c Thu May 16 14:42:16 2019 (r347700) @@ -52,10 +52,11 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include #include -#include +#include #ifdef DEV_APIC #include @@ -293,6 +294,7 @@ acpi_wakeup_machdep(struct acpi_softc *sc, int state, if (!intr_enabled) { /* Wakeup MD procedures in interrupt disabled context */ if (sleep_result == 1) { + ucode_reload(); pmap_init_pat(); initializecpu(); PCPU_SET(switchtime, 0); Copied and modified: stable/11/sys/x86/include/ucode.h (from r337715, head/sys/x86/include/ucode.h) ============================================================================== --- head/sys/x86/include/ucode.h Mon Aug 13 17:13:09 2018 (r337715, copy source) +++ stable/11/sys/x86/include/ucode.h Thu May 16 14:42:16 2019 (r347700) @@ -58,7 +58,8 @@ struct ucode_intel_extsig_table { } entries[0]; }; -int ucode_intel_load(void *data, bool unsafe); +int ucode_intel_load(void *data, bool unsafe, + uint64_t *nrevp, uint64_t *orevp); size_t ucode_load_bsp(uintptr_t free); void ucode_load_ap(int cpu); void ucode_reload(void); Modified: stable/11/sys/x86/x86/mp_x86.c ============================================================================== --- stable/11/sys/x86/x86/mp_x86.c Thu May 16 14:39:48 2019 (r347699) +++ stable/11/sys/x86/x86/mp_x86.c Thu May 16 14:42:16 2019 (r347700) @@ -65,6 +65,7 @@ __FBSDID("$FreeBSD$"); #include #include +#include #include #include #include @@ -72,7 +73,7 @@ __FBSDID("$FreeBSD$"); #include #include #include -#include +#include /* lock region used by kernel profiling */ int mcount_lock; @@ -1362,6 +1363,9 @@ cpususpend_handler(void) /* Wait for resume directive */ while (!CPU_ISSET(cpu, &toresume_cpus)) ia32_pause(); + + /* Re-apply microcode updates. */ + ucode_reload(); if (cpu_ops.cpu_resume) cpu_ops.cpu_resume(); Copied and modified: stable/11/sys/x86/x86/ucode.c (from r337715, head/sys/x86/x86/ucode.c) ============================================================================== --- head/sys/x86/x86/ucode.c Mon Aug 13 17:13:09 2018 (r337715, copy source) +++ stable/11/sys/x86/x86/ucode.c Thu May 16 14:42:16 2019 (r347700) @@ -59,7 +59,7 @@ static int ucode_intel_verify(struct ucode_intel_heade static struct ucode_ops { const char *vendor; - int (*load)(void *, bool); + int (*load)(void *, bool, uint64_t *, uint64_t *); void *(*match)(uint8_t *, size_t *); } loaders[] = { { @@ -72,35 +72,46 @@ static struct ucode_ops { /* Selected microcode update data. */ static void *early_ucode_data; static void *ucode_data; +static struct ucode_ops *ucode_loader; -static char errbuf[128]; +/* Variables used for reporting success or failure. */ +enum { + NO_ERROR, + NO_MATCH, + VERIFICATION_FAILED, +} ucode_error = NO_ERROR; +static uint64_t ucode_nrev, ucode_orev; -static void __printflike(1, 2) -log_err(const char *fmt, ...) -{ - va_list ap; - - va_start(ap, fmt); - vsnprintf(errbuf, sizeof(errbuf), fmt, ap); - va_end(ap); -} - static void -print_err(void *arg __unused) +log_msg(void *arg __unused) { - if (errbuf[0] != '\0') - printf("microcode load error: %s\n", errbuf); + if (ucode_nrev != 0) { + printf("CPU microcode: updated from %#jx to %#jx\n", + (uintmax_t)ucode_orev, (uintmax_t)ucode_nrev); + return; + } + + switch (ucode_error) { + case NO_MATCH: + printf("CPU microcode: no matching update found\n"); + break; + case VERIFICATION_FAILED: + printf("CPU microcode: microcode verification failed\n"); + break; + default: + break; + } } -SYSINIT(ucode_print_err, SI_SUB_CPU, SI_ORDER_FIRST, print_err, NULL); +SYSINIT(ucode_log, SI_SUB_CPU, SI_ORDER_FIRST, log_msg, NULL); int -ucode_intel_load(void *data, bool unsafe) +ucode_intel_load(void *data, bool unsafe, uint64_t *nrevp, uint64_t *orevp) { - uint64_t rev0, rev1; + uint64_t nrev, orev; uint32_t cpuid[4]; - rev0 = rdmsr(MSR_BIOS_SIGN); + orev = rdmsr(MSR_BIOS_SIGN) >> 32; /* * Perform update. Flush caches first to work around seemingly @@ -118,8 +129,15 @@ ucode_intel_load(void *data, bool unsafe) */ do_cpuid(0, cpuid); - rev1 = rdmsr(MSR_BIOS_SIGN); - if (rev1 <= rev0) + /* + * Verify that the microcode revision changed. + */ + nrev = rdmsr(MSR_BIOS_SIGN) >> 32; + if (nrevp != NULL) + *nrevp = nrev; + if (orevp != NULL) + *orevp = orev; + if (nrev <= orev) return (EEXIST); return (0); } @@ -130,36 +148,26 @@ ucode_intel_verify(struct ucode_intel_header *hdr, siz uint32_t cksum, *data, size; int i; - if (resid < sizeof(struct ucode_intel_header)) { - log_err("truncated update header"); + if (resid < sizeof(struct ucode_intel_header)) return (1); - } size = hdr->total_size; if (size == 0) size = UCODE_INTEL_DEFAULT_DATA_SIZE + sizeof(struct ucode_intel_header); - if (hdr->header_version != 1) { - log_err("unexpected header version %u", hdr->header_version); + if (hdr->header_version != 1) return (1); - } - if (size % 16 != 0) { - log_err("unexpected update size %u", hdr->total_size); + if (size % 16 != 0) return (1); - } - if (resid < size) { - log_err("truncated update"); + if (resid < size) return (1); - } cksum = 0; data = (uint32_t *)hdr; for (i = 0; i < size / sizeof(uint32_t); i++) cksum += data[i]; - if (cksum != 0) { - log_err("checksum failed"); + if (cksum != 0) return (1); - } return (0); } @@ -182,8 +190,10 @@ ucode_intel_match(uint8_t *data, size_t *len) for (resid = *len; resid > 0; data += total_size, resid -= total_size) { hdr = (struct ucode_intel_header *)data; - if (ucode_intel_verify(hdr, resid) != 0) + if (ucode_intel_verify(hdr, resid) != 0) { + ucode_error = VERIFICATION_FAILED; break; + } data_size = hdr->data_size; total_size = hdr->total_size; @@ -255,21 +265,26 @@ SYSINIT(ucode_release, SI_SUB_KMEM + 1, SI_ORDER_ANY, void ucode_load_ap(int cpu) { - +#ifdef SMP KASSERT(cpu_info[cpu_apic_ids[cpu]].cpu_present, ("cpu %d not present", cpu)); - if (ucode_data != NULL && !cpu_info[cpu_apic_ids[cpu]].cpu_hyperthread) - (void)ucode_intel_load(ucode_data, false); + if (cpu_info[cpu_apic_ids[cpu]].cpu_hyperthread) + return; +#endif + + if (ucode_data != NULL) + (void)ucode_loader->load(ucode_data, false, NULL, NULL); } static void * -map_ucode(vm_paddr_t free, size_t len) +map_ucode(uintptr_t free, size_t len) { - #ifdef __i386__ - for (vm_paddr_t pa = free; pa < free + len; pa += PAGE_SIZE) - pmap_kenter(pa, pa); + uintptr_t va; + + for (va = free; va < free + len; va += PAGE_SIZE) + pmap_kenter(va, (vm_paddr_t)va); #else (void)len; #endif @@ -277,12 +292,13 @@ map_ucode(vm_paddr_t free, size_t len) } static void -unmap_ucode(vm_paddr_t free, size_t len) +unmap_ucode(uintptr_t free, size_t len) { - #ifdef __i386__ - for (vm_paddr_t pa = free; pa < free + len; pa += PAGE_SIZE) - pmap_kremove((vm_offset_t)pa); + uintptr_t va; + + for (va = free; va < free + len; va += PAGE_SIZE) + pmap_kremove(va); #else (void)free; (void)len; @@ -304,12 +320,12 @@ ucode_load_bsp(uintptr_t free) uint32_t regs[4]; char vendor[13]; } cpuid; - struct ucode_ops *loader; uint8_t *addr, *fileaddr, *match; char *type; + uint64_t nrev, orev; caddr_t file; - size_t len, ucode_len; - int i; + size_t i, len; + int error; KASSERT(free % PAGE_SIZE == 0, ("unaligned boundary %p", (void *)free)); @@ -317,17 +333,16 @@ ucode_load_bsp(uintptr_t free) cpuid.regs[0] = cpuid.regs[1]; cpuid.regs[1] = cpuid.regs[3]; cpuid.vendor[12] = '\0'; - for (i = 0, loader = NULL; i < nitems(loaders); i++) + for (i = 0; i < nitems(loaders); i++) if (strcmp(cpuid.vendor, loaders[i].vendor) == 0) { - loader = &loaders[i]; + ucode_loader = &loaders[i]; break; } - if (loader == NULL) + if (ucode_loader == NULL) return (0); file = 0; fileaddr = match = NULL; - ucode_len = 0; for (;;) { file = preload_search_next_name(file); if (file == 0) @@ -338,24 +353,27 @@ ucode_load_bsp(uintptr_t free) fileaddr = preload_fetch_addr(file); len = preload_fetch_size(file); - match = loader->match(fileaddr, &len); + match = ucode_loader->match(fileaddr, &len); if (match != NULL) { addr = map_ucode(free, len); - memcpy(addr, match, len); + /* We can't use memcpy() before ifunc resolution. */ + for (i = 0; i < len; i++) + addr[i] = ((volatile uint8_t *)match)[i]; match = addr; - if (loader->load(match, false) == 0) { - ucode_data = match; - ucode_len = len; - early_ucode_data = ucode_data; - break; + error = ucode_loader->load(match, false, &nrev, &orev); + if (error == 0) { + ucode_data = early_ucode_data = match; + ucode_nrev = nrev; + ucode_orev = orev; + return (len); } unmap_ucode(free, len); } } - if (fileaddr != NULL && ucode_data == NULL) - log_err("no matching update found"); - return (ucode_len); + if (fileaddr != NULL && ucode_error == NO_ERROR) + ucode_error = NO_MATCH; + return (0); } /* From owner-svn-src-stable@freebsd.org Thu May 16 14:46:23 2019 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 0362B1598E1B; Thu, 16 May 2019 14:46:23 +0000 (UTC) (envelope-from kib@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 9B5B6816B4; Thu, 16 May 2019 14:46:22 +0000 (UTC) (envelope-from kib@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 6DA0D22467; Thu, 16 May 2019 14:46:22 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x4GEkM0F014173; Thu, 16 May 2019 14:46:22 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x4GEkMLU014172; Thu, 16 May 2019 14:46:22 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201905161446.x4GEkMLU014172@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Thu, 16 May 2019 14:46:22 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r347701 - stable/11/sys/kern X-SVN-Group: stable-11 X-SVN-Commit-Author: kib X-SVN-Commit-Paths: stable/11/sys/kern X-SVN-Commit-Revision: 347701 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 9B5B6816B4 X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.98 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_SHORT(-0.98)[-0.979,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US]; NEURAL_HAM_MEDIUM(-1.00)[-0.998,0]; NEURAL_HAM_LONG(-1.00)[-1.000,0] X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 16 May 2019 14:46:23 -0000 Author: kib Date: Thu May 16 14:46:21 2019 New Revision: 347701 URL: https://svnweb.freebsd.org/changeset/base/347701 Log: MFC r343985, r344133, r345273 (by bde): Prevent overflow for usertime/systime in caclru1(). PR: 76972 Modified: stable/11/sys/kern/kern_resource.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/kern/kern_resource.c ============================================================================== --- stable/11/sys/kern/kern_resource.c Thu May 16 14:42:16 2019 (r347700) +++ stable/11/sys/kern/kern_resource.c Thu May 16 14:46:21 2019 (r347701) @@ -863,6 +863,90 @@ rufetchtd(struct thread *td, struct rusage *ru) calcru1(p, &td->td_rux, &ru->ru_utime, &ru->ru_stime); } +/* XXX: the MI version is too slow to use: */ +#ifndef __HAVE_INLINE_FLSLL +#define flsll(x) (fls((x) >> 32) != 0 ? fls((x) >> 32) + 32 : fls(x)) +#endif + +static uint64_t +mul64_by_fraction(uint64_t a, uint64_t b, uint64_t c) +{ + uint64_t acc, bh, bl; + int i, s, sa, sb; + + /* + * Calculate (a * b) / c accurately enough without overflowing. c + * must be nonzero, and its top bit must be 0. a or b must be + * <= c, and the implementation is tuned for b <= c. + * + * The comments about times are for use in calcru1() with units of + * microseconds for 'a' and stathz ticks at 128 Hz for b and c. + * + * Let n be the number of top zero bits in c. Each iteration + * either returns, or reduces b by right shifting it by at least n. + * The number of iterations is at most 1 + 64 / n, and the error is + * at most the number of iterations. + * + * It is very unusual to need even 2 iterations. Previous + * implementations overflowed essentially by returning early in the + * first iteration, with n = 38 giving overflow at 105+ hours and + * n = 32 giving overlow at at 388+ days despite a more careful + * calculation. 388 days is a reasonable uptime, and the calculation + * needs to work for the uptime times the number of CPUs since 'a' + * is per-process. + */ + if (a >= (uint64_t)1 << 63) + return (0); /* Unsupported arg -- can't happen. */ + acc = 0; + for (i = 0; i < 128; i++) { + sa = flsll(a); + sb = flsll(b); + if (sa + sb <= 64) + /* Up to 105 hours on first iteration. */ + return (acc + (a * b) / c); + if (a >= c) { + /* + * This reduction is based on a = q * c + r, with the + * remainder r < c. 'a' may be large to start, and + * moving bits from b into 'a' at the end of the loop + * sets the top bit of 'a', so the reduction makes + * significant progress. + */ + acc += (a / c) * b; + a %= c; + sa = flsll(a); + if (sa + sb <= 64) + /* Up to 388 days on first iteration. */ + return (acc + (a * b) / c); + } + + /* + * This step writes a * b as a * ((bh << s) + bl) = + * a * (bh << s) + a * bl = (a << s) * bh + a * bl. The 2 + * additive terms are handled separately. Splitting in + * this way is linear except for rounding errors. + * + * s = 64 - sa is the maximum such that a << s fits in 64 + * bits. Since a < c and c has at least 1 zero top bit, + * sa < 64 and s > 0. Thus this step makes progress by + * reducing b (it increases 'a', but taking remainders on + * the next iteration completes the reduction). + * + * Finally, the choice for s is just what is needed to keep + * a * bl from overflowing, so we don't need complications + * like a recursive call mul64_by_fraction(a, bl, c) to + * handle the second additive term. + */ + s = 64 - sa; + bh = b >> s; + bl = b - (bh << s); + acc += (a * bl) / c; + a <<= s; + b = bh; + } + return (0); /* Algorithm failure -- can't happen. */ +} + static void calcru1(struct proc *p, struct rusage_ext *ruxp, struct timeval *up, struct timeval *sp) @@ -887,15 +971,23 @@ calcru1(struct proc *p, struct rusage_ext *ruxp, struc tu = ruxp->rux_tu; } + /* Subdivide tu. Avoid overflow in the multiplications. */ + if (__predict_true(tu <= ((uint64_t)1 << 38) && tt <= (1 << 26))) { + /* Up to 76 hours when stathz is 128. */ + uu = (tu * ut) / tt; + su = (tu * st) / tt; + } else { + uu = mul64_by_fraction(tu, ut, tt); + su = mul64_by_fraction(tu, st, tt); + } + if (tu >= ruxp->rux_tu) { /* * The normal case, time increased. * Enforce monotonicity of bucketed numbers. */ - uu = (tu * ut) / tt; if (uu < ruxp->rux_uu) uu = ruxp->rux_uu; - su = (tu * st) / tt; if (su < ruxp->rux_su) su = ruxp->rux_su; } else if (tu + 3 > ruxp->rux_tu || 101 * tu > 100 * ruxp->rux_tu) { @@ -924,8 +1016,6 @@ calcru1(struct proc *p, struct rusage_ext *ruxp, struc "to %ju usec for pid %d (%s)\n", (uintmax_t)ruxp->rux_tu, (uintmax_t)tu, p->p_pid, p->p_comm); - uu = (tu * ut) / tt; - su = (tu * st) / tt; } ruxp->rux_uu = uu; From owner-svn-src-stable@freebsd.org Thu May 16 14:48:09 2019 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 6E0A41598F1E; Thu, 16 May 2019 14:48:09 +0000 (UTC) (envelope-from kib@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 1192781828; Thu, 16 May 2019 14:48:09 +0000 (UTC) (envelope-from kib@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 D58D422469; Thu, 16 May 2019 14:48:08 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x4GEm8Wj014313; Thu, 16 May 2019 14:48:08 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x4GEm8do014312; Thu, 16 May 2019 14:48:08 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201905161448.x4GEm8do014312@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Thu, 16 May 2019 14:48:08 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r347702 - stable/11/sys/dev/cpuctl X-SVN-Group: stable-11 X-SVN-Commit-Author: kib X-SVN-Commit-Paths: stable/11/sys/dev/cpuctl X-SVN-Commit-Revision: 347702 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 1192781828 X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.98 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.998,0]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; NEURAL_HAM_SHORT(-0.98)[-0.978,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US] X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 16 May 2019 14:48:09 -0000 Author: kib Date: Thu May 16 14:48:08 2019 New Revision: 347702 URL: https://svnweb.freebsd.org/changeset/base/347702 Log: MFC r347368: x86: Put other CPUs into tight loop when updating Intel microcode from loaded OS. Modified: stable/11/sys/dev/cpuctl/cpuctl.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/dev/cpuctl/cpuctl.c ============================================================================== --- stable/11/sys/dev/cpuctl/cpuctl.c Thu May 16 14:46:21 2019 (r347701) +++ stable/11/sys/dev/cpuctl/cpuctl.c Thu May 16 14:48:08 2019 (r347702) @@ -328,9 +328,26 @@ cpuctl_do_update(int cpu, cpuctl_update_args_t *data, return (ret); } +struct ucode_update_data { + void *ptr; + int cpu; + int ret; +}; + +static void +ucode_intel_load_rv(void *arg) +{ + struct ucode_update_data *d; + + d = arg; + if (PCPU_GET(cpuid) == d->cpu) + d->ret = ucode_intel_load(d->ptr, true, NULL, NULL); +} + static int update_intel(int cpu, cpuctl_update_args_t *args, struct thread *td) { + struct ucode_update_data d; void *ptr; int is_bound, oldcpu, ret; @@ -358,12 +375,11 @@ update_intel(int cpu, cpuctl_update_args_t *args, stru oldcpu = td->td_oncpu; is_bound = cpu_sched_is_bound(td); set_cpu(cpu, td); - critical_enter(); - - ret = ucode_intel_load(ptr, true, NULL, NULL); - - critical_exit(); + d.ptr = ptr; + d.cpu = cpu; + smp_rendezvous(NULL, ucode_intel_load_rv, NULL, &d); restore_cpu(oldcpu, is_bound, td); + ret = d.ret; /* * Replace any existing update. This ensures that the new update From owner-svn-src-stable@freebsd.org Thu May 16 15:30:37 2019 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id D75121599F4B; Thu, 16 May 2019 15:30:36 +0000 (UTC) (envelope-from ian@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 7EB46832C0; Thu, 16 May 2019 15:30:36 +0000 (UTC) (envelope-from ian@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 5AA5522B13; Thu, 16 May 2019 15:30:36 +0000 (UTC) (envelope-from ian@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x4GFUaHP035206; Thu, 16 May 2019 15:30:36 GMT (envelope-from ian@FreeBSD.org) Received: (from ian@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x4GFUZuq035204; Thu, 16 May 2019 15:30:35 GMT (envelope-from ian@FreeBSD.org) Message-Id: <201905161530.x4GFUZuq035204@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ian set sender to ian@FreeBSD.org using -f From: Ian Lepore Date: Thu, 16 May 2019 15:30:35 +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: r347704 - in stable/12: sbin/reboot stand/i386/gptboot X-SVN-Group: stable-12 X-SVN-Commit-Author: ian X-SVN-Commit-Paths: in stable/12: sbin/reboot stand/i386/gptboot X-SVN-Commit-Revision: 347704 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 7EB46832C0 X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.96 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.998,0]; NEURAL_HAM_SHORT(-0.96)[-0.959,0]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US] X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 16 May 2019 15:30:37 -0000 Author: ian Date: Thu May 16 15:30:35 2019 New Revision: 347704 URL: https://svnweb.freebsd.org/changeset/base/347704 Log: MFC r346968, r346973 r346968: Update the manpage text to show the output generated by the first-stage bootloader these days (x86 instead of i386). r346973: Add a paragraph that mentions gptboot having an interactive mode, and direct the user to the boot(8) manpage, which provides the details on that. Modified: stable/12/sbin/reboot/boot_i386.8 stable/12/stand/i386/gptboot/gptboot.8 Directory Properties: stable/12/ (props changed) Modified: stable/12/sbin/reboot/boot_i386.8 ============================================================================== --- stable/12/sbin/reboot/boot_i386.8 Thu May 16 15:22:17 2019 (r347703) +++ stable/12/sbin/reboot/boot_i386.8 Thu May 16 15:30:35 2019 (r347704) @@ -36,7 +36,7 @@ .\" .\" $FreeBSD$ .\" -.Dd May 15, 2018 +.Dd April 30, 2019 .Dt BOOT 8 i386 .Os .Sh NAME @@ -95,7 +95,7 @@ program is documented separately. After the boot blocks have been loaded, you should see a prompt similar to the following: .Bd -literal ->> FreeBSD/i386 BOOT +>> FreeBSD/x86 BOOT Default: 0:ad(0,a)/boot/loader boot: .Ed Modified: stable/12/stand/i386/gptboot/gptboot.8 ============================================================================== --- stable/12/stand/i386/gptboot/gptboot.8 Thu May 16 15:22:17 2019 (r347703) +++ stable/12/stand/i386/gptboot/gptboot.8 Thu May 16 15:30:35 2019 (r347704) @@ -24,7 +24,7 @@ .\" .\" $FreeBSD$ .\" -.Dd February 5, 2014 +.Dd April 30, 2019 .Dt GPTBOOT 8 .Os .Sh NAME @@ -39,6 +39,20 @@ is installed in a .Cm freebsd-boot partition with .Xr gpart 8 . +.Pp +When it starts, +.Nm +first reads the GPT and determines which drive and partition to +boot from, as described under +.Sx BOOTING , +below. +If it does not find an eligible partition, or if the user hits a +key within three seconds, +.Nm +switches from auto-boot to interactive mode. +Interactive mode allows manual selection of the disk, partition, +filename, and boot option flags, as described in +.Xr boot 8 . .Sh IMPLEMENTATION NOTES The GPT standard allows a variable number of partitions, but .Nm From owner-svn-src-stable@freebsd.org Thu May 16 15:32:05 2019 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 0D009159A16C; Thu, 16 May 2019 15:32:05 +0000 (UTC) (envelope-from ian@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 A3EB18367B; Thu, 16 May 2019 15:32:04 +0000 (UTC) (envelope-from ian@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 7DF4822C89; Thu, 16 May 2019 15:32:04 +0000 (UTC) (envelope-from ian@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x4GFW4ec040079; Thu, 16 May 2019 15:32:04 GMT (envelope-from ian@FreeBSD.org) Received: (from ian@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x4GFW4nq040077; Thu, 16 May 2019 15:32:04 GMT (envelope-from ian@FreeBSD.org) Message-Id: <201905161532.x4GFW4nq040077@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ian set sender to ian@FreeBSD.org using -f From: Ian Lepore Date: Thu, 16 May 2019 15:32:04 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r347705 - in stable/11: sbin/reboot stand/i386/gptboot X-SVN-Group: stable-11 X-SVN-Commit-Author: ian X-SVN-Commit-Paths: in stable/11: sbin/reboot stand/i386/gptboot X-SVN-Commit-Revision: 347705 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: A3EB18367B X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.96 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.998,0]; NEURAL_HAM_SHORT(-0.96)[-0.959,0]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US] X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 16 May 2019 15:32:05 -0000 Author: ian Date: Thu May 16 15:32:03 2019 New Revision: 347705 URL: https://svnweb.freebsd.org/changeset/base/347705 Log: MFC r346968, r346973 r346968: Update the manpage text to show the output generated by the first-stage bootloader these days (x86 instead of i386). r346973: Add a paragraph that mentions gptboot having an interactive mode, and direct the user to the boot(8) manpage, which provides the details on that. Modified: stable/11/sbin/reboot/boot_i386.8 stable/11/stand/i386/gptboot/gptboot.8 Directory Properties: stable/11/ (props changed) Modified: stable/11/sbin/reboot/boot_i386.8 ============================================================================== --- stable/11/sbin/reboot/boot_i386.8 Thu May 16 15:30:35 2019 (r347704) +++ stable/11/sbin/reboot/boot_i386.8 Thu May 16 15:32:03 2019 (r347705) @@ -36,7 +36,7 @@ .\" .\" $FreeBSD$ .\" -.Dd May 15, 2018 +.Dd April 30, 2019 .Dt BOOT 8 i386 .Os .Sh NAME @@ -95,7 +95,7 @@ program is documented separately. After the boot blocks have been loaded, you should see a prompt similar to the following: .Bd -literal ->> FreeBSD/i386 BOOT +>> FreeBSD/x86 BOOT Default: 0:ad(0,a)/boot/loader boot: .Ed Modified: stable/11/stand/i386/gptboot/gptboot.8 ============================================================================== --- stable/11/stand/i386/gptboot/gptboot.8 Thu May 16 15:30:35 2019 (r347704) +++ stable/11/stand/i386/gptboot/gptboot.8 Thu May 16 15:32:03 2019 (r347705) @@ -24,7 +24,7 @@ .\" .\" $FreeBSD$ .\" -.Dd February 5, 2014 +.Dd April 30, 2019 .Dt GPTBOOT 8 .Os .Sh NAME @@ -39,6 +39,20 @@ is installed in a .Cm freebsd-boot partition with .Xr gpart 8 . +.Pp +When it starts, +.Nm +first reads the GPT and determines which drive and partition to +boot from, as described under +.Sx BOOTING , +below. +If it does not find an eligible partition, or if the user hits a +key within three seconds, +.Nm +switches from auto-boot to interactive mode. +Interactive mode allows manual selection of the disk, partition, +filename, and boot option flags, as described in +.Xr boot 8 . .Sh IMPLEMENTATION NOTES The GPT standard allows a variable number of partitions, but .Nm From owner-svn-src-stable@freebsd.org Thu May 16 15:35:51 2019 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id CC982159A39C; Thu, 16 May 2019 15:35:51 +0000 (UTC) (envelope-from hselasky@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 72320839AE; Thu, 16 May 2019 15:35:51 +0000 (UTC) (envelope-from hselasky@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 4628822CB5; Thu, 16 May 2019 15:35:51 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x4GFZph2040458; Thu, 16 May 2019 15:35:51 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x4GFZoir040457; Thu, 16 May 2019 15:35:50 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201905161535.x4GFZoir040457@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Thu, 16 May 2019 15:35:50 +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: r347706 - in stable/12/sys/compat/linuxkpi/common: include/linux src X-SVN-Group: stable-12 X-SVN-Commit-Author: hselasky X-SVN-Commit-Paths: in stable/12/sys/compat/linuxkpi/common: include/linux src X-SVN-Commit-Revision: 347706 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 72320839AE X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.96 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.998,0]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; NEURAL_HAM_SHORT(-0.96)[-0.959,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US] X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 16 May 2019 15:35:52 -0000 Author: hselasky Date: Thu May 16 15:35:50 2019 New Revision: 347706 URL: https://svnweb.freebsd.org/changeset/base/347706 Log: MFC r347185: Allow controlling pr_debug at runtime in the LinuxKPI. Turning on pr_debug at compile time make it non-optional at runtime. This often means that the amount of the debugging is unbearable. Allow developer to turn on pr_debug output only when needed. Build tested drm-current-kmod prior to commit. Submitted by: kib@ Sponsored by: Mellanox Technologies Modified: stable/12/sys/compat/linuxkpi/common/include/linux/kernel.h stable/12/sys/compat/linuxkpi/common/src/linux_compat.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/compat/linuxkpi/common/include/linux/kernel.h ============================================================================== --- stable/12/sys/compat/linuxkpi/common/include/linux/kernel.h Thu May 16 15:32:03 2019 (r347705) +++ stable/12/sys/compat/linuxkpi/common/include/linux/kernel.h Thu May 16 15:35:50 2019 (r347706) @@ -177,8 +177,12 @@ scnprintf(char *buf, size_t size, const char *fmt, ... * unless DEBUG is defined: */ #ifdef DEBUG -#define pr_debug(fmt, ...) \ - log(LOG_DEBUG, fmt, ##__VA_ARGS__) +extern int linuxkpi_debug; +#define pr_debug(fmt, ...) \ + do { \ + if (linuxkpi_debug) \ + log(LOG_DEBUG, fmt, ##__VA_ARGS__); \ + } while (0) #define pr_devel(fmt, ...) \ log(LOG_DEBUG, pr_fmt(fmt), ##__VA_ARGS__) #else Modified: stable/12/sys/compat/linuxkpi/common/src/linux_compat.c ============================================================================== --- stable/12/sys/compat/linuxkpi/common/src/linux_compat.c Thu May 16 15:32:03 2019 (r347705) +++ stable/12/sys/compat/linuxkpi/common/src/linux_compat.c Thu May 16 15:35:50 2019 (r347706) @@ -92,6 +92,10 @@ __FBSDID("$FreeBSD$"); SYSCTL_NODE(_compat, OID_AUTO, linuxkpi, CTLFLAG_RW, 0, "LinuxKPI parameters"); +int linuxkpi_debug; +SYSCTL_INT(_compat_linuxkpi, OID_AUTO, debug, CTLFLAG_RWTUN, + &linuxkpi_debug, 0, "Set to enable pr_debug() prints. Clear to disable."); + MALLOC_DEFINE(M_KMALLOC, "linux", "Linux kmalloc compat"); #include From owner-svn-src-stable@freebsd.org Thu May 16 15:36:57 2019 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 4D172159A424; Thu, 16 May 2019 15:36:57 +0000 (UTC) (envelope-from hselasky@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 E6F7683AFE; Thu, 16 May 2019 15:36:56 +0000 (UTC) (envelope-from hselasky@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 D93AB22CB7; Thu, 16 May 2019 15:36:56 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x4GFau3F040558; Thu, 16 May 2019 15:36:56 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x4GFau4J040557; Thu, 16 May 2019 15:36:56 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201905161536.x4GFau4J040557@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Thu, 16 May 2019 15:36:56 +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: r347707 - stable/12/sys/compat/linuxkpi/common/include/linux X-SVN-Group: stable-12 X-SVN-Commit-Author: hselasky X-SVN-Commit-Paths: stable/12/sys/compat/linuxkpi/common/include/linux X-SVN-Commit-Revision: 347707 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: E6F7683AFE X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.96 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.998,0]; NEURAL_HAM_SHORT(-0.96)[-0.959,0]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US] X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 16 May 2019 15:36:57 -0000 Author: hselasky Date: Thu May 16 15:36:56 2019 New Revision: 347707 URL: https://svnweb.freebsd.org/changeset/base/347707 Log: MFC r347187: Implement print_hex_dump_debug() function macro in the LinuxKPI. Build tested drm-current-kmod prior to commit. Submitted by: slavash@ Sponsored by: Mellanox Technologies Modified: stable/12/sys/compat/linuxkpi/common/include/linux/printk.h Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/compat/linuxkpi/common/include/linux/printk.h ============================================================================== --- stable/12/sys/compat/linuxkpi/common/include/linux/printk.h Thu May 16 15:35:50 2019 (r347706) +++ stable/12/sys/compat/linuxkpi/common/include/linux/printk.h Thu May 16 15:36:56 2019 (r347707) @@ -121,6 +121,9 @@ print_hex_dump_bytes(const char *prefix_str, const int #define pr_err_ratelimited(fmt, ...) \ printk_ratelimited(KERN_ERR pr_fmt(fmt), ##__VA_ARGS__) +#define print_hex_dump_debug(...) \ + print_hex_dump(KERN_DEBUG, ##__VA_ARGS__) + #define pr_info_ratelimited(fmt, ...) \ printk_ratelimited(KERN_INFO pr_fmt(fmt), ##__VA_ARGS__) From owner-svn-src-stable@freebsd.org Thu May 16 15:37:50 2019 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id D7206159A4AE; Thu, 16 May 2019 15:37:50 +0000 (UTC) (envelope-from hselasky@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 7D11C83C45; Thu, 16 May 2019 15:37:50 +0000 (UTC) (envelope-from hselasky@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 57EDE22CB8; Thu, 16 May 2019 15:37:50 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x4GFbodj040653; Thu, 16 May 2019 15:37:50 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x4GFbot3040652; Thu, 16 May 2019 15:37:50 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201905161537.x4GFbot3040652@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Thu, 16 May 2019 15:37:50 +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: r347708 - stable/12/sys/compat/linuxkpi/common/include/linux X-SVN-Group: stable-12 X-SVN-Commit-Author: hselasky X-SVN-Commit-Paths: stable/12/sys/compat/linuxkpi/common/include/linux X-SVN-Commit-Revision: 347708 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 7D11C83C45 X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.96 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.998,0]; NEURAL_HAM_SHORT(-0.96)[-0.959,0]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US] X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 16 May 2019 15:37:51 -0000 Author: hselasky Date: Thu May 16 15:37:49 2019 New Revision: 347708 URL: https://svnweb.freebsd.org/changeset/base/347708 Log: MFC r347188: Disabling a PCI device should only disable busmaster in the LinuxKPI. As Linux comment for this function point: Signal to the system that the PCI device is not in use by the system anymore. This only involves disabling PCI bus-mastering, if active. Build tested drm-current-kmod prior to commit. Submitted by: slavash@ Sponsored by: Mellanox Technologies Modified: stable/12/sys/compat/linuxkpi/common/include/linux/pci.h Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/compat/linuxkpi/common/include/linux/pci.h ============================================================================== --- stable/12/sys/compat/linuxkpi/common/include/linux/pci.h Thu May 16 15:36:56 2019 (r347707) +++ stable/12/sys/compat/linuxkpi/common/include/linux/pci.h Thu May 16 15:37:49 2019 (r347708) @@ -342,8 +342,6 @@ static inline void pci_disable_device(struct pci_dev *pdev) { - pci_disable_io(pdev->dev.bsddev, SYS_RES_IOPORT); - pci_disable_io(pdev->dev.bsddev, SYS_RES_MEMORY); pci_disable_busmaster(pdev->dev.bsddev); } From owner-svn-src-stable@freebsd.org Thu May 16 15:39:08 2019 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 76174159A57C; Thu, 16 May 2019 15:39:08 +0000 (UTC) (envelope-from hselasky@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 1C23983DD5; Thu, 16 May 2019 15:39:08 +0000 (UTC) (envelope-from hselasky@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 EA07022CB9; Thu, 16 May 2019 15:39:07 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x4GFd7at040765; Thu, 16 May 2019 15:39:07 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x4GFd7px040764; Thu, 16 May 2019 15:39:07 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201905161539.x4GFd7px040764@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Thu, 16 May 2019 15:39:07 +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: r347709 - stable/12/sys/compat/linuxkpi/common/include/linux X-SVN-Group: stable-12 X-SVN-Commit-Author: hselasky X-SVN-Commit-Paths: stable/12/sys/compat/linuxkpi/common/include/linux X-SVN-Commit-Revision: 347709 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 1C23983DD5 X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.96 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.998,0]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; NEURAL_HAM_SHORT(-0.96)[-0.959,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US] X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 16 May 2019 15:39:08 -0000 Author: hselasky Date: Thu May 16 15:39:07 2019 New Revision: 347709 URL: https://svnweb.freebsd.org/changeset/base/347709 Log: MFC r347190: Use PCIV_INVALID in pci_channel_offline() in the LinuxKPI. Build tested drm-current-kmod prior to commit. Submitted by: slavash@ Sponsored by: Mellanox Technologies Modified: stable/12/sys/compat/linuxkpi/common/include/linux/pci.h Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/compat/linuxkpi/common/include/linux/pci.h ============================================================================== --- stable/12/sys/compat/linuxkpi/common/include/linux/pci.h Thu May 16 15:37:49 2019 (r347708) +++ stable/12/sys/compat/linuxkpi/common/include/linux/pci.h Thu May 16 15:39:07 2019 (r347709) @@ -603,7 +603,7 @@ static inline int pci_channel_offline(struct pci_dev *pdev) { - return (pci_get_vendor(pdev->dev.bsddev) == 0xffff); + return (pci_get_vendor(pdev->dev.bsddev) == PCIV_INVALID); } static inline int pci_enable_sriov(struct pci_dev *dev, int nr_virtfn) From owner-svn-src-stable@freebsd.org Thu May 16 15:40:25 2019 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id E8F93159A634; Thu, 16 May 2019 15:40:24 +0000 (UTC) (envelope-from hselasky@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 9C4E883F28; Thu, 16 May 2019 15:40:24 +0000 (UTC) (envelope-from hselasky@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 75C3F22CBD; Thu, 16 May 2019 15:40:24 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x4GFeOxh040909; Thu, 16 May 2019 15:40:24 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x4GFeMjA040899; Thu, 16 May 2019 15:40:22 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201905161540.x4GFeMjA040899@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Thu, 16 May 2019 15:40:22 +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: r347710 - in stable/12/sys: compat/linuxkpi/common/include/linux conf dev/mlx5/mlx5_en modules/mlx5en X-SVN-Group: stable-12 X-SVN-Commit-Author: hselasky X-SVN-Commit-Paths: in stable/12/sys: compat/linuxkpi/common/include/linux conf dev/mlx5/mlx5_en modules/mlx5en X-SVN-Commit-Revision: 347710 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 9C4E883F28 X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.96 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.998,0]; NEURAL_HAM_SHORT(-0.96)[-0.963,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US]; NEURAL_HAM_LONG(-1.00)[-1.000,0] X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 16 May 2019 15:40:25 -0000 Author: hselasky Date: Thu May 16 15:40:22 2019 New Revision: 347710 URL: https://svnweb.freebsd.org/changeset/base/347710 Log: MFC r347246: Add support for Dynamic Interrupt Moderation, DIM, in mlx5en(4). Add support for DIM based on Linux, with some minor adaptions specific to FreeBSD. Linux commit f97c3dc3c0e8d23a5c4357d182afeef4c67f5c33 Sponsored by: Mellanox Technologies Added: stable/12/sys/compat/linuxkpi/common/include/linux/net_dim.h - copied unchanged from r347246, head/sys/compat/linuxkpi/common/include/linux/net_dim.h stable/12/sys/dev/mlx5/mlx5_en/mlx5_en_dim.c - copied unchanged from r347246, head/sys/dev/mlx5/mlx5_en/mlx5_en_dim.c Modified: stable/12/sys/conf/files stable/12/sys/dev/mlx5/mlx5_en/en.h stable/12/sys/dev/mlx5/mlx5_en/mlx5_en_ethtool.c stable/12/sys/dev/mlx5/mlx5_en/mlx5_en_main.c stable/12/sys/dev/mlx5/mlx5_en/mlx5_en_rx.c stable/12/sys/modules/mlx5en/Makefile Directory Properties: stable/12/ (props changed) Copied: stable/12/sys/compat/linuxkpi/common/include/linux/net_dim.h (from r347246, head/sys/compat/linuxkpi/common/include/linux/net_dim.h) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/12/sys/compat/linuxkpi/common/include/linux/net_dim.h Thu May 16 15:40:22 2019 (r347710, copy of r347246, head/sys/compat/linuxkpi/common/include/linux/net_dim.h) @@ -0,0 +1,410 @@ +/*- + * SPDX-License-Identifier: BSD-2-Clause OR GPL-2.0 + * + * Copyright (c) 2016, Mellanox Technologies. All rights reserved. + * Copyright (c) 2017-2018, Broadcom Limited. All rights reserved. + * + * This software is available to you under a choice of one of two + * licenses. You may choose to be licensed under the terms of the GNU + * General Public License (GPL) Version 2, available from the file + * COPYING in the main directory of this source tree, or the + * OpenIB.org BSD license below: + * + * Redistribution and use in source and binary forms, with or + * without modification, are permitted provided that the following + * conditions are met: + * + * - Redistributions of source code must retain the above + * copyright notice, this list of conditions and the following + * disclaimer. + * + * - Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following + * disclaimer in the documentation and/or other materials + * provided with the distribution. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS + * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN + * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + * $FreeBSD$ + */ + +/* This file implements Dynamic Interrupt Moderation, DIM */ + +#ifndef NET_DIM_H +#define NET_DIM_H + +#include + +#include +#include + +struct net_dim_cq_moder { + u16 usec; + u16 pkts; + u8 cq_period_mode; +}; + +struct net_dim_sample { + ktime_t time; + u32 pkt_ctr; + u32 byte_ctr; + u16 event_ctr; +}; + +struct net_dim_stats { + int ppms; /* packets per msec */ + int bpms; /* bytes per msec */ + int epms; /* events per msec */ +}; + +struct net_dim { /* Adaptive Moderation */ + u8 state; + struct net_dim_stats prev_stats; + struct net_dim_sample start_sample; + struct work_struct work; + u16 event_ctr; + u8 profile_ix; + u8 mode; + u8 tune_state; + u8 steps_right; + u8 steps_left; + u8 tired; +}; + +enum { + NET_DIM_CQ_PERIOD_MODE_START_FROM_EQE = 0x0, + NET_DIM_CQ_PERIOD_MODE_START_FROM_CQE = 0x1, + NET_DIM_CQ_PERIOD_NUM_MODES = 0x2, + NET_DIM_CQ_PERIOD_MODE_DISABLED = 0xFF, +}; + +/* Adaptive moderation logic */ +enum { + NET_DIM_START_MEASURE, + NET_DIM_MEASURE_IN_PROGRESS, + NET_DIM_APPLY_NEW_PROFILE, +}; + +enum { + NET_DIM_PARKING_ON_TOP, + NET_DIM_PARKING_TIRED, + NET_DIM_GOING_RIGHT, + NET_DIM_GOING_LEFT, +}; + +enum { + NET_DIM_STATS_WORSE, + NET_DIM_STATS_SAME, + NET_DIM_STATS_BETTER, +}; + +enum { + NET_DIM_STEPPED, + NET_DIM_TOO_TIRED, + NET_DIM_ON_EDGE, +}; + +#define NET_DIM_PARAMS_NUM_PROFILES 5 +/* Adaptive moderation profiles */ +#define NET_DIM_DEFAULT_RX_CQ_MODERATION_PKTS_FROM_EQE 256 +#define NET_DIM_DEF_PROFILE_CQE 1 +#define NET_DIM_DEF_PROFILE_EQE 1 + +/* All profiles sizes must be NET_PARAMS_DIM_NUM_PROFILES */ +#define NET_DIM_EQE_PROFILES { \ + {1, NET_DIM_DEFAULT_RX_CQ_MODERATION_PKTS_FROM_EQE}, \ + {8, NET_DIM_DEFAULT_RX_CQ_MODERATION_PKTS_FROM_EQE}, \ + {64, NET_DIM_DEFAULT_RX_CQ_MODERATION_PKTS_FROM_EQE}, \ + {128, NET_DIM_DEFAULT_RX_CQ_MODERATION_PKTS_FROM_EQE}, \ + {256, NET_DIM_DEFAULT_RX_CQ_MODERATION_PKTS_FROM_EQE}, \ +} + +#define NET_DIM_CQE_PROFILES { \ + {2, 256}, \ + {8, 128}, \ + {16, 64}, \ + {32, 64}, \ + {64, 64} \ +} + +static const struct net_dim_cq_moder + net_dim_profile[NET_DIM_CQ_PERIOD_NUM_MODES][NET_DIM_PARAMS_NUM_PROFILES] = { + NET_DIM_EQE_PROFILES, + NET_DIM_CQE_PROFILES, +}; + +static inline struct net_dim_cq_moder +net_dim_get_profile(u8 cq_period_mode, + int ix) +{ + struct net_dim_cq_moder cq_moder; + + cq_moder = net_dim_profile[cq_period_mode][ix]; + cq_moder.cq_period_mode = cq_period_mode; + return cq_moder; +} + +static inline struct net_dim_cq_moder +net_dim_get_def_profile(u8 rx_cq_period_mode) +{ + int default_profile_ix; + + if (rx_cq_period_mode == NET_DIM_CQ_PERIOD_MODE_START_FROM_CQE) + default_profile_ix = NET_DIM_DEF_PROFILE_CQE; + else /* NET_DIM_CQ_PERIOD_MODE_START_FROM_EQE */ + default_profile_ix = NET_DIM_DEF_PROFILE_EQE; + + return net_dim_get_profile(rx_cq_period_mode, default_profile_ix); +} + +static inline bool +net_dim_on_top(struct net_dim *dim) +{ + switch (dim->tune_state) { + case NET_DIM_PARKING_ON_TOP: + case NET_DIM_PARKING_TIRED: + return true; + case NET_DIM_GOING_RIGHT: + return (dim->steps_left > 1) && (dim->steps_right == 1); + default: /* NET_DIM_GOING_LEFT */ + return (dim->steps_right > 1) && (dim->steps_left == 1); + } +} + +static inline void +net_dim_turn(struct net_dim *dim) +{ + switch (dim->tune_state) { + case NET_DIM_PARKING_ON_TOP: + case NET_DIM_PARKING_TIRED: + break; + case NET_DIM_GOING_RIGHT: + dim->tune_state = NET_DIM_GOING_LEFT; + dim->steps_left = 0; + break; + case NET_DIM_GOING_LEFT: + dim->tune_state = NET_DIM_GOING_RIGHT; + dim->steps_right = 0; + break; + } +} + +static inline int +net_dim_step(struct net_dim *dim) +{ + if (dim->tired == (NET_DIM_PARAMS_NUM_PROFILES * 2)) + return NET_DIM_TOO_TIRED; + + switch (dim->tune_state) { + case NET_DIM_PARKING_ON_TOP: + case NET_DIM_PARKING_TIRED: + break; + case NET_DIM_GOING_RIGHT: + if (dim->profile_ix == (NET_DIM_PARAMS_NUM_PROFILES - 1)) + return NET_DIM_ON_EDGE; + dim->profile_ix++; + dim->steps_right++; + break; + case NET_DIM_GOING_LEFT: + if (dim->profile_ix == 0) + return NET_DIM_ON_EDGE; + dim->profile_ix--; + dim->steps_left++; + break; + } + + dim->tired++; + return NET_DIM_STEPPED; +} + +static inline void +net_dim_park_on_top(struct net_dim *dim) +{ + dim->steps_right = 0; + dim->steps_left = 0; + dim->tired = 0; + dim->tune_state = NET_DIM_PARKING_ON_TOP; +} + +static inline void +net_dim_park_tired(struct net_dim *dim) +{ + dim->steps_right = 0; + dim->steps_left = 0; + dim->tune_state = NET_DIM_PARKING_TIRED; +} + +static inline void +net_dim_exit_parking(struct net_dim *dim) +{ + dim->tune_state = dim->profile_ix ? NET_DIM_GOING_LEFT : + NET_DIM_GOING_RIGHT; + net_dim_step(dim); +} + +#define IS_SIGNIFICANT_DIFF(val, ref) \ + (((100UL * abs((val) - (ref))) / (ref)) > 10) /* more than 10% + * difference */ + +static inline int +net_dim_stats_compare(struct net_dim_stats *curr, + struct net_dim_stats *prev) +{ + if (!prev->bpms) + return curr->bpms ? NET_DIM_STATS_BETTER : + NET_DIM_STATS_SAME; + + if (IS_SIGNIFICANT_DIFF(curr->bpms, prev->bpms)) + return (curr->bpms > prev->bpms) ? NET_DIM_STATS_BETTER : + NET_DIM_STATS_WORSE; + + if (!prev->ppms) + return curr->ppms ? NET_DIM_STATS_BETTER : + NET_DIM_STATS_SAME; + + if (IS_SIGNIFICANT_DIFF(curr->ppms, prev->ppms)) + return (curr->ppms > prev->ppms) ? NET_DIM_STATS_BETTER : + NET_DIM_STATS_WORSE; + + if (!prev->epms) + return NET_DIM_STATS_SAME; + + if (IS_SIGNIFICANT_DIFF(curr->epms, prev->epms)) + return (curr->epms < prev->epms) ? NET_DIM_STATS_BETTER : + NET_DIM_STATS_WORSE; + + return NET_DIM_STATS_SAME; +} + +static inline bool +net_dim_decision(struct net_dim_stats *curr_stats, + struct net_dim *dim) +{ + int prev_state = dim->tune_state; + int prev_ix = dim->profile_ix; + int stats_res; + int step_res; + + switch (dim->tune_state) { + case NET_DIM_PARKING_ON_TOP: + stats_res = net_dim_stats_compare(curr_stats, &dim->prev_stats); + if (stats_res != NET_DIM_STATS_SAME) + net_dim_exit_parking(dim); + break; + + case NET_DIM_PARKING_TIRED: + dim->tired--; + if (!dim->tired) + net_dim_exit_parking(dim); + break; + + case NET_DIM_GOING_RIGHT: + case NET_DIM_GOING_LEFT: + stats_res = net_dim_stats_compare(curr_stats, &dim->prev_stats); + if (stats_res != NET_DIM_STATS_BETTER) + net_dim_turn(dim); + + if (net_dim_on_top(dim)) { + net_dim_park_on_top(dim); + break; + } + step_res = net_dim_step(dim); + switch (step_res) { + case NET_DIM_ON_EDGE: + net_dim_park_on_top(dim); + break; + case NET_DIM_TOO_TIRED: + net_dim_park_tired(dim); + break; + } + + break; + } + + if ((prev_state != NET_DIM_PARKING_ON_TOP) || + (dim->tune_state != NET_DIM_PARKING_ON_TOP)) + dim->prev_stats = *curr_stats; + + return dim->profile_ix != prev_ix; +} + +static inline void +net_dim_sample(u16 event_ctr, + u64 packets, + u64 bytes, + struct net_dim_sample *s) +{ + s->time = ktime_get(); + s->pkt_ctr = packets; + s->byte_ctr = bytes; + s->event_ctr = event_ctr; +} + +#define NET_DIM_NEVENTS 64 +#define BIT_GAP(bits, end, start) ((((end) - (start)) + BIT_ULL(bits)) & (BIT_ULL(bits) - 1)) + +static inline void +net_dim_calc_stats(struct net_dim_sample *start, + struct net_dim_sample *end, + struct net_dim_stats *curr_stats) +{ + /* u32 holds up to 71 minutes, should be enough */ + u32 delta_us = ktime_us_delta(end->time, start->time); + u32 npkts = BIT_GAP(BITS_PER_TYPE(u32), end->pkt_ctr, start->pkt_ctr); + u32 nbytes = BIT_GAP(BITS_PER_TYPE(u32), end->byte_ctr, + start->byte_ctr); + + if (!delta_us) + return; + + curr_stats->ppms = DIV_ROUND_UP(npkts * USEC_PER_MSEC, delta_us); + curr_stats->bpms = DIV_ROUND_UP(nbytes * USEC_PER_MSEC, delta_us); + curr_stats->epms = DIV_ROUND_UP(NET_DIM_NEVENTS * USEC_PER_MSEC, + delta_us); +} + +static inline void +net_dim(struct net_dim *dim, + u64 packets, u64 bytes) +{ + struct net_dim_stats curr_stats; + struct net_dim_sample end_sample; + u16 nevents; + + dim->event_ctr++; + + switch (dim->state) { + case NET_DIM_MEASURE_IN_PROGRESS: + nevents = BIT_GAP(BITS_PER_TYPE(u16), + dim->event_ctr, + dim->start_sample.event_ctr); + if (nevents < NET_DIM_NEVENTS) + break; + net_dim_sample(dim->event_ctr, packets, bytes, &end_sample); + net_dim_calc_stats(&dim->start_sample, &end_sample, + &curr_stats); + if (net_dim_decision(&curr_stats, dim)) { + dim->state = NET_DIM_APPLY_NEW_PROFILE; + schedule_work(&dim->work); + break; + } + /* FALLTHROUGH */ + case NET_DIM_START_MEASURE: + net_dim_sample(dim->event_ctr, packets, bytes, &dim->start_sample); + dim->state = NET_DIM_MEASURE_IN_PROGRESS; + break; + case NET_DIM_APPLY_NEW_PROFILE: + break; + default: + break; + } +} + +#endif /* NET_DIM_H */ Modified: stable/12/sys/conf/files ============================================================================== --- stable/12/sys/conf/files Thu May 16 15:39:07 2019 (r347709) +++ stable/12/sys/conf/files Thu May 16 15:40:22 2019 (r347710) @@ -4808,6 +4808,8 @@ dev/mlx5/mlx5_core/mlx5_wq.c optional mlx5 pci \ dev/mlx5/mlx5_lib/mlx5_gid.c optional mlx5 pci \ compile-with "${OFED_C}" +dev/mlx5/mlx5_en/mlx5_en_dim.c optional mlx5en pci inet inet6 \ + compile-with "${OFED_C}" dev/mlx5/mlx5_en/mlx5_en_ethtool.c optional mlx5en pci inet inet6 \ compile-with "${OFED_C}" dev/mlx5/mlx5_en/mlx5_en_main.c optional mlx5en pci inet inet6 \ Modified: stable/12/sys/dev/mlx5/mlx5_en/en.h ============================================================================== --- stable/12/sys/dev/mlx5/mlx5_en/en.h Thu May 16 15:39:07 2019 (r347709) +++ stable/12/sys/dev/mlx5/mlx5_en/en.h Thu May 16 15:40:22 2019 (r347710) @@ -1,5 +1,5 @@ /*- - * Copyright (c) 2015 Mellanox Technologies. All rights reserved. + * Copyright (c) 2015-2018 Mellanox Technologies. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -38,6 +38,8 @@ #include #include #include +#include +#include #include #include @@ -94,6 +96,8 @@ #define MLX5E_PARAMS_DEFAULT_LRO_WQE_SZ \ MIN(65535, MLX5E_MAX_RX_SEGS * MLX5E_MAX_RX_BYTES) #endif +#define MLX5E_DIM_DEFAULT_PROFILE 3 +#define MLX5E_DIM_MAX_RX_CQ_MODERATION_PKTS_WITH_LRO 16 #define MLX5E_PARAMS_DEFAULT_RX_CQ_MODERATION_USEC 0x10 #define MLX5E_PARAMS_DEFAULT_RX_CQ_MODERATION_USEC_FROM_CQE 0x3 #define MLX5E_PARAMS_DEFAULT_RX_CQ_MODERATION_PKTS 0x20 @@ -471,7 +475,7 @@ struct mlx5e_params { m(+1, u64 coalesce_pkts_max, "coalesce_pkts_max", "Maximum packets to join") \ m(+1, u64 rx_coalesce_usecs, "rx_coalesce_usecs", "Limit in usec for joining rx packets") \ m(+1, u64 rx_coalesce_pkts, "rx_coalesce_pkts", "Maximum number of rx packets to join") \ - m(+1, u64 rx_coalesce_mode, "rx_coalesce_mode", "0: EQE mode 1: CQE mode") \ + m(+1, u64 rx_coalesce_mode, "rx_coalesce_mode", "0: EQE fixed mode 1: CQE fixed mode 2: EQE auto mode 3: CQE auto mode") \ m(+1, u64 tx_coalesce_usecs, "tx_coalesce_usecs", "Limit in usec for joining tx packets") \ m(+1, u64 tx_coalesce_pkts, "tx_coalesce_pkts", "Maximum number of tx packets to join") \ m(+1, u64 tx_coalesce_mode, "tx_coalesce_mode", "0: EQE mode 1: CQE mode") \ @@ -561,6 +565,9 @@ struct mlx5e_rq { volatile int enabled; int ix; + /* Dynamic Interrupt Moderation */ + struct net_dim dim; + /* control */ struct mlx5_wq_ctrl wq_ctrl; u32 rqn; @@ -879,6 +886,9 @@ void mlx5e_cq_error_event(struct mlx5_core_cq *mcq, in void mlx5e_rx_cq_comp(struct mlx5_core_cq *); void mlx5e_tx_cq_comp(struct mlx5_core_cq *); struct mlx5_cqe64 *mlx5e_get_cqe(struct mlx5e_cq *cq); + +void mlx5e_dim_work(struct work_struct *); +void mlx5e_dim_build_cq_param(struct mlx5e_priv *, struct mlx5e_cq_param *); int mlx5e_open_flow_table(struct mlx5e_priv *priv); void mlx5e_close_flow_table(struct mlx5e_priv *priv); Copied: stable/12/sys/dev/mlx5/mlx5_en/mlx5_en_dim.c (from r347246, head/sys/dev/mlx5/mlx5_en/mlx5_en_dim.c) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/12/sys/dev/mlx5/mlx5_en/mlx5_en_dim.c Thu May 16 15:40:22 2019 (r347710, copy of r347246, head/sys/dev/mlx5/mlx5_en/mlx5_en_dim.c) @@ -0,0 +1,92 @@ +/*- + * Copyright (c) 2018 Mellanox Technologies. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY AUTHOR AND CONTRIBUTORS `AS IS' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * $FreeBSD$ + */ + +#include "en.h" + +void +mlx5e_dim_build_cq_param(struct mlx5e_priv *priv, + struct mlx5e_cq_param *param) +{ + struct net_dim_cq_moder prof; + void *cqc = param->cqc; + + if (priv->params.rx_cq_moderation_mode < 2) + return; + + switch (MLX5_GET(cqc, cqc, cq_period_mode)) { + case MLX5_CQ_PERIOD_MODE_START_FROM_CQE: + prof = net_dim_profile[NET_DIM_CQ_PERIOD_MODE_START_FROM_CQE] + [NET_DIM_DEF_PROFILE_CQE]; + MLX5_SET(cqc, cqc, cq_period, prof.usec); + MLX5_SET(cqc, cqc, cq_max_count, prof.pkts); + break; + + case MLX5_CQ_PERIOD_MODE_START_FROM_EQE: + prof = net_dim_profile[NET_DIM_CQ_PERIOD_MODE_START_FROM_EQE] + [NET_DIM_DEF_PROFILE_EQE]; + MLX5_SET(cqc, cqc, cq_period, prof.usec); + MLX5_SET(cqc, cqc, cq_max_count, prof.pkts); + break; + default: + break; + } +} + +void +mlx5e_dim_work(struct work_struct *work) +{ + struct net_dim *dim = container_of(work, struct net_dim, work); + struct mlx5e_rq *rq = container_of(dim, struct mlx5e_rq, dim); + struct mlx5e_channel *c = container_of(rq, struct mlx5e_channel, rq); + struct net_dim_cq_moder cur_profile; + u8 profile_ix; + u8 mode; + + /* copy current auto moderation settings and set new state */ + mtx_lock(&rq->mtx); + profile_ix = dim->profile_ix; + mode = dim->mode; + dim->state = NET_DIM_START_MEASURE; + mtx_unlock(&rq->mtx); + + /* check for invalid mode */ + if (mode == 255) + return; + + /* get current profile */ + cur_profile = net_dim_profile[mode][profile_ix]; + + /* apply LRO restrictions */ + if (c->priv->params.hw_lro_en && + cur_profile.pkts > MLX5E_DIM_MAX_RX_CQ_MODERATION_PKTS_WITH_LRO) { + cur_profile.pkts = MLX5E_DIM_MAX_RX_CQ_MODERATION_PKTS_WITH_LRO; + } + + /* modify CQ */ + mlx5_core_modify_cq_moderation(c->priv->mdev, &rq->cq.mcq, + cur_profile.usec, cur_profile.pkts); +} Modified: stable/12/sys/dev/mlx5/mlx5_en/mlx5_en_ethtool.c ============================================================================== --- stable/12/sys/dev/mlx5/mlx5_en/mlx5_en_ethtool.c Thu May 16 15:39:07 2019 (r347709) +++ stable/12/sys/dev/mlx5/mlx5_en/mlx5_en_ethtool.c Thu May 16 15:40:22 2019 (r347710) @@ -629,8 +629,8 @@ mlx5e_ethtool_handler(SYSCTL_HANDLER_ARGS) mlx5e_close_locked(priv->ifp); /* import RX coalesce mode */ - if (priv->params_ethtool.rx_coalesce_mode != 0) - priv->params_ethtool.rx_coalesce_mode = 1; + if (priv->params_ethtool.rx_coalesce_mode > 3) + priv->params_ethtool.rx_coalesce_mode = 3; priv->params.rx_cq_moderation_mode = priv->params_ethtool.rx_coalesce_mode; Modified: stable/12/sys/dev/mlx5/mlx5_en/mlx5_en_main.c ============================================================================== --- stable/12/sys/dev/mlx5/mlx5_en/mlx5_en_main.c Thu May 16 15:39:07 2019 (r347709) +++ stable/12/sys/dev/mlx5/mlx5_en/mlx5_en_main.c Thu May 16 15:40:22 2019 (r347710) @@ -915,6 +915,26 @@ mlx5e_create_rq(struct mlx5e_channel *c, #endif } + INIT_WORK(&rq->dim.work, mlx5e_dim_work); + if (priv->params.rx_cq_moderation_mode < 2) { + rq->dim.mode = NET_DIM_CQ_PERIOD_MODE_DISABLED; + } else { + void *cqc = container_of(param, + struct mlx5e_channel_param, rq)->rx_cq.cqc; + + switch (MLX5_GET(cqc, cqc, cq_period_mode)) { + case MLX5_CQ_PERIOD_MODE_START_FROM_EQE: + rq->dim.mode = NET_DIM_CQ_PERIOD_MODE_START_FROM_EQE; + break; + case MLX5_CQ_PERIOD_MODE_START_FROM_CQE: + rq->dim.mode = NET_DIM_CQ_PERIOD_MODE_START_FROM_CQE; + break; + default: + rq->dim.mode = NET_DIM_CQ_PERIOD_MODE_DISABLED; + break; + } + } + rq->ifp = c->tag.m_snd_tag.ifp; rq->channel = c; rq->ix = c->ix; @@ -1116,6 +1136,7 @@ mlx5e_close_rq_wait(struct mlx5e_rq *rq) rq->cq.mcq.comp(&rq->cq.mcq); } + cancel_work_sync(&rq->dim.work); mlx5e_disable_rq(rq); mlx5e_destroy_rq(rq); } @@ -1916,9 +1937,23 @@ mlx5e_build_common_cq_param(struct mlx5e_priv *priv, } static void +mlx5e_get_default_profile(struct mlx5e_priv *priv, int mode, struct net_dim_cq_moder *ptr) +{ + + *ptr = net_dim_get_profile(mode, MLX5E_DIM_DEFAULT_PROFILE); + + /* apply LRO restrictions */ + if (priv->params.hw_lro_en && + ptr->pkts > MLX5E_DIM_MAX_RX_CQ_MODERATION_PKTS_WITH_LRO) { + ptr->pkts = MLX5E_DIM_MAX_RX_CQ_MODERATION_PKTS_WITH_LRO; + } +} + +static void mlx5e_build_rx_cq_param(struct mlx5e_priv *priv, struct mlx5e_cq_param *param) { + struct net_dim_cq_moder curr; void *cqc = param->cqc; @@ -1932,21 +1967,42 @@ mlx5e_build_rx_cq_param(struct mlx5e_priv *priv, } MLX5_SET(cqc, cqc, log_cq_size, priv->params.log_rq_size); - MLX5_SET(cqc, cqc, cq_period, priv->params.rx_cq_moderation_usec); - MLX5_SET(cqc, cqc, cq_max_count, priv->params.rx_cq_moderation_pkts); switch (priv->params.rx_cq_moderation_mode) { case 0: + MLX5_SET(cqc, cqc, cq_period, priv->params.rx_cq_moderation_usec); + MLX5_SET(cqc, cqc, cq_max_count, priv->params.rx_cq_moderation_pkts); MLX5_SET(cqc, cqc, cq_period_mode, MLX5_CQ_PERIOD_MODE_START_FROM_EQE); break; - default: + case 1: + MLX5_SET(cqc, cqc, cq_period, priv->params.rx_cq_moderation_usec); + MLX5_SET(cqc, cqc, cq_max_count, priv->params.rx_cq_moderation_pkts); if (MLX5_CAP_GEN(priv->mdev, cq_period_start_from_cqe)) MLX5_SET(cqc, cqc, cq_period_mode, MLX5_CQ_PERIOD_MODE_START_FROM_CQE); else MLX5_SET(cqc, cqc, cq_period_mode, MLX5_CQ_PERIOD_MODE_START_FROM_EQE); break; + case 2: + mlx5e_get_default_profile(priv, NET_DIM_CQ_PERIOD_MODE_START_FROM_EQE, &curr); + MLX5_SET(cqc, cqc, cq_period, curr.usec); + MLX5_SET(cqc, cqc, cq_max_count, curr.pkts); + MLX5_SET(cqc, cqc, cq_period_mode, MLX5_CQ_PERIOD_MODE_START_FROM_EQE); + break; + case 3: + mlx5e_get_default_profile(priv, NET_DIM_CQ_PERIOD_MODE_START_FROM_CQE, &curr); + MLX5_SET(cqc, cqc, cq_period, curr.usec); + MLX5_SET(cqc, cqc, cq_max_count, curr.pkts); + if (MLX5_CAP_GEN(priv->mdev, cq_period_start_from_cqe)) + MLX5_SET(cqc, cqc, cq_period_mode, MLX5_CQ_PERIOD_MODE_START_FROM_CQE); + else + MLX5_SET(cqc, cqc, cq_period_mode, MLX5_CQ_PERIOD_MODE_START_FROM_EQE); + break; + default: + break; } + mlx5e_dim_build_cq_param(priv, param); + mlx5e_build_common_cq_param(priv, param); } @@ -2037,6 +2093,7 @@ mlx5e_refresh_sq_params(struct mlx5e_priv *priv, struc switch (priv->params.tx_cq_moderation_mode) { case 0: + case 2: cq_mode = MLX5_CQ_PERIOD_MODE_START_FROM_EQE; break; default: @@ -2061,22 +2118,49 @@ mlx5e_refresh_rq_params(struct mlx5e_priv *priv, struc if (MLX5_CAP_GEN(priv->mdev, cq_period_mode_modify)) { uint8_t cq_mode; + uint8_t dim_mode; int retval; switch (priv->params.rx_cq_moderation_mode) { case 0: + case 2: cq_mode = MLX5_CQ_PERIOD_MODE_START_FROM_EQE; + dim_mode = NET_DIM_CQ_PERIOD_MODE_START_FROM_EQE; break; default: cq_mode = MLX5_CQ_PERIOD_MODE_START_FROM_CQE; + dim_mode = NET_DIM_CQ_PERIOD_MODE_START_FROM_CQE; break; } - retval = mlx5_core_modify_cq_moderation_mode(priv->mdev, &rq->cq.mcq, - priv->params.rx_cq_moderation_usec, - priv->params.rx_cq_moderation_pkts, - cq_mode); + /* tear down dynamic interrupt moderation */ + mtx_lock(&rq->mtx); + rq->dim.mode = NET_DIM_CQ_PERIOD_MODE_DISABLED; + mtx_unlock(&rq->mtx); + /* wait for dynamic interrupt moderation work task, if any */ + cancel_work_sync(&rq->dim.work); + + if (priv->params.rx_cq_moderation_mode >= 2) { + struct net_dim_cq_moder curr; + + mlx5e_get_default_profile(priv, dim_mode, &curr); + + retval = mlx5_core_modify_cq_moderation_mode(priv->mdev, &rq->cq.mcq, + curr.usec, curr.pkts, cq_mode); + + /* set dynamic interrupt moderation mode and zero defaults */ + mtx_lock(&rq->mtx); + rq->dim.mode = dim_mode; + rq->dim.state = 0; + rq->dim.profile_ix = MLX5E_DIM_DEFAULT_PROFILE; + mtx_unlock(&rq->mtx); + } else { + retval = mlx5_core_modify_cq_moderation_mode(priv->mdev, &rq->cq.mcq, + priv->params.rx_cq_moderation_usec, + priv->params.rx_cq_moderation_pkts, + cq_mode); + } return (retval); } Modified: stable/12/sys/dev/mlx5/mlx5_en/mlx5_en_rx.c ============================================================================== --- stable/12/sys/dev/mlx5/mlx5_en/mlx5_en_rx.c Thu May 16 15:39:07 2019 (r347709) +++ stable/12/sys/dev/mlx5/mlx5_en/mlx5_en_rx.c Thu May 16 15:40:22 2019 (r347710) @@ -545,6 +545,9 @@ mlx5e_rx_cq_comp(struct mlx5_core_cq *mcq) mlx5e_post_rx_wqes(rq); } mlx5e_post_rx_wqes(rq); + /* check for dynamic interrupt moderation callback */ + if (rq->dim.mode != NET_DIM_CQ_PERIOD_MODE_DISABLED) + net_dim(&rq->dim, rq->stats.packets, rq->stats.bytes); mlx5e_cq_arm(&rq->cq, MLX5_GET_DOORBELL_LOCK(&rq->channel->priv->doorbell_lock)); tcp_lro_flush_all(&rq->lro); mtx_unlock(&rq->mtx); Modified: stable/12/sys/modules/mlx5en/Makefile ============================================================================== --- stable/12/sys/modules/mlx5en/Makefile Thu May 16 15:39:07 2019 (r347709) +++ stable/12/sys/modules/mlx5en/Makefile Thu May 16 15:40:22 2019 (r347710) @@ -3,6 +3,7 @@ KMOD=mlx5en SRCS= \ +mlx5_en_dim.c \ mlx5_en_ethtool.c \ mlx5_en_main.c \ mlx5_en_tx.c \ From owner-svn-src-stable@freebsd.org Thu May 16 15:41:06 2019 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 93656159A7D1; Thu, 16 May 2019 15:41:06 +0000 (UTC) (envelope-from hselasky@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 35E878409F; Thu, 16 May 2019 15:41:06 +0000 (UTC) (envelope-from hselasky@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 122AA22CE6; Thu, 16 May 2019 15:41:06 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x4GFf5OY041728; Thu, 16 May 2019 15:41:05 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x4GFf53l041723; Thu, 16 May 2019 15:41:05 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201905161541.x4GFf53l041723@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Thu, 16 May 2019 15:41:05 +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: r347711 - in stable/12/sys/dev/mlx5: . mlx5_fpga mlx5_fpga_tools X-SVN-Group: stable-12 X-SVN-Commit-Author: hselasky X-SVN-Commit-Paths: in stable/12/sys/dev/mlx5: . mlx5_fpga mlx5_fpga_tools X-SVN-Commit-Revision: 347711 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 35E878409F X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.96 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.998,0]; NEURAL_HAM_SHORT(-0.96)[-0.960,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US]; NEURAL_HAM_LONG(-1.00)[-1.000,0] X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 16 May 2019 15:41:06 -0000 Author: hselasky Date: Thu May 16 15:41:04 2019 New Revision: 347711 URL: https://svnweb.freebsd.org/changeset/base/347711 Log: MFC r347247: Add MLX5_FPGA_RELOAD IOCTL(2) to mlx5fpga. Submitted by: kib@ Sponsored by: Mellanox Technologies Modified: stable/12/sys/dev/mlx5/mlx5_fpga/mlx5_ifc_fpga.h stable/12/sys/dev/mlx5/mlx5_fpga/mlx5fpga_sdk.c stable/12/sys/dev/mlx5/mlx5_fpga_tools/mlx5fpga_tools_char.c stable/12/sys/dev/mlx5/mlx5io.h Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/dev/mlx5/mlx5_fpga/mlx5_ifc_fpga.h ============================================================================== --- stable/12/sys/dev/mlx5/mlx5_fpga/mlx5_ifc_fpga.h Thu May 16 15:40:22 2019 (r347710) +++ stable/12/sys/dev/mlx5/mlx5_fpga/mlx5_ifc_fpga.h Thu May 16 15:41:04 2019 (r347711) @@ -135,6 +135,7 @@ enum { MLX5_FPGA_CTRL_OPERATION_RESET_SANDBOX = 0x6, MLX5_FPGA_CTRL_OPERATION_DISCONNECT = 0x9, MLX5_FPGA_CTRL_OPERATION_CONNECT = 0xA, + MLX5_FPGA_CTRL_OPERATION_RELOAD = 0xB, }; struct mlx5_ifc_fpga_ctrl_bits { Modified: stable/12/sys/dev/mlx5/mlx5_fpga/mlx5fpga_sdk.c ============================================================================== --- stable/12/sys/dev/mlx5/mlx5_fpga/mlx5fpga_sdk.c Thu May 16 15:40:22 2019 (r347710) +++ stable/12/sys/dev/mlx5/mlx5_fpga/mlx5fpga_sdk.c Thu May 16 15:41:04 2019 (r347711) @@ -324,6 +324,45 @@ void mlx5_fpga_device_query(struct mlx5_fpga_device *f } EXPORT_SYMBOL(mlx5_fpga_device_query); +static int mlx5_fpga_device_reload_cmd(struct mlx5_fpga_device *fdev) +{ + struct mlx5_core_dev *mdev = fdev->mdev; + unsigned long timeout; + unsigned long flags; + int err = 0; + + mlx5_fpga_info(fdev, "mlx5/fpga - reload started\n"); + fdev->fdev_state = MLX5_FDEV_STATE_IN_PROGRESS; + reinit_completion(&fdev->load_event); + err = mlx5_fpga_ctrl_op(mdev, MLX5_FPGA_CTRL_OPERATION_RELOAD); + if (err) { + mlx5_fpga_err(fdev, "Failed to request reload: %d\n", + err); + goto out; + } + timeout = jiffies + msecs_to_jiffies(MLX5_FPGA_LOAD_TIMEOUT); + err = wait_for_completion_timeout(&fdev->load_event, + timeout - jiffies); + if (err < 0) { + mlx5_fpga_err(fdev, "Failed waiting for reload: %d\n", err); + fdev->fdev_state = MLX5_FDEV_STATE_FAILURE; + goto out; + } + /* Check device loaded successful */ + err = mlx5_fpga_device_start(mdev); + if (err) { + mlx5_fpga_err(fdev, "Failed load check for reload: %d\n", err); + fdev->fdev_state = MLX5_FDEV_STATE_FAILURE; + goto out; + } + spin_lock_irqsave(&fdev->state_lock, flags); + fdev->fdev_state = MLX5_FDEV_STATE_SUCCESS; + spin_unlock_irqrestore(&fdev->state_lock, flags); + mlx5_fpga_info(fdev, "mlx5/fpga - reload ended\n"); +out: + return err; +} + int mlx5_fpga_device_reload(struct mlx5_fpga_device *fdev, enum mlx5_fpga_image image) { @@ -350,6 +389,12 @@ int mlx5_fpga_device_reload(struct mlx5_fpga_device *f return err; mutex_lock(&mdev->intf_state_mutex); + + if (image == MLX5_FPGA_IMAGE_RELOAD) { + err = mlx5_fpga_device_reload_cmd(fdev); + goto out; + } + clear_bit(MLX5_INTERFACE_STATE_UP, &mdev->intf_state); mlx5_unregister_device(mdev); @@ -359,7 +404,7 @@ int mlx5_fpga_device_reload(struct mlx5_fpga_device *f fdev->fdev_state = MLX5_FDEV_STATE_IN_PROGRESS; reinit_completion(&fdev->load_event); - if (image <= MLX5_FPGA_IMAGE_MAX) { + if (image <= MLX5_FPGA_IMAGE_FACTORY) { mlx5_fpga_info(fdev, "Loading from flash\n"); err = mlx5_fpga_load(mdev, image); if (err) { @@ -367,7 +412,7 @@ int mlx5_fpga_device_reload(struct mlx5_fpga_device *f err); goto out; } - } else { + } else if (image == MLX5_FPGA_IMAGE_RESET) { mlx5_fpga_info(fdev, "Resetting\n"); err = mlx5_fpga_ctrl_op(mdev, MLX5_FPGA_CTRL_OPERATION_RESET); if (err) { @@ -375,6 +420,10 @@ int mlx5_fpga_device_reload(struct mlx5_fpga_device *f err); goto out; } + } else { + mlx5_fpga_err(fdev, "Unknown command: %d\n", + image); + goto out; } timeout = jiffies + msecs_to_jiffies(MLX5_FPGA_LOAD_TIMEOUT); Modified: stable/12/sys/dev/mlx5/mlx5_fpga_tools/mlx5fpga_tools_char.c ============================================================================== --- stable/12/sys/dev/mlx5/mlx5_fpga_tools/mlx5fpga_tools_char.c Thu May 16 15:40:22 2019 (r347710) +++ stable/12/sys/dev/mlx5/mlx5_fpga_tools/mlx5fpga_tools_char.c Thu May 16 15:41:04 2019 (r347711) @@ -225,7 +225,7 @@ tools_char_ioctl(struct cdev *dev, u_long cmd, caddr_t break; case MLX5_FPGA_LOAD: arg = *(int *)data; - if (arg > MLX5_FPGA_IMAGE_MAX) { + if (arg > MLX5_FPGA_IMAGE_FACTORY) { dev_err(mlx5_fpga_dev(fdev), "unknown image type %u\n", arg); err = EINVAL; @@ -234,11 +234,14 @@ tools_char_ioctl(struct cdev *dev, u_long cmd, caddr_t err = mlx5_fpga_device_reload(fdev, arg); break; case MLX5_FPGA_RESET: - err = mlx5_fpga_device_reload(fdev, MLX5_FPGA_IMAGE_MAX + 1); + err = mlx5_fpga_device_reload(fdev, MLX5_FPGA_IMAGE_RESET); break; + case MLX5_FPGA_RELOAD: + err = mlx5_fpga_device_reload(fdev, MLX5_FPGA_IMAGE_RELOAD); + break; case MLX5_FPGA_IMAGE_SEL: arg = *(int *)data; - if (arg > MLX5_FPGA_IMAGE_MAX) { + if (arg > MLX5_FPGA_IMAGE_FACTORY) { dev_err(mlx5_fpga_dev(fdev), "unknown image type %u\n", arg); err = EINVAL; Modified: stable/12/sys/dev/mlx5/mlx5io.h ============================================================================== --- stable/12/sys/dev/mlx5/mlx5io.h Thu May 16 15:40:22 2019 (r347710) +++ stable/12/sys/dev/mlx5/mlx5io.h Thu May 16 15:41:04 2019 (r347711) @@ -67,8 +67,9 @@ enum mlx5_fpga_id { enum mlx5_fpga_image { MLX5_FPGA_IMAGE_USER = 0, MLX5_FPGA_IMAGE_FACTORY = 1, - MLX5_FPGA_IMAGE_MAX = MLX5_FPGA_IMAGE_FACTORY, MLX5_FPGA_IMAGE_FACTORY_FAILOVER = 2, + MLX5_FPGA_IMAGE_RESET = 17, + MLX5_FPGA_IMAGE_RELOAD = 18, }; enum mlx5_fpga_status { @@ -135,6 +136,7 @@ struct mlx5_fpga_temperature { #define MLX5_FPGA_CAP _IOR('m', 0x85, uint32_t[MLX5_FPGA_CAP_ARR_SZ]) #define MLX5_FPGA_TEMPERATURE _IOWR('m', 0x86, struct mlx5_fpga_temperature) #define MLX5_FPGA_CONNECT _IOWR('m', 0x87, enum mlx5_fpga_connect) +#define MLX5_FPGA_RELOAD _IO('m', 0x88) #define MLX5_FPGA_TOOLS_NAME_SUFFIX "_mlx5_fpga_tools" From owner-svn-src-stable@freebsd.org Thu May 16 15:42:01 2019 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 32E66159A876; Thu, 16 May 2019 15:42:01 +0000 (UTC) (envelope-from hselasky@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 CBF778429A; Thu, 16 May 2019 15:42:00 +0000 (UTC) (envelope-from hselasky@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 A867B22D2C; Thu, 16 May 2019 15:42:00 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x4GFg0rn043353; Thu, 16 May 2019 15:42:00 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x4GFg09Q043352; Thu, 16 May 2019 15:42:00 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201905161542.x4GFg09Q043352@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Thu, 16 May 2019 15:42:00 +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: r347712 - stable/12/sys/dev/mlx5/mlx5_core X-SVN-Group: stable-12 X-SVN-Commit-Author: hselasky X-SVN-Commit-Paths: stable/12/sys/dev/mlx5/mlx5_core X-SVN-Commit-Revision: 347712 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: CBF778429A X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.96 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.998,0]; NEURAL_HAM_SHORT(-0.96)[-0.959,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US]; NEURAL_HAM_LONG(-1.00)[-1.000,0] X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 16 May 2019 15:42:01 -0000 Author: hselasky Date: Thu May 16 15:42:00 2019 New Revision: 347712 URL: https://svnweb.freebsd.org/changeset/base/347712 Log: MFC r347248: Enable FPGA and FPGA QP errors for EQ and call the handler in mlx5core. Submitted by: kib@ Sponsored by: Mellanox Technologies Modified: stable/12/sys/dev/mlx5/mlx5_core/mlx5_eq.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/dev/mlx5/mlx5_core/mlx5_eq.c ============================================================================== --- stable/12/sys/dev/mlx5/mlx5_core/mlx5_eq.c Thu May 16 15:41:04 2019 (r347711) +++ stable/12/sys/dev/mlx5/mlx5_core/mlx5_eq.c Thu May 16 15:42:00 2019 (r347712) @@ -29,6 +29,7 @@ #include #include #include +#include #include "mlx5_core.h" #include "opt_rss.h" @@ -153,6 +154,10 @@ static const char *eqe_type_str(u8 type) return "MLX5_EVENT_TYPE_PAGE_REQUEST"; case MLX5_EVENT_TYPE_NIC_VPORT_CHANGE: return "MLX5_EVENT_TYPE_NIC_VPORT_CHANGE"; + case MLX5_EVENT_TYPE_FPGA_ERROR: + return "MLX5_EVENT_TYPE_FPGA_ERROR"; + case MLX5_EVENT_TYPE_FPGA_QP_ERROR: + return "MLX5_EVENT_TYPE_FPGA_QP_ERROR"; case MLX5_EVENT_TYPE_CODING_DCBX_CHANGE_EVENT: return "MLX5_EVENT_TYPE_CODING_DCBX_CHANGE_EVENT"; case MLX5_EVENT_TYPE_CODING_GENERAL_NOTIFICATION_EVENT: @@ -338,6 +343,11 @@ static int mlx5_eq_int(struct mlx5_core_dev *dev, stru } break; + case MLX5_EVENT_TYPE_FPGA_ERROR: + case MLX5_EVENT_TYPE_FPGA_QP_ERROR: + mlx5_fpga_event(dev, eqe->type, &eqe->data.raw); + break; + default: mlx5_core_warn(dev, "Unhandled event 0x%x on EQ 0x%x\n", eqe->type, eq->eqn); @@ -526,6 +536,10 @@ int mlx5_start_eqs(struct mlx5_core_dev *dev) if (MLX5_CAP_GEN(dev, dcbx)) async_event_mask |= (1ull << MLX5_EVENT_TYPE_CODING_DCBX_CHANGE_EVENT); + + if (MLX5_CAP_GEN(dev, fpga)) + async_event_mask |= (1ull << MLX5_EVENT_TYPE_FPGA_ERROR) | + (1ull << MLX5_EVENT_TYPE_FPGA_QP_ERROR); err = mlx5_create_map_eq(dev, &table->cmd_eq, MLX5_EQ_VEC_CMD, MLX5_NUM_CMD_EQE, 1ull << MLX5_EVENT_TYPE_CMD, From owner-svn-src-stable@freebsd.org Thu May 16 15:42:49 2019 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id DF4B6159A8F7; Thu, 16 May 2019 15:42:48 +0000 (UTC) (envelope-from hselasky@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 827CD84534; Thu, 16 May 2019 15:42:48 +0000 (UTC) (envelope-from hselasky@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 5CF3C22E8F; Thu, 16 May 2019 15:42:48 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x4GFgm1q045901; Thu, 16 May 2019 15:42:48 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x4GFgmh6045899; Thu, 16 May 2019 15:42:48 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201905161542.x4GFgmh6045899@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Thu, 16 May 2019 15:42:48 +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: r347713 - in stable/12/sys/dev/mlx5: . mlx5_core X-SVN-Group: stable-12 X-SVN-Commit-Author: hselasky X-SVN-Commit-Paths: in stable/12/sys/dev/mlx5: . mlx5_core X-SVN-Commit-Revision: 347713 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 827CD84534 X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.96 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.998,0]; NEURAL_HAM_SHORT(-0.96)[-0.960,0]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US] X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 16 May 2019 15:42:49 -0000 Author: hselasky Date: Thu May 16 15:42:47 2019 New Revision: 347713 URL: https://svnweb.freebsd.org/changeset/base/347713 Log: MFC r347249: Correctly define the interface state bits in mlx5en(4). While at it remove unused interface state bits. This also fixes and issue during shutdown: There is an issue where the firmware fails during mlx5_load_one, the health_care timer detects the issue and schedules a health_care call. Then the mlx5_load_one detects the issue, cleans up and quits. Then the health_care starts and calls mlx5_unload_one to clean up the resources that no longer exist and causes kernel panic. The root cause is that the bit MLX5_INTERFACE_STATE_DOWN is not set after mlx5_load_one fails. The solution is removing the bit MLX5_INTERFACE_STATE_DOWN and quit mlx5_unload_one if the bit MLX5_INTERFACE_STATE_UP is not set. The bit MLX5_INTERFACE_STATE_DOWN is redundant and we can use MLX5_INTERFACE_STATE_UP instead. Linux commit: 10a8d00707082955b177164d4b4e758ffcbd4017 b3cb5388499c5e219324bfe7da2e46cbad82bfcf Sponsored by: Mellanox Technologies Modified: stable/12/sys/dev/mlx5/driver.h stable/12/sys/dev/mlx5/mlx5_core/mlx5_main.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/dev/mlx5/driver.h ============================================================================== --- stable/12/sys/dev/mlx5/driver.h Thu May 16 15:42:00 2019 (r347712) +++ stable/12/sys/dev/mlx5/driver.h Thu May 16 15:42:47 2019 (r347713) @@ -662,9 +662,7 @@ enum mlx5_device_state { }; enum mlx5_interface_state { - MLX5_INTERFACE_STATE_DOWN = BIT(0), - MLX5_INTERFACE_STATE_UP = BIT(1), - MLX5_INTERFACE_STATE_SHUTDOWN = BIT(2), + MLX5_INTERFACE_STATE_UP, }; enum mlx5_pci_status { Modified: stable/12/sys/dev/mlx5/mlx5_core/mlx5_main.c ============================================================================== --- stable/12/sys/dev/mlx5/mlx5_core/mlx5_main.c Thu May 16 15:42:00 2019 (r347712) +++ stable/12/sys/dev/mlx5/mlx5_core/mlx5_main.c Thu May 16 15:42:47 2019 (r347713) @@ -1096,7 +1096,6 @@ static int mlx5_load_one(struct mlx5_core_dev *dev, st goto err_fs; } - clear_bit(MLX5_INTERFACE_STATE_DOWN, &dev->intf_state); set_bit(MLX5_INTERFACE_STATE_UP, &dev->intf_state); out: @@ -1159,7 +1158,7 @@ static int mlx5_unload_one(struct mlx5_core_dev *dev, mlx5_drain_health_recovery(dev); mutex_lock(&dev->intf_state_mutex); - if (test_bit(MLX5_INTERFACE_STATE_DOWN, &dev->intf_state)) { + if (!test_bit(MLX5_INTERFACE_STATE_UP, &dev->intf_state)) { dev_warn(&dev->pdev->dev, "%s: interface is down, NOP\n", __func__); if (cleanup) mlx5_cleanup_once(dev); @@ -1191,7 +1190,6 @@ static int mlx5_unload_one(struct mlx5_core_dev *dev, out: clear_bit(MLX5_INTERFACE_STATE_UP, &dev->intf_state); - set_bit(MLX5_INTERFACE_STATE_DOWN, &dev->intf_state); mutex_unlock(&dev->intf_state_mutex); return err; } @@ -1451,7 +1449,6 @@ static void shutdown_one(struct pci_dev *pdev) struct mlx5_priv *priv = &dev->priv; int err; - set_bit(MLX5_INTERFACE_STATE_SHUTDOWN, &dev->intf_state); err = mlx5_try_fast_unload(dev); if (err) mlx5_unload_one(dev, priv, false); From owner-svn-src-stable@freebsd.org Thu May 16 15:43:36 2019 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id D0151159A9BF; Thu, 16 May 2019 15:43:35 +0000 (UTC) (envelope-from hselasky@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 7216F8467B; Thu, 16 May 2019 15:43:35 +0000 (UTC) (envelope-from hselasky@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 4D53822E90; Thu, 16 May 2019 15:43:35 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x4GFhZWg045995; Thu, 16 May 2019 15:43:35 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x4GFhYUb045992; Thu, 16 May 2019 15:43:34 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201905161543.x4GFhYUb045992@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Thu, 16 May 2019 15:43:34 +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: r347714 - in stable/12/sys/dev/mlx5: . mlx5_core X-SVN-Group: stable-12 X-SVN-Commit-Author: hselasky X-SVN-Commit-Paths: in stable/12/sys/dev/mlx5: . mlx5_core X-SVN-Commit-Revision: 347714 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 7216F8467B X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.96 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.998,0]; NEURAL_HAM_SHORT(-0.96)[-0.960,0]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US] X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 16 May 2019 15:43:36 -0000 Author: hselasky Date: Thu May 16 15:43:34 2019 New Revision: 347714 URL: https://svnweb.freebsd.org/changeset/base/347714 Log: MFC r347250: Add temperature warning event to log in mlx5core. Temperature warning event is sent by FW to indicate high temperature as detected by one of the sensors on the board. Add handling of this event by writing the numbers of the alert sensors to the kernel log. Linux commit: 1865ea9adbfaf341c5cd5d8f7d384f19948b2fe9 Submitted by: slavash@ Sponsored by: Mellanox Technologies Modified: stable/12/sys/dev/mlx5/device.h stable/12/sys/dev/mlx5/mlx5_core/mlx5_eq.c stable/12/sys/dev/mlx5/mlx5_ifc.h Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/dev/mlx5/device.h ============================================================================== --- stable/12/sys/dev/mlx5/device.h Thu May 16 15:42:47 2019 (r347713) +++ stable/12/sys/dev/mlx5/device.h Thu May 16 15:43:34 2019 (r347714) @@ -566,6 +566,11 @@ struct mlx5_eqe_general_notification_event { u32 rsvd0[6]; }; +struct mlx5_eqe_temp_warning { + __be64 sensor_warning_msb; + __be64 sensor_warning_lsb; +} __packed; + union ev_data { __be32 raw[7]; struct mlx5_eqe_cmd cmd; @@ -580,6 +585,7 @@ union ev_data { struct mlx5_eqe_port_module_event port_module_event; struct mlx5_eqe_vport_change vport_change; struct mlx5_eqe_general_notification_event general_notifications; + struct mlx5_eqe_temp_warning temp_warning; } __packed; struct mlx5_eqe { Modified: stable/12/sys/dev/mlx5/mlx5_core/mlx5_eq.c ============================================================================== --- stable/12/sys/dev/mlx5/mlx5_core/mlx5_eq.c Thu May 16 15:42:47 2019 (r347713) +++ stable/12/sys/dev/mlx5/mlx5_core/mlx5_eq.c Thu May 16 15:43:34 2019 (r347714) @@ -142,6 +142,8 @@ static const char *eqe_type_str(u8 type) return "MLX5_EVENT_TYPE_GPIO_EVENT"; case MLX5_EVENT_TYPE_CODING_PORT_MODULE_EVENT: return "MLX5_EVENT_TYPE_PORT_MODULE_EVENT"; + case MLX5_EVENT_TYPE_TEMP_WARN_EVENT: + return "MLX5_EVENT_TYPE_TEMP_WARN_EVENT"; case MLX5_EVENT_TYPE_REMOTE_CONFIG: return "MLX5_EVENT_TYPE_REMOTE_CONFIG"; case MLX5_EVENT_TYPE_DB_BF_CONGESTION: @@ -212,6 +214,16 @@ static void eq_update_ci(struct mlx5_eq *eq, int arm) mb(); } +static void +mlx5_temp_warning_event(struct mlx5_core_dev *dev, struct mlx5_eqe *eqe) +{ + + mlx5_core_warn(dev, + "High temperature on sensors with bit set %#jx %#jx", + (uintmax_t)be64_to_cpu(eqe->data.temp_warning.sensor_warning_msb), + (uintmax_t)be64_to_cpu(eqe->data.temp_warning.sensor_warning_lsb)); +} + static int mlx5_eq_int(struct mlx5_core_dev *dev, struct mlx5_eq *eq) { struct mlx5_eqe *eqe; @@ -347,6 +359,9 @@ static int mlx5_eq_int(struct mlx5_core_dev *dev, stru case MLX5_EVENT_TYPE_FPGA_QP_ERROR: mlx5_fpga_event(dev, eqe->type, &eqe->data.raw); break; + case MLX5_EVENT_TYPE_TEMP_WARN_EVENT: + mlx5_temp_warning_event(dev, eqe); + break; default: mlx5_core_warn(dev, "Unhandled event 0x%x on EQ 0x%x\n", @@ -540,6 +555,9 @@ int mlx5_start_eqs(struct mlx5_core_dev *dev) if (MLX5_CAP_GEN(dev, fpga)) async_event_mask |= (1ull << MLX5_EVENT_TYPE_FPGA_ERROR) | (1ull << MLX5_EVENT_TYPE_FPGA_QP_ERROR); + + if (MLX5_CAP_GEN(dev, temp_warn_event)) + async_event_mask |= (1ull << MLX5_EVENT_TYPE_TEMP_WARN_EVENT); err = mlx5_create_map_eq(dev, &table->cmd_eq, MLX5_EQ_VEC_CMD, MLX5_NUM_CMD_EQE, 1ull << MLX5_EVENT_TYPE_CMD, Modified: stable/12/sys/dev/mlx5/mlx5_ifc.h ============================================================================== --- stable/12/sys/dev/mlx5/mlx5_ifc.h Thu May 16 15:42:47 2019 (r347713) +++ stable/12/sys/dev/mlx5/mlx5_ifc.h Thu May 16 15:43:34 2019 (r347714) @@ -50,7 +50,7 @@ enum { MLX5_EVENT_TYPE_PORT_CHANGE = 0x9, MLX5_EVENT_TYPE_GPIO_EVENT = 0x15, MLX5_EVENT_TYPE_CODING_PORT_MODULE_EVENT = 0x16, - MLX5_EVENT_TYPE_CODING_TEMP_WARNING_EVENT = 0x17, + MLX5_EVENT_TYPE_TEMP_WARN_EVENT = 0x17, MLX5_EVENT_TYPE_REMOTE_CONFIG = 0x19, MLX5_EVENT_TYPE_CODING_DCBX_CHANGE_EVENT = 0x1e, MLX5_EVENT_TYPE_CODING_PPS_EVENT = 0x25, From owner-svn-src-stable@freebsd.org Thu May 16 15:44:29 2019 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 1EDE3159AA63; Thu, 16 May 2019 15:44:29 +0000 (UTC) (envelope-from hselasky@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 B7AC3847BB; Thu, 16 May 2019 15:44:28 +0000 (UTC) (envelope-from hselasky@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 43A7122E91; Thu, 16 May 2019 15:44:28 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x4GFiSfr046110; Thu, 16 May 2019 15:44:28 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x4GFiSPo046109; Thu, 16 May 2019 15:44:28 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201905161544.x4GFiSPo046109@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Thu, 16 May 2019 15:44:28 +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: r347715 - stable/12/sys/dev/mlx5/mlx5_ib X-SVN-Group: stable-12 X-SVN-Commit-Author: hselasky X-SVN-Commit-Paths: stable/12/sys/dev/mlx5/mlx5_ib X-SVN-Commit-Revision: 347715 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: B7AC3847BB X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.96 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.998,0]; NEURAL_HAM_SHORT(-0.96)[-0.960,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US]; NEURAL_HAM_LONG(-1.00)[-1.000,0] X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 16 May 2019 15:44:29 -0000 Author: hselasky Date: Thu May 16 15:44:27 2019 New Revision: 347715 URL: https://svnweb.freebsd.org/changeset/base/347715 Log: MFC r347251: Import Linux code to implement mlx5_ib_disassociate_ucontext() in mlx5ib. Submitted by: kib@ Sponsored by: Mellanox Technologies Modified: stable/12/sys/dev/mlx5/mlx5_ib/mlx5_ib_main.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/dev/mlx5/mlx5_ib/mlx5_ib_main.c ============================================================================== --- stable/12/sys/dev/mlx5/mlx5_ib/mlx5_ib_main.c Thu May 16 15:43:34 2019 (r347714) +++ stable/12/sys/dev/mlx5/mlx5_ib/mlx5_ib_main.c Thu May 16 15:44:27 2019 (r347715) @@ -1335,6 +1335,70 @@ static int mlx5_ib_set_vma_data(struct vm_area_struct return 0; } +static void mlx5_ib_disassociate_ucontext(struct ib_ucontext *ibcontext) +{ + int ret; + struct vm_area_struct *vma; + struct mlx5_ib_vma_private_data *vma_private, *n; + struct mlx5_ib_ucontext *context = to_mucontext(ibcontext); + struct task_struct *owning_process = NULL; + struct mm_struct *owning_mm = NULL; + + owning_process = get_pid_task(ibcontext->tgid, PIDTYPE_PID); + if (!owning_process) + return; + + owning_mm = get_task_mm(owning_process); + if (!owning_mm) { + pr_info("no mm, disassociate ucontext is pending task termination\n"); + while (1) { + put_task_struct(owning_process); + usleep_range(1000, 2000); + owning_process = get_pid_task(ibcontext->tgid, + PIDTYPE_PID); + if (!owning_process || owning_process->task_thread-> + td_proc->p_state == PRS_ZOMBIE) { + pr_info("disassociate ucontext done, task was terminated\n"); + /* in case task was dead need to release the + * task struct. + */ + if (owning_process) + put_task_struct(owning_process); + return; + } + } + } + + /* need to protect from a race on closing the vma as part of + * mlx5_ib_vma_close. + */ + down_write(&owning_mm->mmap_sem); + list_for_each_entry_safe(vma_private, n, &context->vma_private_list, + list) { + vma = vma_private->vma; + ret = zap_vma_ptes(vma, vma->vm_start, + PAGE_SIZE); + if (ret == -ENOTSUP) { + if (bootverbose) + WARN_ONCE( + "%s: zap_vma_ptes not implemented for unmanaged mappings", __func__); + } else { + WARN(ret, "%s: zap_vma_ptes failed, error %d", + __func__, -ret); + } + /* context going to be destroyed, should + * not access ops any more. + */ + /* XXXKIB vma->vm_flags &= ~(VM_SHARED | VM_MAYSHARE); */ + vma->vm_ops = NULL; + list_del(&vma_private->list); + kfree(vma_private); + } + up_write(&owning_mm->mmap_sem); + mmput(owning_mm); + put_task_struct(owning_process); +} + static inline char *mmap_cmd2str(enum mlx5_ib_mmap_cmd cmd) { switch (cmd) { @@ -3083,6 +3147,8 @@ static void *mlx5_ib_add(struct mlx5_core_dev *mdev) dev->ib_dev.get_vf_stats = mlx5_ib_get_vf_stats; dev->ib_dev.set_vf_guid = mlx5_ib_set_vf_guid; } + + dev->ib_dev.disassociate_ucontext = mlx5_ib_disassociate_ucontext; mlx5_ib_internal_fill_odp_caps(dev); From owner-svn-src-stable@freebsd.org Thu May 16 15:45:12 2019 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 134D5159AB0A; Thu, 16 May 2019 15:45:12 +0000 (UTC) (envelope-from hselasky@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 AA6BF84905; Thu, 16 May 2019 15:45:11 +0000 (UTC) (envelope-from hselasky@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 85A0B22E93; Thu, 16 May 2019 15:45:11 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x4GFjB25046229; Thu, 16 May 2019 15:45:11 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x4GFjADE046226; Thu, 16 May 2019 15:45:10 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201905161545.x4GFjADE046226@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Thu, 16 May 2019 15:45:10 +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: r347716 - in stable/12/sys/dev/mlx5: . mlx5_core X-SVN-Group: stable-12 X-SVN-Commit-Author: hselasky X-SVN-Commit-Paths: in stable/12/sys/dev/mlx5: . mlx5_core X-SVN-Commit-Revision: 347716 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: AA6BF84905 X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.96 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.998,0]; NEURAL_HAM_SHORT(-0.96)[-0.960,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US]; NEURAL_HAM_LONG(-1.00)[-1.000,0] X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 16 May 2019 15:45:12 -0000 Author: hselasky Date: Thu May 16 15:45:10 2019 New Revision: 347716 URL: https://svnweb.freebsd.org/changeset/base/347716 Log: MFC r347252: Disable all MSIX interrupts before shutdown in mlx5. Make sure the interrupt handlers don't race with the fast unload one code in the shutdown handler. Sponsored by: Mellanox Technologies Modified: stable/12/sys/dev/mlx5/driver.h stable/12/sys/dev/mlx5/mlx5_core/mlx5_cmd.c stable/12/sys/dev/mlx5/mlx5_core/mlx5_eq.c stable/12/sys/dev/mlx5/mlx5_core/mlx5_main.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/dev/mlx5/driver.h ============================================================================== --- stable/12/sys/dev/mlx5/driver.h Thu May 16 15:44:27 2019 (r347715) +++ stable/12/sys/dev/mlx5/driver.h Thu May 16 15:45:10 2019 (r347716) @@ -606,6 +606,7 @@ struct mlx5_priv { struct mlx5_irq_info *irq_info; struct mlx5_uuar_info uuari; MLX5_DECLARE_DOORBELL_LOCK(cq_uar_lock); + int disable_irqs; struct io_mapping *bf_mapping; Modified: stable/12/sys/dev/mlx5/mlx5_core/mlx5_cmd.c ============================================================================== --- stable/12/sys/dev/mlx5/mlx5_core/mlx5_cmd.c Thu May 16 15:44:27 2019 (r347715) +++ stable/12/sys/dev/mlx5/mlx5_core/mlx5_cmd.c Thu May 16 15:45:10 2019 (r347716) @@ -1143,6 +1143,9 @@ static void mlx5_cmd_change_mod(struct mlx5_core_dev * struct mlx5_cmd *cmd = &dev->cmd; int i; + if (cmd->mode == mode) + return; + for (i = 0; i < cmd->max_reg_cmds; i++) down(&cmd->sem); Modified: stable/12/sys/dev/mlx5/mlx5_core/mlx5_eq.c ============================================================================== --- stable/12/sys/dev/mlx5/mlx5_core/mlx5_eq.c Thu May 16 15:44:27 2019 (r347715) +++ stable/12/sys/dev/mlx5/mlx5_core/mlx5_eq.c Thu May 16 15:45:10 2019 (r347716) @@ -395,7 +395,9 @@ static irqreturn_t mlx5_msix_handler(int irq, void *eq struct mlx5_eq *eq = eq_ptr; struct mlx5_core_dev *dev = eq->dev; - mlx5_eq_int(dev, eq); + /* check if IRQs are not disabled */ + if (likely(dev->priv.disable_irqs == 0)) + mlx5_eq_int(dev, eq); /* MSI-X vectors always belong to us */ return IRQ_HANDLED; Modified: stable/12/sys/dev/mlx5/mlx5_core/mlx5_main.c ============================================================================== --- stable/12/sys/dev/mlx5/mlx5_core/mlx5_main.c Thu May 16 15:44:27 2019 (r347715) +++ stable/12/sys/dev/mlx5/mlx5_core/mlx5_main.c Thu May 16 15:45:10 2019 (r347716) @@ -35,6 +35,7 @@ #include #include #include +#include #include #include #include @@ -1443,11 +1444,29 @@ static int mlx5_try_fast_unload(struct mlx5_core_dev * return 0; } +static void mlx5_disable_interrupts(struct mlx5_core_dev *mdev) +{ + int nvec = mdev->priv.eq_table.num_comp_vectors + MLX5_EQ_VEC_COMP_BASE; + int x; + + mdev->priv.disable_irqs = 1; + + /* wait for all IRQ handlers to finish processing */ + for (x = 0; x != nvec; x++) + synchronize_irq(mdev->priv.msix_arr[x].vector); +} + static void shutdown_one(struct pci_dev *pdev) { struct mlx5_core_dev *dev = pci_get_drvdata(pdev); struct mlx5_priv *priv = &dev->priv; int err; + + /* enter polling mode */ + mlx5_cmd_use_polling(dev); + + /* disable all interrupts */ + mlx5_disable_interrupts(dev); err = mlx5_try_fast_unload(dev); if (err) From owner-svn-src-stable@freebsd.org Thu May 16 15:46:06 2019 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 07EAB159AC2B; Thu, 16 May 2019 15:46:06 +0000 (UTC) (envelope-from hselasky@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 9F64B84A70; Thu, 16 May 2019 15:46:05 +0000 (UTC) (envelope-from hselasky@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 7779622E94; Thu, 16 May 2019 15:46:05 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x4GFk5FB046338; Thu, 16 May 2019 15:46:05 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x4GFk5UM046334; Thu, 16 May 2019 15:46:05 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201905161546.x4GFk5UM046334@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Thu, 16 May 2019 15:46:05 +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: r347717 - in stable/12/sys/dev/mlx5: . mlx5_core X-SVN-Group: stable-12 X-SVN-Commit-Author: hselasky X-SVN-Commit-Paths: in stable/12/sys/dev/mlx5: . mlx5_core X-SVN-Commit-Revision: 347717 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 9F64B84A70 X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.96 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.998,0]; NEURAL_HAM_SHORT(-0.96)[-0.960,0]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US] X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 16 May 2019 15:46:06 -0000 Author: hselasky Date: Thu May 16 15:46:04 2019 New Revision: 347717 URL: https://svnweb.freebsd.org/changeset/base/347717 Log: MFC r347253: Protect from infinite sw-reset loop in mlx5core. Avoid an infinite software firmware reset loop that may be caused by a hardware bug by limiting the maximum number of resets. The counter between resets is reset by request for reset, and not by a successful reset. The interval between two resets can be configured via sysctl: hw.mlx5.sw_reset_timeout which is global to all mlx5 devices in the system. Submitted by: slavash@ Sponsored by: Mellanox Technologies Modified: stable/12/sys/dev/mlx5/driver.h stable/12/sys/dev/mlx5/mlx5_core/mlx5_health.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/dev/mlx5/driver.h ============================================================================== --- stable/12/sys/dev/mlx5/driver.h Thu May 16 15:45:10 2019 (r347716) +++ stable/12/sys/dev/mlx5/driver.h Thu May 16 15:46:04 2019 (r347717) @@ -536,6 +536,7 @@ struct mlx5_core_health { unsigned long flags; struct work_struct work; struct delayed_work recover_work; + unsigned int last_reset_req; }; #ifdef RATELIMIT Modified: stable/12/sys/dev/mlx5/mlx5_core/mlx5_health.c ============================================================================== --- stable/12/sys/dev/mlx5/mlx5_core/mlx5_health.c Thu May 16 15:45:10 2019 (r347716) +++ stable/12/sys/dev/mlx5/mlx5_core/mlx5_health.c Thu May 16 15:46:04 2019 (r347717) @@ -64,6 +64,12 @@ SYSCTL_INT(_hw_mlx5, OID_AUTO, fw_reset_enable, CTLFLA &mlx5_fw_reset_enable, 0, "Enable firmware reset"); +static unsigned int sw_reset_to = 1200; +SYSCTL_UINT(_hw_mlx5, OID_AUTO, sw_reset_timeout, CTLFLAG_RWTUN, + &sw_reset_to, 0, + "Minimum timeout in seconds between two firmware resets"); + + static int lock_sem_sw_reset(struct mlx5_core_dev *dev) { int ret; @@ -218,6 +224,32 @@ static void reset_fw_if_needed(struct mlx5_core_dev *d &dev->iseg->cmdq_addr_l_sz); } +static bool +mlx5_health_allow_reset(struct mlx5_core_dev *dev) +{ + struct mlx5_core_health *health = &dev->priv.health; + unsigned int delta; + bool ret; + + if (health->last_reset_req != 0) { + delta = ticks - health->last_reset_req; + delta /= hz; + ret = delta >= sw_reset_to; + } else { + ret = true; + } + + /* + * In principle, ticks may be 0. Setting it to off by one (-1) + * to prevent certain reset in next request. + */ + health->last_reset_req = ticks ? : -1; + if (!ret) + mlx5_core_warn(dev, "Firmware reset elided due to " + "auto-reset frequency threshold.\n"); + return (ret); +} + #define MLX5_CRDUMP_WAIT_MS 60000 #define MLX5_FW_RESET_WAIT_MS 1000 #define MLX5_NIC_STATE_POLL_MS 5 @@ -243,7 +275,8 @@ void mlx5_enter_error_state(struct mlx5_core_dev *dev, if (force) goto err_state_done; - if (fatal_error == MLX5_SENSOR_FW_SYND_RFR) { + if (fatal_error == MLX5_SENSOR_FW_SYND_RFR && + mlx5_health_allow_reset(dev)) { /* Get cr-dump and reset FW semaphore */ if (mlx5_core_is_pf(dev)) lock = lock_sem_sw_reset(dev); From owner-svn-src-stable@freebsd.org Thu May 16 15:46:52 2019 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 3AF73159ACCC; Thu, 16 May 2019 15:46:52 +0000 (UTC) (envelope-from hselasky@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 D2B4E84BAF; Thu, 16 May 2019 15:46:51 +0000 (UTC) (envelope-from hselasky@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 909CB22E95; Thu, 16 May 2019 15:46:51 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x4GFkpIQ046425; Thu, 16 May 2019 15:46:51 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x4GFkoCj046422; Thu, 16 May 2019 15:46:50 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201905161546.x4GFkoCj046422@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Thu, 16 May 2019 15:46:50 +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: r347718 - in stable/12/sys/dev/mlx5: . mlx5_en X-SVN-Group: stable-12 X-SVN-Commit-Author: hselasky X-SVN-Commit-Paths: in stable/12/sys/dev/mlx5: . mlx5_en X-SVN-Commit-Revision: 347718 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: D2B4E84BAF X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.96 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.998,0]; NEURAL_HAM_SHORT(-0.96)[-0.960,0]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US] X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 16 May 2019 15:46:52 -0000 Author: hselasky Date: Thu May 16 15:46:50 2019 New Revision: 347718 URL: https://svnweb.freebsd.org/changeset/base/347718 Log: MFC r347254: Update Ethernet extended counters in mlx5en(4). Expose all Ethernet extended counters those counters via debug_stats sysctl: dev.mce.X.debug_stats Submitted by: slavash@ Sponsored by: Mellanox Technologies Modified: stable/12/sys/dev/mlx5/mlx5_en/en.h stable/12/sys/dev/mlx5/mlx5_en/mlx5_en_main.c stable/12/sys/dev/mlx5/mlx5_ifc.h Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/dev/mlx5/mlx5_en/en.h ============================================================================== --- stable/12/sys/dev/mlx5/mlx5_en/en.h Thu May 16 15:46:04 2019 (r347717) +++ stable/12/sys/dev/mlx5/mlx5_en/en.h Thu May 16 15:46:50 2019 (r347718) @@ -255,6 +255,28 @@ struct mlx5e_vport_stats { m(+1, u64 out_multicast_pkts, "out_multicast_pkts", "Out multicast packets") \ m(+1, u64 out_broadcast_pkts, "out_broadcast_pkts", "Out broadcast packets") +#define MLX5E_PPORT_ETHERNET_EXTENDED_STATS_DEBUG(m) \ + m(+1, u64 port_transmit_wait_high, "port_transmit_wait_high", "Port transmit wait high") \ + m(+1, u64 ecn_marked, "ecn_marked", "ECN marked") \ + m(+1, u64 no_buffer_discard_mc, "no_buffer_discard_mc", "No buffer discard mc") \ + m(+1, u64 rx_ebp, "rx_ebp", "RX EBP") \ + m(+1, u64 tx_ebp, "tx_ebp", "TX EBP") \ + m(+1, u64 rx_buffer_almost_full, "rx_buffer_almost_full", "RX buffer almost full") \ + m(+1, u64 rx_buffer_full, "rx_buffer_full", "RX buffer full") \ + m(+1, u64 rx_icrc_encapsulated, "rx_icrc_encapsulated", "RX ICRC encapsulated") \ + m(+1, u64 ex_reserved_0, "ex_reserved_0", "Reserved") \ + m(+1, u64 ex_reserved_1, "ex_reserved_1", "Reserved") \ + m(+1, u64 tx_stat_p64octets, "tx_stat_p64octets", "Bytes") \ + m(+1, u64 tx_stat_p65to127octets, "tx_stat_p65to127octets", "Bytes") \ + m(+1, u64 tx_stat_p128to255octets, "tx_stat_p128to255octets", "Bytes") \ + m(+1, u64 tx_stat_p256to511octets, "tx_stat_p256to511octets", "Bytes") \ + m(+1, u64 tx_stat_p512to1023octets, "tx_stat_p512to1023octets", "Bytes") \ + m(+1, u64 tx_stat_p1024to1518octets, "tx_stat_p1024to1518octets", "Bytes") \ + m(+1, u64 tx_stat_p1519to2047octets, "tx_stat_p1519to2047octets", "Bytes") \ + m(+1, u64 tx_stat_p2048to4095octets, "tx_stat_p2048to4095octets", "Bytes") \ + m(+1, u64 tx_stat_p4096to8191octets, "tx_stat_p4096to8191octets", "Bytes") \ + m(+1, u64 tx_stat_p8192to10239octets, "tx_stat_p8192to10239octets", "Bytes") + #define MLX5E_PPORT_PHYSICAL_LAYER_STATS_DEBUG(m) \ m(+1, u64 time_since_last_clear, "time_since_last_clear", \ "Time since the last counters clear event (msec)") \ @@ -349,7 +371,8 @@ struct mlx5e_vport_stats { #define MLX5E_PORT_STATS_DEBUG(m) \ MLX5E_PPORT_RFC2819_STATS_DEBUG(m) \ MLX5E_PPORT_RFC2863_STATS_DEBUG(m) \ - MLX5E_PPORT_PHYSICAL_LAYER_STATS_DEBUG(m) + MLX5E_PPORT_PHYSICAL_LAYER_STATS_DEBUG(m) \ + MLX5E_PPORT_ETHERNET_EXTENDED_STATS_DEBUG(m) #define MLX5E_PPORT_IEEE802_3_STATS_NUM \ (0 MLX5E_PPORT_IEEE802_3_STATS(MLX5E_STATS_COUNT)) @@ -366,6 +389,8 @@ struct mlx5e_vport_stats { (0 MLX5E_PPORT_RFC2863_STATS_DEBUG(MLX5E_STATS_COUNT)) #define MLX5E_PPORT_PHYSICAL_LAYER_STATS_DEBUG_NUM \ (0 MLX5E_PPORT_PHYSICAL_LAYER_STATS_DEBUG(MLX5E_STATS_COUNT)) +#define MLX5E_PPORT_ETHERNET_EXTENDED_STATS_DEBUG_NUM \ + (0 MLX5E_PPORT_ETHERNET_EXTENDED_STATS_DEBUG(MLX5E_STATS_COUNT)) #define MLX5E_PORT_STATS_DEBUG_NUM \ (0 MLX5E_PORT_STATS_DEBUG(MLX5E_STATS_COUNT)) Modified: stable/12/sys/dev/mlx5/mlx5_en/mlx5_en_main.c ============================================================================== --- stable/12/sys/dev/mlx5/mlx5_en/mlx5_en_main.c Thu May 16 15:46:04 2019 (r347717) +++ stable/12/sys/dev/mlx5/mlx5_en/mlx5_en_main.c Thu May 16 15:46:50 2019 (r347718) @@ -440,6 +440,12 @@ mlx5e_update_pport_counters(struct mlx5e_priv *priv) for (x = 0; x != MLX5E_PPORT_PHYSICAL_LAYER_STATS_DEBUG_NUM; x++, y++) s_debug->arg[y] = be64toh(ptr[x]); + /* read Extended Ethernet counter group using predefined counter layout */ + MLX5_SET(ppcnt_reg, in, grp, MLX5_ETHERNET_EXTENDED_COUNTERS_GROUP); + mlx5_core_access_reg(mdev, in, sz, out, sz, MLX5_REG_PPCNT, 0, 0); + for (x = 0; x != MLX5E_PPORT_ETHERNET_EXTENDED_STATS_DEBUG_NUM; x++, y++) + s_debug->arg[y] = be64toh(ptr[x]); + /* read per-priority counters */ MLX5_SET(ppcnt_reg, in, grp, MLX5_PER_PRIORITY_COUNTERS_GROUP); @@ -453,6 +459,7 @@ mlx5e_update_pport_counters(struct mlx5e_priv *priv) MLX5E_PPORT_PER_PRIO_STATS_NUM_PRIO); x++, y++) s->arg[y] = be64toh(ptr[x]); } + free_out: /* free firmware request structures */ kvfree(in); Modified: stable/12/sys/dev/mlx5/mlx5_ifc.h ============================================================================== --- stable/12/sys/dev/mlx5/mlx5_ifc.h Thu May 16 15:46:04 2019 (r347717) +++ stable/12/sys/dev/mlx5/mlx5_ifc.h Thu May 16 15:46:50 2019 (r347718) @@ -8752,7 +8752,69 @@ struct mlx5_ifc_eth_extended_cntrs_grp_data_layout_bit u8 no_buffer_discard_mc_low[0x20]; - u8 reserved_0[0x700]; + u8 rx_ebp_high[0x20]; + + u8 rx_ebp_low[0x20]; + + u8 tx_ebp_high[0x20]; + + u8 tx_ebp_low[0x20]; + + u8 rx_buffer_almost_full_high[0x20]; + + u8 rx_buffer_almost_full_low[0x20]; + + u8 rx_buffer_full_high[0x20]; + + u8 rx_buffer_full_low[0x20]; + + u8 rx_icrc_encapsulated_high[0x20]; + + u8 rx_icrc_encapsulated_low[0x20]; + + u8 reserved_0[0x80]; + + u8 tx_stats_pkts64octets_high[0x20]; + + u8 tx_stats_pkts64octets_low[0x20]; + + u8 tx_stats_pkts65to127octets_high[0x20]; + + u8 tx_stats_pkts65to127octets_low[0x20]; + + u8 tx_stats_pkts128to255octets_high[0x20]; + + u8 tx_stats_pkts128to255octets_low[0x20]; + + u8 tx_stats_pkts256to511octets_high[0x20]; + + u8 tx_stats_pkts256to511octets_low[0x20]; + + u8 tx_stats_pkts512to1023octets_high[0x20]; + + u8 tx_stats_pkts512to1023octets_low[0x20]; + + u8 tx_stats_pkts1024to1518octets_high[0x20]; + + u8 tx_stats_pkts1024to1518octets_low[0x20]; + + u8 tx_stats_pkts1519to2047octets_high[0x20]; + + u8 tx_stats_pkts1519to2047octets_low[0x20]; + + u8 tx_stats_pkts2048to4095octets_high[0x20]; + + u8 tx_stats_pkts2048to4095octets_low[0x20]; + + u8 tx_stats_pkts4096to8191octets_high[0x20]; + + u8 tx_stats_pkts4096to8191octets_low[0x20]; + + u8 tx_stats_pkts8192to10239octets_high[0x20]; + + u8 tx_stats_pkts8192to10239octets_low[0x20]; + + u8 reserved_1[0x2C0]; }; struct mlx5_ifc_eth_802_3_cntrs_grp_data_layout_bits { From owner-svn-src-stable@freebsd.org Thu May 16 15:47:34 2019 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id B2A8C159ADD0; Thu, 16 May 2019 15:47:34 +0000 (UTC) (envelope-from hselasky@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 54FE084CDC; Thu, 16 May 2019 15:47:34 +0000 (UTC) (envelope-from hselasky@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 EF19122E96; Thu, 16 May 2019 15:47:33 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x4GFlXqu046516; Thu, 16 May 2019 15:47:33 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x4GFlXrA046515; Thu, 16 May 2019 15:47:33 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201905161547.x4GFlXrA046515@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Thu, 16 May 2019 15:47:33 +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: r347719 - stable/12/sys/dev/mlx5/mlx5_en X-SVN-Group: stable-12 X-SVN-Commit-Author: hselasky X-SVN-Commit-Paths: stable/12/sys/dev/mlx5/mlx5_en X-SVN-Commit-Revision: 347719 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 54FE084CDC X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.96 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.998,0]; NEURAL_HAM_SHORT(-0.96)[-0.959,0]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US] X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 16 May 2019 15:47:34 -0000 Author: hselasky Date: Thu May 16 15:47:33 2019 New Revision: 347719 URL: https://svnweb.freebsd.org/changeset/base/347719 Log: MFC r347255: Fix tx_jumbo_packets counter in mlx5en(4). Instead of reading Ethernet RFC 2819 pXtoYoctets counters from hardware which counts RX octets, count tx_stat_pXtoYoctets from Ethernet extended counters which counts TX octets. TX jumbo counters should be accumulated only after the PPCNT counters were fetched from hardware with their latest value. Submitted by: slavash@ Sponsored by: Mellanox Technologies Modified: stable/12/sys/dev/mlx5/mlx5_en/mlx5_en_main.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/dev/mlx5/mlx5_en/mlx5_en_main.c ============================================================================== --- stable/12/sys/dev/mlx5/mlx5_en/mlx5_en_main.c Thu May 16 15:46:50 2019 (r347718) +++ stable/12/sys/dev/mlx5/mlx5_en/mlx5_en_main.c Thu May 16 15:47:33 2019 (r347719) @@ -540,12 +540,6 @@ mlx5e_update_stats_work(struct work_struct *work) } } - s->tx_jumbo_packets = - priv->stats.port_stats_debug.p1519to2047octets + - priv->stats.port_stats_debug.p2048to4095octets + - priv->stats.port_stats_debug.p4096to8191octets + - priv->stats.port_stats_debug.p8192to10239octets; - /* update counters */ s->tso_packets = tso_packets; s->tso_bytes = tso_bytes; @@ -644,6 +638,12 @@ mlx5e_update_stats_work(struct work_struct *work) /* Get physical port counters */ mlx5e_update_pport_counters(priv); + + s->tx_jumbo_packets = + priv->stats.port_stats_debug.tx_stat_p1519to2047octets + + priv->stats.port_stats_debug.tx_stat_p2048to4095octets + + priv->stats.port_stats_debug.tx_stat_p4096to8191octets + + priv->stats.port_stats_debug.tx_stat_p8192to10239octets; #if (__FreeBSD_version < 1100000) /* no get_counters interface in fbsd 10 */ From owner-svn-src-stable@freebsd.org Thu May 16 15:48:20 2019 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 92D7E159AE6F; Thu, 16 May 2019 15:48:20 +0000 (UTC) (envelope-from hselasky@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 39CDE84E1B; Thu, 16 May 2019 15:48:20 +0000 (UTC) (envelope-from hselasky@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 14C3A22E97; Thu, 16 May 2019 15:48:20 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x4GFmJ1g046605; Thu, 16 May 2019 15:48:19 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x4GFmJQx046604; Thu, 16 May 2019 15:48:19 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201905161548.x4GFmJQx046604@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Thu, 16 May 2019 15:48:19 +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: r347720 - stable/12/sys/dev/mlx5/mlx5_en X-SVN-Group: stable-12 X-SVN-Commit-Author: hselasky X-SVN-Commit-Paths: stable/12/sys/dev/mlx5/mlx5_en X-SVN-Commit-Revision: 347720 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 39CDE84E1B X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.97 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.998,0]; NEURAL_HAM_SHORT(-0.97)[-0.969,0]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US] X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 16 May 2019 15:48:20 -0000 Author: hselasky Date: Thu May 16 15:48:19 2019 New Revision: 347720 URL: https://svnweb.freebsd.org/changeset/base/347720 Log: MFC r347256: Destroy port stats debug context in correct order in mlx5en(4). Destroy children nodes before parent nodes. Sponsored by: Mellanox Technologies Modified: stable/12/sys/dev/mlx5/mlx5_en/mlx5_en_ethtool.c stable/12/sys/dev/mlx5/mlx5_en/mlx5_en_main.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/dev/mlx5/mlx5_en/mlx5_en_ethtool.c ============================================================================== --- stable/12/sys/dev/mlx5/mlx5_en/mlx5_en_ethtool.c Thu May 16 15:47:33 2019 (r347719) +++ stable/12/sys/dev/mlx5/mlx5_en/mlx5_en_ethtool.c Thu May 16 15:48:19 2019 (r347720) @@ -1063,6 +1063,10 @@ mlx5e_ethtool_debug_stats(SYSCTL_HANDLER_ARGS) int error; PRIV_LOCK(priv); + if (priv->gone != 0) { + error = ENODEV; + goto done; + } sys_debug = priv->sysctl_debug; error = sysctl_handle_int(oidp, &sys_debug, 0, req); if (error != 0 || !req->newptr) Modified: stable/12/sys/dev/mlx5/mlx5_en/mlx5_en_main.c ============================================================================== --- stable/12/sys/dev/mlx5/mlx5_en/mlx5_en_main.c Thu May 16 15:47:33 2019 (r347719) +++ stable/12/sys/dev/mlx5/mlx5_en/mlx5_en_main.c Thu May 16 15:48:19 2019 (r347720) @@ -4076,9 +4076,9 @@ mlx5e_destroy_ifp(struct mlx5_core_dev *mdev, void *vp /* destroy all remaining sysctl nodes */ sysctl_ctx_free(&priv->stats.vport.ctx); sysctl_ctx_free(&priv->stats.pport.ctx); - sysctl_ctx_free(&priv->sysctl_ctx); if (priv->sysctl_debug) sysctl_ctx_free(&priv->stats.port_stats_debug.ctx); + sysctl_ctx_free(&priv->sysctl_ctx); mlx5_core_destroy_mkey(priv->mdev, &priv->mr); mlx5_dealloc_transport_domain(priv->mdev, priv->tdn); From owner-svn-src-stable@freebsd.org Thu May 16 15:48:57 2019 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 6C0CD159AEF1; Thu, 16 May 2019 15:48:57 +0000 (UTC) (envelope-from hselasky@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 0C4D884F62; Thu, 16 May 2019 15:48:57 +0000 (UTC) (envelope-from hselasky@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 D8DF522E98; Thu, 16 May 2019 15:48:56 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x4GFmuY7046690; Thu, 16 May 2019 15:48:56 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x4GFmuBA046689; Thu, 16 May 2019 15:48:56 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201905161548.x4GFmuBA046689@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Thu, 16 May 2019 15:48:56 +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: r347721 - stable/12/sys/ofed/drivers/infiniband/core X-SVN-Group: stable-12 X-SVN-Commit-Author: hselasky X-SVN-Commit-Paths: stable/12/sys/ofed/drivers/infiniband/core X-SVN-Commit-Revision: 347721 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 0C4D884F62 X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.97 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.998,0]; NEURAL_HAM_SHORT(-0.97)[-0.969,0]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US] X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 16 May 2019 15:48:57 -0000 Author: hselasky Date: Thu May 16 15:48:56 2019 New Revision: 347721 URL: https://svnweb.freebsd.org/changeset/base/347721 Log: MFC r347257: Make sure to error out when arming the CQ fails in ibcore. Sponsored by: Mellanox Technologies Modified: stable/12/sys/ofed/drivers/infiniband/core/ib_uverbs_cmd.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/ofed/drivers/infiniband/core/ib_uverbs_cmd.c ============================================================================== --- stable/12/sys/ofed/drivers/infiniband/core/ib_uverbs_cmd.c Thu May 16 15:48:19 2019 (r347720) +++ stable/12/sys/ofed/drivers/infiniband/core/ib_uverbs_cmd.c Thu May 16 15:48:56 2019 (r347721) @@ -1692,6 +1692,7 @@ ssize_t ib_uverbs_req_notify_cq(struct ib_uverbs_file { struct ib_uverbs_req_notify_cq cmd; struct ib_cq *cq; + int retval; if (copy_from_user(&cmd, buf, sizeof cmd)) return -EFAULT; @@ -1700,12 +1701,15 @@ ssize_t ib_uverbs_req_notify_cq(struct ib_uverbs_file if (!cq) return -EINVAL; - ib_req_notify_cq(cq, cmd.solicited_only ? - IB_CQ_SOLICITED : IB_CQ_NEXT_COMP); + if (ib_req_notify_cq(cq, cmd.solicited_only ? + IB_CQ_SOLICITED : IB_CQ_NEXT_COMP) < 0) + retval = -ENXIO; + else + retval = in_len; put_cq_read(cq); - return in_len; + return retval; } ssize_t ib_uverbs_destroy_cq(struct ib_uverbs_file *file, From owner-svn-src-stable@freebsd.org Thu May 16 15:49:37 2019 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 535E5159AF91; Thu, 16 May 2019 15:49:37 +0000 (UTC) (envelope-from hselasky@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 E882C850A1; Thu, 16 May 2019 15:49:36 +0000 (UTC) (envelope-from hselasky@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 AA13F22E99; Thu, 16 May 2019 15:49:36 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x4GFna6M046776; Thu, 16 May 2019 15:49:36 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x4GFnaJ0046774; Thu, 16 May 2019 15:49:36 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201905161549.x4GFnaJ0046774@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Thu, 16 May 2019 15:49:36 +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: r347722 - in stable/12/sys/dev: mlx4/mlx4_ib mlx5/mlx5_ib X-SVN-Group: stable-12 X-SVN-Commit-Author: hselasky X-SVN-Commit-Paths: in stable/12/sys/dev: mlx4/mlx4_ib mlx5/mlx5_ib X-SVN-Commit-Revision: 347722 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: E882C850A1 X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.97 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.998,0]; NEURAL_HAM_SHORT(-0.97)[-0.970,0]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US] X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 16 May 2019 15:49:37 -0000 Author: hselasky Date: Thu May 16 15:49:35 2019 New Revision: 347722 URL: https://svnweb.freebsd.org/changeset/base/347722 Log: MFC r347258: Make sure to error out when arming the CQ fails in mlx4ib and mlx5ib. Sponsored by: Mellanox Technologies Modified: stable/12/sys/dev/mlx4/mlx4_ib/mlx4_ib_cq.c stable/12/sys/dev/mlx5/mlx5_ib/mlx5_ib_cq.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/dev/mlx4/mlx4_ib/mlx4_ib_cq.c ============================================================================== --- stable/12/sys/dev/mlx4/mlx4_ib/mlx4_ib_cq.c Thu May 16 15:48:56 2019 (r347721) +++ stable/12/sys/dev/mlx4/mlx4_ib/mlx4_ib_cq.c Thu May 16 15:49:35 2019 (r347722) @@ -878,7 +878,8 @@ int mlx4_ib_poll_cq(struct ib_cq *ibcq, int num_entrie struct mlx4_ib_dev *mdev = to_mdev(cq->ibcq.device); spin_lock_irqsave(&cq->lock, flags); - if (mdev->dev->persist->state & MLX4_DEVICE_STATE_INTERNAL_ERROR) { + if (unlikely(mdev->dev->persist->state & + MLX4_DEVICE_STATE_INTERNAL_ERROR)) { mlx4_ib_poll_sw_comp(cq, num_entries, wc, &npolled); goto out; } @@ -898,11 +899,18 @@ out: int mlx4_ib_arm_cq(struct ib_cq *ibcq, enum ib_cq_notify_flags flags) { - mlx4_cq_arm(&to_mcq(ibcq)->mcq, + struct mlx4_ib_cq *cq = to_mcq(ibcq); + struct mlx4_ib_dev *mdev = to_mdev(cq->ibcq.device); + + if (unlikely(mdev->dev->persist->state & + MLX4_DEVICE_STATE_INTERNAL_ERROR)) + return -1; + + mlx4_cq_arm(&cq->mcq, (flags & IB_CQ_SOLICITED_MASK) == IB_CQ_SOLICITED ? MLX4_CQ_DB_REQ_NOT_SOL : MLX4_CQ_DB_REQ_NOT, - to_mdev(ibcq->device)->uar_map, - MLX4_GET_DOORBELL_LOCK(&to_mdev(ibcq->device)->uar_lock)); + mdev->uar_map, + MLX4_GET_DOORBELL_LOCK(&mdev->uar_lock)); return 0; } Modified: stable/12/sys/dev/mlx5/mlx5_ib/mlx5_ib_cq.c ============================================================================== --- stable/12/sys/dev/mlx5/mlx5_ib/mlx5_ib_cq.c Thu May 16 15:48:56 2019 (r347721) +++ stable/12/sys/dev/mlx5/mlx5_ib/mlx5_ib_cq.c Thu May 16 15:49:35 2019 (r347722) @@ -673,7 +673,7 @@ int mlx5_ib_poll_cq(struct ib_cq *ibcq, int num_entrie int npolled; spin_lock_irqsave(&cq->lock, flags); - if (mdev->state == MLX5_DEVICE_STATE_INTERNAL_ERROR) { + if (unlikely(mdev->state == MLX5_DEVICE_STATE_INTERNAL_ERROR)) { mlx5_ib_poll_sw_comp(cq, num_entries, wc, &npolled); goto out; } @@ -702,6 +702,9 @@ int mlx5_ib_arm_cq(struct ib_cq *ibcq, enum ib_cq_noti unsigned long irq_flags; int ret = 0; + if (unlikely(mdev->state == MLX5_DEVICE_STATE_INTERNAL_ERROR)) + return -1; + spin_lock_irqsave(&cq->lock, irq_flags); if (cq->notify_flags != IB_CQ_NEXT_COMP) cq->notify_flags = flags & IB_CQ_SOLICITED_MASK; @@ -715,7 +718,7 @@ int mlx5_ib_arm_cq(struct ib_cq *ibcq, enum ib_cq_noti MLX5_CQ_DB_REQ_NOT_SOL : MLX5_CQ_DB_REQ_NOT, uar_page, MLX5_GET_DOORBELL_LOCK(&mdev->priv.cq_uar_lock), - to_mcq(ibcq)->mcq.cons_index); + cq->mcq.cons_index); return ret; } From owner-svn-src-stable@freebsd.org Thu May 16 15:50:12 2019 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 651F8159B026; Thu, 16 May 2019 15:50:12 +0000 (UTC) (envelope-from hselasky@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 0D2C5851D8; Thu, 16 May 2019 15:50:12 +0000 (UTC) (envelope-from hselasky@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 B2F9F22E9E; Thu, 16 May 2019 15:50:11 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x4GFoB1w046889; Thu, 16 May 2019 15:50:11 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x4GFoBj3046888; Thu, 16 May 2019 15:50:11 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201905161550.x4GFoBj3046888@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Thu, 16 May 2019 15:50:11 +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: r347723 - stable/12/sys/dev/mlx5/mlx5_ib X-SVN-Group: stable-12 X-SVN-Commit-Author: hselasky X-SVN-Commit-Paths: stable/12/sys/dev/mlx5/mlx5_ib X-SVN-Commit-Revision: 347723 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 0D2C5851D8 X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.97 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.998,0]; NEURAL_HAM_SHORT(-0.97)[-0.969,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US]; NEURAL_HAM_LONG(-1.00)[-1.000,0] X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 16 May 2019 15:50:12 -0000 Author: hselasky Date: Thu May 16 15:50:11 2019 New Revision: 347723 URL: https://svnweb.freebsd.org/changeset/base/347723 Log: MFC r347259: Remove unused module parameter in mlx5ib. Sponsored by: Mellanox Technologies Modified: stable/12/sys/dev/mlx5/mlx5_ib/mlx5_ib_main.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/dev/mlx5/mlx5_ib/mlx5_ib_main.c ============================================================================== --- stable/12/sys/dev/mlx5/mlx5_ib/mlx5_ib_main.c Thu May 16 15:49:35 2019 (r347722) +++ stable/12/sys/dev/mlx5/mlx5_ib/mlx5_ib_main.c Thu May 16 15:50:11 2019 (r347723) @@ -63,10 +63,6 @@ MODULE_DEPEND(mlx5ib, mlx5, 1, 1, 1); MODULE_DEPEND(mlx5ib, ibcore, 1, 1, 1); MODULE_VERSION(mlx5ib, 1); -static int deprecated_prof_sel = 2; -module_param_named(prof_sel, deprecated_prof_sel, int, 0444); -MODULE_PARM_DESC(prof_sel, "profile selector. Deprecated here. Moved to module mlx5_core"); - static const char mlx5_version[] = DRIVER_NAME ": Mellanox Connect-IB Infiniband driver " DRIVER_VERSION " (" DRIVER_RELDATE ")\n"; @@ -3300,9 +3296,6 @@ static struct mlx5_interface mlx5_ib_interface = { static int __init mlx5_ib_init(void) { int err; - - if (deprecated_prof_sel != 2) - pr_warn("prof_sel is deprecated for mlx5_ib, set it for mlx5_core\n"); err = mlx5_ib_odp_init(); if (err) From owner-svn-src-stable@freebsd.org Thu May 16 15:51:30 2019 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 58B37159B2C1; Thu, 16 May 2019 15:51:30 +0000 (UTC) (envelope-from hselasky@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 F358D85531; Thu, 16 May 2019 15:51:29 +0000 (UTC) (envelope-from hselasky@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 C9A5122EE2; Thu, 16 May 2019 15:51:29 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x4GFpTd7049970; Thu, 16 May 2019 15:51:29 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x4GFpTb6049964; Thu, 16 May 2019 15:51:29 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201905161551.x4GFpTb6049964@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Thu, 16 May 2019 15:51:29 +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: r347724 - stable/12/sys/dev/mlx5/mlx5_en X-SVN-Group: stable-12 X-SVN-Commit-Author: hselasky X-SVN-Commit-Paths: stable/12/sys/dev/mlx5/mlx5_en X-SVN-Commit-Revision: 347724 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: F358D85531 X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.97 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.998,0]; NEURAL_HAM_SHORT(-0.97)[-0.971,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US]; NEURAL_HAM_LONG(-1.00)[-1.000,0] X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 16 May 2019 15:51:30 -0000 Author: hselasky Date: Thu May 16 15:51:28 2019 New Revision: 347724 URL: https://svnweb.freebsd.org/changeset/base/347724 Log: MFC r347260 and r347326: Correct number of elements for priority to traffic class mappings in mlx5en(4). The number of priorities is always 8, while the number of traffic classes supported can vary. While at it convert the sysctl node into an array. Sponsored by: Mellanox Technologies Modified: stable/12/sys/dev/mlx5/mlx5_en/en.h stable/12/sys/dev/mlx5/mlx5_en/mlx5_en_ethtool.c stable/12/sys/dev/mlx5/mlx5_en/mlx5_en_main.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/dev/mlx5/mlx5_en/en.h ============================================================================== --- stable/12/sys/dev/mlx5/mlx5_en/en.h Thu May 16 15:50:11 2019 (r347723) +++ stable/12/sys/dev/mlx5/mlx5_en/en.h Thu May 16 15:51:28 2019 (r347724) @@ -73,6 +73,9 @@ #include #include +#define MLX5E_MAX_PRIORITY 8 + +/* IEEE 802.1Qaz standard supported values */ #define IEEE_8021QAZ_MAX_TCS 8 #define MLX5E_PARAMS_MINIMUM_LOG_SQ_SIZE 0x7 @@ -482,10 +485,10 @@ struct mlx5e_params { u16 rx_hash_log_tbl_sz; u32 tx_pauseframe_control __aligned(4); u32 rx_pauseframe_control __aligned(4); - u32 tx_priority_flow_control __aligned(4); - u32 rx_priority_flow_control __aligned(4); u16 tx_max_inline; u8 tx_min_inline_mode; + u8 tx_priority_flow_control; + u8 rx_priority_flow_control; u8 channels_rsss; }; @@ -524,7 +527,7 @@ struct mlx5e_params_ethtool { MLX5E_PARAMS(MLX5E_STATS_VAR) u64 max_bw_value[IEEE_8021QAZ_MAX_TCS]; u8 max_bw_share[IEEE_8021QAZ_MAX_TCS]; - u8 prio_tc[IEEE_8021QAZ_MAX_TCS]; + u8 prio_tc[MLX5E_MAX_PRIORITY]; u8 dscp2prio[MLX5_MAX_SUPPORTED_DSCP]; u8 trust_state; }; Modified: stable/12/sys/dev/mlx5/mlx5_en/mlx5_en_ethtool.c ============================================================================== --- stable/12/sys/dev/mlx5/mlx5_en/mlx5_en_ethtool.c Thu May 16 15:50:11 2019 (r347723) +++ stable/12/sys/dev/mlx5/mlx5_en/mlx5_en_ethtool.c Thu May 16 15:51:28 2019 (r347724) @@ -298,8 +298,8 @@ mlx5e_get_prio_tc(struct mlx5e_priv *priv) return (EOPNOTSUPP); } - for (i = 0; i <= mlx5_max_tc(priv->mdev); i++) { - err = -mlx5_query_port_prio_tc(mdev, i, &(priv->params_ethtool.prio_tc[i])); + for (i = 0; i != MLX5E_MAX_PRIORITY; i++) { + err = -mlx5_query_port_prio_tc(mdev, i, priv->params_ethtool.prio_tc + i); if (err) break; } @@ -311,29 +311,35 @@ static int mlx5e_prio_to_tc_handler(SYSCTL_HANDLER_ARGS) { struct mlx5e_priv *priv = arg1; - int prio_index = arg2; struct mlx5_core_dev *mdev = priv->mdev; + uint8_t temp[MLX5E_MAX_PRIORITY]; int err; - uint8_t result; + int i; PRIV_LOCK(priv); - result = priv->params_ethtool.prio_tc[prio_index]; - err = sysctl_handle_8(oidp, &result, 0, req); - if (err || !req->newptr || - result == priv->params_ethtool.prio_tc[prio_index]) + err = SYSCTL_OUT(req, priv->params_ethtool.prio_tc, MLX5E_MAX_PRIORITY); + if (err || !req->newptr) goto done; - - if (result > mlx5_max_tc(mdev)) { - err = ERANGE; - goto done; - } - - err = -mlx5_set_port_prio_tc(mdev, prio_index, result); + err = SYSCTL_IN(req, temp, MLX5E_MAX_PRIORITY); if (err) goto done; - priv->params_ethtool.prio_tc[prio_index] = result; + for (i = 0; i != MLX5E_MAX_PRIORITY; i++) { + if (temp[i] > mlx5_max_tc(mdev)) { + err = ERANGE; + goto done; + } + } + for (i = 0; i != MLX5E_MAX_PRIORITY; i++) { + if (temp[i] == priv->params_ethtool.prio_tc[i]) + continue; + err = -mlx5_set_port_prio_tc(mdev, i, temp[i]); + if (err) + goto done; + /* update cached value */ + priv->params_ethtool.prio_tc[i] = temp[i]; + } done: PRIV_UNLOCK(priv); return (err); @@ -1135,7 +1141,6 @@ mlx5e_create_diagnostics(struct mlx5e_priv *priv) void mlx5e_create_ethtool(struct mlx5e_priv *priv) { - struct mlx5_core_dev *mdev = priv->mdev; struct sysctl_oid *node, *qos_node; const char *pnameunit; unsigned x; @@ -1262,14 +1267,10 @@ mlx5e_create_ethtool(struct mlx5e_priv *priv) /* Priority to traffic class mapping */ if (mlx5e_get_prio_tc(priv) == 0) { - for (i = 0; i <= mlx5_max_tc(mdev); i++) { - char name[32]; - snprintf(name, sizeof(name), "prio_%d_to_tc", i); - SYSCTL_ADD_PROC(&priv->sysctl_ctx, SYSCTL_CHILDREN(qos_node), - OID_AUTO, name, CTLTYPE_U8 | CTLFLAG_RWTUN | CTLFLAG_MPSAFE, - priv, i, mlx5e_prio_to_tc_handler, "CU", - "Set priority to traffic class"); - } + SYSCTL_ADD_PROC(&priv->sysctl_ctx, SYSCTL_CHILDREN(qos_node), + OID_AUTO, "prio_0_7_tc", CTLTYPE_U8 | CTLFLAG_RWTUN | CTLFLAG_MPSAFE, + priv, 0, mlx5e_prio_to_tc_handler, "CU", + "Set traffic class 0 to 7 for priority 0 to 7 inclusivly"); } /* DSCP support */ @@ -1287,7 +1288,7 @@ mlx5e_create_ethtool(struct mlx5e_priv *priv) SYSCTL_ADD_PROC(&priv->sysctl_ctx, SYSCTL_CHILDREN(qos_node), OID_AUTO, "trust_state", CTLTYPE_U8 | CTLFLAG_RWTUN | CTLFLAG_MPSAFE, priv, 0, mlx5e_trust_state_handler, "CU", - MLX5_CAP_QCAM_FEATURE(mdev, qpts_trust_both) ? + MLX5_CAP_QCAM_FEATURE(priv->mdev, qpts_trust_both) ? A B : A); #undef B #undef A Modified: stable/12/sys/dev/mlx5/mlx5_en/mlx5_en_main.c ============================================================================== --- stable/12/sys/dev/mlx5/mlx5_en/mlx5_en_main.c Thu May 16 15:50:11 2019 (r347723) +++ stable/12/sys/dev/mlx5/mlx5_en/mlx5_en_main.c Thu May 16 15:51:28 2019 (r347724) @@ -281,7 +281,9 @@ mlx5e_set_port_pfc(struct mlx5e_priv *priv) { int error; - if (priv->params.rx_pauseframe_control || + if (priv->gone != 0) { + error = -ENXIO; + } else if (priv->params.rx_pauseframe_control || priv->params.tx_pauseframe_control) { if_printf(priv->ifp, "Global pauseframes must be disabled before enabling PFC.\n"); @@ -3443,79 +3445,98 @@ static int mlx5e_sysctl_tx_priority_flow_control(SYSCTL_HANDLER_ARGS) { struct mlx5e_priv *priv = arg1; + uint8_t temp[MLX5E_MAX_PRIORITY]; uint32_t tx_pfc; - uint32_t value; - int error; + int err; + int i; PRIV_LOCK(priv); tx_pfc = priv->params.tx_priority_flow_control; - /* get current value */ - value = (tx_pfc >> arg2) & 1; + for (i = 0; i != MLX5E_MAX_PRIORITY; i++) + temp[i] = (tx_pfc >> i) & 1; - error = sysctl_handle_32(oidp, &value, 0, req); + err = SYSCTL_OUT(req, temp, MLX5E_MAX_PRIORITY); + if (err || !req->newptr) + goto done; + err = SYSCTL_IN(req, temp, MLX5E_MAX_PRIORITY); + if (err) + goto done; - /* range check value */ - if (value != 0) - priv->params.tx_priority_flow_control |= (1 << arg2); - else - priv->params.tx_priority_flow_control &= ~(1 << arg2); + priv->params.tx_priority_flow_control = 0; - /* check if update is required */ - if (error == 0 && priv->gone == 0 && - tx_pfc != priv->params.tx_priority_flow_control) { - error = -mlx5e_set_port_pfc(priv); - /* restore previous value */ - if (error != 0) - priv->params.tx_priority_flow_control= tx_pfc; + /* range check input value */ + for (i = 0; i != MLX5E_MAX_PRIORITY; i++) { + if (temp[i] > 1) { + err = ERANGE; + goto done; + } + priv->params.tx_priority_flow_control |= (temp[i] << i); } + + /* check if update is required */ + if (tx_pfc != priv->params.tx_priority_flow_control) + err = -mlx5e_set_port_pfc(priv); +done: + if (err != 0) + priv->params.tx_priority_flow_control= tx_pfc; PRIV_UNLOCK(priv); - return (error); + return (err); } static int mlx5e_sysctl_rx_priority_flow_control(SYSCTL_HANDLER_ARGS) { struct mlx5e_priv *priv = arg1; + uint8_t temp[MLX5E_MAX_PRIORITY]; uint32_t rx_pfc; - uint32_t value; - int error; + int err; + int i; PRIV_LOCK(priv); rx_pfc = priv->params.rx_priority_flow_control; - /* get current value */ - value = (rx_pfc >> arg2) & 1; + for (i = 0; i != MLX5E_MAX_PRIORITY; i++) + temp[i] = (rx_pfc >> i) & 1; - error = sysctl_handle_32(oidp, &value, 0, req); + err = SYSCTL_OUT(req, temp, MLX5E_MAX_PRIORITY); + if (err || !req->newptr) + goto done; + err = SYSCTL_IN(req, temp, MLX5E_MAX_PRIORITY); + if (err) + goto done; - /* range check value */ - if (value != 0) - priv->params.rx_priority_flow_control |= (1 << arg2); - else - priv->params.rx_priority_flow_control &= ~(1 << arg2); + priv->params.rx_priority_flow_control = 0; - /* check if update is required */ - if (error == 0 && priv->gone == 0 && - rx_pfc != priv->params.rx_priority_flow_control) { - error = -mlx5e_set_port_pfc(priv); - /* restore previous value */ - if (error != 0) - priv->params.rx_priority_flow_control= rx_pfc; + /* range check input value */ + for (i = 0; i != MLX5E_MAX_PRIORITY; i++) { + if (temp[i] > 1) { + err = ERANGE; + goto done; + } + priv->params.rx_priority_flow_control |= (temp[i] << i); } + + /* check if update is required */ + if (rx_pfc != priv->params.rx_priority_flow_control) + err = -mlx5e_set_port_pfc(priv); +done: + if (err != 0) + priv->params.rx_priority_flow_control= rx_pfc; PRIV_UNLOCK(priv); - return (error); + return (err); } static void mlx5e_setup_pauseframes(struct mlx5e_priv *priv) { - unsigned int x; +#if (__FreeBSD_version < 1100000) char path[96]; +#endif int error; /* enable pauseframes by default */ @@ -3540,25 +3561,6 @@ mlx5e_setup_pauseframes(struct mlx5e_priv *priv) /* try to fetch tunable, if any */ TUNABLE_INT_FETCH(path, &priv->params.rx_pauseframe_control); - - for (x = 0; x != 8; x++) { - - /* compute path for sysctl */ - snprintf(path, sizeof(path), "dev.mce.%d.tx_priority_flow_control_%u", - device_get_unit(priv->mdev->pdev->dev.bsddev), x); - - /* try to fetch tunable, if any */ - if (TUNABLE_INT_FETCH(path, &value) == 0 && value != 0) - priv->params.tx_priority_flow_control |= 1 << x; - - /* compute path for sysctl */ - snprintf(path, sizeof(path), "dev.mce.%d.rx_priority_flow_control_%u", - device_get_unit(priv->mdev->pdev->dev.bsddev), x); - - /* try to fetch tunable, if any */ - if (TUNABLE_INT_FETCH(path, &value) == 0 && value != 0) - priv->params.rx_priority_flow_control |= 1 << x; - } #endif /* register pauseframe SYSCTLs */ @@ -3572,22 +3574,16 @@ mlx5e_setup_pauseframes(struct mlx5e_priv *priv) &priv->params.rx_pauseframe_control, 0, "Set to enable RX pause frames. Clear to disable."); - /* register priority_flow control, PFC, SYSCTLs */ - for (x = 0; x != 8; x++) { - snprintf(path, sizeof(path), "tx_priority_flow_control_%u", x); + /* register priority flow control, PFC, SYSCTLs */ + SYSCTL_ADD_PROC(&priv->sysctl_ctx, SYSCTL_CHILDREN(priv->sysctl_ifnet), + OID_AUTO, "tx_priority_flow_control", CTLTYPE_U8 | CTLFLAG_RWTUN | + CTLFLAG_MPSAFE, priv, 0, &mlx5e_sysctl_tx_priority_flow_control, "CU", + "Set to enable TX ports flow control frames for priorities 0..7. Clear to disable."); - SYSCTL_ADD_PROC(&priv->sysctl_ctx, SYSCTL_CHILDREN(priv->sysctl_ifnet), - OID_AUTO, path, CTLTYPE_UINT | CTLFLAG_RWTUN | - CTLFLAG_MPSAFE, priv, x, &mlx5e_sysctl_tx_priority_flow_control, "IU", - "Set to enable TX ports flow control frames for given priority. Clear to disable."); - - snprintf(path, sizeof(path), "rx_priority_flow_control_%u", x); - - SYSCTL_ADD_PROC(&priv->sysctl_ctx, SYSCTL_CHILDREN(priv->sysctl_ifnet), - OID_AUTO, path, CTLTYPE_UINT | CTLFLAG_RWTUN | - CTLFLAG_MPSAFE, priv, x, &mlx5e_sysctl_rx_priority_flow_control, "IU", - "Set to enable RX ports flow control frames for given priority. Clear to disable."); - } + SYSCTL_ADD_PROC(&priv->sysctl_ctx, SYSCTL_CHILDREN(priv->sysctl_ifnet), + OID_AUTO, "rx_priority_flow_control", CTLTYPE_U8 | CTLFLAG_RWTUN | + CTLFLAG_MPSAFE, priv, 0, &mlx5e_sysctl_rx_priority_flow_control, "CU", + "Set to enable RX ports flow control frames for priorities 0..7. Clear to disable."); PRIV_LOCK(priv); From owner-svn-src-stable@freebsd.org Thu May 16 15:52:19 2019 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 5B6DA159B379; Thu, 16 May 2019 15:52:19 +0000 (UTC) (envelope-from hselasky@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 0073C85721; Thu, 16 May 2019 15:52:19 +0000 (UTC) (envelope-from hselasky@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 CF37922F1C; Thu, 16 May 2019 15:52:18 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x4GFqIOs050987; Thu, 16 May 2019 15:52:18 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x4GFqI0i050986; Thu, 16 May 2019 15:52:18 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201905161552.x4GFqI0i050986@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Thu, 16 May 2019 15:52:18 +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: r347725 - stable/12/sys/dev/mlx5/mlx5_en X-SVN-Group: stable-12 X-SVN-Commit-Author: hselasky X-SVN-Commit-Paths: stable/12/sys/dev/mlx5/mlx5_en X-SVN-Commit-Revision: 347725 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 0073C85721 X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.97 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.998,0]; NEURAL_HAM_SHORT(-0.97)[-0.969,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US]; NEURAL_HAM_LONG(-1.00)[-1.000,0] X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 16 May 2019 15:52:19 -0000 Author: hselasky Date: Thu May 16 15:52:18 2019 New Revision: 347725 URL: https://svnweb.freebsd.org/changeset/base/347725 Log: MFC r347261: Implement fast close of RX channel in mlx5en(4). Instead of waiting for all jobs to be cancelled, simply close the completion queue to prevent more completion events and let mlx5e_destroy_rq() cleanup the remaining mbufs. Sponsored by: Mellanox Technologies Modified: stable/12/sys/dev/mlx5/mlx5_en/mlx5_en_main.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/dev/mlx5/mlx5_en/mlx5_en_main.c ============================================================================== --- stable/12/sys/dev/mlx5/mlx5_en/mlx5_en_main.c Thu May 16 15:51:28 2019 (r347724) +++ stable/12/sys/dev/mlx5/mlx5_en/mlx5_en_main.c Thu May 16 15:52:18 2019 (r347725) @@ -1136,17 +1136,10 @@ mlx5e_close_rq(struct mlx5e_rq *rq) static void mlx5e_close_rq_wait(struct mlx5e_rq *rq) { - struct mlx5_core_dev *mdev = rq->channel->priv->mdev; - /* wait till RQ is empty */ - while (!mlx5_wq_ll_is_empty(&rq->wq) && - (mdev->state != MLX5_DEVICE_STATE_INTERNAL_ERROR)) { - msleep(4); - rq->cq.mcq.comp(&rq->cq.mcq); - } - - cancel_work_sync(&rq->dim.work); mlx5e_disable_rq(rq); + mlx5e_close_cq(&rq->cq); + cancel_work_sync(&rq->dim.work); mlx5e_destroy_rq(rq); } @@ -1861,7 +1854,6 @@ mlx5e_close_channel_wait(struct mlx5e_channel *c) { mlx5e_close_rq_wait(&c->rq); mlx5e_close_sqs_wait(c); - mlx5e_close_cq(&c->rq.cq); mlx5e_close_tx_cqs(c); /* destroy mutexes */ mlx5e_chan_mtx_destroy(c); From owner-svn-src-stable@freebsd.org Thu May 16 15:53:13 2019 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 88BEB159B45A; Thu, 16 May 2019 15:53:13 +0000 (UTC) (envelope-from hselasky@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 30E5F858CC; Thu, 16 May 2019 15:53:13 +0000 (UTC) (envelope-from hselasky@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 0BB882303C; Thu, 16 May 2019 15:53:13 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x4GFrC8r051809; Thu, 16 May 2019 15:53:12 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x4GFrC8w051808; Thu, 16 May 2019 15:53:12 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201905161553.x4GFrC8w051808@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Thu, 16 May 2019 15:53:12 +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: r347726 - stable/12/sys/dev/mlx5/mlx5_en X-SVN-Group: stable-12 X-SVN-Commit-Author: hselasky X-SVN-Commit-Paths: stable/12/sys/dev/mlx5/mlx5_en X-SVN-Commit-Revision: 347726 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 30E5F858CC X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.97 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.998,0]; NEURAL_HAM_SHORT(-0.97)[-0.970,0]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US] X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 16 May 2019 15:53:13 -0000 Author: hselasky Date: Thu May 16 15:53:12 2019 New Revision: 347726 URL: https://svnweb.freebsd.org/changeset/base/347726 Log: MFC r347262: Split mlx5e_update_stats_work() in mlx5en(4). Split the function into the mlx5e_update_stats_locked() core and make mlx5e_update_stats_work() call the _locked helper, similar to many other places in the kernel. This improves the code structure, making the locking clean. Submitted by: kib@ Sponsored by: Mellanox Technologies Modified: stable/12/sys/dev/mlx5/mlx5_en/mlx5_en_main.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/dev/mlx5/mlx5_en/mlx5_en_main.c ============================================================================== --- stable/12/sys/dev/mlx5/mlx5_en/mlx5_en_main.c Thu May 16 15:52:18 2019 (r347725) +++ stable/12/sys/dev/mlx5/mlx5_en/mlx5_en_main.c Thu May 16 15:53:12 2019 (r347726) @@ -475,10 +475,8 @@ free_out: * configuration lock. */ static void -mlx5e_update_stats_work(struct work_struct *work) +mlx5e_update_stats_locked(struct mlx5e_priv *priv) { - struct mlx5e_priv *priv = container_of(work, struct mlx5e_priv, - update_stats_work); struct mlx5_core_dev *mdev = priv->mdev; struct mlx5e_vport_stats *s = &priv->stats.vport; struct mlx5e_sq_stats *sq_stats; @@ -505,12 +503,9 @@ mlx5e_update_stats_work(struct work_struct *work) int i; int j; - PRIV_LOCK(priv); out = mlx5_vzalloc(outlen); if (out == NULL) goto free_out; - if (test_bit(MLX5E_STATE_OPENED, &priv->state) == 0) - goto free_out; /* Collect firts the SW counters and then HW for consistency */ for (i = 0; i < priv->params.num_channels; i++) { @@ -565,78 +560,70 @@ mlx5e_update_stats_work(struct work_struct *work) memset(out, 0, outlen); /* get number of out-of-buffer drops first */ - if (mlx5_vport_query_out_of_rx_buffer(mdev, priv->counter_set_id, - &rx_out_of_buffer)) - goto free_out; + if (test_bit(MLX5E_STATE_OPENED, &priv->state) != 0 && + mlx5_vport_query_out_of_rx_buffer(mdev, priv->counter_set_id, + &rx_out_of_buffer) == 0) { + /* accumulate difference into a 64-bit counter */ + s->rx_out_of_buffer += (u64)(u32)(rx_out_of_buffer - + s->rx_out_of_buffer_prev); + s->rx_out_of_buffer_prev = rx_out_of_buffer; + } - /* accumulate difference into a 64-bit counter */ - s->rx_out_of_buffer += (u64)(u32)(rx_out_of_buffer - s->rx_out_of_buffer_prev); - s->rx_out_of_buffer_prev = rx_out_of_buffer; - /* get port statistics */ - if (mlx5_cmd_exec(mdev, in, sizeof(in), out, outlen)) - goto free_out; - + if (mlx5_cmd_exec(mdev, in, sizeof(in), out, outlen) == 0) { #define MLX5_GET_CTR(out, x) \ MLX5_GET64(query_vport_counter_out, out, x) - s->rx_error_packets = - MLX5_GET_CTR(out, received_errors.packets); - s->rx_error_bytes = - MLX5_GET_CTR(out, received_errors.octets); - s->tx_error_packets = - MLX5_GET_CTR(out, transmit_errors.packets); - s->tx_error_bytes = - MLX5_GET_CTR(out, transmit_errors.octets); + s->rx_error_packets = + MLX5_GET_CTR(out, received_errors.packets); + s->rx_error_bytes = + MLX5_GET_CTR(out, received_errors.octets); + s->tx_error_packets = + MLX5_GET_CTR(out, transmit_errors.packets); + s->tx_error_bytes = + MLX5_GET_CTR(out, transmit_errors.octets); - s->rx_unicast_packets = - MLX5_GET_CTR(out, received_eth_unicast.packets); - s->rx_unicast_bytes = - MLX5_GET_CTR(out, received_eth_unicast.octets); - s->tx_unicast_packets = - MLX5_GET_CTR(out, transmitted_eth_unicast.packets); - s->tx_unicast_bytes = - MLX5_GET_CTR(out, transmitted_eth_unicast.octets); + s->rx_unicast_packets = + MLX5_GET_CTR(out, received_eth_unicast.packets); + s->rx_unicast_bytes = + MLX5_GET_CTR(out, received_eth_unicast.octets); + s->tx_unicast_packets = + MLX5_GET_CTR(out, transmitted_eth_unicast.packets); + s->tx_unicast_bytes = + MLX5_GET_CTR(out, transmitted_eth_unicast.octets); - s->rx_multicast_packets = - MLX5_GET_CTR(out, received_eth_multicast.packets); - s->rx_multicast_bytes = - MLX5_GET_CTR(out, received_eth_multicast.octets); - s->tx_multicast_packets = - MLX5_GET_CTR(out, transmitted_eth_multicast.packets); - s->tx_multicast_bytes = - MLX5_GET_CTR(out, transmitted_eth_multicast.octets); + s->rx_multicast_packets = + MLX5_GET_CTR(out, received_eth_multicast.packets); + s->rx_multicast_bytes = + MLX5_GET_CTR(out, received_eth_multicast.octets); + s->tx_multicast_packets = + MLX5_GET_CTR(out, transmitted_eth_multicast.packets); + s->tx_multicast_bytes = + MLX5_GET_CTR(out, transmitted_eth_multicast.octets); - s->rx_broadcast_packets = - MLX5_GET_CTR(out, received_eth_broadcast.packets); - s->rx_broadcast_bytes = - MLX5_GET_CTR(out, received_eth_broadcast.octets); - s->tx_broadcast_packets = - MLX5_GET_CTR(out, transmitted_eth_broadcast.packets); - s->tx_broadcast_bytes = - MLX5_GET_CTR(out, transmitted_eth_broadcast.octets); + s->rx_broadcast_packets = + MLX5_GET_CTR(out, received_eth_broadcast.packets); + s->rx_broadcast_bytes = + MLX5_GET_CTR(out, received_eth_broadcast.octets); + s->tx_broadcast_packets = + MLX5_GET_CTR(out, transmitted_eth_broadcast.packets); + s->tx_broadcast_bytes = + MLX5_GET_CTR(out, transmitted_eth_broadcast.octets); - s->rx_packets = - s->rx_unicast_packets + - s->rx_multicast_packets + - s->rx_broadcast_packets - - s->rx_out_of_buffer; - s->rx_bytes = - s->rx_unicast_bytes + - s->rx_multicast_bytes + - s->rx_broadcast_bytes; - s->tx_packets = - s->tx_unicast_packets + - s->tx_multicast_packets + - s->tx_broadcast_packets; - s->tx_bytes = - s->tx_unicast_bytes + - s->tx_multicast_bytes + - s->tx_broadcast_bytes; + s->rx_packets = s->rx_unicast_packets + + s->rx_multicast_packets + s->rx_broadcast_packets - + s->rx_out_of_buffer; + s->rx_bytes = s->rx_unicast_bytes + s->rx_multicast_bytes + + s->rx_broadcast_bytes; + s->tx_packets = s->tx_unicast_packets + + s->tx_multicast_packets + s->tx_broadcast_packets; + s->tx_bytes = s->tx_unicast_bytes + s->tx_multicast_bytes + + s->tx_broadcast_bytes; - /* Update calculated offload counters */ - s->tx_csum_offload = s->tx_packets - tx_offload_none; - s->rx_csum_good = s->rx_packets - s->rx_csum_none; + /* Update calculated offload counters */ + s->tx_csum_offload = s->tx_packets - tx_offload_none; + s->rx_csum_good = s->rx_packets - s->rx_csum_none; + } /* Get physical port counters */ mlx5e_update_pport_counters(priv); @@ -685,6 +672,17 @@ free_out: if (error != 0) if_printf(priv->ifp, "Failed reading diagnostics: %d\n", error); } +} + +static void +mlx5e_update_stats_work(struct work_struct *work) +{ + struct mlx5e_priv *priv; + + priv = container_of(work, struct mlx5e_priv, update_stats_work); + PRIV_LOCK(priv); + if (test_bit(MLX5E_STATE_OPENED, &priv->state) != 0) + mlx5e_update_stats_locked(priv); PRIV_UNLOCK(priv); } From owner-svn-src-stable@freebsd.org Thu May 16 15:53:49 2019 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 542B9159B586; Thu, 16 May 2019 15:53:49 +0000 (UTC) (envelope-from hselasky@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 ECF8685A40; Thu, 16 May 2019 15:53:48 +0000 (UTC) (envelope-from hselasky@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 C8C042303D; Thu, 16 May 2019 15:53:48 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x4GFrmJD051890; Thu, 16 May 2019 15:53:48 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x4GFrmOS051889; Thu, 16 May 2019 15:53:48 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201905161553.x4GFrmOS051889@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Thu, 16 May 2019 15:53:48 +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: r347727 - stable/12/sys/dev/mlx5/mlx5_en X-SVN-Group: stable-12 X-SVN-Commit-Author: hselasky X-SVN-Commit-Paths: stable/12/sys/dev/mlx5/mlx5_en X-SVN-Commit-Revision: 347727 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: ECF8685A40 X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.97 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.998,0]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; NEURAL_HAM_SHORT(-0.97)[-0.969,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US] X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 16 May 2019 15:53:49 -0000 Author: hselasky Date: Thu May 16 15:53:48 2019 New Revision: 347727 URL: https://svnweb.freebsd.org/changeset/base/347727 Log: MFC r347263: Disable CQE zipping by default in mlx5en(4). After doing performance measurements, it seems like CQE zipping doesn't have any significant benefit. Moreover, we know that this feature is disabled by default on other operating systems (Linux for example). Submitted by: slavash@ Sponsored by: Mellanox Technologies Modified: stable/12/sys/dev/mlx5/mlx5_en/mlx5_en_main.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/dev/mlx5/mlx5_en/mlx5_en_main.c ============================================================================== --- stable/12/sys/dev/mlx5/mlx5_en/mlx5_en_main.c Thu May 16 15:53:12 2019 (r347726) +++ stable/12/sys/dev/mlx5/mlx5_en/mlx5_en_main.c Thu May 16 15:53:48 2019 (r347727) @@ -3175,7 +3175,12 @@ mlx5e_build_ifp_priv(struct mlx5_core_dev *mdev, priv->params.hw_lro_en = false; priv->params.lro_wqe_sz = MLX5E_PARAMS_DEFAULT_LRO_WQE_SZ; - priv->params.cqe_zipping_en = !!MLX5_CAP_GEN(mdev, cqe_compression); + /* + * CQE zipping is currently defaulted to off. when it won't + * anymore we will consider the HW capability: + * "!!MLX5_CAP_GEN(mdev, cqe_compression)" + */ + priv->params.cqe_zipping_en = false; priv->mdev = mdev; priv->params.num_channels = num_comp_vectors; From owner-svn-src-stable@freebsd.org Thu May 16 15:55:10 2019 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 488BB159B944; Thu, 16 May 2019 15:55:10 +0000 (UTC) (envelope-from hselasky@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 DD84785CEA; Thu, 16 May 2019 15:55:09 +0000 (UTC) (envelope-from hselasky@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 9F1792303E; Thu, 16 May 2019 15:55:09 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x4GFt9fi052055; Thu, 16 May 2019 15:55:09 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x4GFt93x052054; Thu, 16 May 2019 15:55:09 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201905161555.x4GFt93x052054@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Thu, 16 May 2019 15:55:09 +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: r347728 - stable/12/sys/dev/mlx5/mlx5_en X-SVN-Group: stable-12 X-SVN-Commit-Author: hselasky X-SVN-Commit-Paths: stable/12/sys/dev/mlx5/mlx5_en X-SVN-Commit-Revision: 347728 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: DD84785CEA X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.97 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.998,0]; NEURAL_HAM_SHORT(-0.97)[-0.970,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US]; NEURAL_HAM_LONG(-1.00)[-1.000,0] X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 16 May 2019 15:55:10 -0000 Author: hselasky Date: Thu May 16 15:55:08 2019 New Revision: 347728 URL: https://svnweb.freebsd.org/changeset/base/347728 Log: MFC r347264: Configure firmware to use RX hash format in mini CQE in mlx5en(4). When using CQE zipping, one can choose between RX hash and Checksum. This will indicate the parameter on which a zipping session should be stopped. While porting the Linux code, Checksum was chosen. However, the value of Checksum is not being used anywhere. For the FreeBSD driver, we prefer to use the RX hash format which will guarantee the RX hash value for all the mini CQEs. While at it, make sure to initialize the Checksum value in the decompressed CQE. Submitted by: slavash@ Sponsored by: Mellanox Technologies Modified: stable/12/sys/dev/mlx5/mlx5_en/mlx5_en_main.c stable/12/sys/dev/mlx5/mlx5_en/mlx5_en_rx.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/dev/mlx5/mlx5_en/mlx5_en_main.c ============================================================================== --- stable/12/sys/dev/mlx5/mlx5_en/mlx5_en_main.c Thu May 16 15:53:48 2019 (r347727) +++ stable/12/sys/dev/mlx5/mlx5_en/mlx5_en_main.c Thu May 16 15:55:08 2019 (r347728) @@ -1955,13 +1955,15 @@ mlx5e_build_rx_cq_param(struct mlx5e_priv *priv, struct net_dim_cq_moder curr; void *cqc = param->cqc; - /* - * TODO The sysctl to control on/off is a bool value for now, which means - * we only support CSUM, once HASH is implemnted we'll need to address that. + * We use MLX5_CQE_FORMAT_HASH because the RX hash mini CQE + * format is more beneficial for FreeBSD use case. + * + * Adding support for MLX5_CQE_FORMAT_CSUM will require changes + * in mlx5e_decompress_cqe. */ if (priv->params.cqe_zipping_en) { - MLX5_SET(cqc, cqc, mini_cqe_res_format, MLX5_CQE_FORMAT_CSUM); + MLX5_SET(cqc, cqc, mini_cqe_res_format, MLX5_CQE_FORMAT_HASH); MLX5_SET(cqc, cqc, cqe_compression_en, 1); } Modified: stable/12/sys/dev/mlx5/mlx5_en/mlx5_en_rx.c ============================================================================== --- stable/12/sys/dev/mlx5/mlx5_en/mlx5_en_rx.c Thu May 16 15:53:48 2019 (r347727) +++ stable/12/sys/dev/mlx5/mlx5_en/mlx5_en_rx.c Thu May 16 15:55:08 2019 (r347728) @@ -385,7 +385,12 @@ mlx5e_decompress_cqe(struct mlx5e_cq *cq, struct mlx5_ */ title->byte_cnt = mini->byte_cnt; title->wqe_counter = cpu_to_be16((wqe_counter + i) & cq->wq.sz_m1); - title->check_sum = mini->checksum; + title->rss_hash_result = mini->rx_hash_result; + /* + * Since we use MLX5_CQE_FORMAT_HASH when creating the RX CQ, + * the value of the checksum should be ignored. + */ + title->check_sum = 0; title->op_own = (title->op_own & 0xf0) | (((cq->wq.cc + i) >> cq->wq.log_sz) & 1); } From owner-svn-src-stable@freebsd.org Thu May 16 15:55:55 2019 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 5AEA8159B9E5; Thu, 16 May 2019 15:55:55 +0000 (UTC) (envelope-from hselasky@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 F225185E32; Thu, 16 May 2019 15:55:54 +0000 (UTC) (envelope-from hselasky@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 CB4BD2303F; Thu, 16 May 2019 15:55:54 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x4GFtsAb052144; Thu, 16 May 2019 15:55:54 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x4GFtsq9052143; Thu, 16 May 2019 15:55:54 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201905161555.x4GFtsq9052143@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Thu, 16 May 2019 15:55:54 +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: r347729 - stable/12/sys/dev/mlx5/mlx5_core X-SVN-Group: stable-12 X-SVN-Commit-Author: hselasky X-SVN-Commit-Paths: stable/12/sys/dev/mlx5/mlx5_core X-SVN-Commit-Revision: 347729 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: F225185E32 X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.97 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.998,0]; NEURAL_HAM_SHORT(-0.97)[-0.969,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US]; NEURAL_HAM_LONG(-1.00)[-1.000,0] X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 16 May 2019 15:55:55 -0000 Author: hselasky Date: Thu May 16 15:55:54 2019 New Revision: 347729 URL: https://svnweb.freebsd.org/changeset/base/347729 Log: MFC r347265: Ticks are integer type in FreeBSD. Sponsored by: Mellanox Technologies Modified: stable/12/sys/dev/mlx5/mlx5_core/mlx5_health.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/dev/mlx5/mlx5_core/mlx5_health.c ============================================================================== --- stable/12/sys/dev/mlx5/mlx5_core/mlx5_health.c Thu May 16 15:55:08 2019 (r347728) +++ stable/12/sys/dev/mlx5/mlx5_core/mlx5_health.c Thu May 16 15:55:54 2019 (r347729) @@ -255,7 +255,7 @@ mlx5_health_allow_reset(struct mlx5_core_dev *dev) #define MLX5_NIC_STATE_POLL_MS 5 void mlx5_enter_error_state(struct mlx5_core_dev *dev, bool force) { - unsigned long end, delay_ms = MLX5_CRDUMP_WAIT_MS; + int end, delay_ms = MLX5_CRDUMP_WAIT_MS; u32 fatal_error; int lock = -EBUSY; @@ -299,7 +299,7 @@ void mlx5_enter_error_state(struct mlx5_core_dev *dev, } while (!time_after(jiffies, end)); if (!sensor_nic_disabled(dev)) { - dev_err(&dev->pdev->dev, "NIC IFC still %d after %lums.\n", + dev_err(&dev->pdev->dev, "NIC IFC still %d after %ums.\n", get_nic_mode(dev), delay_ms); } From owner-svn-src-stable@freebsd.org Thu May 16 15:56:31 2019 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 5CD8B159BA79; Thu, 16 May 2019 15:56:31 +0000 (UTC) (envelope-from hselasky@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 02FB085F5B; Thu, 16 May 2019 15:56:31 +0000 (UTC) (envelope-from hselasky@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 D1EDD23040; Thu, 16 May 2019 15:56:30 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x4GFuUnN052230; Thu, 16 May 2019 15:56:30 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x4GFuUPR052228; Thu, 16 May 2019 15:56:30 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201905161556.x4GFuUPR052228@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Thu, 16 May 2019 15:56:30 +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: r347730 - stable/12/sys/dev/mlx5/mlx5_core X-SVN-Group: stable-12 X-SVN-Commit-Author: hselasky X-SVN-Commit-Paths: stable/12/sys/dev/mlx5/mlx5_core X-SVN-Commit-Revision: 347730 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 02FB085F5B X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.97 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.998,0]; NEURAL_HAM_SHORT(-0.97)[-0.970,0]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US] X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 16 May 2019 15:56:31 -0000 Author: hselasky Date: Thu May 16 15:56:30 2019 New Revision: 347730 URL: https://svnweb.freebsd.org/changeset/base/347730 Log: MFC r347266: Implement get and set nic state as global functions in mlx5core. Sponsored by: Mellanox Technologies Modified: stable/12/sys/dev/mlx5/mlx5_core/mlx5_core.h stable/12/sys/dev/mlx5/mlx5_core/mlx5_health.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/dev/mlx5/mlx5_core/mlx5_core.h ============================================================================== --- stable/12/sys/dev/mlx5/mlx5_core/mlx5_core.h Thu May 16 15:55:54 2019 (r347729) +++ stable/12/sys/dev/mlx5/mlx5_core/mlx5_core.h Thu May 16 15:56:30 2019 (r347730) @@ -108,4 +108,15 @@ extern struct pci_driver mlx5_core_driver; SYSCTL_DECL(_hw_mlx5); +enum { + MLX5_NIC_IFC_FULL = 0, + MLX5_NIC_IFC_DISABLED = 1, + MLX5_NIC_IFC_NO_DRAM_NIC = 2, + MLX5_NIC_IFC_INVALID = 3, + MLX5_NIC_IFC_SW_RESET = 7, +}; + +u8 mlx5_get_nic_state(struct mlx5_core_dev *dev); +void mlx5_set_nic_state(struct mlx5_core_dev *dev, u8 state); + #endif /* __MLX5_CORE_H__ */ Modified: stable/12/sys/dev/mlx5/mlx5_core/mlx5_health.c ============================================================================== --- stable/12/sys/dev/mlx5/mlx5_core/mlx5_health.c Thu May 16 15:55:54 2019 (r347729) +++ stable/12/sys/dev/mlx5/mlx5_core/mlx5_health.c Thu May 16 15:56:30 2019 (r347730) @@ -39,13 +39,6 @@ #define MAX_MISSES 3 enum { - MLX5_NIC_IFC_FULL = 0, - MLX5_NIC_IFC_DISABLED = 1, - MLX5_NIC_IFC_NO_DRAM_NIC = 2, - MLX5_NIC_IFC_SW_RESET = 7, -}; - -enum { MLX5_DROP_NEW_HEALTH_WORK, MLX5_DROP_NEW_RECOVERY_WORK, }; @@ -114,11 +107,21 @@ static int unlock_sem_sw_reset(struct mlx5_core_dev *d return ret; } -static u8 get_nic_mode(struct mlx5_core_dev *dev) +u8 mlx5_get_nic_state(struct mlx5_core_dev *dev) { return (ioread32be(&dev->iseg->cmdq_addr_l_sz) >> 8) & 7; } +void mlx5_set_nic_state(struct mlx5_core_dev *dev, u8 state) +{ + u32 cur_cmdq_addr_l_sz; + + cur_cmdq_addr_l_sz = ioread32be(&dev->iseg->cmdq_addr_l_sz); + iowrite32be((cur_cmdq_addr_l_sz & 0xFFFFF000) | + state << MLX5_NIC_IFC_OFFSET, + &dev->iseg->cmdq_addr_l_sz); +} + static bool sensor_fw_synd_rfr(struct mlx5_core_dev *dev) { struct mlx5_core_health *health = &dev->priv.health; @@ -165,12 +168,12 @@ static bool sensor_pci_no_comm(struct mlx5_core_dev *d static bool sensor_nic_disabled(struct mlx5_core_dev *dev) { - return get_nic_mode(dev) == MLX5_NIC_IFC_DISABLED; + return mlx5_get_nic_state(dev) == MLX5_NIC_IFC_DISABLED; } static bool sensor_nic_sw_reset(struct mlx5_core_dev *dev) { - return get_nic_mode(dev) == MLX5_NIC_IFC_SW_RESET; + return mlx5_get_nic_state(dev) == MLX5_NIC_IFC_SW_RESET; } static u32 check_fatal_sensors(struct mlx5_core_dev *dev) @@ -300,7 +303,7 @@ void mlx5_enter_error_state(struct mlx5_core_dev *dev, if (!sensor_nic_disabled(dev)) { dev_err(&dev->pdev->dev, "NIC IFC still %d after %ums.\n", - get_nic_mode(dev), delay_ms); + mlx5_get_nic_state(dev), delay_ms); } /* Release FW semaphore if you are the lock owner */ @@ -316,7 +319,7 @@ err_state_done: static void mlx5_handle_bad_state(struct mlx5_core_dev *dev) { - u8 nic_mode = get_nic_mode(dev); + u8 nic_mode = mlx5_get_nic_state(dev); if (nic_mode == MLX5_NIC_IFC_SW_RESET) { /* The IFC mode field is 3 bits, so it will read 0x7 in two cases: @@ -362,11 +365,11 @@ static void health_recover(struct work_struct *work) recover = false; } - nic_mode = get_nic_mode(dev); + nic_mode = mlx5_get_nic_state(dev); while (nic_mode != MLX5_NIC_IFC_DISABLED && !time_after(jiffies, end)) { msleep(MLX5_NIC_STATE_POLL_MS); - nic_mode = get_nic_mode(dev); + nic_mode = mlx5_get_nic_state(dev); } if (nic_mode != MLX5_NIC_IFC_DISABLED) { From owner-svn-src-stable@freebsd.org Thu May 16 15:57:15 2019 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 37E81159BB48; Thu, 16 May 2019 15:57:15 +0000 (UTC) (envelope-from hselasky@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 D3607860B4; Thu, 16 May 2019 15:57:14 +0000 (UTC) (envelope-from hselasky@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 AB6E523041; Thu, 16 May 2019 15:57:14 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x4GFvEx9052318; Thu, 16 May 2019 15:57:14 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x4GFvE4X052317; Thu, 16 May 2019 15:57:14 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201905161557.x4GFvE4X052317@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Thu, 16 May 2019 15:57:14 +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: r347731 - stable/12/sys/dev/mlx5/mlx5_en X-SVN-Group: stable-12 X-SVN-Commit-Author: hselasky X-SVN-Commit-Paths: stable/12/sys/dev/mlx5/mlx5_en X-SVN-Commit-Revision: 347731 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: D3607860B4 X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.97 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.998,0]; NEURAL_HAM_SHORT(-0.97)[-0.969,0]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US] X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 16 May 2019 15:57:15 -0000 Author: hselasky Date: Thu May 16 15:57:14 2019 New Revision: 347731 URL: https://svnweb.freebsd.org/changeset/base/347731 Log: MFC r347267: Make sure the running variable is properly set for ratelimited SQs in mlx5en(4). Else the SQs won't be properly released when closing rate-limited connections leading to wrong state transitions on the SQ. Sponsored by: Mellanox Technologies Modified: stable/12/sys/dev/mlx5/mlx5_en/mlx5_en_rl.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/dev/mlx5/mlx5_en/mlx5_en_rl.c ============================================================================== --- stable/12/sys/dev/mlx5/mlx5_en/mlx5_en_rl.c Thu May 16 15:56:30 2019 (r347730) +++ stable/12/sys/dev/mlx5/mlx5_en/mlx5_en_rl.c Thu May 16 15:57:14 2019 (r347731) @@ -176,6 +176,8 @@ mlx5e_rl_open_sq(struct mlx5e_priv *priv, struct mlx5e if (err) goto err_disable_sq; + WRITE_ONCE(sq->running, 1); + return (0); err_disable_sq: From owner-svn-src-stable@freebsd.org Thu May 16 15:58:01 2019 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 857FA159BC14; Thu, 16 May 2019 15:58:01 +0000 (UTC) (envelope-from hselasky@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 C46B586202; Thu, 16 May 2019 15:58:00 +0000 (UTC) (envelope-from hselasky@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 998D123043; Thu, 16 May 2019 15:58:00 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x4GFw0HC052412; Thu, 16 May 2019 15:58:00 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x4GFvx9K052404; Thu, 16 May 2019 15:57:59 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201905161557.x4GFvx9K052404@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Thu, 16 May 2019 15:57:59 +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: r347732 - in stable/12/sys/dev/mlx5: . mlx5_core X-SVN-Group: stable-12 X-SVN-Commit-Author: hselasky X-SVN-Commit-Paths: in stable/12/sys/dev/mlx5: . mlx5_core X-SVN-Commit-Revision: 347732 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: C46B586202 X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.97 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.998,0]; NEURAL_HAM_SHORT(-0.97)[-0.970,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US]; NEURAL_HAM_LONG(-1.00)[-1.000,0] X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 16 May 2019 15:58:02 -0000 Author: hselasky Date: Thu May 16 15:57:59 2019 New Revision: 347732 URL: https://svnweb.freebsd.org/changeset/base/347732 Log: MFC r347268: Add Fast teardown support to mlx5core. Today mlx5 devices support two teardown modes: 1- Regular teardown 2- Force teardown This change introduces the enhanced version of the "Force teardown" that allows SW to perform teardown in a faster way without the need to reclaim all the pages. Fast teardown provides the following advantages: 1- Fix a FW race condition that could cause command timeout 2- Avoid moving to polling mode 3- Close the vport to prevent PCI ACK to be sent without been scattered to memory Linux commit: fcd29ad17c6ff885dfae58f557e9323941e63ba2 Sponsored by: Mellanox Technologies Modified: stable/12/sys/dev/mlx5/mlx5_core/mlx5_core.h stable/12/sys/dev/mlx5/mlx5_core/mlx5_fw.c stable/12/sys/dev/mlx5/mlx5_core/mlx5_main.c stable/12/sys/dev/mlx5/mlx5_ifc.h Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/dev/mlx5/mlx5_core/mlx5_core.h ============================================================================== --- stable/12/sys/dev/mlx5/mlx5_core/mlx5_core.h Thu May 16 15:57:14 2019 (r347731) +++ stable/12/sys/dev/mlx5/mlx5_core/mlx5_core.h Thu May 16 15:57:59 2019 (r347732) @@ -79,6 +79,7 @@ int mlx5_query_qcam_reg(struct mlx5_core_dev *mdev, u3 int mlx5_cmd_init_hca(struct mlx5_core_dev *dev); int mlx5_cmd_teardown_hca(struct mlx5_core_dev *dev); int mlx5_cmd_force_teardown_hca(struct mlx5_core_dev *dev); +int mlx5_cmd_fast_teardown_hca(struct mlx5_core_dev *dev); void mlx5_core_event(struct mlx5_core_dev *dev, enum mlx5_dev_event event, unsigned long param); void mlx5_enter_error_state(struct mlx5_core_dev *dev, bool force); Modified: stable/12/sys/dev/mlx5/mlx5_core/mlx5_fw.c ============================================================================== --- stable/12/sys/dev/mlx5/mlx5_core/mlx5_fw.c Thu May 16 15:57:14 2019 (r347731) +++ stable/12/sys/dev/mlx5/mlx5_core/mlx5_fw.c Thu May 16 15:57:59 2019 (r347732) @@ -249,12 +249,59 @@ int mlx5_cmd_force_teardown_hca(struct mlx5_core_dev * if (ret) return ret; - force_state = MLX5_GET(teardown_hca_out, out, force_state); + force_state = MLX5_GET(teardown_hca_out, out, state); if (force_state == MLX5_TEARDOWN_HCA_OUT_FORCE_STATE_FAIL) { mlx5_core_err(dev, "teardown with force mode failed\n"); return -EIO; } + return 0; +} + +#define MLX5_FAST_TEARDOWN_WAIT_MS 3000 +int mlx5_cmd_fast_teardown_hca(struct mlx5_core_dev *dev) +{ + int end, delay_ms = MLX5_FAST_TEARDOWN_WAIT_MS; + u32 out[MLX5_ST_SZ_DW(teardown_hca_out)] = {}; + u32 in[MLX5_ST_SZ_DW(teardown_hca_in)] = {}; + int state; + int ret; + + if (!MLX5_CAP_GEN(dev, fast_teardown)) { + mlx5_core_dbg(dev, "fast teardown is not supported in the firmware\n"); + return -EOPNOTSUPP; + } + + MLX5_SET(teardown_hca_in, in, opcode, MLX5_CMD_OP_TEARDOWN_HCA); + MLX5_SET(teardown_hca_in, in, profile, + MLX5_TEARDOWN_HCA_IN_PROFILE_PREPARE_FAST_TEARDOWN); + + ret = mlx5_cmd_exec(dev, in, sizeof(in), out, sizeof(out)); + if (ret) + return ret; + + state = MLX5_GET(teardown_hca_out, out, state); + if (state == MLX5_TEARDOWN_HCA_OUT_FORCE_STATE_FAIL) { + mlx5_core_warn(dev, "teardown with fast mode failed\n"); + return -EIO; + } + + mlx5_set_nic_state(dev, MLX5_NIC_IFC_DISABLED); + + /* Loop until device state turns to disable */ + end = jiffies + msecs_to_jiffies(delay_ms); + do { + if (mlx5_get_nic_state(dev) == MLX5_NIC_IFC_DISABLED) + break; + + pause("W", 1); + } while (!time_after(jiffies, end)); + + if (mlx5_get_nic_state(dev) != MLX5_NIC_IFC_DISABLED) { + dev_err(&dev->pdev->dev, "NIC IFC still %d after %ums.\n", + mlx5_get_nic_state(dev), delay_ms); + return -EIO; + } return 0; } Modified: stable/12/sys/dev/mlx5/mlx5_core/mlx5_main.c ============================================================================== --- stable/12/sys/dev/mlx5/mlx5_core/mlx5_main.c Thu May 16 15:57:14 2019 (r347731) +++ stable/12/sys/dev/mlx5/mlx5_core/mlx5_main.c Thu May 16 15:57:59 2019 (r347732) @@ -1415,12 +1415,17 @@ static const struct pci_error_handlers mlx5_err_handle static int mlx5_try_fast_unload(struct mlx5_core_dev *dev) { + bool fast_teardown, force_teardown; int err; - if (!MLX5_CAP_GEN(dev, force_teardown)) { - mlx5_core_dbg(dev, "force teardown is not supported in the firmware\n"); + fast_teardown = MLX5_CAP_GEN(dev, fast_teardown); + force_teardown = MLX5_CAP_GEN(dev, force_teardown); + + mlx5_core_dbg(dev, "force teardown firmware support=%d\n", force_teardown); + mlx5_core_dbg(dev, "fast teardown firmware support=%d\n", fast_teardown); + + if (!fast_teardown && !force_teardown) return -EOPNOTSUPP; - } if (dev->state == MLX5_DEVICE_STATE_INTERNAL_ERROR) { mlx5_core_dbg(dev, "Device in internal error state, giving up\n"); @@ -1433,14 +1438,19 @@ static int mlx5_try_fast_unload(struct mlx5_core_dev * mlx5_drain_health_wq(dev); mlx5_stop_health_poll(dev, false); + err = mlx5_cmd_fast_teardown_hca(dev); + if (!err) + goto done; + err = mlx5_cmd_force_teardown_hca(dev); - if (err) { - mlx5_core_dbg(dev, "Firmware couldn't do fast unload error: %d\n", err); - return err; - } + if (!err) + goto done; + mlx5_core_dbg(dev, "Firmware couldn't do fast unload error: %d\n", err); + mlx5_start_health_poll(dev); + return err; +done: mlx5_enter_error_state(dev, true); - return 0; } Modified: stable/12/sys/dev/mlx5/mlx5_ifc.h ============================================================================== --- stable/12/sys/dev/mlx5/mlx5_ifc.h Thu May 16 15:57:14 2019 (r347731) +++ stable/12/sys/dev/mlx5/mlx5_ifc.h Thu May 16 15:57:59 2019 (r347732) @@ -1054,7 +1054,8 @@ struct mlx5_ifc_cmd_hca_cap_bits { u8 relaxed_ordering_write[1]; u8 reserved_6[0x1]; u8 log_max_mkey[0x6]; - u8 reserved_7[0xc]; + u8 reserved_7[0xb]; + u8 fast_teardown[0x1]; u8 log_max_eq[0x4]; u8 max_indirection[0x8]; @@ -3289,12 +3290,13 @@ struct mlx5_ifc_teardown_hca_out_bits { u8 reserved_1[0x3f]; - u8 force_state[0x1]; + u8 state[0x1]; }; enum { MLX5_TEARDOWN_HCA_IN_PROFILE_GRACEFUL_CLOSE = 0x0, MLX5_TEARDOWN_HCA_IN_PROFILE_FORCE_CLOSE = 0x1, + MLX5_TEARDOWN_HCA_IN_PROFILE_PREPARE_FAST_TEARDOWN = 0x2, }; struct mlx5_ifc_teardown_hca_in_bits { From owner-svn-src-stable@freebsd.org Thu May 16 15:58:38 2019 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id C53B4159BCAD; Thu, 16 May 2019 15:58:38 +0000 (UTC) (envelope-from hselasky@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 6B1698634B; Thu, 16 May 2019 15:58:38 +0000 (UTC) (envelope-from hselasky@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 4366523044; Thu, 16 May 2019 15:58:38 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x4GFwcU1052497; Thu, 16 May 2019 15:58:38 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x4GFwcQV052496; Thu, 16 May 2019 15:58:38 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201905161558.x4GFwcQV052496@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Thu, 16 May 2019 15:58:38 +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: r347733 - stable/12/sys/dev/mlx5/mlx5_core X-SVN-Group: stable-12 X-SVN-Commit-Author: hselasky X-SVN-Commit-Paths: stable/12/sys/dev/mlx5/mlx5_core X-SVN-Commit-Revision: 347733 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 6B1698634B X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.97 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.998,0]; NEURAL_HAM_SHORT(-0.97)[-0.969,0]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US] X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 16 May 2019 15:58:38 -0000 Author: hselasky Date: Thu May 16 15:58:37 2019 New Revision: 347733 URL: https://svnweb.freebsd.org/changeset/base/347733 Log: MFC r347269: Add sysctl(8) to control fast unload support in mlx5core. Sponsored by: Mellanox Technologies Modified: stable/12/sys/dev/mlx5/mlx5_core/mlx5_main.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/dev/mlx5/mlx5_core/mlx5_main.c ============================================================================== --- stable/12/sys/dev/mlx5/mlx5_core/mlx5_main.c Thu May 16 15:57:59 2019 (r347732) +++ stable/12/sys/dev/mlx5/mlx5_core/mlx5_main.c Thu May 16 15:58:37 2019 (r347733) @@ -1,5 +1,5 @@ /*- - * Copyright (c) 2013-2017, Mellanox Technologies, Ltd. All rights reserved. + * Copyright (c) 2013-2019, Mellanox Technologies, Ltd. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -68,6 +68,11 @@ MODULE_PARM_DESC(prof_sel, "profile selector. Valid ra SYSCTL_NODE(_hw, OID_AUTO, mlx5, CTLFLAG_RW, 0, "mlx5 HW controls"); +static int mlx5_fast_unload_enabled = 1; +SYSCTL_INT(_hw_mlx5, OID_AUTO, fast_unload_enabled, CTLFLAG_RWTUN, + &mlx5_fast_unload_enabled, 0, + "Set to enable fast unload. Clear to disable."); + #define NUMA_NO_NODE -1 static LIST_HEAD(intf_list); @@ -1417,6 +1422,11 @@ static int mlx5_try_fast_unload(struct mlx5_core_dev * { bool fast_teardown, force_teardown; int err; + + if (!mlx5_fast_unload_enabled) { + mlx5_core_dbg(dev, "fast unload is disabled by user\n"); + return -EOPNOTSUPP; + } fast_teardown = MLX5_CAP_GEN(dev, fast_teardown); force_teardown = MLX5_CAP_GEN(dev, force_teardown); From owner-svn-src-stable@freebsd.org Thu May 16 15:59:25 2019 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 6AB33159BD7E; Thu, 16 May 2019 15:59:25 +0000 (UTC) (envelope-from hselasky@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 F327B864CA; Thu, 16 May 2019 15:59:24 +0000 (UTC) (envelope-from hselasky@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 D75FE23047; Thu, 16 May 2019 15:59:24 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x4GFxOlC052598; Thu, 16 May 2019 15:59:24 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x4GFxOnP052595; Thu, 16 May 2019 15:59:24 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201905161559.x4GFxOnP052595@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Thu, 16 May 2019 15:59:24 +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: r347734 - stable/12/sys/dev/mlx5 X-SVN-Group: stable-12 X-SVN-Commit-Author: hselasky X-SVN-Commit-Paths: stable/12/sys/dev/mlx5 X-SVN-Commit-Revision: 347734 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: F327B864CA X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.97 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.998,0]; NEURAL_HAM_SHORT(-0.97)[-0.970,0]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US] X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 16 May 2019 15:59:25 -0000 Author: hselasky Date: Thu May 16 15:59:23 2019 New Revision: 347734 URL: https://svnweb.freebsd.org/changeset/base/347734 Log: MFC r347270: Expose PCAM, MCAM registers infrastructure in mlx5core. PCAM: Ports capabilities mask register. MCAM: Management capabilities mask register. PCAM and MCAM registers will provide information regarding firmware support for different features, in order to avoid cases where new driver combined with old firmware results in syndromes (for ex. PCIe counters before this patchset). Linux commit: cfdcbceaeffc669b70d904d80a2df9c86c232566 Submitted by: slavash@ Sponsored by: Mellanox Technologies Modified: stable/12/sys/dev/mlx5/device.h stable/12/sys/dev/mlx5/driver.h stable/12/sys/dev/mlx5/mlx5_ifc.h Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/dev/mlx5/device.h ============================================================================== --- stable/12/sys/dev/mlx5/device.h Thu May 16 15:58:37 2019 (r347733) +++ stable/12/sys/dev/mlx5/device.h Thu May 16 15:59:23 2019 (r347734) @@ -929,6 +929,22 @@ enum mlx5_qcam_feature_groups { MLX5_QCAM_FEATURE_ENHANCED_FEATURES = 0x0, }; +enum mlx5_pcam_reg_groups { + MLX5_PCAM_REGS_5000_TO_507F = 0x0, +}; + +enum mlx5_pcam_feature_groups { + MLX5_PCAM_FEATURE_ENHANCED_FEATURES = 0x0, +}; + +enum mlx5_mcam_reg_groups { + MLX5_MCAM_REGS_FIRST_128 = 0x0, +}; + +enum mlx5_mcam_feature_groups { + MLX5_MCAM_FEATURE_ENHANCED_FEATURES = 0x0, +}; + /* GET Dev Caps macros */ #define MLX5_CAP_GEN(mdev, cap) \ MLX5_GET(cmd_hca_cap, mdev->hca_caps_cur[MLX5_CAP_GENERAL], cap) Modified: stable/12/sys/dev/mlx5/driver.h ============================================================================== --- stable/12/sys/dev/mlx5/driver.h Thu May 16 15:58:37 2019 (r347733) +++ stable/12/sys/dev/mlx5/driver.h Thu May 16 15:59:23 2019 (r347734) @@ -149,11 +149,13 @@ enum { MLX5_REG_PELC = 0x500e, MLX5_REG_PVLC = 0x500f, MLX5_REG_PMLP = 0x5002, + MLX5_REG_PCAM = 0x507f, MLX5_REG_NODE_DESC = 0x6001, MLX5_REG_HOST_ENDIANNESS = 0x7004, MLX5_REG_MTMP = 0x900a, MLX5_REG_MCIA = 0x9014, MLX5_REG_MPCNT = 0x9051, + MLX5_REG_MCAM = 0x907f, }; enum dbg_rsc_type { Modified: stable/12/sys/dev/mlx5/mlx5_ifc.h ============================================================================== --- stable/12/sys/dev/mlx5/mlx5_ifc.h Thu May 16 15:58:37 2019 (r347733) +++ stable/12/sys/dev/mlx5/mlx5_ifc.h Thu May 16 15:59:23 2019 (r347734) @@ -1103,7 +1103,9 @@ struct mlx5_ifc_cmd_hca_cap_bits { u8 ets[0x1]; u8 nic_flow_table[0x1]; u8 eswitch_flow_table[0x1]; - u8 reserved_18[0x3]; + u8 reserved_18[0x1]; + u8 mcam_reg[0x1]; + u8 pcam_reg[0x1]; u8 local_ca_ack_delay[0x5]; u8 port_module_event[0x1]; u8 reserved_19[0x5]; @@ -8544,6 +8546,63 @@ struct mlx5_ifc_qcam_reg_bits { struct mlx5_ifc_qcam_qos_feature_cap_mask feature_cap; u8 reserved_at_0[0x80]; } qos_feature_cap_mask; + + u8 reserved_at_1c0[0x80]; +}; + +struct mlx5_ifc_pcam_enhanced_features_bits { + u8 reserved_at_0[0x7e]; + + u8 ppcnt_discard_group[0x1]; + u8 ppcnt_statistical_group[0x1]; +}; + +struct mlx5_ifc_pcam_reg_bits { + u8 reserved_at_0[0x8]; + u8 feature_group[0x8]; + u8 reserved_at_10[0x8]; + u8 access_reg_group[0x8]; + + u8 reserved_at_20[0x20]; + + union { + u8 reserved_at_0[0x80]; + } port_access_reg_cap_mask; + + u8 reserved_at_c0[0x80]; + + union { + struct mlx5_ifc_pcam_enhanced_features_bits enhanced_features; + u8 reserved_at_0[0x80]; + } feature_cap_mask; + + u8 reserved_at_1c0[0xc0]; +}; + +struct mlx5_ifc_mcam_enhanced_features_bits { + u8 reserved_at_0[0x7f]; + + u8 pcie_performance_group[0x1]; +}; + +struct mlx5_ifc_mcam_reg_bits { + u8 reserved_at_0[0x8]; + u8 feature_group[0x8]; + u8 reserved_at_10[0x8]; + u8 access_reg_group[0x8]; + + u8 reserved_at_20[0x20]; + + union { + u8 reserved_at_0[0x80]; + } mng_access_reg_cap_mask; + + u8 reserved_at_c0[0x80]; + + union { + struct mlx5_ifc_mcam_enhanced_features_bits enhanced_features; + u8 reserved_at_0[0x80]; + } mng_feature_cap_mask; u8 reserved_at_1c0[0x80]; }; From owner-svn-src-stable@freebsd.org Thu May 16 16:00:01 2019 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 3F1BA159BE17; Thu, 16 May 2019 16:00:01 +0000 (UTC) (envelope-from hselasky@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 CFBAC86630; Thu, 16 May 2019 16:00:00 +0000 (UTC) (envelope-from hselasky@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 AAA482304C; Thu, 16 May 2019 16:00:00 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x4GG000E052741; Thu, 16 May 2019 16:00:00 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x4GG00bl052739; Thu, 16 May 2019 16:00:00 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201905161600.x4GG00bl052739@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Thu, 16 May 2019 16:00:00 +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: r347735 - stable/12/sys/dev/mlx5/mlx5_core X-SVN-Group: stable-12 X-SVN-Commit-Author: hselasky X-SVN-Commit-Paths: stable/12/sys/dev/mlx5/mlx5_core X-SVN-Commit-Revision: 347735 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: CFBAC86630 X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.97 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.998,0]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; NEURAL_HAM_SHORT(-0.97)[-0.970,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US] X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 16 May 2019 16:00:01 -0000 Author: hselasky Date: Thu May 16 16:00:00 2019 New Revision: 347735 URL: https://svnweb.freebsd.org/changeset/base/347735 Log: MFC r347271: Implement PCAM, MCAM access register commands in mlx5core. Introduced registers will expose capabilities of new registers and features related to port/management. Driver will query MCAM and PCAM in order to avoid failing on old firmwares with lack of support. Linux commit: c835ad64683bd3e2d1b31ed2cb1ff4366932edb1 Submitted by: slavash@ Sponsored by: Mellanox Technologies Modified: stable/12/sys/dev/mlx5/mlx5_core/mlx5_core.h stable/12/sys/dev/mlx5/mlx5_core/mlx5_port.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/dev/mlx5/mlx5_core/mlx5_core.h ============================================================================== --- stable/12/sys/dev/mlx5/mlx5_core/mlx5_core.h Thu May 16 15:59:23 2019 (r347734) +++ stable/12/sys/dev/mlx5/mlx5_core/mlx5_core.h Thu May 16 16:00:00 2019 (r347735) @@ -76,6 +76,10 @@ int mlx5_query_hca_caps(struct mlx5_core_dev *dev); int mlx5_query_board_id(struct mlx5_core_dev *dev); int mlx5_query_qcam_reg(struct mlx5_core_dev *mdev, u32 *qcam, u8 feature_group, u8 access_reg_group); +int mlx5_query_pcam_reg(struct mlx5_core_dev *dev, u32 *pcam, + u8 feature_group, u8 access_reg_group); +int mlx5_query_mcam_reg(struct mlx5_core_dev *dev, u32 *mcap, + u8 feature_group, u8 access_reg_group); int mlx5_cmd_init_hca(struct mlx5_core_dev *dev); int mlx5_cmd_teardown_hca(struct mlx5_core_dev *dev); int mlx5_cmd_force_teardown_hca(struct mlx5_core_dev *dev); Modified: stable/12/sys/dev/mlx5/mlx5_core/mlx5_port.c ============================================================================== --- stable/12/sys/dev/mlx5/mlx5_core/mlx5_port.c Thu May 16 15:59:23 2019 (r347734) +++ stable/12/sys/dev/mlx5/mlx5_core/mlx5_port.c Thu May 16 16:00:00 2019 (r347735) @@ -79,6 +79,30 @@ int mlx5_query_qcam_reg(struct mlx5_core_dev *mdev, u3 } EXPORT_SYMBOL_GPL(mlx5_query_qcam_reg); +int mlx5_query_pcam_reg(struct mlx5_core_dev *dev, u32 *pcam, u8 feature_group, + u8 access_reg_group) +{ + u32 in[MLX5_ST_SZ_DW(pcam_reg)] = {}; + int sz = MLX5_ST_SZ_BYTES(pcam_reg); + + MLX5_SET(pcam_reg, in, feature_group, feature_group); + MLX5_SET(pcam_reg, in, access_reg_group, access_reg_group); + + return mlx5_core_access_reg(dev, in, sz, pcam, sz, MLX5_REG_PCAM, 0, 0); +} + +int mlx5_query_mcam_reg(struct mlx5_core_dev *dev, u32 *mcam, u8 feature_group, + u8 access_reg_group) +{ + u32 in[MLX5_ST_SZ_DW(mcam_reg)] = {}; + int sz = MLX5_ST_SZ_BYTES(mcam_reg); + + MLX5_SET(mcam_reg, in, feature_group, feature_group); + MLX5_SET(mcam_reg, in, access_reg_group, access_reg_group); + + return mlx5_core_access_reg(dev, in, sz, mcam, sz, MLX5_REG_MCAM, 0, 0); +} + struct mlx5_reg_pcap { u8 rsvd0; u8 port_num; From owner-svn-src-stable@freebsd.org Thu May 16 16:00:39 2019 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 2C1F8159BED6; Thu, 16 May 2019 16:00:39 +0000 (UTC) (envelope-from hselasky@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 BEE4C86845; Thu, 16 May 2019 16:00:38 +0000 (UTC) (envelope-from hselasky@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 9A41923054; Thu, 16 May 2019 16:00:38 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x4GG0cCn053043; Thu, 16 May 2019 16:00:38 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x4GG0cjv053040; Thu, 16 May 2019 16:00:38 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201905161600.x4GG0cjv053040@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Thu, 16 May 2019 16:00:38 +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: r347736 - in stable/12/sys/dev/mlx5: . mlx5_core X-SVN-Group: stable-12 X-SVN-Commit-Author: hselasky X-SVN-Commit-Paths: in stable/12/sys/dev/mlx5: . mlx5_core X-SVN-Commit-Revision: 347736 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: BEE4C86845 X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.97 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.998,0]; NEURAL_HAM_SHORT(-0.97)[-0.970,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US]; NEURAL_HAM_LONG(-1.00)[-1.000,0] X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 16 May 2019 16:00:39 -0000 Author: hselasky Date: Thu May 16 16:00:37 2019 New Revision: 347736 URL: https://svnweb.freebsd.org/changeset/base/347736 Log: MFC r347272: Query and cache PCAM, MCAM registers on initialization in mlx5core. On load_one, we now cache our capabilities registers internally, similar to QUERY_HCA_CAP. Capabilities can later be queried using macros introduced in this patch. Linux commit: 71862561f3a62015a11de16d1c306481e8415c08 Submitted by: slavash@ Sponsored by: Mellanox Technologies Modified: stable/12/sys/dev/mlx5/device.h stable/12/sys/dev/mlx5/driver.h stable/12/sys/dev/mlx5/mlx5_core/mlx5_fw.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/dev/mlx5/device.h ============================================================================== --- stable/12/sys/dev/mlx5/device.h Thu May 16 16:00:00 2019 (r347735) +++ stable/12/sys/dev/mlx5/device.h Thu May 16 16:00:37 2019 (r347736) @@ -1050,6 +1050,12 @@ enum mlx5_mcam_feature_groups { MLX5_GET(qos_cap,\ mdev->hca_caps_max[MLX5_CAP_QOS], cap) +#define MLX5_CAP_PCAM_FEATURE(mdev, fld) \ + MLX5_GET(pcam_reg, (mdev)->caps.pcam, feature_cap_mask.enhanced_features.fld) + +#define MLX5_CAP_MCAM_FEATURE(mdev, fld) \ + MLX5_GET(mcam_reg, (mdev)->caps.mcam, mng_feature_cap_mask.enhanced_features.fld) + #define MLX5_CAP_QCAM_REG(mdev, fld) \ MLX5_GET(qcam_reg, (mdev)->caps.qcam, qos_access_reg_cap_mask.reg_cap.fld) Modified: stable/12/sys/dev/mlx5/driver.h ============================================================================== --- stable/12/sys/dev/mlx5/driver.h Thu May 16 16:00:00 2019 (r347735) +++ stable/12/sys/dev/mlx5/driver.h Thu May 16 16:00:37 2019 (r347736) @@ -699,6 +699,8 @@ struct mlx5_core_dev { u32 hca_caps_cur[MLX5_CAP_NUM][MLX5_UN_SZ_DW(hca_cap_union)]; u32 hca_caps_max[MLX5_CAP_NUM][MLX5_UN_SZ_DW(hca_cap_union)]; struct { + u32 pcam[MLX5_ST_SZ_DW(pcam_reg)]; + u32 mcam[MLX5_ST_SZ_DW(mcam_reg)]; u32 qcam[MLX5_ST_SZ_DW(qcam_reg)]; u32 fpga[MLX5_ST_SZ_DW(fpga_cap)]; } caps; Modified: stable/12/sys/dev/mlx5/mlx5_core/mlx5_fw.c ============================================================================== --- stable/12/sys/dev/mlx5/mlx5_core/mlx5_fw.c Thu May 16 16:00:00 2019 (r347735) +++ stable/12/sys/dev/mlx5/mlx5_core/mlx5_fw.c Thu May 16 16:00:37 2019 (r347736) @@ -117,6 +117,20 @@ static int mlx5_get_qcam_reg(struct mlx5_core_dev *dev MLX5_QCAM_REGS_FIRST_128); } +static int mlx5_get_pcam_reg(struct mlx5_core_dev *dev) +{ + return mlx5_query_pcam_reg(dev, dev->caps.pcam, + MLX5_PCAM_FEATURE_ENHANCED_FEATURES, + MLX5_PCAM_REGS_5000_TO_507F); +} + +static int mlx5_get_mcam_reg(struct mlx5_core_dev *dev) +{ + return mlx5_query_mcam_reg(dev, dev->caps.mcam, + MLX5_MCAM_FEATURE_ENHANCED_FEATURES, + MLX5_MCAM_REGS_FIRST_128); +} + int mlx5_query_hca_caps(struct mlx5_core_dev *dev) { int err; From owner-svn-src-stable@freebsd.org Thu May 16 16:01:12 2019 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 6C5AA159BF4B; Thu, 16 May 2019 16:01:12 +0000 (UTC) (envelope-from hselasky@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 0D275869FC; Thu, 16 May 2019 16:01:12 +0000 (UTC) (envelope-from hselasky@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 D9F722317F; Thu, 16 May 2019 16:01:11 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x4GG1B4i056345; Thu, 16 May 2019 16:01:11 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x4GG1BRt056344; Thu, 16 May 2019 16:01:11 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201905161601.x4GG1BRt056344@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Thu, 16 May 2019 16:01:11 +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: r347737 - stable/12/sys/dev/mlx5/mlx5_core X-SVN-Group: stable-12 X-SVN-Commit-Author: hselasky X-SVN-Commit-Paths: stable/12/sys/dev/mlx5/mlx5_core X-SVN-Commit-Revision: 347737 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 0D275869FC X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.97 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.998,0]; NEURAL_HAM_SHORT(-0.97)[-0.969,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US]; NEURAL_HAM_LONG(-1.00)[-1.000,0] X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 16 May 2019 16:01:12 -0000 Author: hselasky Date: Thu May 16 16:01:11 2019 New Revision: 347737 URL: https://svnweb.freebsd.org/changeset/base/347737 Log: MFC r347273: Add reading the mcam_reg in mlx5core. Submitted by: slavash@ Sponsored by: Mellanox Technologies Modified: stable/12/sys/dev/mlx5/mlx5_core/mlx5_fw.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/dev/mlx5/mlx5_core/mlx5_fw.c ============================================================================== --- stable/12/sys/dev/mlx5/mlx5_core/mlx5_fw.c Thu May 16 16:00:37 2019 (r347736) +++ stable/12/sys/dev/mlx5/mlx5_core/mlx5_fw.c Thu May 16 16:01:11 2019 (r347737) @@ -215,6 +215,12 @@ int mlx5_query_hca_caps(struct mlx5_core_dev *dev) return err; } + if (MLX5_CAP_GEN(dev, mcam_reg)) { + err = mlx5_get_mcam_reg(dev); + if (err) + return err; + } + err = mlx5_core_query_special_contexts(dev); if (err) return err; From owner-svn-src-stable@freebsd.org Thu May 16 16:01:46 2019 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 67AFF159C008; Thu, 16 May 2019 16:01:46 +0000 (UTC) (envelope-from hselasky@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 C650B86BBC; Thu, 16 May 2019 16:01:45 +0000 (UTC) (envelope-from hselasky@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 B8197231A8; Thu, 16 May 2019 16:01:45 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x4GG1jNF057386; Thu, 16 May 2019 16:01:45 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x4GG1jpB057384; Thu, 16 May 2019 16:01:45 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201905161601.x4GG1jpB057384@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Thu, 16 May 2019 16:01:45 +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: r347738 - stable/12/sys/dev/mlx5 X-SVN-Group: stable-12 X-SVN-Commit-Author: hselasky X-SVN-Commit-Paths: stable/12/sys/dev/mlx5 X-SVN-Commit-Revision: 347738 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: C650B86BBC X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.97 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.998,0]; NEURAL_HAM_SHORT(-0.97)[-0.970,0]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US] X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 16 May 2019 16:01:46 -0000 Author: hselasky Date: Thu May 16 16:01:45 2019 New Revision: 347738 URL: https://svnweb.freebsd.org/changeset/base/347738 Log: MFC r347274: Add MCC (Management Component Control) register definitions in mlx5core. MCC (Management Component Control) allows to control a firmware component update. MCDA (Management Component Data Access) allows to read and write a firmware component. MCQI (Management Component Query Information) allows to query information about firmware components. Linux commit: 4717628938423fcba0aa8fa889e9fed4eb6a655f Submitted by: slavash@ Sponsored by: Mellanox Technologies Modified: stable/12/sys/dev/mlx5/driver.h stable/12/sys/dev/mlx5/mlx5_ifc.h Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/dev/mlx5/driver.h ============================================================================== --- stable/12/sys/dev/mlx5/driver.h Thu May 16 16:01:11 2019 (r347737) +++ stable/12/sys/dev/mlx5/driver.h Thu May 16 16:01:45 2019 (r347738) @@ -155,6 +155,9 @@ enum { MLX5_REG_MTMP = 0x900a, MLX5_REG_MCIA = 0x9014, MLX5_REG_MPCNT = 0x9051, + MLX5_REG_MCQI = 0x9061, + MLX5_REG_MCC = 0x9062, + MLX5_REG_MCDA = 0x9063, MLX5_REG_MCAM = 0x907f, }; Modified: stable/12/sys/dev/mlx5/mlx5_ifc.h ============================================================================== --- stable/12/sys/dev/mlx5/mlx5_ifc.h Thu May 16 16:01:11 2019 (r347737) +++ stable/12/sys/dev/mlx5/mlx5_ifc.h Thu May 16 16:01:45 2019 (r347738) @@ -9927,6 +9927,85 @@ struct mlx5_ifc_mpcnt_reg_bits { union mlx5_ifc_mpcnt_cntrs_grp_data_layout_bits counter_set; }; +struct mlx5_ifc_mcqi_cap_bits { + u8 supported_info_bitmask[0x20]; + + u8 component_size[0x20]; + + u8 max_component_size[0x20]; + + u8 log_mcda_word_size[0x4]; + u8 reserved_at_64[0xc]; + u8 mcda_max_write_size[0x10]; + + u8 rd_en[0x1]; + u8 reserved_at_81[0x1]; + u8 match_chip_id[0x1]; + u8 match_psid[0x1]; + u8 check_user_timestamp[0x1]; + u8 match_base_guid_mac[0x1]; + u8 reserved_at_86[0x1a]; +}; + +struct mlx5_ifc_mcqi_reg_bits { + u8 read_pending_component[0x1]; + u8 reserved_at_1[0xf]; + u8 component_index[0x10]; + + u8 reserved_at_20[0x20]; + + u8 reserved_at_40[0x1b]; + u8 info_type[0x5]; + + u8 info_size[0x20]; + + u8 offset[0x20]; + + u8 reserved_at_a0[0x10]; + u8 data_size[0x10]; + + u8 data[0][0x20]; +}; + +struct mlx5_ifc_mcc_reg_bits { + u8 reserved_at_0[0x4]; + u8 time_elapsed_since_last_cmd[0xc]; + u8 reserved_at_10[0x8]; + u8 instruction[0x8]; + + u8 reserved_at_20[0x10]; + u8 component_index[0x10]; + + u8 reserved_at_40[0x8]; + u8 update_handle[0x18]; + + u8 handle_owner_type[0x4]; + u8 handle_owner_host_id[0x4]; + u8 reserved_at_68[0x1]; + u8 control_progress[0x7]; + u8 error_code[0x8]; + u8 reserved_at_78[0x4]; + u8 control_state[0x4]; + + u8 component_size[0x20]; + + u8 reserved_at_a0[0x60]; +}; + +struct mlx5_ifc_mcda_reg_bits { + u8 reserved_at_0[0x8]; + u8 update_handle[0x18]; + + u8 offset[0x20]; + + u8 reserved_at_40[0x10]; + u8 size[0x10]; + + u8 reserved_at_60[0x20]; + + u8 data[0][0x20]; +}; + union mlx5_ifc_ports_control_registers_document_bits { struct mlx5_ifc_ib_portcntrs_attribute_grp_data_bits ib_portcntrs_attribute_grp_data; struct mlx5_ifc_bufferx_reg_bits bufferx_reg; From owner-svn-src-stable@freebsd.org Thu May 16 16:02:21 2019 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 459F5159C212; Thu, 16 May 2019 16:02:21 +0000 (UTC) (envelope-from hselasky@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 8817386E98; Thu, 16 May 2019 16:02:20 +0000 (UTC) (envelope-from hselasky@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 5C61E231DA; Thu, 16 May 2019 16:02:20 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x4GG2K2h058281; Thu, 16 May 2019 16:02:20 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x4GG2KUk058280; Thu, 16 May 2019 16:02:20 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201905161602.x4GG2KUk058280@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Thu, 16 May 2019 16:02:20 +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: r347739 - stable/12/sys/dev/mlx5 X-SVN-Group: stable-12 X-SVN-Commit-Author: hselasky X-SVN-Commit-Paths: stable/12/sys/dev/mlx5 X-SVN-Commit-Revision: 347739 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 8817386E98 X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.97 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.998,0]; NEURAL_HAM_SHORT(-0.97)[-0.969,0]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US] X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 16 May 2019 16:02:21 -0000 Author: hselasky Date: Thu May 16 16:02:19 2019 New Revision: 347739 URL: https://svnweb.freebsd.org/changeset/base/347739 Log: MFC r347275: Enhance MCAM reg to allow query on access reg support in mlx5core. Enhance MCAM to allow the driver to query which access regs are supported. For now, expose the regs needed for FW flashing. Linux commit: 0ab87743cc8c5bcd482daf71961ed5fc45349e01 Submitted by: slavash@ Sponsored by: Mellanox Technologies Modified: stable/12/sys/dev/mlx5/device.h stable/12/sys/dev/mlx5/mlx5_ifc.h Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/dev/mlx5/device.h ============================================================================== --- stable/12/sys/dev/mlx5/device.h Thu May 16 16:01:45 2019 (r347738) +++ stable/12/sys/dev/mlx5/device.h Thu May 16 16:02:19 2019 (r347739) @@ -1056,6 +1056,9 @@ enum mlx5_mcam_feature_groups { #define MLX5_CAP_MCAM_FEATURE(mdev, fld) \ MLX5_GET(mcam_reg, (mdev)->caps.mcam, mng_feature_cap_mask.enhanced_features.fld) +#define MLX5_CAP_MCAM_REG(mdev, reg) \ + MLX5_GET(mcam_reg, (mdev)->caps.mcam, mng_access_reg_cap_mask.access_regs.reg) + #define MLX5_CAP_QCAM_REG(mdev, fld) \ MLX5_GET(qcam_reg, (mdev)->caps.qcam, qos_access_reg_cap_mask.reg_cap.fld) Modified: stable/12/sys/dev/mlx5/mlx5_ifc.h ============================================================================== --- stable/12/sys/dev/mlx5/mlx5_ifc.h Thu May 16 16:01:45 2019 (r347738) +++ stable/12/sys/dev/mlx5/mlx5_ifc.h Thu May 16 16:02:19 2019 (r347739) @@ -8585,6 +8585,18 @@ struct mlx5_ifc_mcam_enhanced_features_bits { u8 pcie_performance_group[0x1]; }; +struct mlx5_ifc_mcam_access_reg_bits { + u8 reserved_at_0[0x1c]; + u8 mcda[0x1]; + u8 mcc[0x1]; + u8 mcqi[0x1]; + u8 reserved_at_1f[0x1]; + + u8 regs_95_to_64[0x20]; + u8 regs_63_to_32[0x20]; + u8 regs_31_to_0[0x20]; +}; + struct mlx5_ifc_mcam_reg_bits { u8 reserved_at_0[0x8]; u8 feature_group[0x8]; @@ -8594,6 +8606,7 @@ struct mlx5_ifc_mcam_reg_bits { u8 reserved_at_20[0x20]; union { + struct mlx5_ifc_mcam_access_reg_bits access_regs; u8 reserved_at_0[0x80]; } mng_access_reg_cap_mask; From owner-svn-src-stable@freebsd.org Thu May 16 16:03:04 2019 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 05B61159C2C0; Thu, 16 May 2019 16:03:03 +0000 (UTC) (envelope-from hselasky@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 7B99087035; Thu, 16 May 2019 16:03:03 +0000 (UTC) (envelope-from hselasky@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 53D5E231ED; Thu, 16 May 2019 16:03:03 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x4GG33Po058373; Thu, 16 May 2019 16:03:03 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x4GG33ZY058372; Thu, 16 May 2019 16:03:03 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201905161603.x4GG33ZY058372@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Thu, 16 May 2019 16:03:03 +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: r347740 - stable/12/sys/dev/mlx5/mlx5_core X-SVN-Group: stable-12 X-SVN-Commit-Author: hselasky X-SVN-Commit-Paths: stable/12/sys/dev/mlx5/mlx5_core X-SVN-Commit-Revision: 347740 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 7B99087035 X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.97 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.998,0]; NEURAL_HAM_SHORT(-0.97)[-0.970,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US]; NEURAL_HAM_LONG(-1.00)[-1.000,0] X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 16 May 2019 16:03:04 -0000 Author: hselasky Date: Thu May 16 16:03:02 2019 New Revision: 347740 URL: https://svnweb.freebsd.org/changeset/base/347740 Log: MFC r347276: Add helper functions to set/query MCC/MCDA/MCQI registers in mlx5core. To be used by the mlx5 callbacks exposed to the mlxfw module. Linux commit: d2ad488b0073bd1a2c3f5d2ea50a7eb632103e5d Submitted by: slavash@ Sponsored by: Mellanox Technologies Modified: stable/12/sys/dev/mlx5/mlx5_core/mlx5_fw.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/dev/mlx5/mlx5_core/mlx5_fw.c ============================================================================== --- stable/12/sys/dev/mlx5/mlx5_core/mlx5_fw.c Thu May 16 16:02:19 2019 (r347739) +++ stable/12/sys/dev/mlx5/mlx5_core/mlx5_fw.c Thu May 16 16:03:02 2019 (r347740) @@ -341,3 +341,117 @@ int mlx5_core_set_dc_cnak_trace(struct mlx5_core_dev * return mlx5_cmd_exec(dev, &in, sizeof(in), &out, sizeof(out)); } + +enum mlxsw_reg_mcc_instruction { + MLX5_REG_MCC_INSTRUCTION_LOCK_UPDATE_HANDLE = 0x01, + MLX5_REG_MCC_INSTRUCTION_RELEASE_UPDATE_HANDLE = 0x02, + MLX5_REG_MCC_INSTRUCTION_UPDATE_COMPONENT = 0x03, + MLX5_REG_MCC_INSTRUCTION_VERIFY_COMPONENT = 0x04, + MLX5_REG_MCC_INSTRUCTION_ACTIVATE = 0x06, + MLX5_REG_MCC_INSTRUCTION_CANCEL = 0x08, +}; + +static int mlx5_reg_mcc_set(struct mlx5_core_dev *dev, + enum mlxsw_reg_mcc_instruction instr, + u16 component_index, u32 update_handle, + u32 component_size) +{ + u32 out[MLX5_ST_SZ_DW(mcc_reg)]; + u32 in[MLX5_ST_SZ_DW(mcc_reg)]; + + memset(in, 0, sizeof(in)); + + MLX5_SET(mcc_reg, in, instruction, instr); + MLX5_SET(mcc_reg, in, component_index, component_index); + MLX5_SET(mcc_reg, in, update_handle, update_handle); + MLX5_SET(mcc_reg, in, component_size, component_size); + + return mlx5_core_access_reg(dev, in, sizeof(in), out, + sizeof(out), MLX5_REG_MCC, 0, 1); +} + +static int mlx5_reg_mcc_query(struct mlx5_core_dev *dev, + u32 *update_handle, u8 *error_code, + u8 *control_state) +{ + u32 out[MLX5_ST_SZ_DW(mcc_reg)]; + u32 in[MLX5_ST_SZ_DW(mcc_reg)]; + int err; + + memset(in, 0, sizeof(in)); + memset(out, 0, sizeof(out)); + MLX5_SET(mcc_reg, in, update_handle, *update_handle); + + err = mlx5_core_access_reg(dev, in, sizeof(in), out, + sizeof(out), MLX5_REG_MCC, 0, 0); + if (err) + goto out; + + *update_handle = MLX5_GET(mcc_reg, out, update_handle); + *error_code = MLX5_GET(mcc_reg, out, error_code); + *control_state = MLX5_GET(mcc_reg, out, control_state); + +out: + return err; +} + +static int mlx5_reg_mcda_set(struct mlx5_core_dev *dev, + u32 update_handle, + u32 offset, u16 size, + u8 *data) +{ + int err, in_size = MLX5_ST_SZ_BYTES(mcda_reg) + size; + u32 out[MLX5_ST_SZ_DW(mcda_reg)]; + int i, j, dw_size = size >> 2; + __be32 data_element; + u32 *in; + + in = kzalloc(in_size, GFP_KERNEL); + if (!in) + return -ENOMEM; + + MLX5_SET(mcda_reg, in, update_handle, update_handle); + MLX5_SET(mcda_reg, in, offset, offset); + MLX5_SET(mcda_reg, in, size, size); + + for (i = 0; i < dw_size; i++) { + j = i * 4; + data_element = htonl(*(u32 *)&data[j]); + memcpy(MLX5_ADDR_OF(mcda_reg, in, data) + j, &data_element, 4); + } + + err = mlx5_core_access_reg(dev, in, in_size, out, + sizeof(out), MLX5_REG_MCDA, 0, 1); + kfree(in); + return err; +} + +static int mlx5_reg_mcqi_query(struct mlx5_core_dev *dev, + u16 component_index, + u32 *max_component_size, + u8 *log_mcda_word_size, + u16 *mcda_max_write_size) +{ + u32 out[MLX5_ST_SZ_DW(mcqi_reg) + MLX5_ST_SZ_DW(mcqi_cap)]; + int offset = MLX5_ST_SZ_DW(mcqi_reg); + u32 in[MLX5_ST_SZ_DW(mcqi_reg)]; + int err; + + memset(in, 0, sizeof(in)); + memset(out, 0, sizeof(out)); + + MLX5_SET(mcqi_reg, in, component_index, component_index); + MLX5_SET(mcqi_reg, in, data_size, MLX5_ST_SZ_BYTES(mcqi_cap)); + + err = mlx5_core_access_reg(dev, in, sizeof(in), out, + sizeof(out), MLX5_REG_MCQI, 0, 0); + if (err) + goto out; + + *max_component_size = MLX5_GET(mcqi_cap, out + offset, max_component_size); + *log_mcda_word_size = MLX5_GET(mcqi_cap, out + offset, log_mcda_word_size); + *mcda_max_write_size = MLX5_GET(mcqi_cap, out + offset, mcda_max_write_size); + +out: + return err; +} From owner-svn-src-stable@freebsd.org Thu May 16 16:03:47 2019 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id AFAA8159C3D4; Thu, 16 May 2019 16:03:47 +0000 (UTC) (envelope-from hselasky@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 510088719E; Thu, 16 May 2019 16:03:47 +0000 (UTC) (envelope-from hselasky@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 2B9F5231EF; Thu, 16 May 2019 16:03:47 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x4GG3lP7058461; Thu, 16 May 2019 16:03:47 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x4GG3kxq058460; Thu, 16 May 2019 16:03:46 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201905161603.x4GG3kxq058460@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Thu, 16 May 2019 16:03:46 +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: r347741 - stable/12/sys/dev/mlx5/mlx5_en X-SVN-Group: stable-12 X-SVN-Commit-Author: hselasky X-SVN-Commit-Paths: stable/12/sys/dev/mlx5/mlx5_en X-SVN-Commit-Revision: 347741 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 510088719E X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.97 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.998,0]; NEURAL_HAM_SHORT(-0.97)[-0.969,0]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US] X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 16 May 2019 16:03:47 -0000 Author: hselasky Date: Thu May 16 16:03:46 2019 New Revision: 347741 URL: https://svnweb.freebsd.org/changeset/base/347741 Log: MFC r347277: Avoid leaking send queue mbufs during error recovery in mlx5en(4). Sponsored by: Mellanox Technologies Modified: stable/12/sys/dev/mlx5/mlx5_en/mlx5_en_main.c stable/12/sys/dev/mlx5/mlx5_en/mlx5_en_tx.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/dev/mlx5/mlx5_en/mlx5_en_main.c ============================================================================== --- stable/12/sys/dev/mlx5/mlx5_en/mlx5_en_main.c Thu May 16 16:03:02 2019 (r347740) +++ stable/12/sys/dev/mlx5/mlx5_en/mlx5_en_main.c Thu May 16 16:03:46 2019 (r347741) @@ -1147,8 +1147,13 @@ mlx5e_free_sq_db(struct mlx5e_sq *sq) int wq_sz = mlx5_wq_cyc_get_size(&sq->wq); int x; - for (x = 0; x != wq_sz; x++) + for (x = 0; x != wq_sz; x++) { + if (sq->mbuf[x].mbuf != NULL) { + bus_dmamap_unload(sq->dma_tag, sq->mbuf[x].dma_map); + m_freem(sq->mbuf[x].mbuf); + } bus_dmamap_destroy(sq->dma_tag, sq->mbuf[x].dma_map); + } free(sq->mbuf, M_MLX5EN); } Modified: stable/12/sys/dev/mlx5/mlx5_en/mlx5_en_tx.c ============================================================================== --- stable/12/sys/dev/mlx5/mlx5_en/mlx5_en_tx.c Thu May 16 16:03:02 2019 (r347740) +++ stable/12/sys/dev/mlx5/mlx5_en/mlx5_en_tx.c Thu May 16 16:03:46 2019 (r347741) @@ -537,7 +537,7 @@ mlx5e_poll_tx_cq(struct mlx5e_sq *sq, int budget) for (x = 0; x != sq->cev_factor; x++) { ci = sqcc & sq->wq.sz_m1; mb = sq->mbuf[ci].mbuf; - sq->mbuf[ci].mbuf = NULL; /* Safety clear */ + sq->mbuf[ci].mbuf = NULL; if (mb == NULL) { if (sq->mbuf[ci].num_bytes == 0) { From owner-svn-src-stable@freebsd.org Thu May 16 16:04:24 2019 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 712CE159C46C; Thu, 16 May 2019 16:04:24 +0000 (UTC) (envelope-from hselasky@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 160EF872E4; Thu, 16 May 2019 16:04:24 +0000 (UTC) (envelope-from hselasky@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 06618231F0; Thu, 16 May 2019 16:04:24 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x4GG4NZP058546; Thu, 16 May 2019 16:04:23 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x4GG4NG9058545; Thu, 16 May 2019 16:04:23 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201905161604.x4GG4NG9058545@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Thu, 16 May 2019 16:04:23 +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: r347742 - stable/12/sys/ofed/drivers/infiniband/ulp/ipoib X-SVN-Group: stable-12 X-SVN-Commit-Author: hselasky X-SVN-Commit-Paths: stable/12/sys/ofed/drivers/infiniband/ulp/ipoib X-SVN-Commit-Revision: 347742 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 160EF872E4 X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.97 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.998,0]; NEURAL_HAM_SHORT(-0.97)[-0.969,0]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US] X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 16 May 2019 16:04:24 -0000 Author: hselasky Date: Thu May 16 16:04:23 2019 New Revision: 347742 URL: https://svnweb.freebsd.org/changeset/base/347742 Log: MFC r347278: Fix endless loop in ipoib_poll(). ib_req_notify_cq may return negative value which will indicate a failure. In the case of uncorrectable error, we will end up in an endless loop. Fix that, by going to another loop with poll_more only if there is anything left to poll. Submitted by: slavash@ Sponsored by: Mellanox Technologies Modified: stable/12/sys/ofed/drivers/infiniband/ulp/ipoib/ipoib_ib.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/ofed/drivers/infiniband/ulp/ipoib/ipoib_ib.c ============================================================================== --- stable/12/sys/ofed/drivers/infiniband/ulp/ipoib/ipoib_ib.c Thu May 16 16:03:46 2019 (r347741) +++ stable/12/sys/ofed/drivers/infiniband/ulp/ipoib/ipoib_ib.c Thu May 16 16:04:23 2019 (r347742) @@ -409,7 +409,7 @@ poll_more: spin_unlock(&priv->drain_lock); if (ib_req_notify_cq(priv->recv_cq, - IB_CQ_NEXT_COMP | IB_CQ_REPORT_MISSED_EVENTS)) + IB_CQ_NEXT_COMP | IB_CQ_REPORT_MISSED_EVENTS) > 0) goto poll_more; } From owner-svn-src-stable@freebsd.org Thu May 16 16:05:08 2019 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 47FBF159C52B; Thu, 16 May 2019 16:05:08 +0000 (UTC) (envelope-from hselasky@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 D47B887447; Thu, 16 May 2019 16:05:07 +0000 (UTC) (envelope-from hselasky@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 A7352231F1; Thu, 16 May 2019 16:05:07 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x4GG577h058645; Thu, 16 May 2019 16:05:07 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x4GG579q058644; Thu, 16 May 2019 16:05:07 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201905161605.x4GG579q058644@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Thu, 16 May 2019 16:05:07 +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: r347743 - stable/12/sys/dev/mlx5/mlx5_en X-SVN-Group: stable-12 X-SVN-Commit-Author: hselasky X-SVN-Commit-Paths: stable/12/sys/dev/mlx5/mlx5_en X-SVN-Commit-Revision: 347743 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: D47B887447 X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.97 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.998,0]; NEURAL_HAM_SHORT(-0.97)[-0.970,0]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US] X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 16 May 2019 16:05:08 -0000 Author: hselasky Date: Thu May 16 16:05:07 2019 New Revision: 347743 URL: https://svnweb.freebsd.org/changeset/base/347743 Log: MFC r347279: Fix netstat counters mapping in mlx5en(4). The current mapping of driver counters to netstat counters is wrong. For example, a single jabber packet, will cause the Ierrs counter to count three times. The work for mapping the hardware and software counters to their right place in netstat counters were already done in Linux, take that as is to the FreeBSD driver. Submitted by: slavash@ Sponsored by: Mellanox Technologies Modified: stable/12/sys/dev/mlx5/mlx5_en/mlx5_en_main.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/dev/mlx5/mlx5_en/mlx5_en_main.c ============================================================================== --- stable/12/sys/dev/mlx5/mlx5_en/mlx5_en_main.c Thu May 16 16:04:23 2019 (r347742) +++ stable/12/sys/dev/mlx5/mlx5_en/mlx5_en_main.c Thu May 16 16:05:07 2019 (r347743) @@ -637,22 +637,14 @@ mlx5e_update_stats_locked(struct mlx5e_priv *priv) #if (__FreeBSD_version < 1100000) /* no get_counters interface in fbsd 10 */ ifp->if_ipackets = s->rx_packets; - ifp->if_ierrors = s->rx_error_packets + - priv->stats.pport.alignment_err + - priv->stats.pport.check_seq_err + - priv->stats.pport.crc_align_errors + - priv->stats.pport.in_range_len_errors + - priv->stats.pport.jabbers + + ifp->if_ierrors = priv->stats.pport.in_range_len_errors + priv->stats.pport.out_of_range_len + - priv->stats.pport.oversize_pkts + - priv->stats.pport.symbol_err + priv->stats.pport.too_long_errors + - priv->stats.pport.undersize_pkts + - priv->stats.pport.unsupported_op_rx; - ifp->if_iqdrops = s->rx_out_of_buffer + - priv->stats.pport.drop_events; + priv->stats.pport.check_seq_err + + priv->stats.pport.alignment_err; + ifp->if_iqdrops = s->rx_out_of_buffer; ifp->if_opackets = s->tx_packets; - ifp->if_oerrors = s->tx_error_packets; + ifp->if_oerrors = priv->stats.port_stats_debug.out_discards; ifp->if_snd.ifq_drops = s->tx_queue_dropped; ifp->if_ibytes = s->rx_bytes; ifp->if_obytes = s->tx_bytes; @@ -2769,28 +2761,20 @@ mlx5e_get_counter(struct ifnet *ifp, ift_counter cnt) retval = priv->stats.vport.rx_packets; break; case IFCOUNTER_IERRORS: - retval = priv->stats.vport.rx_error_packets + - priv->stats.pport.alignment_err + - priv->stats.pport.check_seq_err + - priv->stats.pport.crc_align_errors + - priv->stats.pport.in_range_len_errors + - priv->stats.pport.jabbers + + retval = priv->stats.pport.in_range_len_errors + priv->stats.pport.out_of_range_len + - priv->stats.pport.oversize_pkts + - priv->stats.pport.symbol_err + priv->stats.pport.too_long_errors + - priv->stats.pport.undersize_pkts + - priv->stats.pport.unsupported_op_rx; + priv->stats.pport.check_seq_err + + priv->stats.pport.alignment_err; break; case IFCOUNTER_IQDROPS: - retval = priv->stats.vport.rx_out_of_buffer + - priv->stats.pport.drop_events; + retval = priv->stats.vport.rx_out_of_buffer; break; case IFCOUNTER_OPACKETS: retval = priv->stats.vport.tx_packets; break; case IFCOUNTER_OERRORS: - retval = priv->stats.vport.tx_error_packets; + retval = priv->stats.port_stats_debug.out_discards; break; case IFCOUNTER_IBYTES: retval = priv->stats.vport.rx_bytes; From owner-svn-src-stable@freebsd.org Thu May 16 16:05:43 2019 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 0BC6A159C5C1; Thu, 16 May 2019 16:05:43 +0000 (UTC) (envelope-from hselasky@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 A34898757B; Thu, 16 May 2019 16:05:42 +0000 (UTC) (envelope-from hselasky@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 730A1231F2; Thu, 16 May 2019 16:05:42 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x4GG5gRC058723; Thu, 16 May 2019 16:05:42 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x4GG5gQW058722; Thu, 16 May 2019 16:05:42 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201905161605.x4GG5gQW058722@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Thu, 16 May 2019 16:05:42 +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: r347744 - stable/12/usr.sbin/mlx5tool X-SVN-Group: stable-12 X-SVN-Commit-Author: hselasky X-SVN-Commit-Paths: stable/12/usr.sbin/mlx5tool X-SVN-Commit-Revision: 347744 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: A34898757B X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.97 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.998,0]; NEURAL_HAM_SHORT(-0.97)[-0.969,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US]; NEURAL_HAM_LONG(-1.00)[-1.000,0] X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 16 May 2019 16:05:43 -0000 Author: hselasky Date: Thu May 16 16:05:42 2019 New Revision: 347744 URL: https://svnweb.freebsd.org/changeset/base/347744 Log: MFC r347280: Fix style. Submitted by: kib@ Sponsored by: Mellanox Technologies Modified: stable/12/usr.sbin/mlx5tool/mlx5tool.c Directory Properties: stable/12/ (props changed) Modified: stable/12/usr.sbin/mlx5tool/mlx5tool.c ============================================================================== --- stable/12/usr.sbin/mlx5tool/mlx5tool.c Thu May 16 16:05:07 2019 (r347743) +++ stable/12/usr.sbin/mlx5tool/mlx5tool.c Thu May 16 16:05:42 2019 (r347744) @@ -184,7 +184,7 @@ main(int argc, char *argv[]) act = ACTION_DUMP_GET; break; case 'e': - act= ACTION_DUMP_FORCE; + act = ACTION_DUMP_FORCE; break; case 'o': dumpname = optarg; From owner-svn-src-stable@freebsd.org Thu May 16 16:06:19 2019 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id D63B8159C660; Thu, 16 May 2019 16:06:19 +0000 (UTC) (envelope-from hselasky@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 4A5CD876F0; Thu, 16 May 2019 16:06:19 +0000 (UTC) (envelope-from hselasky@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 22F85231F3; Thu, 16 May 2019 16:06:19 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x4GG6IaS058810; Thu, 16 May 2019 16:06:18 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x4GG6IvC058809; Thu, 16 May 2019 16:06:18 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201905161606.x4GG6IvC058809@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Thu, 16 May 2019 16:06:18 +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: r347745 - stable/12/usr.sbin/mlx5tool X-SVN-Group: stable-12 X-SVN-Commit-Author: hselasky X-SVN-Commit-Paths: stable/12/usr.sbin/mlx5tool X-SVN-Commit-Revision: 347745 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 4A5CD876F0 X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.97 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.998,0]; NEURAL_HAM_SHORT(-0.97)[-0.969,0]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US] X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 16 May 2019 16:06:20 -0000 Author: hselasky Date: Thu May 16 16:06:18 2019 New Revision: 347745 URL: https://svnweb.freebsd.org/changeset/base/347745 Log: MFC r347281: Fix typo. Submitted by: kib@ Sponsored by: Mellanox Technologies Modified: stable/12/usr.sbin/mlx5tool/mlx5tool.8 Directory Properties: stable/12/ (props changed) Modified: stable/12/usr.sbin/mlx5tool/mlx5tool.8 ============================================================================== --- stable/12/usr.sbin/mlx5tool/mlx5tool.8 Thu May 16 16:05:42 2019 (r347744) +++ stable/12/usr.sbin/mlx5tool/mlx5tool.8 Thu May 16 16:06:18 2019 (r347745) @@ -25,7 +25,7 @@ .\" .\" $FreeBSD$ .\" -.Dd March 8, 2018 +.Dd May 7, 2019 .Dt mlx5tool 8 .Os .Sh NAME @@ -78,7 +78,7 @@ command for the specified device. Clear the stored firmware dump, preparing the kernel buffer for the next dump. .It Fl w -Fetche the stored firmware dump and writes it into the file specified +Fetches the stored firmware dump and writes it into the file specified by the .Fl o option argument. From owner-svn-src-stable@freebsd.org Thu May 16 16:06:53 2019 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 7557B159C6F5; Thu, 16 May 2019 16:06:53 +0000 (UTC) (envelope-from hselasky@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 1BD3487867; Thu, 16 May 2019 16:06:53 +0000 (UTC) (envelope-from hselasky@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 E941B231F4; Thu, 16 May 2019 16:06:52 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x4GG6qC1058889; Thu, 16 May 2019 16:06:52 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x4GG6qT1058888; Thu, 16 May 2019 16:06:52 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201905161606.x4GG6qT1058888@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Thu, 16 May 2019 16:06:52 +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: r347746 - stable/12/sys/dev/mlx5/mlx5_core X-SVN-Group: stable-12 X-SVN-Commit-Author: hselasky X-SVN-Commit-Paths: stable/12/sys/dev/mlx5/mlx5_core X-SVN-Commit-Revision: 347746 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 1BD3487867 X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.97 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.998,0]; NEURAL_HAM_SHORT(-0.97)[-0.969,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US]; NEURAL_HAM_LONG(-1.00)[-1.000,0] X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 16 May 2019 16:06:53 -0000 Author: hselasky Date: Thu May 16 16:06:52 2019 New Revision: 347746 URL: https://svnweb.freebsd.org/changeset/base/347746 Log: MFC r347282: Change implicit and probably erronous EPERM to EIO on command status error in mlx5core. Submitted by: kib@ Sponsored by: Mellanox Technologies Modified: stable/12/sys/dev/mlx5/mlx5_core/mlx5_cmd.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/dev/mlx5/mlx5_core/mlx5_cmd.c ============================================================================== --- stable/12/sys/dev/mlx5/mlx5_core/mlx5_cmd.c Thu May 16 16:06:18 2019 (r347745) +++ stable/12/sys/dev/mlx5/mlx5_core/mlx5_cmd.c Thu May 16 16:06:52 2019 (r347746) @@ -1235,7 +1235,7 @@ EXPORT_SYMBOL(mlx5_cmd_comp_handler); static int status_to_err(u8 status) { - return status ? -1 : 0; /* TBD more meaningful codes */ + return status ? -EIO : 0; /* TBD more meaningful codes */ } static struct mlx5_cmd_msg *alloc_msg(struct mlx5_core_dev *dev, int in_size, From owner-svn-src-stable@freebsd.org Thu May 16 16:07:27 2019 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 23280159C76F; Thu, 16 May 2019 16:07:27 +0000 (UTC) (envelope-from hselasky@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 BEAA2879DB; Thu, 16 May 2019 16:07:26 +0000 (UTC) (envelope-from hselasky@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 AABA1231F5; Thu, 16 May 2019 16:07:26 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x4GG7Q60058976; Thu, 16 May 2019 16:07:26 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x4GG7QKS058975; Thu, 16 May 2019 16:07:26 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201905161607.x4GG7QKS058975@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Thu, 16 May 2019 16:07:26 +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: r347747 - stable/12/sys/dev/mlx5/mlx5_core X-SVN-Group: stable-12 X-SVN-Commit-Author: hselasky X-SVN-Commit-Paths: stable/12/sys/dev/mlx5/mlx5_core X-SVN-Commit-Revision: 347747 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: BEAA2879DB X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.97 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.998,0]; NEURAL_HAM_SHORT(-0.97)[-0.969,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US]; NEURAL_HAM_LONG(-1.00)[-1.000,0] X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 16 May 2019 16:07:27 -0000 Author: hselasky Date: Thu May 16 16:07:26 2019 New Revision: 347747 URL: https://svnweb.freebsd.org/changeset/base/347747 Log: MFC r347283: Remove redundant line of code in mlx5core. Sponsored by: Mellanox Technologies Modified: stable/12/sys/dev/mlx5/mlx5_core/mlx5_cmd.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/dev/mlx5/mlx5_core/mlx5_cmd.c ============================================================================== --- stable/12/sys/dev/mlx5/mlx5_core/mlx5_cmd.c Thu May 16 16:06:52 2019 (r347746) +++ stable/12/sys/dev/mlx5/mlx5_core/mlx5_cmd.c Thu May 16 16:07:26 2019 (r347747) @@ -1215,7 +1215,7 @@ void mlx5_cmd_comp_handler(struct mlx5_core_dev *dev, ent->ret = verify_signature(ent); else ent->ret = 0; - ent->status = ent->lay->status_own >> 1; + if (triggered) ent->status = MLX5_DRIVER_STATUS_ABORTED; else From owner-svn-src-stable@freebsd.org Thu May 16 16:08:02 2019 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 3F52E159C83E; Thu, 16 May 2019 16:08:02 +0000 (UTC) (envelope-from hselasky@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 D8E1E87B85; Thu, 16 May 2019 16:08:01 +0000 (UTC) (envelope-from hselasky@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 B3C97231F8; Thu, 16 May 2019 16:08:01 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x4GG81cB059061; Thu, 16 May 2019 16:08:01 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x4GG81pk059060; Thu, 16 May 2019 16:08:01 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201905161608.x4GG81pk059060@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Thu, 16 May 2019 16:08:01 +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: r347748 - stable/12/sys/dev/mlx5/mlx5_core X-SVN-Group: stable-12 X-SVN-Commit-Author: hselasky X-SVN-Commit-Paths: stable/12/sys/dev/mlx5/mlx5_core X-SVN-Commit-Revision: 347748 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: D8E1E87B85 X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.97 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.998,0]; NEURAL_HAM_SHORT(-0.97)[-0.969,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US]; NEURAL_HAM_LONG(-1.00)[-1.000,0] X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 16 May 2019 16:08:02 -0000 Author: hselasky Date: Thu May 16 16:08:01 2019 New Revision: 347748 URL: https://svnweb.freebsd.org/changeset/base/347748 Log: MFC r347284: Convert remaining module parameters into SYSCTLs in mlx5core. Sponsored by: Mellanox Technologies Modified: stable/12/sys/dev/mlx5/mlx5_core/mlx5_main.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/dev/mlx5/mlx5_core/mlx5_main.c ============================================================================== --- stable/12/sys/dev/mlx5/mlx5_core/mlx5_main.c Thu May 16 16:07:26 2019 (r347747) +++ stable/12/sys/dev/mlx5/mlx5_core/mlx5_main.c Thu May 16 16:08:01 2019 (r347748) @@ -25,8 +25,6 @@ * $FreeBSD$ */ -#define LINUXKPI_PARAM_PREFIX mlx5_ - #include #include #include @@ -57,17 +55,19 @@ MODULE_DEPEND(mlx5, linuxkpi, 1, 1, 1); #endif MODULE_VERSION(mlx5, 1); +SYSCTL_NODE(_hw, OID_AUTO, mlx5, CTLFLAG_RW, 0, "mlx5 hardware controls"); + int mlx5_core_debug_mask; -module_param_named(debug_mask, mlx5_core_debug_mask, int, 0644); -MODULE_PARM_DESC(debug_mask, "debug mask: 1 = dump cmd data, 2 = dump cmd exec time, 3 = both. Default=0"); +SYSCTL_INT(_hw_mlx5, OID_AUTO, debug_mask, CTLFLAG_RWTUN, + &mlx5_core_debug_mask, 0, + "debug mask: 1 = dump cmd data, 2 = dump cmd exec time, 3 = both. Default=0"); #define MLX5_DEFAULT_PROF 2 -static int prof_sel = MLX5_DEFAULT_PROF; -module_param_named(prof_sel, prof_sel, int, 0444); -MODULE_PARM_DESC(prof_sel, "profile selector. Valid range 0 - 2"); +static int mlx5_prof_sel = MLX5_DEFAULT_PROF; +SYSCTL_INT(_hw_mlx5, OID_AUTO, prof_sel, CTLFLAG_RWTUN, + &mlx5_prof_sel, 0, + "profile selector. Valid range 0 - 2"); -SYSCTL_NODE(_hw, OID_AUTO, mlx5, CTLFLAG_RW, 0, "mlx5 HW controls"); - static int mlx5_fast_unload_enabled = 1; SYSCTL_INT(_hw_mlx5, OID_AUTO, fast_unload_enabled, CTLFLAG_RWTUN, &mlx5_fast_unload_enabled, 0, @@ -1235,11 +1235,11 @@ static int init_one(struct pci_dev *pdev, if (id) priv->pci_dev_data = id->driver_data; - if (prof_sel < 0 || prof_sel >= ARRAY_SIZE(profiles)) { + if (mlx5_prof_sel < 0 || mlx5_prof_sel >= ARRAY_SIZE(profiles)) { device_printf(bsddev, "WARN: selected profile out of range, selecting default (%d)\n", MLX5_DEFAULT_PROF); - prof_sel = MLX5_DEFAULT_PROF; + mlx5_prof_sel = MLX5_DEFAULT_PROF; } - dev->profile = &profiles[prof_sel]; + dev->profile = &profiles[mlx5_prof_sel]; dev->pdev = pdev; dev->event = mlx5_core_event; From owner-svn-src-stable@freebsd.org Thu May 16 16:09:18 2019 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 7CF7D159C940; Thu, 16 May 2019 16:09:18 +0000 (UTC) (envelope-from hselasky@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 2246E87D6D; Thu, 16 May 2019 16:09:18 +0000 (UTC) (envelope-from hselasky@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 E9DE2231F9; Thu, 16 May 2019 16:09:17 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x4GG9HW0059173; Thu, 16 May 2019 16:09:17 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x4GG9G7P059168; Thu, 16 May 2019 16:09:16 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201905161609.x4GG9G7P059168@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Thu, 16 May 2019 16:09:16 +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: r347749 - in stable/12: share/man/man4 sys/conf sys/dev/mlxfw sys/modules sys/modules/mlxfw X-SVN-Group: stable-12 X-SVN-Commit-Author: hselasky X-SVN-Commit-Paths: in stable/12: share/man/man4 sys/conf sys/dev/mlxfw sys/modules sys/modules/mlxfw X-SVN-Commit-Revision: 347749 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 2246E87D6D X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.97 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.998,0]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; NEURAL_HAM_SHORT(-0.97)[-0.970,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US] X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 16 May 2019 16:09:18 -0000 Author: hselasky Date: Thu May 16 16:09:16 2019 New Revision: 347749 URL: https://svnweb.freebsd.org/changeset/base/347749 Log: MFC r347285 and r347327: Initial version of Mellanox in-kernel firmware upgrade support. Submitted by: slavash@ Sponsored by: Mellanox Technologies Added: stable/12/sys/dev/mlxfw/ - copied from r347285, head/sys/dev/mlxfw/ stable/12/sys/modules/mlxfw/ - copied from r347285, head/sys/modules/mlxfw/ Modified: stable/12/share/man/man4/mlx5en.4 stable/12/sys/conf/NOTES stable/12/sys/conf/files stable/12/sys/conf/kern.pre.mk stable/12/sys/modules/Makefile Directory Properties: stable/12/ (props changed) Modified: stable/12/share/man/man4/mlx5en.4 ============================================================================== --- stable/12/share/man/man4/mlx5en.4 Thu May 16 16:08:01 2019 (r347748) +++ stable/12/share/man/man4/mlx5en.4 Thu May 16 16:09:16 2019 (r347749) @@ -24,7 +24,7 @@ .\" .\" $FreeBSD$ .\" -.Dd May 29, 2018 +.Dd May 8, 2019 .Dt MLX5EN 4 .Os .Sh NAME @@ -37,6 +37,9 @@ kernel configuration file: .Bd -ragged -offset indent .Cd "options COMPAT_LINUXKPI" .Cd "options RATELIMIT" +.Cd "device xz" +.Cd "device mlxfw" +.Cd "device firmware" .Cd "device mlx5" .Cd "device mlx5en" .Ed Modified: stable/12/sys/conf/NOTES ============================================================================== --- stable/12/sys/conf/NOTES Thu May 16 16:08:01 2019 (r347748) +++ stable/12/sys/conf/NOTES Thu May 16 16:09:16 2019 (r347749) @@ -2005,6 +2005,7 @@ device xmphy # XaQti XMAC II # Yukon II Gigabit controllers, including 88E8021, 88E8022, 88E8061, # 88E8062, 88E8035, 88E8036, 88E8038, 88E8050, 88E8052, 88E8053, # 88E8055, 88E8056 and D-Link 560T/550SX. +# mlxfw: Mellanox firmware update module. # mlx5: Mellanox ConnectX-4 and ConnectX-4 LX IB and Eth shared code module. # mlx5en:Mellanox ConnectX-4 and ConnectX-4 LX PCIe Ethernet adapters. # my: Myson Fast Ethernet (MTD80X, MTD89X) @@ -2118,6 +2119,7 @@ device gem # Apple GMAC/Sun ERI/Sun GEM device hme # Sun HME (Happy Meal Ethernet) device jme # JMicron JMC250 Gigabit/JMC260 Fast Ethernet device lge # Level 1 LXT1001 gigabit Ethernet +device mlxfw # Mellanox firmware update module device mlx5 # Shared code module between IB and Ethernet device mlx5en # Mellanox ConnectX-4 and ConnectX-4 LX device msk # Marvell/SysKonnect Yukon II Gigabit Ethernet Modified: stable/12/sys/conf/files ============================================================================== --- stable/12/sys/conf/files Thu May 16 16:08:01 2019 (r347748) +++ stable/12/sys/conf/files Thu May 16 16:09:16 2019 (r347749) @@ -2440,6 +2440,12 @@ dev/mii/ukphy_subr.c optional miibus | mii dev/mii/vscphy.c optional miibus | vscphy dev/mii/xmphy.c optional miibus | xmphy dev/mk48txx/mk48txx.c optional mk48txx +dev/mlxfw/mlxfw_fsm.c optional mlxfw \ + compile-with "${MLXFW_C}" +dev/mlxfw/mlxfw_mfa2.c optional mlxfw \ + compile-with "${MLXFW_C}" +dev/mlxfw/mlxfw_mfa2_tlv_multi.c optional mlxfw \ + compile-with "${MLXFW_C}" dev/mlx/mlx.c optional mlx dev/mlx/mlx_disk.c optional mlx dev/mlx/mlx_pci.c optional mlx pci Modified: stable/12/sys/conf/kern.pre.mk ============================================================================== --- stable/12/sys/conf/kern.pre.mk Thu May 16 16:08:01 2019 (r347748) +++ stable/12/sys/conf/kern.pre.mk Thu May 16 16:09:16 2019 (r347749) @@ -203,6 +203,12 @@ OFEDCFLAGS= ${CFLAGS:N-I*} -DCONFIG_INFINIBAND_USER_ME OFED_C_NOIMP= ${CC} -c -o ${.TARGET} ${OFEDCFLAGS} ${WERROR} ${PROF} OFED_C= ${OFED_C_NOIMP} ${.IMPSRC} +# mlxfw C flags. +MLXFW_C= ${OFED_C_NOIMP} \ + -I${SRCTOP}/sys/contrib/xz-embedded/freebsd \ + -I${SRCTOP}/sys/contrib/xz-embedded/linux/lib/xz \ + ${.IMPSRC} + GEN_CFILES= $S/$M/$M/genassym.c ${MFILES:T:S/.m$/.c/} SYSTEM_CFILES= config.c env.c hints.c vnode_if.c SYSTEM_DEP= Makefile ${SYSTEM_OBJS} Modified: stable/12/sys/modules/Makefile ============================================================================== --- stable/12/sys/modules/Makefile Thu May 16 16:08:01 2019 (r347748) +++ stable/12/sys/modules/Makefile Thu May 16 16:09:16 2019 (r347749) @@ -246,6 +246,7 @@ SUBDIR= \ mfi \ mii \ mlx \ + mlxfw \ ${_mlx4} \ ${_mlx4ib} \ ${_mlx4en} \ From owner-svn-src-stable@freebsd.org Thu May 16 16:10:25 2019 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 754DF159C9F3; Thu, 16 May 2019 16:10:25 +0000 (UTC) (envelope-from hselasky@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 1BA2C87ED3; Thu, 16 May 2019 16:10:25 +0000 (UTC) (envelope-from hselasky@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 06B84231FE; Thu, 16 May 2019 16:10:25 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x4GGAOCM059306; Thu, 16 May 2019 16:10:24 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x4GGAOHS059304; Thu, 16 May 2019 16:10:24 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201905161610.x4GGAOHS059304@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Thu, 16 May 2019 16:10:24 +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: r347750 - stable/12/sys/dev/mlx5/mlx5_core X-SVN-Group: stable-12 X-SVN-Commit-Author: hselasky X-SVN-Commit-Paths: stable/12/sys/dev/mlx5/mlx5_core X-SVN-Commit-Revision: 347750 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 1BA2C87ED3 X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.97 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.998,0]; NEURAL_HAM_SHORT(-0.97)[-0.970,0]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US] X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 16 May 2019 16:10:25 -0000 Author: hselasky Date: Thu May 16 16:10:24 2019 New Revision: 347750 URL: https://svnweb.freebsd.org/changeset/base/347750 Log: MFC r347286: Add mlxfw callbacks in mlx5core. Add mlx5 implementation for the ones defined by the mlxfw shared module to be used while flashing the device firmware. The callbacks do their job through the MCQI, MCC and MCDA registers. Linux commit: 62bd22cf326dc4ac5be673c11cef4602dc1f5e47 Submitted by: slavash@ Sponsored by: Mellanox Technologies Modified: stable/12/sys/dev/mlx5/mlx5_core/mlx5_core.h stable/12/sys/dev/mlx5/mlx5_core/mlx5_fw.c stable/12/sys/dev/mlx5/mlx5_core/mlx5_main.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/dev/mlx5/mlx5_core/mlx5_core.h ============================================================================== --- stable/12/sys/dev/mlx5/mlx5_core/mlx5_core.h Thu May 16 16:09:16 2019 (r347749) +++ stable/12/sys/dev/mlx5/mlx5_core/mlx5_core.h Thu May 16 16:10:24 2019 (r347750) @@ -32,6 +32,8 @@ #include #include +#include + #define DRIVER_NAME "mlx5_core" #ifndef DRIVER_VERSION #define DRIVER_VERSION "3.5.0" @@ -92,6 +94,8 @@ void mlx5_recover_device(struct mlx5_core_dev *dev); int mlx5_register_device(struct mlx5_core_dev *dev); void mlx5_unregister_device(struct mlx5_core_dev *dev); + +int mlx5_firmware_flash(struct mlx5_core_dev *dev, const struct firmware *fw); void mlx5e_init(void); void mlx5e_cleanup(void); Modified: stable/12/sys/dev/mlx5/mlx5_core/mlx5_fw.c ============================================================================== --- stable/12/sys/dev/mlx5/mlx5_core/mlx5_fw.c Thu May 16 16:09:16 2019 (r347749) +++ stable/12/sys/dev/mlx5/mlx5_core/mlx5_fw.c Thu May 16 16:10:24 2019 (r347750) @@ -455,3 +455,156 @@ static int mlx5_reg_mcqi_query(struct mlx5_core_dev *d out: return err; } + +struct mlx5_mlxfw_dev { + struct mlxfw_dev mlxfw_dev; + struct mlx5_core_dev *mlx5_core_dev; +}; + +static int mlx5_component_query(struct mlxfw_dev *mlxfw_dev, + u16 component_index, u32 *p_max_size, + u8 *p_align_bits, u16 *p_max_write_size) +{ + struct mlx5_mlxfw_dev *mlx5_mlxfw_dev = + container_of(mlxfw_dev, struct mlx5_mlxfw_dev, mlxfw_dev); + struct mlx5_core_dev *dev = mlx5_mlxfw_dev->mlx5_core_dev; + + return mlx5_reg_mcqi_query(dev, component_index, p_max_size, + p_align_bits, p_max_write_size); +} + +static int mlx5_fsm_lock(struct mlxfw_dev *mlxfw_dev, u32 *fwhandle) +{ + struct mlx5_mlxfw_dev *mlx5_mlxfw_dev = + container_of(mlxfw_dev, struct mlx5_mlxfw_dev, mlxfw_dev); + struct mlx5_core_dev *dev = mlx5_mlxfw_dev->mlx5_core_dev; + u8 control_state, error_code; + int err; + + *fwhandle = 0; + err = mlx5_reg_mcc_query(dev, fwhandle, &error_code, &control_state); + if (err) + return err; + + if (control_state != MLXFW_FSM_STATE_IDLE) + return -EBUSY; + + return mlx5_reg_mcc_set(dev, MLX5_REG_MCC_INSTRUCTION_LOCK_UPDATE_HANDLE, + 0, *fwhandle, 0); +} + +static int mlx5_fsm_component_update(struct mlxfw_dev *mlxfw_dev, u32 fwhandle, + u16 component_index, u32 component_size) +{ + struct mlx5_mlxfw_dev *mlx5_mlxfw_dev = + container_of(mlxfw_dev, struct mlx5_mlxfw_dev, mlxfw_dev); + struct mlx5_core_dev *dev = mlx5_mlxfw_dev->mlx5_core_dev; + + return mlx5_reg_mcc_set(dev, MLX5_REG_MCC_INSTRUCTION_UPDATE_COMPONENT, + component_index, fwhandle, component_size); +} + +static int mlx5_fsm_block_download(struct mlxfw_dev *mlxfw_dev, u32 fwhandle, + u8 *data, u16 size, u32 offset) +{ + struct mlx5_mlxfw_dev *mlx5_mlxfw_dev = + container_of(mlxfw_dev, struct mlx5_mlxfw_dev, mlxfw_dev); + struct mlx5_core_dev *dev = mlx5_mlxfw_dev->mlx5_core_dev; + + return mlx5_reg_mcda_set(dev, fwhandle, offset, size, data); +} + +static int mlx5_fsm_component_verify(struct mlxfw_dev *mlxfw_dev, u32 fwhandle, + u16 component_index) +{ + struct mlx5_mlxfw_dev *mlx5_mlxfw_dev = + container_of(mlxfw_dev, struct mlx5_mlxfw_dev, mlxfw_dev); + struct mlx5_core_dev *dev = mlx5_mlxfw_dev->mlx5_core_dev; + + return mlx5_reg_mcc_set(dev, MLX5_REG_MCC_INSTRUCTION_VERIFY_COMPONENT, + component_index, fwhandle, 0); +} + +static int mlx5_fsm_activate(struct mlxfw_dev *mlxfw_dev, u32 fwhandle) +{ + struct mlx5_mlxfw_dev *mlx5_mlxfw_dev = + container_of(mlxfw_dev, struct mlx5_mlxfw_dev, mlxfw_dev); + struct mlx5_core_dev *dev = mlx5_mlxfw_dev->mlx5_core_dev; + + return mlx5_reg_mcc_set(dev, MLX5_REG_MCC_INSTRUCTION_ACTIVATE, 0, + fwhandle, 0); +} + +static int mlx5_fsm_query_state(struct mlxfw_dev *mlxfw_dev, u32 fwhandle, + enum mlxfw_fsm_state *fsm_state, + enum mlxfw_fsm_state_err *fsm_state_err) +{ + struct mlx5_mlxfw_dev *mlx5_mlxfw_dev = + container_of(mlxfw_dev, struct mlx5_mlxfw_dev, mlxfw_dev); + struct mlx5_core_dev *dev = mlx5_mlxfw_dev->mlx5_core_dev; + u8 control_state, error_code; + int err; + + err = mlx5_reg_mcc_query(dev, &fwhandle, &error_code, &control_state); + if (err) + return err; + + *fsm_state = control_state; + *fsm_state_err = min_t(enum mlxfw_fsm_state_err, error_code, + MLXFW_FSM_STATE_ERR_MAX); + return 0; +} + +static void mlx5_fsm_cancel(struct mlxfw_dev *mlxfw_dev, u32 fwhandle) +{ + struct mlx5_mlxfw_dev *mlx5_mlxfw_dev = + container_of(mlxfw_dev, struct mlx5_mlxfw_dev, mlxfw_dev); + struct mlx5_core_dev *dev = mlx5_mlxfw_dev->mlx5_core_dev; + + mlx5_reg_mcc_set(dev, MLX5_REG_MCC_INSTRUCTION_CANCEL, 0, fwhandle, 0); +} + +static void mlx5_fsm_release(struct mlxfw_dev *mlxfw_dev, u32 fwhandle) +{ + struct mlx5_mlxfw_dev *mlx5_mlxfw_dev = + container_of(mlxfw_dev, struct mlx5_mlxfw_dev, mlxfw_dev); + struct mlx5_core_dev *dev = mlx5_mlxfw_dev->mlx5_core_dev; + + mlx5_reg_mcc_set(dev, MLX5_REG_MCC_INSTRUCTION_RELEASE_UPDATE_HANDLE, 0, + fwhandle, 0); +} + +static const struct mlxfw_dev_ops mlx5_mlxfw_dev_ops = { + .component_query = mlx5_component_query, + .fsm_lock = mlx5_fsm_lock, + .fsm_component_update = mlx5_fsm_component_update, + .fsm_block_download = mlx5_fsm_block_download, + .fsm_component_verify = mlx5_fsm_component_verify, + .fsm_activate = mlx5_fsm_activate, + .fsm_query_state = mlx5_fsm_query_state, + .fsm_cancel = mlx5_fsm_cancel, + .fsm_release = mlx5_fsm_release +}; + +int mlx5_firmware_flash(struct mlx5_core_dev *dev, + const struct firmware *firmware) +{ + struct mlx5_mlxfw_dev mlx5_mlxfw_dev = { + .mlxfw_dev = { + .ops = &mlx5_mlxfw_dev_ops, + .psid = dev->board_id, + .psid_size = strlen(dev->board_id), + }, + .mlx5_core_dev = dev + }; + + if (!MLX5_CAP_GEN(dev, mcam_reg) || + !MLX5_CAP_MCAM_REG(dev, mcqi) || + !MLX5_CAP_MCAM_REG(dev, mcc) || + !MLX5_CAP_MCAM_REG(dev, mcda)) { + pr_info("%s flashing isn't supported by the running FW\n", __func__); + return -EOPNOTSUPP; + } + + return mlxfw_firmware_flash(&mlx5_mlxfw_dev.mlxfw_dev, firmware); +} Modified: stable/12/sys/dev/mlx5/mlx5_core/mlx5_main.c ============================================================================== --- stable/12/sys/dev/mlx5/mlx5_core/mlx5_main.c Thu May 16 16:09:16 2019 (r347749) +++ stable/12/sys/dev/mlx5/mlx5_core/mlx5_main.c Thu May 16 16:10:24 2019 (r347750) @@ -50,9 +50,8 @@ static const char mlx5_version[] = "Mellanox Core driv MODULE_AUTHOR("Eli Cohen "); MODULE_DESCRIPTION("Mellanox Connect-IB, ConnectX-4 core driver"); MODULE_LICENSE("Dual BSD/GPL"); -#if (__FreeBSD_version >= 1100000) MODULE_DEPEND(mlx5, linuxkpi, 1, 1, 1); -#endif +MODULE_DEPEND(mlx5, mlxfw, 1, 1, 1); MODULE_VERSION(mlx5, 1); SYSCTL_NODE(_hw, OID_AUTO, mlx5, CTLFLAG_RW, 0, "mlx5 hardware controls"); From owner-svn-src-stable@freebsd.org Thu May 16 16:11:05 2019 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 319C1159CA58; Thu, 16 May 2019 16:11:05 +0000 (UTC) (envelope-from hselasky@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 C8F9288162; Thu, 16 May 2019 16:11:04 +0000 (UTC) (envelope-from hselasky@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 A34A82321D; Thu, 16 May 2019 16:11:04 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x4GGB4e9060232; Thu, 16 May 2019 16:11:04 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x4GGB3Sh060228; Thu, 16 May 2019 16:11:03 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201905161611.x4GGB3Sh060228@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Thu, 16 May 2019 16:11:03 +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: r347751 - in stable/12: share/man/man4 sys/dev/mlx5 sys/dev/mlx5/mlx5_core usr.sbin/mlx5tool X-SVN-Group: stable-12 X-SVN-Commit-Author: hselasky X-SVN-Commit-Paths: in stable/12: share/man/man4 sys/dev/mlx5 sys/dev/mlx5/mlx5_core usr.sbin/mlx5tool X-SVN-Commit-Revision: 347751 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: C8F9288162 X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.97 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.998,0]; NEURAL_HAM_SHORT(-0.97)[-0.970,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US]; NEURAL_HAM_LONG(-1.00)[-1.000,0] X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 16 May 2019 16:11:05 -0000 Author: hselasky Date: Thu May 16 16:11:03 2019 New Revision: 347751 URL: https://svnweb.freebsd.org/changeset/base/347751 Log: MFC r347287: Rename mlx5_fwdump_addr to more neutral mlx5_tool_addr in mlx5core. Submitted by: kib@ Sponsored by: Mellanox Technologies Modified: stable/12/share/man/man4/mlx5io.4 stable/12/sys/dev/mlx5/mlx5_core/mlx5_fwdump.c stable/12/sys/dev/mlx5/mlx5io.h stable/12/usr.sbin/mlx5tool/mlx5tool.c Directory Properties: stable/12/ (props changed) Modified: stable/12/share/man/man4/mlx5io.4 ============================================================================== --- stable/12/share/man/man4/mlx5io.4 Thu May 16 16:10:24 2019 (r347750) +++ stable/12/share/man/man4/mlx5io.4 Thu May 16 16:11:03 2019 (r347751) @@ -25,7 +25,7 @@ .\" .\" $FreeBSD$ .\" -.Dd February 20, 2018 +.Dd May 7, 2019 .Dt mlx5io 4 .Os .Sh NAME @@ -55,10 +55,10 @@ far, or existing dump cleared with the .Dv MLX5_FWDUMP_RESET command for the specified device. The argument for the command should point to the -.Vt struct mlx5_fwdump_addr +.Vt struct mlx5_tool_addr structure, containing the PCIe bus address of the device. .Bd -literal -struct mlx5_fwdump_addr { +struct mlx5_tool_addr { uint32_t domain; uint8_t bus; uint8_t slot; @@ -69,7 +69,7 @@ struct mlx5_fwdump_addr { Clear the stored firmware dump, preparing the kernel buffer for the next dump. The argument for the command should point to the -.Vt struct mlx5_fwdump_addr +.Vt struct mlx5_tool_addr structure, containing the PCIe bus address of the device. .It Dv MLX5_FWDUMP_GET Fetch the stored firmware dump into the user memory. @@ -88,7 +88,7 @@ in the field. .Bd -literal struct mlx5_fwdump_get { - struct mlx5_fwdump_addr devaddr; + struct mlx5_tool_addr devaddr; struct mlx5_fwdump_reg *buf; size_t reg_cnt; size_t reg_filled; /* out */ Modified: stable/12/sys/dev/mlx5/mlx5_core/mlx5_fwdump.c ============================================================================== --- stable/12/sys/dev/mlx5/mlx5_core/mlx5_fwdump.c Thu May 16 16:10:24 2019 (r347750) +++ stable/12/sys/dev/mlx5/mlx5_core/mlx5_fwdump.c Thu May 16 16:11:03 2019 (r347751) @@ -170,7 +170,7 @@ mlx5_fwdump_clean(struct mlx5_core_dev *mdev) } static int -mlx5_dbsf_to_core(const struct mlx5_fwdump_addr *devaddr, +mlx5_dbsf_to_core(const struct mlx5_tool_addr *devaddr, struct mlx5_core_dev **mdev) { device_t dev; @@ -231,7 +231,7 @@ mlx5_fwdump_ioctl(struct cdev *dev, u_long cmd, caddr_ { struct mlx5_core_dev *mdev; struct mlx5_fwdump_get *fwg; - struct mlx5_fwdump_addr *devaddr; + struct mlx5_tool_addr *devaddr; struct mlx5_dump_data *dd; int error; @@ -254,7 +254,7 @@ mlx5_fwdump_ioctl(struct cdev *dev, u_long cmd, caddr_ error = EBADF; break; } - devaddr = (struct mlx5_fwdump_addr *)data; + devaddr = (struct mlx5_tool_addr *)data; error = mlx5_dbsf_to_core(devaddr, &mdev); if (error != 0) break; @@ -269,7 +269,7 @@ mlx5_fwdump_ioctl(struct cdev *dev, u_long cmd, caddr_ error = EBADF; break; } - devaddr = (struct mlx5_fwdump_addr *)data; + devaddr = (struct mlx5_tool_addr *)data; error = mlx5_dbsf_to_core(devaddr, &mdev); if (error != 0) break; Modified: stable/12/sys/dev/mlx5/mlx5io.h ============================================================================== --- stable/12/sys/dev/mlx5/mlx5io.h Thu May 16 16:10:24 2019 (r347750) +++ stable/12/sys/dev/mlx5/mlx5io.h Thu May 16 16:11:03 2019 (r347751) @@ -35,7 +35,7 @@ struct mlx5_fwdump_reg { uint32_t val; }; -struct mlx5_fwdump_addr { +struct mlx5_tool_addr { uint32_t domain; uint8_t bus; uint8_t slot; @@ -43,15 +43,15 @@ struct mlx5_fwdump_addr { }; struct mlx5_fwdump_get { - struct mlx5_fwdump_addr devaddr; + struct mlx5_tool_addr devaddr; struct mlx5_fwdump_reg *buf; size_t reg_cnt; size_t reg_filled; /* out */ }; #define MLX5_FWDUMP_GET _IOWR('m', 1, struct mlx5_fwdump_get) -#define MLX5_FWDUMP_RESET _IOW('m', 2, struct mlx5_fwdump_addr) -#define MLX5_FWDUMP_FORCE _IOW('m', 3, struct mlx5_fwdump_addr) +#define MLX5_FWDUMP_RESET _IOW('m', 2, struct mlx5_tool_addr) +#define MLX5_FWDUMP_FORCE _IOW('m', 3, struct mlx5_tool_addr) #ifndef _KERNEL #define MLX5_DEV_PATH _PATH_DEV"mlx5ctl" Modified: stable/12/usr.sbin/mlx5tool/mlx5tool.c ============================================================================== --- stable/12/usr.sbin/mlx5tool/mlx5tool.c Thu May 16 16:10:24 2019 (r347750) +++ stable/12/usr.sbin/mlx5tool/mlx5tool.c Thu May 16 16:11:03 2019 (r347751) @@ -41,7 +41,7 @@ __FBSDID("$FreeBSD$"); /* stolen from pciconf.c: parsesel() */ static int -parse_pci_addr(const char *addrstr, struct mlx5_fwdump_addr *addr) +parse_pci_addr(const char *addrstr, struct mlx5_tool_addr *addr) { char *eppos; unsigned long selarr[4]; @@ -73,7 +73,7 @@ parse_pci_addr(const char *addrstr, struct mlx5_fwdump } static int -mlx5tool_save_dump(int ctldev, const struct mlx5_fwdump_addr *addr, +mlx5tool_save_dump(int ctldev, const struct mlx5_tool_addr *addr, const char *dumpname) { struct mlx5_fwdump_get fdg; @@ -123,7 +123,7 @@ out: } static int -mlx5tool_dump_reset(int ctldev, const struct mlx5_fwdump_addr *addr) +mlx5tool_dump_reset(int ctldev, const struct mlx5_tool_addr *addr) { if (ioctl(ctldev, MLX5_FWDUMP_RESET, addr) == -1) { @@ -134,7 +134,7 @@ mlx5tool_dump_reset(int ctldev, const struct mlx5_fwdu } static int -mlx5tool_dump_force(int ctldev, const struct mlx5_fwdump_addr *addr) +mlx5tool_dump_force(int ctldev, const struct mlx5_tool_addr *addr) { if (ioctl(ctldev, MLX5_FWDUMP_FORCE, addr) == -1) { @@ -166,7 +166,7 @@ enum mlx5_action { int main(int argc, char *argv[]) { - struct mlx5_fwdump_addr addr; + struct mlx5_tool_addr addr; char *dumpname; char *addrstr; int c, ctldev, res; From owner-svn-src-stable@freebsd.org Thu May 16 16:11:44 2019 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 619F9159CC3F; Thu, 16 May 2019 16:11:44 +0000 (UTC) (envelope-from hselasky@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 05CBC88305; Thu, 16 May 2019 16:11:44 +0000 (UTC) (envelope-from hselasky@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 D402823250; Thu, 16 May 2019 16:11:43 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x4GGBhLt060322; Thu, 16 May 2019 16:11:43 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x4GGBh2f060319; Thu, 16 May 2019 16:11:43 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201905161611.x4GGBh2f060319@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Thu, 16 May 2019 16:11:43 +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: r347752 - in stable/12: sys/dev/mlx5 sys/dev/mlx5/mlx5_core usr.sbin/mlx5tool X-SVN-Group: stable-12 X-SVN-Commit-Author: hselasky X-SVN-Commit-Paths: in stable/12: sys/dev/mlx5 sys/dev/mlx5/mlx5_core usr.sbin/mlx5tool X-SVN-Commit-Revision: 347752 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 05CBC88305 X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.97 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.998,0]; NEURAL_HAM_SHORT(-0.97)[-0.970,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US]; NEURAL_HAM_LONG(-1.00)[-1.000,0] X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 16 May 2019 16:11:44 -0000 Author: hselasky Date: Thu May 16 16:11:42 2019 New Revision: 347752 URL: https://svnweb.freebsd.org/changeset/base/347752 Log: MFC r347288: Implement userspace firmware update for ConnectX-4/5/6. Submitted by: kib@ Sponsored by: Mellanox Technologies Modified: stable/12/sys/dev/mlx5/mlx5_core/mlx5_fwdump.c stable/12/sys/dev/mlx5/mlx5io.h stable/12/usr.sbin/mlx5tool/mlx5tool.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/dev/mlx5/mlx5_core/mlx5_fwdump.c ============================================================================== --- stable/12/sys/dev/mlx5/mlx5_core/mlx5_fwdump.c Thu May 16 16:11:03 2019 (r347751) +++ stable/12/sys/dev/mlx5/mlx5_core/mlx5_fwdump.c Thu May 16 16:11:42 2019 (r347752) @@ -233,6 +233,8 @@ mlx5_fwdump_ioctl(struct cdev *dev, u_long cmd, caddr_ struct mlx5_fwdump_get *fwg; struct mlx5_tool_addr *devaddr; struct mlx5_dump_data *dd; + struct mlx5_fw_update *fu; + struct firmware fake_fw; int error; error = 0; @@ -274,6 +276,36 @@ mlx5_fwdump_ioctl(struct cdev *dev, u_long cmd, caddr_ if (error != 0) break; mlx5_fwdump(mdev); + break; + case MLX5_FW_UPDATE: + if ((fflag & FWRITE) == 0) { + error = EBADF; + break; + } + fu = (struct mlx5_fw_update *)data; + if (fu->img_fw_data_len > 10 * 1024 * 1024) { + error = EINVAL; + break; + } + devaddr = &fu->devaddr; + error = mlx5_dbsf_to_core(devaddr, &mdev); + if (error != 0) + break; + bzero(&fake_fw, sizeof(fake_fw)); + fake_fw.name = "umlx_fw_up"; + fake_fw.datasize = fu->img_fw_data_len; + fake_fw.version = 1; + fake_fw.data = (void *)kmem_malloc(fu->img_fw_data_len, + M_WAITOK); + if (fake_fw.data == NULL) { + error = ENOMEM; + break; + } + error = copyin(fu->img_fw_data, __DECONST(void *, fake_fw.data), + fu->img_fw_data_len); + if (error == 0) + error = -mlx5_firmware_flash(mdev, &fake_fw); + kmem_free((vm_offset_t)fake_fw.data, fu->img_fw_data_len); break; default: error = ENOTTY; Modified: stable/12/sys/dev/mlx5/mlx5io.h ============================================================================== --- stable/12/sys/dev/mlx5/mlx5io.h Thu May 16 16:11:03 2019 (r347751) +++ stable/12/sys/dev/mlx5/mlx5io.h Thu May 16 16:11:42 2019 (r347752) @@ -49,9 +49,16 @@ struct mlx5_fwdump_get { size_t reg_filled; /* out */ }; +struct mlx5_fw_update { + struct mlx5_tool_addr devaddr; + void *img_fw_data; + size_t img_fw_data_len; +}; + #define MLX5_FWDUMP_GET _IOWR('m', 1, struct mlx5_fwdump_get) #define MLX5_FWDUMP_RESET _IOW('m', 2, struct mlx5_tool_addr) #define MLX5_FWDUMP_FORCE _IOW('m', 3, struct mlx5_tool_addr) +#define MLX5_FW_UPDATE _IOW('m', 4, struct mlx5_fw_update) #ifndef _KERNEL #define MLX5_DEV_PATH _PATH_DEV"mlx5ctl" Modified: stable/12/usr.sbin/mlx5tool/mlx5tool.c ============================================================================== --- stable/12/usr.sbin/mlx5tool/mlx5tool.c Thu May 16 16:11:03 2019 (r347751) +++ stable/12/usr.sbin/mlx5tool/mlx5tool.c Thu May 16 16:11:42 2019 (r347752) @@ -28,6 +28,8 @@ __FBSDID("$FreeBSD$"); #include #include +#include +#include #include #include #include @@ -144,15 +146,60 @@ mlx5tool_dump_force(int ctldev, const struct mlx5_tool return (0); } +static int +mlx5tool_fw_update(int ctldev, const struct mlx5_tool_addr *addr, + const char *img_fw_path) +{ + struct stat st; + struct mlx5_fw_update fwup; + int error, fd, res; + + res = 0; + fd = open(img_fw_path, O_RDONLY); + if (fd == -1) { + warn("Unable to open %s", img_fw_path); + res = 1; + goto close_fd; + } + error = fstat(fd, &st); + if (error != 0) { + warn("Unable to stat %s", img_fw_path); + res = 1; + goto close_fd; + } + memset(&fwup, 0, sizeof(fwup)); + memcpy(&fwup.devaddr, addr, sizeof(fwup.devaddr)); + fwup.img_fw_data = mmap(NULL, st.st_size, PROT_READ, MAP_PRIVATE, + fd, 0); + if (fwup.img_fw_data == MAP_FAILED) { + warn("Unable to mmap %s", img_fw_path); + res = 1; + goto close_fd; + } + fwup.img_fw_data_len = st.st_size; + + error = ioctl(ctldev, MLX5_FW_UPDATE, &fwup); + if (error == -1) { + warn("MLX5_FW_UPDATE"); + } + + munmap(fwup.img_fw_data, st.st_size); +close_fd: + close(fd); + return (res); +} + static void usage(void) { fprintf(stderr, - "Usage: mlx5tool -d pci [-w -o dump.file | -r | -e]\n"); + "Usage: mlx5tool -d pci [-w -o dump.file | -r |" + " -e | -f fw.mfa2]\n"); fprintf(stderr, "\t-w - write firmware dump to the specified file\n"); fprintf(stderr, "\t-r - reset dump\n"); fprintf(stderr, "\t-e - force dump\n"); + fprintf(stderr, "\t-f fw.img - flash firmware from fw.img\n"); exit(1); } @@ -160,6 +207,7 @@ enum mlx5_action { ACTION_DUMP_GET, ACTION_DUMP_RESET, ACTION_DUMP_FORCE, + ACTION_FW_UPDATE, ACTION_NONE, }; @@ -169,13 +217,15 @@ main(int argc, char *argv[]) struct mlx5_tool_addr addr; char *dumpname; char *addrstr; + char *img_fw_path; int c, ctldev, res; enum mlx5_action act; act = ACTION_NONE; addrstr = NULL; dumpname = NULL; - while ((c = getopt(argc, argv, "d:eho:rw")) != -1) { + img_fw_path = NULL; + while ((c = getopt(argc, argv, "d:ef:ho:rw")) != -1) { switch (c) { case 'd': addrstr = optarg; @@ -192,12 +242,18 @@ main(int argc, char *argv[]) case 'r': act = ACTION_DUMP_RESET; break; + case 'f': + act = ACTION_FW_UPDATE; + img_fw_path = optarg; + break; case 'h': default: usage(); } } - if (act == ACTION_NONE || (dumpname != NULL && act != ACTION_DUMP_GET)) + if (act == ACTION_NONE || (dumpname != NULL && + act != ACTION_DUMP_GET) || (img_fw_path != NULL && + act != ACTION_FW_UPDATE)) usage(); if (parse_pci_addr(addrstr, &addr) != 0) exit(1); @@ -214,6 +270,9 @@ main(int argc, char *argv[]) break; case ACTION_DUMP_FORCE: res = mlx5tool_dump_force(ctldev, &addr); + break; + case ACTION_FW_UPDATE: + res = mlx5tool_fw_update(ctldev, &addr, img_fw_path); break; default: res = 0; From owner-svn-src-stable@freebsd.org Thu May 16 16:12:18 2019 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id AE5E7159CCD8; Thu, 16 May 2019 16:12:18 +0000 (UTC) (envelope-from hselasky@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 51E5D884B6; Thu, 16 May 2019 16:12:18 +0000 (UTC) (envelope-from hselasky@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 2C8832327D; Thu, 16 May 2019 16:12:18 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x4GGCIpT063486; Thu, 16 May 2019 16:12:18 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x4GGCHGM063278; Thu, 16 May 2019 16:12:17 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201905161612.x4GGCHGM063278@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Thu, 16 May 2019 16:12:17 +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: r347753 - in stable/12: share/man/man4 usr.sbin/mlx5tool X-SVN-Group: stable-12 X-SVN-Commit-Author: hselasky X-SVN-Commit-Paths: in stable/12: share/man/man4 usr.sbin/mlx5tool X-SVN-Commit-Revision: 347753 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 51E5D884B6 X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.97 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.998,0]; NEURAL_HAM_SHORT(-0.97)[-0.970,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US]; NEURAL_HAM_LONG(-1.00)[-1.000,0] X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 16 May 2019 16:12:18 -0000 Author: hselasky Date: Thu May 16 16:12:17 2019 New Revision: 347753 URL: https://svnweb.freebsd.org/changeset/base/347753 Log: MFC r347289: Document userspace firmware flash in mlx5tool(8) and mlx5io(4). Submitted by: kib@ Sponsored by: Mellanox Technologies Modified: stable/12/share/man/man4/mlx5io.4 stable/12/usr.sbin/mlx5tool/mlx5tool.8 Directory Properties: stable/12/ (props changed) Modified: stable/12/share/man/man4/mlx5io.4 ============================================================================== --- stable/12/share/man/man4/mlx5io.4 Thu May 16 16:11:42 2019 (r347752) +++ stable/12/share/man/man4/mlx5io.4 Thu May 16 16:12:17 2019 (r347753) @@ -1,5 +1,5 @@ .\" -.\" Copyright (c) 2018 Mellanox Technologies +.\" Copyright (c) 2018, 2019 Mellanox Technologies .\" All rights reserved. .\" .\" Redistribution and use in source and binary forms, with or without @@ -121,6 +121,27 @@ struct mlx5_fwdump_reg { uint32_t val; }; .Ed +.It Dv MLX5_FW_UPDATE +Requests firmware update (flash) on the adapter specified by the +.Dv devaddr +using the firmware image in +.Dv MFA2 +format. +The argument for the ioctl command is the +.Vt struct mlx5_fw_update +with the following definition. +.Bd -literal +struct mlx5_fw_update { + struct mlx5_tool_addr devaddr; + void *img_fw_data; + size_t img_fw_data_len; +}; +.Ed +Image address in memory is passed in +.Dv img_fw_data , +the length of the image is specified in +.Dv img_fw_data_len +field. .El .Sh FILES The Modified: stable/12/usr.sbin/mlx5tool/mlx5tool.8 ============================================================================== --- stable/12/usr.sbin/mlx5tool/mlx5tool.8 Thu May 16 16:11:42 2019 (r347752) +++ stable/12/usr.sbin/mlx5tool/mlx5tool.8 Thu May 16 16:12:17 2019 (r347753) @@ -1,5 +1,5 @@ .\" -.\" Copyright (c) 2018 Mellanox Technologies +.\" Copyright (c) 2018, 2019 Mellanox Technologies .\" All rights reserved. .\" .\" Redistribution and use in source and binary forms, with or without @@ -37,11 +37,14 @@ .Fl e .Nm .Fl d Ar domain:bus:slot:func -.Fl r +.Fl rn .Nm .Fl d Ar domain:bus:slot:func .Fl o Ar file .Fl w +.Nm +.Fl d Ar domain:bus:slot:func +.Fl f Ar file.mfa2 .Sh DESCRIPTION The .Nm @@ -82,6 +85,12 @@ Fetches the stored firmware dump and writes it into th by the .Fl o option argument. +.It Fl f +Flashes the firmware image +.Fa file.mfa2 +to the specified adapter. +Image must be in MFA2 pack format and contain a component suitable +for the adapter hardware. .El .Sh FILES The From owner-svn-src-stable@freebsd.org Thu May 16 16:12:53 2019 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id ECB91159CD76; Thu, 16 May 2019 16:12:52 +0000 (UTC) (envelope-from hselasky@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 9183F88635; Thu, 16 May 2019 16:12:52 +0000 (UTC) (envelope-from hselasky@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 62BD3233B4; Thu, 16 May 2019 16:12:52 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x4GGCqGf064404; Thu, 16 May 2019 16:12:52 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x4GGCqsi064403; Thu, 16 May 2019 16:12:52 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201905161612.x4GGCqsi064403@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Thu, 16 May 2019 16:12:52 +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: r347754 - stable/12/sys/dev/mlx5/mlx5_core X-SVN-Group: stable-12 X-SVN-Commit-Author: hselasky X-SVN-Commit-Paths: stable/12/sys/dev/mlx5/mlx5_core X-SVN-Commit-Revision: 347754 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 9183F88635 X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.97 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.998,0]; NEURAL_HAM_SHORT(-0.97)[-0.969,0]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US] X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 16 May 2019 16:12:53 -0000 Author: hselasky Date: Thu May 16 16:12:51 2019 New Revision: 347754 URL: https://svnweb.freebsd.org/changeset/base/347754 Log: MFC r347290: Fix for double bus master disable in mlx5core. mlx5_pci_disable_device is calling pci_disable_device which disables bus master. No need to explicitly call pci_clear_master. Submitted by: slavash@ Sponsored by: Mellanox Technologies Modified: stable/12/sys/dev/mlx5/mlx5_core/mlx5_main.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/dev/mlx5/mlx5_core/mlx5_main.c ============================================================================== --- stable/12/sys/dev/mlx5/mlx5_core/mlx5_main.c Thu May 16 16:12:17 2019 (r347753) +++ stable/12/sys/dev/mlx5/mlx5_core/mlx5_main.c Thu May 16 16:12:51 2019 (r347754) @@ -866,7 +866,6 @@ static int mlx5_pci_init(struct mlx5_core_dev *dev, st return 0; err_clr_master: - pci_clear_master(dev->pdev); release_bar(dev->pdev); err_disable: mlx5_pci_disable_device(dev); @@ -877,7 +876,6 @@ err_dbg: static void mlx5_pci_close(struct mlx5_core_dev *dev, struct mlx5_priv *priv) { iounmap(dev->iseg); - pci_clear_master(dev->pdev); release_bar(dev->pdev); mlx5_pci_disable_device(dev); } From owner-svn-src-stable@freebsd.org Thu May 16 16:13:30 2019 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 47922159CDF2; Thu, 16 May 2019 16:13:30 +0000 (UTC) (envelope-from hselasky@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 D93B38876B; Thu, 16 May 2019 16:13:29 +0000 (UTC) (envelope-from hselasky@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 A9FFE233B6; Thu, 16 May 2019 16:13:29 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x4GGDTuY064502; Thu, 16 May 2019 16:13:29 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x4GGDTpc064501; Thu, 16 May 2019 16:13:29 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201905161613.x4GGDTpc064501@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Thu, 16 May 2019 16:13:29 +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: r347755 - stable/12/sys/ofed/drivers/infiniband/ulp/ipoib X-SVN-Group: stable-12 X-SVN-Commit-Author: hselasky X-SVN-Commit-Paths: stable/12/sys/ofed/drivers/infiniband/ulp/ipoib X-SVN-Commit-Revision: 347755 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: D93B38876B X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.97 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.998,0]; NEURAL_HAM_SHORT(-0.97)[-0.969,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US]; NEURAL_HAM_LONG(-1.00)[-1.000,0] X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 16 May 2019 16:13:30 -0000 Author: hselasky Date: Thu May 16 16:13:29 2019 New Revision: 347755 URL: https://svnweb.freebsd.org/changeset/base/347755 Log: MFC r347291: Handle IB_EVENT_DEVICE_FATAL event in ipoib. Perform flush if IB_EVENT_DEVICE_FATAL was received. Submitted by: slavash@ Sponsored by: Mellanox Technologies Modified: stable/12/sys/ofed/drivers/infiniband/ulp/ipoib/ipoib_verbs.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/ofed/drivers/infiniband/ulp/ipoib/ipoib_verbs.c ============================================================================== --- stable/12/sys/ofed/drivers/infiniband/ulp/ipoib/ipoib_verbs.c Thu May 16 16:12:51 2019 (r347754) +++ stable/12/sys/ofed/drivers/infiniband/ulp/ipoib/ipoib_verbs.c Thu May 16 16:13:29 2019 (r347755) @@ -282,7 +282,8 @@ void ipoib_event(struct ib_event_handler *handler, queue_work(ipoib_workqueue, &priv->flush_light); } else if (record->event == IB_EVENT_PORT_ERR || record->event == IB_EVENT_PORT_ACTIVE || - record->event == IB_EVENT_LID_CHANGE) { + record->event == IB_EVENT_LID_CHANGE || + record->event == IB_EVENT_DEVICE_FATAL) { queue_work(ipoib_workqueue, &priv->flush_normal); } else if (record->event == IB_EVENT_PKEY_CHANGE) { queue_work(ipoib_workqueue, &priv->flush_heavy); From owner-svn-src-stable@freebsd.org Thu May 16 16:14:04 2019 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 95BBC159CE91; Thu, 16 May 2019 16:14:04 +0000 (UTC) (envelope-from hselasky@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 386B7888CF; Thu, 16 May 2019 16:14:04 +0000 (UTC) (envelope-from hselasky@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 129D0233B7; Thu, 16 May 2019 16:14:04 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x4GGE3Wd064587; Thu, 16 May 2019 16:14:03 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x4GGE3PC064586; Thu, 16 May 2019 16:14:03 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201905161614.x4GGE3PC064586@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Thu, 16 May 2019 16:14:03 +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: r347756 - stable/12/sys/dev/mlx5/mlx5_core X-SVN-Group: stable-12 X-SVN-Commit-Author: hselasky X-SVN-Commit-Paths: stable/12/sys/dev/mlx5/mlx5_core X-SVN-Commit-Revision: 347756 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 386B7888CF X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.97 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.998,0]; NEURAL_HAM_SHORT(-0.97)[-0.969,0]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US] X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 16 May 2019 16:14:04 -0000 Author: hselasky Date: Thu May 16 16:14:03 2019 New Revision: 347756 URL: https://svnweb.freebsd.org/changeset/base/347756 Log: MFC r347292: Add mlx5_firmware_update() in mlx5core. Add support for upgrading firmware on mlx5 module load. Submitted by: slavash@ Sponsored by: Mellanox Technologies Modified: stable/12/sys/dev/mlx5/mlx5_core/mlx5_main.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/dev/mlx5/mlx5_core/mlx5_main.c ============================================================================== --- stable/12/sys/dev/mlx5/mlx5_core/mlx5_main.c Thu May 16 16:13:29 2019 (r347755) +++ stable/12/sys/dev/mlx5/mlx5_core/mlx5_main.c Thu May 16 16:14:03 2019 (r347756) @@ -52,6 +52,7 @@ MODULE_DESCRIPTION("Mellanox Connect-IB, ConnectX-4 co MODULE_LICENSE("Dual BSD/GPL"); MODULE_DEPEND(mlx5, linuxkpi, 1, 1, 1); MODULE_DEPEND(mlx5, mlxfw, 1, 1, 1); +MODULE_DEPEND(mlx5, firmware, 1, 1, 1); MODULE_VERSION(mlx5, 1); SYSCTL_NODE(_hw, OID_AUTO, mlx5, CTLFLAG_RW, 0, "mlx5 hardware controls"); @@ -820,6 +821,23 @@ void *mlx5_get_protocol_dev(struct mlx5_core_dev *mdev } EXPORT_SYMBOL(mlx5_get_protocol_dev); +static int +mlx5_firmware_update(struct mlx5_core_dev *dev) +{ + const struct firmware *fw; + int err; + + fw = firmware_get("mlx5fw_mfa"); + if (fw) { + err = mlx5_firmware_flash(dev, fw); + firmware_put(fw, FIRMWARE_UNLOAD); + } + else + return (-ENOENT); + + return err; +} + static int mlx5_pci_init(struct mlx5_core_dev *dev, struct mlx5_priv *priv) { struct pci_dev *pdev = dev->pdev; @@ -1274,6 +1292,8 @@ static int init_one(struct pci_dev *pdev, } mlx5_fwdump_prep(dev); + + mlx5_firmware_update(dev); pci_save_state(bsddev); return 0; From owner-svn-src-stable@freebsd.org Thu May 16 16:14:44 2019 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 68155159CF2E; Thu, 16 May 2019 16:14:44 +0000 (UTC) (envelope-from hselasky@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 0F1BF88A1A; Thu, 16 May 2019 16:14:44 +0000 (UTC) (envelope-from hselasky@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 C45D9233B8; Thu, 16 May 2019 16:14:43 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x4GGEhDA064673; Thu, 16 May 2019 16:14:43 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x4GGEhZS064672; Thu, 16 May 2019 16:14:43 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201905161614.x4GGEhZS064672@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Thu, 16 May 2019 16:14:43 +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: r347757 - stable/12/sys/dev/mlx5/mlx5_en X-SVN-Group: stable-12 X-SVN-Commit-Author: hselasky X-SVN-Commit-Paths: stable/12/sys/dev/mlx5/mlx5_en X-SVN-Commit-Revision: 347757 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 0F1BF88A1A X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.97 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.998,0]; NEURAL_HAM_SHORT(-0.97)[-0.969,0]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US] X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 16 May 2019 16:14:44 -0000 Author: hselasky Date: Thu May 16 16:14:43 2019 New Revision: 347757 URL: https://svnweb.freebsd.org/changeset/base/347757 Log: MFC r347293: Use software counters for rx_packets and rx_bytes in mlx5en(4). The physical- and virtual- port counters might not reflect the amount of data received after address filtering. Use the software counters instead for rx_packets and rx_bytes to know exactly how much data was received. Sponsored by: Mellanox Technologies Modified: stable/12/sys/dev/mlx5/mlx5_en/mlx5_en_main.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/dev/mlx5/mlx5_en/mlx5_en_main.c ============================================================================== --- stable/12/sys/dev/mlx5/mlx5_en/mlx5_en_main.c Thu May 16 16:14:03 2019 (r347756) +++ stable/12/sys/dev/mlx5/mlx5_en/mlx5_en_main.c Thu May 16 16:14:43 2019 (r347757) @@ -499,6 +499,8 @@ mlx5e_update_stats_locked(struct mlx5e_priv *priv) u64 sw_lro_flushed = 0; u64 rx_csum_none = 0; u64 rx_wqe_err = 0; + u64 rx_packets = 0; + u64 rx_bytes = 0; u32 rx_out_of_buffer = 0; int i; int j; @@ -522,6 +524,8 @@ mlx5e_update_stats_locked(struct mlx5e_priv *priv) lro_bytes += rq_stats->lro_bytes; rx_csum_none += rq_stats->csum_none; rx_wqe_err += rq_stats->wqe_err; + rx_packets += rq_stats->packets; + rx_bytes += rq_stats->bytes; for (j = 0; j < priv->num_tc; j++) { sq_stats = &pch->sq[j].stats; @@ -548,6 +552,8 @@ mlx5e_update_stats_locked(struct mlx5e_priv *priv) s->sw_lro_flushed = sw_lro_flushed; s->rx_csum_none = rx_csum_none; s->rx_wqe_err = rx_wqe_err; + s->rx_packets = rx_packets; + s->rx_bytes = rx_bytes; /* HW counters */ memset(in, 0, sizeof(in)); @@ -610,11 +616,6 @@ mlx5e_update_stats_locked(struct mlx5e_priv *priv) s->tx_broadcast_bytes = MLX5_GET_CTR(out, transmitted_eth_broadcast.octets); - s->rx_packets = s->rx_unicast_packets + - s->rx_multicast_packets + s->rx_broadcast_packets - - s->rx_out_of_buffer; - s->rx_bytes = s->rx_unicast_bytes + s->rx_multicast_bytes + - s->rx_broadcast_bytes; s->tx_packets = s->tx_unicast_packets + s->tx_multicast_packets + s->tx_broadcast_packets; s->tx_bytes = s->tx_unicast_bytes + s->tx_multicast_bytes + From owner-svn-src-stable@freebsd.org Thu May 16 16:15:22 2019 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id F3182159CFAA; Thu, 16 May 2019 16:15:21 +0000 (UTC) (envelope-from hselasky@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 98A7088B5B; Thu, 16 May 2019 16:15:21 +0000 (UTC) (envelope-from hselasky@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 6F684233B9; Thu, 16 May 2019 16:15:21 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x4GGFLjw064770; Thu, 16 May 2019 16:15:21 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x4GGFK1T064766; Thu, 16 May 2019 16:15:20 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201905161615.x4GGFK1T064766@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Thu, 16 May 2019 16:15:20 +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: r347758 - in stable/12/sys/dev/mlx5: . mlx5_core mlx5_en X-SVN-Group: stable-12 X-SVN-Commit-Author: hselasky X-SVN-Commit-Paths: in stable/12/sys/dev/mlx5: . mlx5_core mlx5_en X-SVN-Commit-Revision: 347758 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 98A7088B5B X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.97 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.998,0]; NEURAL_HAM_SHORT(-0.97)[-0.970,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US]; NEURAL_HAM_LONG(-1.00)[-1.000,0] X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 16 May 2019 16:15:22 -0000 Author: hselasky Date: Thu May 16 16:15:20 2019 New Revision: 347758 URL: https://svnweb.freebsd.org/changeset/base/347758 Log: MFC r347295: Add vnic steering drop statistics in mlx5en(4). Sponsored by: Mellanox Technologies Modified: stable/12/sys/dev/mlx5/mlx5_core/mlx5_cmd.c stable/12/sys/dev/mlx5/mlx5_en/en.h stable/12/sys/dev/mlx5/mlx5_en/mlx5_en_main.c stable/12/sys/dev/mlx5/mlx5_ifc.h Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/dev/mlx5/mlx5_core/mlx5_cmd.c ============================================================================== --- stable/12/sys/dev/mlx5/mlx5_core/mlx5_cmd.c Thu May 16 16:14:43 2019 (r347757) +++ stable/12/sys/dev/mlx5/mlx5_core/mlx5_cmd.c Thu May 16 16:15:20 2019 (r347758) @@ -412,6 +412,7 @@ static int mlx5_internal_err_ret_value(struct mlx5_cor case MLX5_CMD_OP_MODIFY_HCA_VPORT_CONTEXT: case MLX5_CMD_OP_QUERY_HCA_VPORT_GID: case MLX5_CMD_OP_QUERY_HCA_VPORT_PKEY: + case MLX5_CMD_OP_QUERY_VNIC_ENV: case MLX5_CMD_OP_QUERY_VPORT_COUNTER: case MLX5_CMD_OP_ALLOC_Q_COUNTER: case MLX5_CMD_OP_QUERY_Q_COUNTER: @@ -537,6 +538,7 @@ const char *mlx5_command_str(int command) MLX5_COMMAND_STR_CASE(MODIFY_HCA_VPORT_CONTEXT); MLX5_COMMAND_STR_CASE(QUERY_HCA_VPORT_GID); MLX5_COMMAND_STR_CASE(QUERY_HCA_VPORT_PKEY); + MLX5_COMMAND_STR_CASE(QUERY_VNIC_ENV); MLX5_COMMAND_STR_CASE(QUERY_VPORT_COUNTER); MLX5_COMMAND_STR_CASE(SET_WOL_ROL); MLX5_COMMAND_STR_CASE(QUERY_WOL_ROL); Modified: stable/12/sys/dev/mlx5/mlx5_en/en.h ============================================================================== --- stable/12/sys/dev/mlx5/mlx5_en/en.h Thu May 16 16:14:43 2019 (r347757) +++ stable/12/sys/dev/mlx5/mlx5_en/en.h Thu May 16 16:15:20 2019 (r347758) @@ -186,7 +186,8 @@ typedef void (mlx5e_cq_comp_t)(struct mlx5_core_cq *); m(+1, u64 tx_queue_dropped, "tx_queue_dropped", "Transmit queue dropped") \ m(+1, u64 tx_defragged, "tx_defragged", "Transmit queue defragged") \ m(+1, u64 rx_wqe_err, "rx_wqe_err", "Receive WQE errors") \ - m(+1, u64 tx_jumbo_packets, "tx_jumbo_packets", "TX packets greater than 1518 octets") + m(+1, u64 tx_jumbo_packets, "tx_jumbo_packets", "TX packets greater than 1518 octets") \ + m(+1, u64 rx_steer_missed_packets, "rx_steer_missed_packets", "RX packets dropped by steering rule(s)") #define MLX5E_VPORT_STATS_NUM (0 MLX5E_VPORT_STATS(MLX5E_STATS_COUNT)) Modified: stable/12/sys/dev/mlx5/mlx5_en/mlx5_en_main.c ============================================================================== --- stable/12/sys/dev/mlx5/mlx5_en/mlx5_en_main.c Thu May 16 16:14:43 2019 (r347757) +++ stable/12/sys/dev/mlx5/mlx5_en/mlx5_en_main.c Thu May 16 16:15:20 2019 (r347758) @@ -468,6 +468,28 @@ free_out: kvfree(out); } +static void +mlx5e_grp_vnic_env_update_stats(struct mlx5e_priv *priv) +{ + u32 out[MLX5_ST_SZ_DW(query_vnic_env_out)] = {}; + u32 in[MLX5_ST_SZ_DW(query_vnic_env_in)] = {}; + + if (!MLX5_CAP_GEN(priv->mdev, nic_receive_steering_discard)) + return; + + MLX5_SET(query_vnic_env_in, in, opcode, + MLX5_CMD_OP_QUERY_VNIC_ENV); + MLX5_SET(query_vnic_env_in, in, op_mod, 0); + MLX5_SET(query_vnic_env_in, in, other_vport, 0); + + if (mlx5_cmd_exec(priv->mdev, in, sizeof(in), out, sizeof(out)) != 0) + return; + + priv->stats.vport.rx_steer_missed_packets = + MLX5_GET64(query_vnic_env_out, out, + vport_env.nic_receive_steering_discard); +} + /* * This function is called regularly to collect all statistics * counters from the firmware. The values can be viewed through the @@ -554,6 +576,8 @@ mlx5e_update_stats_locked(struct mlx5e_priv *priv) s->rx_wqe_err = rx_wqe_err; s->rx_packets = rx_packets; s->rx_bytes = rx_bytes; + + mlx5e_grp_vnic_env_update_stats(priv); /* HW counters */ memset(in, 0, sizeof(in)); Modified: stable/12/sys/dev/mlx5/mlx5_ifc.h ============================================================================== --- stable/12/sys/dev/mlx5/mlx5_ifc.h Thu May 16 16:14:43 2019 (r347757) +++ stable/12/sys/dev/mlx5/mlx5_ifc.h Thu May 16 16:15:20 2019 (r347758) @@ -151,6 +151,7 @@ enum { MLX5_CMD_OP_MODIFY_HCA_VPORT_CONTEXT = 0x763, MLX5_CMD_OP_QUERY_HCA_VPORT_GID = 0x764, MLX5_CMD_OP_QUERY_HCA_VPORT_PKEY = 0x765, + MLX5_CMD_OP_QUERY_VNIC_ENV = 0x76f, MLX5_CMD_OP_QUERY_VPORT_COUNTER = 0x770, MLX5_CMD_OP_ALLOC_Q_COUNTER = 0x771, MLX5_CMD_OP_DEALLOC_Q_COUNTER = 0x772, @@ -1222,7 +1223,9 @@ struct mlx5_ifc_cmd_hca_cap_bits { u8 reserved_44[0xb]; u8 log_max_xrcd[0x5]; - u8 reserved_45[0x10]; + u8 nic_receive_steering_discard[0x1]; + u8 reserved_45[0x7]; + u8 log_max_flow_counter_bulk[0x8]; u8 max_flow_counter[0x10]; u8 reserved_46[0x3]; @@ -2190,6 +2193,24 @@ struct mlx5_ifc_xrc_srqc_bits { u8 reserved_9[0x80]; }; +struct mlx5_ifc_vnic_diagnostic_statistics_bits { + u8 counter_error_queues[0x20]; + + u8 total_error_queues[0x20]; + + u8 send_queue_priority_update_flow[0x20]; + + u8 reserved_at_60[0x20]; + + u8 nic_receive_steering_discard[0x40]; + + u8 receive_discard_vport_down[0x40]; + + u8 transmit_discard_vport_down[0x40]; + + u8 reserved_at_140[0xec0]; +}; + struct mlx5_ifc_traffic_counter_bits { u8 packets[0x40]; @@ -3964,6 +3985,35 @@ struct mlx5_ifc_query_vport_state_in_bits { u8 vport_number[0x10]; u8 reserved_3[0x20]; +}; + +struct mlx5_ifc_query_vnic_env_out_bits { + u8 status[0x8]; + u8 reserved_at_8[0x18]; + + u8 syndrome[0x20]; + + u8 reserved_at_40[0x40]; + + struct mlx5_ifc_vnic_diagnostic_statistics_bits vport_env; +}; + +enum { + MLX5_QUERY_VNIC_ENV_IN_OP_MOD_VPORT_DIAG_STATISTICS = 0x0, +}; + +struct mlx5_ifc_query_vnic_env_in_bits { + u8 opcode[0x10]; + u8 reserved_at_10[0x10]; + + u8 reserved_at_20[0x10]; + u8 op_mod[0x10]; + + u8 other_vport[0x1]; + u8 reserved_at_41[0xf]; + u8 vport_number[0x10]; + + u8 reserved_at_60[0x20]; }; struct mlx5_ifc_query_vport_counter_out_bits { From owner-svn-src-stable@freebsd.org Thu May 16 16:15:44 2019 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 3714F159D029; Thu, 16 May 2019 16:15:44 +0000 (UTC) (envelope-from sjg@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 CEFD988C90; Thu, 16 May 2019 16:15:43 +0000 (UTC) (envelope-from sjg@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 8FA2F233BF; Thu, 16 May 2019 16:15:43 +0000 (UTC) (envelope-from sjg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x4GGFhHe064835; Thu, 16 May 2019 16:15:43 GMT (envelope-from sjg@FreeBSD.org) Received: (from sjg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x4GGFgMK064828; Thu, 16 May 2019 16:15:42 GMT (envelope-from sjg@FreeBSD.org) Message-Id: <201905161615.x4GGFgMK064828@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: sjg set sender to sjg@FreeBSD.org using -f From: "Simon J. Gerraty" Date: Thu, 16 May 2019 16:15:42 +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: r347759 - in stable/12/lib/libsecureboot: . openpgp tests X-SVN-Group: stable-12 X-SVN-Commit-Author: sjg X-SVN-Commit-Paths: in stable/12/lib/libsecureboot: . openpgp tests X-SVN-Commit-Revision: 347759 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: CEFD988C90 X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.97 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.998,0]; NEURAL_HAM_SHORT(-0.97)[-0.971,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US]; NEURAL_HAM_LONG(-1.00)[-1.000,0] X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 16 May 2019 16:15:44 -0000 Author: sjg Date: Thu May 16 16:15:41 2019 New Revision: 347759 URL: https://svnweb.freebsd.org/changeset/base/347759 Log: libsecureboot: make it easier to customize trust anchors Avoid making hash self-tests depend on X.509 certs. Include OpenPGP keys in trust store count. MFC of r347408 Reviewed by: stevek Sponsored by: Juniper Networks Differential Revision: https://reviews.freebsd.org/D20208 Modified: stable/12/lib/libsecureboot/Makefile.inc stable/12/lib/libsecureboot/libsecureboot-priv.h stable/12/lib/libsecureboot/local.trust.mk stable/12/lib/libsecureboot/openpgp/Makefile.inc stable/12/lib/libsecureboot/openpgp/opgp_key.c stable/12/lib/libsecureboot/tests/Makefile stable/12/lib/libsecureboot/vets.c Modified: stable/12/lib/libsecureboot/Makefile.inc ============================================================================== --- stable/12/lib/libsecureboot/Makefile.inc Thu May 16 16:15:20 2019 (r347758) +++ stable/12/lib/libsecureboot/Makefile.inc Thu May 16 16:15:41 2019 (r347759) @@ -98,10 +98,20 @@ CFLAGS+= ${VE_HASH_LIST:@H@-DVE_$H_SUPPORT@} \ .if ${VE_SELF_TESTS} != "no" # The input used for hash KATs +# we use a string by default so it is independent of any other test +VE_HASH_KAT_STRLEN?= strlen +.if ${VE_HASH_KAT_STRLEN} == "strlen" +VE_HASH_KAT_STR?= self-tests-are-good +VE_HASH_KAT_STR_INPUT= echo -n +XCFLAGS.vets+= -DVE_HASH_KAT_STR=\"${VE_HASH_KAT_STR}\" +.else VE_HASH_KAT_STR?= vc_PEM - +VE_HASH_KAT_STR_INPUT= cat +VE_HASH_KAT_STRLEN= sizeof XCFLAGS.vets+= -DVE_HASH_KAT_STR=${VE_HASH_KAT_STR} .endif +XCFLAGS.vets+= -DVE_HASH_KAT_STRLEN=${VE_HASH_KAT_STRLEN} +.endif # this should be updated occassionally this is 2019-01-01Z SOURCE_DATE_EPOCH?= 1546329600 @@ -121,17 +131,20 @@ BUILD_UTC?= ${${STAT:Ustat} -f %m ${BUILD_UTC_FILE}:L: # If we are doing self-tests, we define another arrary vc_PEM # containing certificates that we can verify for each trust anchor. # This is typically a subordinate CA cert. -# Finally we generate a hash of vc_PEM using each supported hash method +# Finally we generate a hash of VE_HASH_KAT_STR +# using each supported hash method # to use as a Known Answer Test (needed for FIPS 140-2) # +TA_PEM_LIST ?= ${.ALLSRC:N*crl*:Mt*.pem} +VC_PEM_LIST ?= ${.ALLSRC:N*crl*:Mv*.pem} vets.o vets.po vets.pico: ta.h -ta.h: ${.ALLTARGETS:M[tv]*pem:O:u} +ta.h: @( echo '/* Autogenerated - DO NOT EDIT!!! */'; echo; \ - cat ${.ALLSRC:N*crl*:Mt*.pem} /dev/null | \ + cat ${TA_PEM_LIST:O:u} /dev/null | \ file2c -sx 'static const char ta_PEM[] = {' '};'; \ - echo "${.newline}${VE_HASH_LIST:@H@static char vh_$H[] = \"`cat ${.ALLSRC:N*crl*:Mv*.pem} | ${$H:U${H:tl}}`\";${.newline}@}"; ) > ${.TARGET} + echo "${.newline}${VE_HASH_LIST:O:u:@H@static char vh_$H[] = \"`${VE_HASH_KAT_STR_INPUT} ${VE_HASH_KAT_STR} | ${$H:U${H:tl}}`\";${.newline}@}"; ) > ${.TARGET} .if ${VE_SELF_TESTS} != "no" - ( cat ${.ALLSRC:N*crl*:Mv*.pem} /dev/null | \ + ( cat ${VC_PEM_LIST:O:u} /dev/null | \ file2c -sx 'static const char vc_PEM[] = {' '};'; echo ) >> ${.TARGET} .endif echo '#define BUILD_UTC ${BUILD_UTC}' >> ${.TARGET} ${.OODATE:MNOMETA_CMP} @@ -141,7 +154,7 @@ vesigned.o vesigned.po vesigned.pico: vse.h vse.h: @( echo '/* Autogenerated - DO NOT EDIT!!! */'; echo; \ echo "static const char *signature_exts[] = {"; \ - echo '${VE_SIGNATURE_EXT_LIST:@e@"$e",${.newline}@}'; \ + echo '${VE_SIGNATURE_EXT_LIST:O:u:@e@"$e",${.newline}@}'; \ echo 'NULL };' ) > ${.TARGET} Modified: stable/12/lib/libsecureboot/libsecureboot-priv.h ============================================================================== --- stable/12/lib/libsecureboot/libsecureboot-priv.h Thu May 16 16:15:20 2019 (r347758) +++ stable/12/lib/libsecureboot/libsecureboot-priv.h Thu May 16 16:15:41 2019 (r347759) @@ -55,6 +55,7 @@ int verify_rsa_digest(br_rsa_public_key *pkey, int is_verified(struct stat *stp); void add_verify_status(struct stat *stp, int status); +int openpgp_trust_init(void); int openpgp_self_tests(void); int efi_secure_boot_enabled(void); Modified: stable/12/lib/libsecureboot/local.trust.mk ============================================================================== --- stable/12/lib/libsecureboot/local.trust.mk Thu May 16 16:15:20 2019 (r347758) +++ stable/12/lib/libsecureboot/local.trust.mk Thu May 16 16:15:41 2019 (r347759) @@ -51,7 +51,7 @@ SIGN_OPENPGP= ${PYTHON} ${SIGNER:H}/openpgp-sign.py -a ta_openpgp.asc: ${SIGN_OPENPGP} -C ${.TARGET} -ta.h: ta_openpgp.asc +ta_asc.h: ta_openpgp.asc .if ${VE_SELF_TESTS} != "no" # for self test @@ -59,7 +59,7 @@ vc_openpgp.asc: ta_openpgp.asc ${SIGN_OPENPGP} ${.ALLSRC:M*.asc} mv ta_openpgp.asc.asc ${.TARGET} -ta.h: vc_openpgp.asc +ta_asc.h: vc_openpgp.asc .endif .endif @@ -72,17 +72,20 @@ ecerts.pem: .if ${VE_SIGNATURE_LIST:tu:MECDSA} != "" # the last cert in the chain is the one we want ta_ec.pem: ecerts.pem _LAST_PEM_USE - +ta.h: ta_ec.pem .if ${VE_SELF_TESTS} != "no" # these are for verification self test vc_ec.pem: ecerts.pem _2ndLAST_PEM_USE +ta.h: vc_ec.pem .endif .endif .if ${VE_SIGNATURE_LIST:tu:MRSA} != "" ta_rsa.pem: rcerts.pem _LAST_PEM_USE +ta.h: ta_rsa.pem .if ${VE_SELF_TESTS} != "no" vc_rsa.pem: rcerts.pem _2ndLAST_PEM_USE +ta.h: vc_rsa.pem .endif .endif Modified: stable/12/lib/libsecureboot/openpgp/Makefile.inc ============================================================================== --- stable/12/lib/libsecureboot/openpgp/Makefile.inc Thu May 16 16:15:20 2019 (r347758) +++ stable/12/lib/libsecureboot/openpgp/Makefile.inc Thu May 16 16:15:41 2019 (r347759) @@ -23,26 +23,29 @@ opgp_key.o opgp_key.po opgp_key.pico: ta_asc.h # It is assumed that these v*.asc files are named similarly to # the appropriate t*.asc so that the relative order of vc_ASC # entries matches ta_ASC. -# -ta_asc.h: ${.ALLTARGETS:M[tv]*.asc:O:u} +# +TA_ASC_LIST ?= ${.ALLSRC:Mt*.asc} +VC_ASC_LIST ?= ${.ALLSRC:Mv*.asc} + +ta_asc.h: .if ${VE_SIGNATURE_LIST:MOPENPGP} != "" @( echo '/* Autogenerated - DO NOT EDIT!!! */'; echo; \ echo "#define HAVE_TA_ASC 1"; \ - set -- ${.ALLSRC:Mt*.asc:@f@$f ${f:T:R}@}; \ + set -- ${TA_ASC_LIST:@f@$f ${f:T:R}@}; \ while test $$# -ge 2; do \ file2c -sx "static const char $$2[] = {" ', 0x00 };' < $$1; \ shift 2; \ done; \ - echo 'static const char *ta_ASC[] = { ${.ALLSRC:Mt*.asc:T:R:ts,}, NULL };'; \ + echo 'static const char *ta_ASC[] = { ${TA_ASC_LIST:T:R:ts,}, NULL };'; \ echo; ) > ${.TARGET} .if ${VE_SELF_TESTS} != "no" @( echo "#define HAVE_VC_ASC 1"; \ - set -- ${.ALLSRC:Mv*.asc:@f@$f ${f:T:R}@}; \ + set -- ${VC_ASC_LIST:@f@$f ${f:T:R}@}; \ while test $$# -ge 2; do \ file2c -sx "static const char $$2[] = {" ', 0x00 };' < $$1; \ shift 2; \ done; \ - echo 'static const char *vc_ASC[] = { ${.ALLSRC:Mv*.asc:T:R:ts,}, NULL };'; \ + echo 'static const char *vc_ASC[] = { ${VC_ASC_LIST:T:R:ts,}, NULL };'; \ echo; ) >> ${.TARGET} .endif .endif Modified: stable/12/lib/libsecureboot/openpgp/opgp_key.c ============================================================================== --- stable/12/lib/libsecureboot/openpgp/opgp_key.c Thu May 16 16:15:20 2019 (r347758) +++ stable/12/lib/libsecureboot/openpgp/opgp_key.c Thu May 16 16:15:41 2019 (r347759) @@ -289,32 +289,47 @@ load_trusted_key_id(const char *keyID) OpenPGP_key * load_key_id(const char *keyID) { - static int once = 0; OpenPGP_key *key; - if (!once) { + key = openpgp_trust_get(keyID); +#ifndef _STANDALONE + if (!key) + key = load_trusted_key_id(keyID); +#endif + return (key); +} + +/** + * @brief initialize our internal trust store if any + */ +int +openpgp_trust_init(void) +{ + static int once = -1; #ifdef HAVE_TA_ASC - const char **tp; - char *cp; - size_t n; + OpenPGP_key *key; + const char **tp; + char *cp; + size_t n; +#endif + if (once < 0) { + once = 0; +#ifdef HAVE_TA_ASC for (tp = ta_ASC; *tp; tp++) { if ((cp = strdup(*tp))) { n = strlen(cp); key = load_key_buf((unsigned char *)cp, n); free(cp); - openpgp_trust_add(key); + if (key) { + openpgp_trust_add(key); + once++; + } } } -#endif - once = 1; } - key = openpgp_trust_get(keyID); -#ifndef _STANDALONE - if (!key) - key = load_trusted_key_id(keyID); #endif - return (key); + return (once); } /** @@ -333,19 +348,21 @@ openpgp_self_tests(void) char *fdata, *sdata = NULL; size_t fbytes, sbytes; - for (tp = ta_ASC, vp = vc_ASC; *tp && *vp && rc; tp++, vp++) { - if ((fdata = strdup(*tp)) && - (sdata = strdup(*vp))) { - fbytes = strlen(fdata); - sbytes = strlen(sdata); - rc = openpgp_verify("ta_ASC", - (unsigned char *)fdata, fbytes, - (unsigned char *)sdata, sbytes, 0); - printf("Testing verify OpenPGP signature:\t\t%s\n", - rc ? "Failed" : "Passed"); + if (openpgp_trust_init() > 0) { + for (tp = ta_ASC, vp = vc_ASC; *tp && *vp && rc; tp++, vp++) { + if ((fdata = strdup(*tp)) && + (sdata = strdup(*vp))) { + fbytes = strlen(fdata); + sbytes = strlen(sdata); + rc = openpgp_verify("ta_ASC", + (unsigned char *)fdata, fbytes, + (unsigned char *)sdata, sbytes, 0); + printf("Testing verify OpenPGP signature:\t\t%s\n", + rc ? "Failed" : "Passed"); + } + free(fdata); + free(sdata); } - free(fdata); - free(sdata); } #endif return (rc); Modified: stable/12/lib/libsecureboot/tests/Makefile ============================================================================== --- stable/12/lib/libsecureboot/tests/Makefile Thu May 16 16:15:20 2019 (r347758) +++ stable/12/lib/libsecureboot/tests/Makefile Thu May 16 16:15:41 2019 (r347759) @@ -13,6 +13,7 @@ NO_SHARED= # we want to test verify_file api too # which requires a kludge or two +MK_LOADER_EFI_SECUREBOOT= no .include "../Makefile.libsa.inc" BRSSL_CFLAGS := ${BRSSL_CFLAGS:N-DNO_STDIO} XCFLAGS.verify_file += -DSOPEN_MAX=64 Modified: stable/12/lib/libsecureboot/vets.c ============================================================================== --- stable/12/lib/libsecureboot/vets.c Thu May 16 16:15:20 2019 (r347758) +++ stable/12/lib/libsecureboot/vets.c Thu May 16 16:15:41 2019 (r347759) @@ -246,7 +246,9 @@ ve_trust_init(void) num = ve_trust_anchors_add(xcs, num); #endif once = (int) VEC_LEN(trust_anchors); - +#ifdef VE_OPENPGP_SUPPORT + once += openpgp_trust_init(); +#endif return (once); } @@ -814,7 +816,7 @@ test_hash(const br_hash_class *md, size_t hlen, #define ve_test_hash(n, N) \ printf("Testing hash: " #n "\t\t\t\t%s\n", \ test_hash(&br_ ## n ## _vtable, br_ ## n ## _SIZE, #n, \ - VE_HASH_KAT_STR, sizeof(VE_HASH_KAT_STR), \ + VE_HASH_KAT_STR, VE_HASH_KAT_STRLEN(VE_HASH_KAT_STR), \ vh_ ## N) ? "Failed" : "Passed") /** @@ -863,34 +865,32 @@ ve_self_tests(void) #ifdef VERIFY_CERTS_STR xcs = parse_certificates(__DECONST(unsigned char *, VERIFY_CERTS_STR), sizeof(VERIFY_CERTS_STR), &num); - if (xcs == NULL) - return (0); - /* - * We want the commonName field - * the OID we want is 2,5,4,3 - but DER encoded - */ - cn_oid[0] = 3; - cn_oid[1] = 0x55; - cn_oid[2] = 4; - cn_oid[3] = 3; - cn.oid = cn_oid; - cn.buf = cn_buf; + if (xcs != NULL) { + /* + * We want the commonName field + * the OID we want is 2,5,4,3 - but DER encoded + */ + cn_oid[0] = 3; + cn_oid[1] = 0x55; + cn_oid[2] = 4; + cn_oid[3] = 3; + cn.oid = cn_oid; + cn.buf = cn_buf; - for (u = 0; u < num; u ++) { - cn.len = sizeof(cn_buf); - if ((pk = verify_signer_xcs(&xcs[u], 1, &cn, 1, &trust_anchors)) != NULL) { - free_cert_contents(&xcs[u]); - once++; - printf("Testing verify certificate: %s\tPassed\n", - cn.status ? cn_buf : ""); - xfreepkey(pk); + for (u = 0; u < num; u ++) { + cn.len = sizeof(cn_buf); + if ((pk = verify_signer_xcs(&xcs[u], 1, &cn, 1, &trust_anchors)) != NULL) { + free_cert_contents(&xcs[u]); + once++; + printf("Testing verify certificate: %s\tPassed\n", + cn.status ? cn_buf : ""); + xfreepkey(pk); + } } + if (!once) + printf("Testing verify certificate:\t\t\tFailed\n"); + xfree(xcs); } - if (!once) - printf("Testing verify certificate:\t\t\tFailed\n"); - xfree(xcs); -#else - printf("No X.509 self tests\n"); #endif /* VERIFY_CERTS_STR */ #ifdef VE_OPENPGP_SUPPORT if (!openpgp_self_tests()) From owner-svn-src-stable@freebsd.org Thu May 16 16:21:33 2019 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 7EDA5159D1AE; Thu, 16 May 2019 16:21:33 +0000 (UTC) (envelope-from hselasky@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 244EA88F4A; Thu, 16 May 2019 16:21:33 +0000 (UTC) (envelope-from hselasky@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 F29D723412; Thu, 16 May 2019 16:21:32 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x4GGLW1p068110; Thu, 16 May 2019 16:21:32 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x4GGLWRT068108; Thu, 16 May 2019 16:21:32 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201905161621.x4GGLWRT068108@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Thu, 16 May 2019 16:21:32 +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: r347760 - stable/12/sys/dev/mlx5/mlx5_en X-SVN-Group: stable-12 X-SVN-Commit-Author: hselasky X-SVN-Commit-Paths: stable/12/sys/dev/mlx5/mlx5_en X-SVN-Commit-Revision: 347760 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 244EA88F4A X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.98 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.998,0]; NEURAL_HAM_SHORT(-0.98)[-0.978,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US]; NEURAL_HAM_LONG(-1.00)[-1.000,0] X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 16 May 2019 16:21:33 -0000 Author: hselasky Date: Thu May 16 16:21:32 2019 New Revision: 347760 URL: https://svnweb.freebsd.org/changeset/base/347760 Log: MFC r347295: Let rx_out_of_buffer be a 32-bit counter in mlx5en(4). This fixes counting issues when the firmware resets the counter during allocation of the counter set where the counter belongs. Sponsored by: Mellanox Technologies Modified: stable/12/sys/dev/mlx5/mlx5_en/en.h stable/12/sys/dev/mlx5/mlx5_en/mlx5_en_main.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/dev/mlx5/mlx5_en/en.h ============================================================================== --- stable/12/sys/dev/mlx5/mlx5_en/en.h Thu May 16 16:15:41 2019 (r347759) +++ stable/12/sys/dev/mlx5/mlx5_en/en.h Thu May 16 16:21:32 2019 (r347760) @@ -195,7 +195,6 @@ struct mlx5e_vport_stats { struct sysctl_ctx_list ctx; u64 arg [0]; MLX5E_VPORT_STATS(MLX5E_STATS_VAR) - u32 rx_out_of_buffer_prev; }; #define MLX5E_PPORT_IEEE802_3_STATS(m) \ Modified: stable/12/sys/dev/mlx5/mlx5_en/mlx5_en_main.c ============================================================================== --- stable/12/sys/dev/mlx5/mlx5_en/mlx5_en_main.c Thu May 16 16:15:41 2019 (r347759) +++ stable/12/sys/dev/mlx5/mlx5_en/mlx5_en_main.c Thu May 16 16:21:32 2019 (r347760) @@ -593,10 +593,7 @@ mlx5e_update_stats_locked(struct mlx5e_priv *priv) if (test_bit(MLX5E_STATE_OPENED, &priv->state) != 0 && mlx5_vport_query_out_of_rx_buffer(mdev, priv->counter_set_id, &rx_out_of_buffer) == 0) { - /* accumulate difference into a 64-bit counter */ - s->rx_out_of_buffer += (u64)(u32)(rx_out_of_buffer - - s->rx_out_of_buffer_prev); - s->rx_out_of_buffer_prev = rx_out_of_buffer; + s->rx_out_of_buffer = rx_out_of_buffer; } /* get port statistics */ From owner-svn-src-stable@freebsd.org Thu May 16 16:22:41 2019 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id A5DEE159D3C7; Thu, 16 May 2019 16:22:41 +0000 (UTC) (envelope-from hps@selasky.org) Received: from mail.turbocat.net (turbocat.net [88.99.82.50]) (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 F2D708926D; Thu, 16 May 2019 16:22:40 +0000 (UTC) (envelope-from hps@selasky.org) Received: from hps2016.home.selasky.org (unknown [176.74.212.121]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.turbocat.net (Postfix) with ESMTPSA id 17064260268; Thu, 16 May 2019 18:22:32 +0200 (CEST) Subject: Re: svn commit: r347758 - in stable/12/sys/dev/mlx5: . mlx5_core mlx5_en To: Hans Petter Selasky , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org References: <201905161615.x4GGFK1T064766@repo.freebsd.org> From: Hans Petter Selasky Message-ID: Date: Thu, 16 May 2019 18:22:02 +0200 User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:60.0) Gecko/20100101 Thunderbird/60.6.1 MIME-Version: 1.0 In-Reply-To: <201905161615.x4GGFK1T064766@repo.freebsd.org> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit X-Rspamd-Queue-Id: F2D708926D X-Spamd-Bar: ------ Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-6.97 / 15.00]; NEURAL_HAM_MEDIUM(-1.00)[-0.999,0]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; REPLY(-4.00)[]; NEURAL_HAM_SHORT(-0.97)[-0.967,0] X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 16 May 2019 16:22:41 -0000 On 2019-05-16 18:15, Hans Petter Selasky wrote: > Author: hselasky > Date: Thu May 16 16:15:20 2019 > New Revision: 347758 > URL: https://svnweb.freebsd.org/changeset/base/347758 > > Log: > MFC r347295: > Add vnic steering drop statistics in mlx5en(4). ^^^ should be MFC r347294, like in the mergeinfo. --HPS From owner-svn-src-stable@freebsd.org Thu May 16 16:23:59 2019 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 62311159D481; Thu, 16 May 2019 16:23:59 +0000 (UTC) (envelope-from hselasky@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 08BB0893E0; Thu, 16 May 2019 16:23:59 +0000 (UTC) (envelope-from hselasky@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 D53B323565; Thu, 16 May 2019 16:23:58 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x4GGNwoi069931; Thu, 16 May 2019 16:23:58 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x4GGNwHT069928; Thu, 16 May 2019 16:23:58 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201905161623.x4GGNwHT069928@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Thu, 16 May 2019 16:23:58 +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: r347761 - stable/12/sys/dev/mlx5/mlx5_en X-SVN-Group: stable-12 X-SVN-Commit-Author: hselasky X-SVN-Commit-Paths: stable/12/sys/dev/mlx5/mlx5_en X-SVN-Commit-Revision: 347761 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 08BB0893E0 X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.98 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.998,0]; NEURAL_HAM_SHORT(-0.98)[-0.979,0]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US] X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 16 May 2019 16:23:59 -0000 Author: hselasky Date: Thu May 16 16:23:58 2019 New Revision: 347761 URL: https://svnweb.freebsd.org/changeset/base/347761 Log: MFC r347296: Correct check for the calibration generation in mlx5en(4). If generation is cleared due to hardware clock failure, check for it before the divisor is used. Actually clear generation when failure occurs. While there, stop doing the calculations inside the generation loop. Since all members of mlx5e_clbr_point are used for calculations, get the local copy of the structure and use it after generation stabilized. Submitted by: kib@ Sponsored by: Mellanox Technologies Modified: stable/12/sys/dev/mlx5/mlx5_en/mlx5_en_main.c stable/12/sys/dev/mlx5/mlx5_en/mlx5_en_rx.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/dev/mlx5/mlx5_en/mlx5_en_main.c ============================================================================== --- stable/12/sys/dev/mlx5/mlx5_en/mlx5_en_main.c Thu May 16 16:21:32 2019 (r347760) +++ stable/12/sys/dev/mlx5/mlx5_en/mlx5_en_main.c Thu May 16 16:23:58 2019 (r347761) @@ -833,11 +833,15 @@ mlx5e_calibration_callout(void *arg) next->clbr_hw_prev = curr->clbr_hw_curr; next->clbr_hw_curr = mlx5e_hw_clock(priv); - if (((next->clbr_hw_curr - curr->clbr_hw_prev) >> MLX5E_TSTMP_PREC) == + if (((next->clbr_hw_curr - curr->clbr_hw_curr) >> MLX5E_TSTMP_PREC) == 0) { - if_printf(priv->ifp, "HW failed tstmp frozen %#jx %#jx," - "disabling\n", next->clbr_hw_curr, curr->clbr_hw_prev); - priv->clbr_done = 0; + if (priv->clbr_done != 0) { + if_printf(priv->ifp, "HW failed tstmp frozen %#jx %#jx," + "disabling\n", + next->clbr_hw_curr, curr->clbr_hw_prev); + priv->clbr_done = 0; + } + atomic_store_rel_int(&curr->clbr_gen, 0); return; } Modified: stable/12/sys/dev/mlx5/mlx5_en/mlx5_en_rx.c ============================================================================== --- stable/12/sys/dev/mlx5/mlx5_en/mlx5_en_rx.c Thu May 16 16:21:32 2019 (r347760) +++ stable/12/sys/dev/mlx5/mlx5_en/mlx5_en_rx.c Thu May 16 16:23:58 2019 (r347761) @@ -222,28 +222,31 @@ mlx5e_lro_update_hdr(struct mbuf *mb, struct mlx5_cqe6 static uint64_t mlx5e_mbuf_tstmp(struct mlx5e_priv *priv, uint64_t hw_tstmp) { - struct mlx5e_clbr_point *cp; + struct mlx5e_clbr_point *cp, dcp; uint64_t a1, a2, res; u_int gen; do { cp = &priv->clbr_points[priv->clbr_curr]; gen = atomic_load_acq_int(&cp->clbr_gen); - a1 = (hw_tstmp - cp->clbr_hw_prev) >> MLX5E_TSTMP_PREC; - a2 = (cp->base_curr - cp->base_prev) >> MLX5E_TSTMP_PREC; - res = (a1 * a2) << MLX5E_TSTMP_PREC; + if (gen == 0) + return (0); + dcp = *cp; + atomic_thread_fence_acq(); + } while (gen != cp->clbr_gen); - /* - * Divisor cannot be zero because calibration callback - * checks for the condition and disables timestamping - * if clock halted. - */ - res /= (cp->clbr_hw_curr - cp->clbr_hw_prev) >> - MLX5E_TSTMP_PREC; + a1 = (hw_tstmp - dcp.clbr_hw_prev) >> MLX5E_TSTMP_PREC; + a2 = (dcp.base_curr - dcp.base_prev) >> MLX5E_TSTMP_PREC; + res = (a1 * a2) << MLX5E_TSTMP_PREC; - res += cp->base_prev; - atomic_thread_fence_acq(); - } while (gen == 0 || gen != cp->clbr_gen); + /* + * Divisor cannot be zero because calibration callback + * checks for the condition and disables timestamping + * if clock halted. + */ + res /= (dcp.clbr_hw_curr - dcp.clbr_hw_prev) >> MLX5E_TSTMP_PREC; + + res += dcp.base_prev; return (res); } From owner-svn-src-stable@freebsd.org Thu May 16 16:24:35 2019 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id D602B159D4F4; Thu, 16 May 2019 16:24:35 +0000 (UTC) (envelope-from hselasky@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 7A04B89500; Thu, 16 May 2019 16:24:35 +0000 (UTC) (envelope-from hselasky@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 5448223566; Thu, 16 May 2019 16:24:35 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x4GGOZGT070016; Thu, 16 May 2019 16:24:35 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x4GGOZQ8070015; Thu, 16 May 2019 16:24:35 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201905161624.x4GGOZQ8070015@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Thu, 16 May 2019 16:24:35 +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: r347762 - stable/12/sys/dev/mlx5/mlx5_core X-SVN-Group: stable-12 X-SVN-Commit-Author: hselasky X-SVN-Commit-Paths: stable/12/sys/dev/mlx5/mlx5_core X-SVN-Commit-Revision: 347762 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 7A04B89500 X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.98 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.998,0]; NEURAL_HAM_SHORT(-0.98)[-0.978,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US]; NEURAL_HAM_LONG(-1.00)[-1.000,0] X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 16 May 2019 16:24:36 -0000 Author: hselasky Date: Thu May 16 16:24:34 2019 New Revision: 347762 URL: https://svnweb.freebsd.org/changeset/base/347762 Log: MFC r347297: Control automatic update of firmware on driver load with a tunable in mlx5core. Submitted by: kib@ Sponsored by: Mellanox Technologies Modified: stable/12/sys/dev/mlx5/mlx5_core/mlx5_main.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/dev/mlx5/mlx5_core/mlx5_main.c ============================================================================== --- stable/12/sys/dev/mlx5/mlx5_core/mlx5_main.c Thu May 16 16:23:58 2019 (r347761) +++ stable/12/sys/dev/mlx5/mlx5_core/mlx5_main.c Thu May 16 16:24:34 2019 (r347762) @@ -821,12 +821,19 @@ void *mlx5_get_protocol_dev(struct mlx5_core_dev *mdev } EXPORT_SYMBOL(mlx5_get_protocol_dev); +static int mlx5_auto_fw_update; +SYSCTL_INT(_hw_mlx5, OID_AUTO, auto_fw_update, CTLFLAG_RDTUN | CTLFLAG_NOFETCH, + &mlx5_auto_fw_update, 0, + "Allow automatic firmware update on driver start"); static int mlx5_firmware_update(struct mlx5_core_dev *dev) { const struct firmware *fw; int err; + TUNABLE_INT_FETCH("hw.mlx5.auto_fw_update", &mlx5_auto_fw_update); + if (!mlx5_auto_fw_update) + return (0); fw = firmware_get("mlx5fw_mfa"); if (fw) { err = mlx5_firmware_flash(dev, fw); From owner-svn-src-stable@freebsd.org Thu May 16 16:25:10 2019 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 10736159D54F; Thu, 16 May 2019 16:25:10 +0000 (UTC) (envelope-from hselasky@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 A839A89633; Thu, 16 May 2019 16:25:09 +0000 (UTC) (envelope-from hselasky@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 838DB23567; Thu, 16 May 2019 16:25:09 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x4GGP9L0070108; Thu, 16 May 2019 16:25:09 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x4GGP9eu070107; Thu, 16 May 2019 16:25:09 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201905161625.x4GGP9eu070107@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Thu, 16 May 2019 16:25:09 +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: r347763 - stable/12/sys/dev/mlx5 X-SVN-Group: stable-12 X-SVN-Commit-Author: hselasky X-SVN-Commit-Paths: stable/12/sys/dev/mlx5 X-SVN-Commit-Revision: 347763 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: A839A89633 X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.98 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.998,0]; NEURAL_HAM_SHORT(-0.98)[-0.978,0]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US] X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 16 May 2019 16:25:10 -0000 Author: hselasky Date: Thu May 16 16:25:09 2019 New Revision: 347763 URL: https://svnweb.freebsd.org/changeset/base/347763 Log: MFC r347298: Remove unused speed enums in mlx5core. Submitted by: slavash@ Sponsored by: Mellanox Technologies Modified: stable/12/sys/dev/mlx5/driver.h Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/dev/mlx5/driver.h ============================================================================== --- stable/12/sys/dev/mlx5/driver.h Thu May 16 16:24:34 2019 (r347762) +++ stable/12/sys/dev/mlx5/driver.h Thu May 16 16:25:09 2019 (r347763) @@ -207,36 +207,6 @@ enum mlx5_port_status { MLX5_PORT_DOWN = 1 << 1, }; -enum mlx5_link_mode { - MLX5_1000BASE_CX_SGMII = 0, - MLX5_1000BASE_KX = 1, - MLX5_10GBASE_CX4 = 2, - MLX5_10GBASE_KX4 = 3, - MLX5_10GBASE_KR = 4, - MLX5_20GBASE_KR2 = 5, - MLX5_40GBASE_CR4 = 6, - MLX5_40GBASE_KR4 = 7, - MLX5_56GBASE_R4 = 8, - MLX5_10GBASE_CR = 12, - MLX5_10GBASE_SR = 13, - MLX5_10GBASE_ER = 14, - MLX5_40GBASE_SR4 = 15, - MLX5_40GBASE_LR4 = 16, - MLX5_100GBASE_CR4 = 20, - MLX5_100GBASE_SR4 = 21, - MLX5_100GBASE_KR4 = 22, - MLX5_100GBASE_LR4 = 23, - MLX5_100BASE_TX = 24, - MLX5_1000BASE_T = 25, - MLX5_10GBASE_T = 26, - MLX5_25GBASE_CR = 27, - MLX5_25GBASE_KR = 28, - MLX5_25GBASE_SR = 29, - MLX5_50GBASE_CR2 = 30, - MLX5_50GBASE_KR2 = 31, - MLX5_LINK_MODES_NUMBER, -}; - enum { MLX5_VSC_SPACE_SUPPORTED = 0x1, MLX5_VSC_SPACE_OFFSET = 0x4, From owner-svn-src-stable@freebsd.org Thu May 16 16:26:11 2019 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id BB99A159D610; Thu, 16 May 2019 16:26:11 +0000 (UTC) (envelope-from hselasky@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 6E71D89788; Thu, 16 May 2019 16:26:11 +0000 (UTC) (envelope-from hselasky@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 5CA7723568; Thu, 16 May 2019 16:26:11 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x4GGQB3X070213; Thu, 16 May 2019 16:26:11 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x4GGQA6k070207; Thu, 16 May 2019 16:26:10 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201905161626.x4GGQA6k070207@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Thu, 16 May 2019 16:26:10 +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: r347764 - in stable/12/sys/dev/mlx5: . mlx5_core mlx5_en mlx5_ib X-SVN-Group: stable-12 X-SVN-Commit-Author: hselasky X-SVN-Commit-Paths: in stable/12/sys/dev/mlx5: . mlx5_core mlx5_en mlx5_ib X-SVN-Commit-Revision: 347764 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 6E71D89788 X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.98 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.998,0]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; NEURAL_HAM_SHORT(-0.98)[-0.982,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US] X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 16 May 2019 16:26:12 -0000 Author: hselasky Date: Thu May 16 16:26:09 2019 New Revision: 347764 URL: https://svnweb.freebsd.org/changeset/base/347764 Log: MFC r347299: Add support for 200Gb ethernet speeds to mlx5core. Submitted by: slavash@ Sponsored by: Mellanox Technologies Modified: stable/12/sys/dev/mlx5/mlx5_core/mlx5_fw.c stable/12/sys/dev/mlx5/mlx5_core/mlx5_port.c stable/12/sys/dev/mlx5/mlx5_en/mlx5_en_main.c stable/12/sys/dev/mlx5/mlx5_ib/mlx5_ib_main.c stable/12/sys/dev/mlx5/mlx5_ifc.h stable/12/sys/dev/mlx5/port.h Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/dev/mlx5/mlx5_core/mlx5_fw.c ============================================================================== --- stable/12/sys/dev/mlx5/mlx5_core/mlx5_fw.c Thu May 16 16:25:09 2019 (r347763) +++ stable/12/sys/dev/mlx5/mlx5_core/mlx5_fw.c Thu May 16 16:26:09 2019 (r347764) @@ -221,6 +221,12 @@ int mlx5_query_hca_caps(struct mlx5_core_dev *dev) return err; } + if (MLX5_CAP_GEN(dev, pcam_reg)) { + err = mlx5_get_pcam_reg(dev); + if (err) + return err; + } + err = mlx5_core_query_special_contexts(dev); if (err) return err; Modified: stable/12/sys/dev/mlx5/mlx5_core/mlx5_port.c ============================================================================== --- stable/12/sys/dev/mlx5/mlx5_core/mlx5_port.c Thu May 16 16:25:09 2019 (r347763) +++ stable/12/sys/dev/mlx5/mlx5_core/mlx5_port.c Thu May 16 16:26:09 2019 (r347764) @@ -260,7 +260,7 @@ int mlx5_query_port_eth_proto_oper(struct mlx5_core_de EXPORT_SYMBOL(mlx5_query_port_eth_proto_oper); int mlx5_set_port_proto(struct mlx5_core_dev *dev, u32 proto_admin, - int proto_mask) + int proto_mask, bool ext) { u32 in[MLX5_ST_SZ_DW(ptys_reg)] = {0}; u32 out[MLX5_ST_SZ_DW(ptys_reg)] = {0}; @@ -268,10 +268,14 @@ int mlx5_set_port_proto(struct mlx5_core_dev *dev, u32 MLX5_SET(ptys_reg, in, local_port, 1); MLX5_SET(ptys_reg, in, proto_mask, proto_mask); - if (proto_mask == MLX5_PTYS_EN) - MLX5_SET(ptys_reg, in, eth_proto_admin, proto_admin); - else + if (proto_mask == MLX5_PTYS_EN) { + if (ext) + MLX5_SET(ptys_reg, in, ext_eth_proto_admin, proto_admin); + else + MLX5_SET(ptys_reg, in, eth_proto_admin, proto_admin); + } else { MLX5_SET(ptys_reg, in, ib_proto_admin, proto_admin); + } err = mlx5_core_access_reg(dev, in, sizeof(in), out, sizeof(out), MLX5_REG_PTYS, 0, 1); Modified: stable/12/sys/dev/mlx5/mlx5_en/mlx5_en_main.c ============================================================================== --- stable/12/sys/dev/mlx5/mlx5_en/mlx5_en_main.c Thu May 16 16:25:09 2019 (r347763) +++ stable/12/sys/dev/mlx5/mlx5_en/mlx5_en_main.c Thu May 16 16:26:09 2019 (r347764) @@ -47,117 +47,355 @@ struct mlx5e_channel_param { struct mlx5e_cq_param tx_cq; }; -static const struct { +struct media { u32 subtype; u64 baudrate; -} mlx5e_mode_table[MLX5E_LINK_MODES_NUMBER] = { +}; - [MLX5E_1000BASE_CX_SGMII] = { +static const struct media mlx5e_mode_table[MLX5E_LINK_SPEEDS_NUMBER][MLX5E_LINK_MODES_NUMBER] = { + + [MLX5E_1000BASE_CX_SGMII][MLX5E_SGMII] = { .subtype = IFM_1000_CX_SGMII, .baudrate = IF_Mbps(1000ULL), }, - [MLX5E_1000BASE_KX] = { + [MLX5E_1000BASE_KX][MLX5E_KX] = { .subtype = IFM_1000_KX, .baudrate = IF_Mbps(1000ULL), }, - [MLX5E_10GBASE_CX4] = { + [MLX5E_10GBASE_CX4][MLX5E_CX4] = { .subtype = IFM_10G_CX4, .baudrate = IF_Gbps(10ULL), }, - [MLX5E_10GBASE_KX4] = { + [MLX5E_10GBASE_KX4][MLX5E_KX4] = { .subtype = IFM_10G_KX4, .baudrate = IF_Gbps(10ULL), }, - [MLX5E_10GBASE_KR] = { + [MLX5E_10GBASE_KR][MLX5E_KR] = { .subtype = IFM_10G_KR, .baudrate = IF_Gbps(10ULL), }, - [MLX5E_20GBASE_KR2] = { + [MLX5E_20GBASE_KR2][MLX5E_KR2] = { .subtype = IFM_20G_KR2, .baudrate = IF_Gbps(20ULL), }, - [MLX5E_40GBASE_CR4] = { + [MLX5E_40GBASE_CR4][MLX5E_CR4] = { .subtype = IFM_40G_CR4, .baudrate = IF_Gbps(40ULL), }, - [MLX5E_40GBASE_KR4] = { + [MLX5E_40GBASE_KR4][MLX5E_KR4] = { .subtype = IFM_40G_KR4, .baudrate = IF_Gbps(40ULL), }, - [MLX5E_56GBASE_R4] = { + [MLX5E_56GBASE_R4][MLX5E_R] = { .subtype = IFM_56G_R4, .baudrate = IF_Gbps(56ULL), }, - [MLX5E_10GBASE_CR] = { + [MLX5E_10GBASE_CR][MLX5E_CR1] = { .subtype = IFM_10G_CR1, .baudrate = IF_Gbps(10ULL), }, - [MLX5E_10GBASE_SR] = { + [MLX5E_10GBASE_SR][MLX5E_SR] = { .subtype = IFM_10G_SR, .baudrate = IF_Gbps(10ULL), }, - [MLX5E_10GBASE_ER] = { + [MLX5E_10GBASE_ER_LR][MLX5E_ER] = { .subtype = IFM_10G_ER, .baudrate = IF_Gbps(10ULL), }, - [MLX5E_40GBASE_SR4] = { + [MLX5E_10GBASE_ER_LR][MLX5E_LR] = { + .subtype = IFM_10G_LR, + .baudrate = IF_Gbps(10ULL), + }, + [MLX5E_40GBASE_SR4][MLX5E_SR4] = { .subtype = IFM_40G_SR4, .baudrate = IF_Gbps(40ULL), }, - [MLX5E_40GBASE_LR4] = { + [MLX5E_40GBASE_LR4_ER4][MLX5E_LR4] = { .subtype = IFM_40G_LR4, .baudrate = IF_Gbps(40ULL), }, - [MLX5E_100GBASE_CR4] = { + [MLX5E_40GBASE_LR4_ER4][MLX5E_ER4] = { + .subtype = IFM_40G_ER4, + .baudrate = IF_Gbps(40ULL), + }, + [MLX5E_100GBASE_CR4][MLX5E_CR4] = { .subtype = IFM_100G_CR4, .baudrate = IF_Gbps(100ULL), }, - [MLX5E_100GBASE_SR4] = { + [MLX5E_100GBASE_SR4][MLX5E_SR4] = { .subtype = IFM_100G_SR4, .baudrate = IF_Gbps(100ULL), }, - [MLX5E_100GBASE_KR4] = { + [MLX5E_100GBASE_KR4][MLX5E_KR4] = { .subtype = IFM_100G_KR4, .baudrate = IF_Gbps(100ULL), }, - [MLX5E_100GBASE_LR4] = { + [MLX5E_100GBASE_LR4][MLX5E_LR4] = { .subtype = IFM_100G_LR4, .baudrate = IF_Gbps(100ULL), }, - [MLX5E_100BASE_TX] = { + [MLX5E_100BASE_TX][MLX5E_TX] = { .subtype = IFM_100_TX, .baudrate = IF_Mbps(100ULL), }, - [MLX5E_1000BASE_T] = { + [MLX5E_1000BASE_T][MLX5E_T] = { .subtype = IFM_1000_T, .baudrate = IF_Mbps(1000ULL), }, - [MLX5E_10GBASE_T] = { + [MLX5E_10GBASE_T][MLX5E_T] = { .subtype = IFM_10G_T, .baudrate = IF_Gbps(10ULL), }, - [MLX5E_25GBASE_CR] = { + [MLX5E_25GBASE_CR][MLX5E_CR] = { .subtype = IFM_25G_CR, .baudrate = IF_Gbps(25ULL), }, - [MLX5E_25GBASE_KR] = { + [MLX5E_25GBASE_KR][MLX5E_KR] = { .subtype = IFM_25G_KR, .baudrate = IF_Gbps(25ULL), }, - [MLX5E_25GBASE_SR] = { + [MLX5E_25GBASE_SR][MLX5E_SR] = { .subtype = IFM_25G_SR, .baudrate = IF_Gbps(25ULL), }, - [MLX5E_50GBASE_CR2] = { + [MLX5E_50GBASE_CR2][MLX5E_CR2] = { .subtype = IFM_50G_CR2, .baudrate = IF_Gbps(50ULL), }, - [MLX5E_50GBASE_KR2] = { + [MLX5E_50GBASE_KR2][MLX5E_KR2] = { .subtype = IFM_50G_KR2, .baudrate = IF_Gbps(50ULL), }, }; +static const struct media mlx5e_ext_mode_table[MLX5E_EXT_LINK_SPEEDS_NUMBER][MLX5E_LINK_MODES_NUMBER] = { + [MLX5E_SGMII_100M][MLX5E_SGMII] = { + .subtype = IFM_100_SGMII, + .baudrate = IF_Mbps(100), + }, + [MLX5E_1000BASE_X_SGMII][MLX5E_KX] = { + .subtype = IFM_1000_KX, + .baudrate = IF_Mbps(1000), + }, + [MLX5E_1000BASE_X_SGMII][MLX5E_CX_SGMII] = { + .subtype = IFM_1000_CX_SGMII, + .baudrate = IF_Mbps(1000), + }, + [MLX5E_1000BASE_X_SGMII][MLX5E_CX] = { + .subtype = IFM_1000_CX, + .baudrate = IF_Mbps(1000), + }, + [MLX5E_1000BASE_X_SGMII][MLX5E_LX] = { + .subtype = IFM_1000_LX, + .baudrate = IF_Mbps(1000), + }, + [MLX5E_1000BASE_X_SGMII][MLX5E_SX] = { + .subtype = IFM_1000_SX, + .baudrate = IF_Mbps(1000), + }, + [MLX5E_1000BASE_X_SGMII][MLX5E_T] = { + .subtype = IFM_1000_T, + .baudrate = IF_Mbps(1000), + }, + [MLX5E_5GBASE_R][MLX5E_T] = { + .subtype = IFM_5000_T, + .baudrate = IF_Mbps(5000), + }, + [MLX5E_5GBASE_R][MLX5E_KR] = { + .subtype = IFM_5000_KR, + .baudrate = IF_Mbps(5000), + }, + [MLX5E_5GBASE_R][MLX5E_KR1] = { + .subtype = IFM_5000_KR1, + .baudrate = IF_Mbps(5000), + }, + [MLX5E_5GBASE_R][MLX5E_KR_S] = { + .subtype = IFM_5000_KR_S, + .baudrate = IF_Mbps(5000), + }, + [MLX5E_10GBASE_XFI_XAUI_1][MLX5E_ER] = { + .subtype = IFM_10G_ER, + .baudrate = IF_Gbps(10ULL), + }, + [MLX5E_10GBASE_XFI_XAUI_1][MLX5E_KR] = { + .subtype = IFM_10G_KR, + .baudrate = IF_Gbps(10ULL), + }, + [MLX5E_10GBASE_XFI_XAUI_1][MLX5E_LR] = { + .subtype = IFM_10G_LR, + .baudrate = IF_Gbps(10ULL), + }, + [MLX5E_10GBASE_XFI_XAUI_1][MLX5E_SR] = { + .subtype = IFM_10G_SR, + .baudrate = IF_Gbps(10ULL), + }, + [MLX5E_10GBASE_XFI_XAUI_1][MLX5E_T] = { + .subtype = IFM_10G_T, + .baudrate = IF_Gbps(10ULL), + }, + [MLX5E_10GBASE_XFI_XAUI_1][MLX5E_AOC] = { + .subtype = IFM_10G_AOC, + .baudrate = IF_Gbps(10ULL), + }, + [MLX5E_10GBASE_XFI_XAUI_1][MLX5E_CR1] = { + .subtype = IFM_10G_CR1, + .baudrate = IF_Gbps(10ULL), + }, + [MLX5E_40GBASE_XLAUI_4_XLPPI_4][MLX5E_CR4] = { + .subtype = IFM_40G_CR4, + .baudrate = IF_Gbps(40ULL), + }, + [MLX5E_40GBASE_XLAUI_4_XLPPI_4][MLX5E_KR4] = { + .subtype = IFM_40G_KR4, + .baudrate = IF_Gbps(40ULL), + }, + [MLX5E_40GBASE_XLAUI_4_XLPPI_4][MLX5E_LR4] = { + .subtype = IFM_40G_LR4, + .baudrate = IF_Gbps(40ULL), + }, + [MLX5E_40GBASE_XLAUI_4_XLPPI_4][MLX5E_SR4] = { + .subtype = IFM_40G_SR4, + .baudrate = IF_Gbps(40ULL), + }, + [MLX5E_40GBASE_XLAUI_4_XLPPI_4][MLX5E_ER4] = { + .subtype = IFM_40G_ER4, + .baudrate = IF_Gbps(40ULL), + }, + + [MLX5E_25GAUI_1_25GBASE_CR_KR][MLX5E_CR] = { + .subtype = IFM_25G_CR, + .baudrate = IF_Gbps(25ULL), + }, + [MLX5E_25GAUI_1_25GBASE_CR_KR][MLX5E_KR] = { + .subtype = IFM_25G_KR, + .baudrate = IF_Gbps(25ULL), + }, + [MLX5E_25GAUI_1_25GBASE_CR_KR][MLX5E_SR] = { + .subtype = IFM_25G_SR, + .baudrate = IF_Gbps(25ULL), + }, + [MLX5E_25GAUI_1_25GBASE_CR_KR][MLX5E_ACC] = { + .subtype = IFM_25G_ACC, + .baudrate = IF_Gbps(25ULL), + }, + [MLX5E_25GAUI_1_25GBASE_CR_KR][MLX5E_AOC] = { + .subtype = IFM_25G_AOC, + .baudrate = IF_Gbps(25ULL), + }, + [MLX5E_25GAUI_1_25GBASE_CR_KR][MLX5E_CR1] = { + .subtype = IFM_25G_CR1, + .baudrate = IF_Gbps(25ULL), + }, + [MLX5E_25GAUI_1_25GBASE_CR_KR][MLX5E_CR_S] = { + .subtype = IFM_25G_CR_S, + .baudrate = IF_Gbps(25ULL), + }, + [MLX5E_25GAUI_1_25GBASE_CR_KR][MLX5E_KR1] = { + .subtype = IFM_5000_KR1, + .baudrate = IF_Gbps(25ULL), + }, + [MLX5E_25GAUI_1_25GBASE_CR_KR][MLX5E_KR_S] = { + .subtype = IFM_25G_KR_S, + .baudrate = IF_Gbps(25ULL), + }, + [MLX5E_25GAUI_1_25GBASE_CR_KR][MLX5E_LR] = { + .subtype = IFM_25G_LR, + .baudrate = IF_Gbps(25ULL), + }, + [MLX5E_25GAUI_1_25GBASE_CR_KR][MLX5E_T] = { + .subtype = IFM_25G_T, + .baudrate = IF_Gbps(25ULL), + }, + [MLX5E_50GAUI_2_LAUI_2_50GBASE_CR2_KR2][MLX5E_CR2] = { + .subtype = IFM_50G_CR2, + .baudrate = IF_Gbps(50ULL), + }, + [MLX5E_50GAUI_2_LAUI_2_50GBASE_CR2_KR2][MLX5E_KR2] = { + .subtype = IFM_50G_KR2, + .baudrate = IF_Gbps(50ULL), + }, + [MLX5E_50GAUI_2_LAUI_2_50GBASE_CR2_KR2][MLX5E_SR2] = { + .subtype = IFM_50G_SR2, + .baudrate = IF_Gbps(50ULL), + }, + [MLX5E_50GAUI_2_LAUI_2_50GBASE_CR2_KR2][MLX5E_LR2] = { + .subtype = IFM_50G_LR2, + .baudrate = IF_Gbps(50ULL), + }, + [MLX5E_50GAUI_1_LAUI_1_50GBASE_CR_KR][MLX5E_LR] = { + .subtype = IFM_50G_LR, + .baudrate = IF_Gbps(50ULL), + }, + [MLX5E_50GAUI_1_LAUI_1_50GBASE_CR_KR][MLX5E_SR] = { + .subtype = IFM_50G_SR, + .baudrate = IF_Gbps(50ULL), + }, + [MLX5E_50GAUI_1_LAUI_1_50GBASE_CR_KR][MLX5E_CP] = { + .subtype = IFM_50G_CP, + .baudrate = IF_Gbps(50ULL), + }, + [MLX5E_50GAUI_1_LAUI_1_50GBASE_CR_KR][MLX5E_FR] = { + .subtype = IFM_50G_FR, + .baudrate = IF_Gbps(50ULL), + }, + [MLX5E_50GAUI_1_LAUI_1_50GBASE_CR_KR][MLX5E_KR_PAM4] = { + .subtype = IFM_50G_KR_PAM4, + .baudrate = IF_Gbps(50ULL), + }, + [MLX5E_CAUI_4_100GBASE_CR4_KR4][MLX5E_CR4] = { + .subtype = IFM_100G_CR4, + .baudrate = IF_Gbps(100ULL), + }, + [MLX5E_CAUI_4_100GBASE_CR4_KR4][MLX5E_KR4] = { + .subtype = IFM_100G_KR4, + .baudrate = IF_Gbps(100ULL), + }, + [MLX5E_CAUI_4_100GBASE_CR4_KR4][MLX5E_LR4] = { + .subtype = IFM_100G_LR4, + .baudrate = IF_Gbps(100ULL), + }, + [MLX5E_CAUI_4_100GBASE_CR4_KR4][MLX5E_SR4] = { + .subtype = IFM_100G_SR4, + .baudrate = IF_Gbps(100ULL), + }, + [MLX5E_100GAUI_2_100GBASE_CR2_KR2][MLX5E_SR2] = { + .subtype = IFM_100G_SR2, + .baudrate = IF_Gbps(100ULL), + }, + [MLX5E_100GAUI_2_100GBASE_CR2_KR2][MLX5E_CP2] = { + .subtype = IFM_100G_CP2, + .baudrate = IF_Gbps(100ULL), + }, + [MLX5E_100GAUI_2_100GBASE_CR2_KR2][MLX5E_KR2_PAM4] = { + .subtype = IFM_100G_KR2_PAM4, + .baudrate = IF_Gbps(100ULL), + }, + [MLX5E_200GAUI_4_200GBASE_CR4_KR4][MLX5E_DR4] = { + .subtype = IFM_200G_DR4, + .baudrate = IF_Gbps(200ULL), + }, + [MLX5E_200GAUI_4_200GBASE_CR4_KR4][MLX5E_LR4] = { + .subtype = IFM_200G_LR4, + .baudrate = IF_Gbps(200ULL), + }, + [MLX5E_200GAUI_4_200GBASE_CR4_KR4][MLX5E_SR4] = { + .subtype = IFM_200G_SR4, + .baudrate = IF_Gbps(200ULL), + }, + [MLX5E_200GAUI_4_200GBASE_CR4_KR4][MLX5E_FR4] = { + .subtype = IFM_200G_FR4, + .baudrate = IF_Gbps(200ULL), + }, + [MLX5E_200GAUI_4_200GBASE_CR4_KR4][MLX5E_CR4_PAM4] = { + .subtype = IFM_200G_CR4_PAM4, + .baudrate = IF_Gbps(200ULL), + }, + [MLX5E_200GAUI_4_200GBASE_CR4_KR4][MLX5E_KR4_PAM4] = { + .subtype = IFM_200G_KR4_PAM4, + .baudrate = IF_Gbps(200ULL), + }, +}; + MALLOC_DEFINE(M_MLX5EN, "MLX5EN", "MLX5 Ethernet"); static void @@ -169,7 +407,9 @@ mlx5e_update_carrier(struct mlx5e_priv *priv) int error; u8 port_state; u8 is_er_type; - u8 i; + u8 i, j; + bool ext; + struct media media_entry = {}; port_state = mlx5_query_vport_state(mdev, MLX5_QUERY_VPORT_STATE_IN_OP_MOD_VNIC_VPORT, 0); @@ -183,49 +423,58 @@ mlx5e_update_carrier(struct mlx5e_priv *priv) return; } - error = mlx5_query_port_ptys(mdev, out, sizeof(out), MLX5_PTYS_EN, 1); + error = mlx5_query_port_ptys(mdev, out, sizeof(out), + MLX5_PTYS_EN, 1); if (error) { priv->media_active_last = IFM_ETHER; priv->ifp->if_baudrate = 1; - if_printf(priv->ifp, "%s: query port ptys failed: 0x%x\n", - __func__, error); + if_printf(priv->ifp, "%s: query port ptys failed: " + "0x%x\n", __func__, error); return; } - eth_proto_oper = MLX5_GET(ptys_reg, out, eth_proto_oper); - for (i = 0; i != MLX5E_LINK_MODES_NUMBER; i++) { - if (mlx5e_mode_table[i].baudrate == 0) - continue; - if (MLX5E_PROT_MASK(i) & eth_proto_oper) { - u32 subtype = mlx5e_mode_table[i].subtype; + ext = MLX5_CAP_PCAM_FEATURE(mdev, ptys_extended_ethernet); + eth_proto_oper = MLX5_GET_ETH_PROTO(ptys_reg, out, ext, + eth_proto_oper); - priv->ifp->if_baudrate = - mlx5e_mode_table[i].baudrate; + i = ilog2(eth_proto_oper); - switch (subtype) { - case IFM_10G_ER: - error = mlx5_query_pddr_range_info(mdev, 1, &is_er_type); - if (error != 0) { - if_printf(priv->ifp, "%s: query port pddr failed: %d\n", - __func__, error); - } - if (error != 0 || is_er_type == 0) - subtype = IFM_10G_LR; - break; - case IFM_40G_LR4: - error = mlx5_query_pddr_range_info(mdev, 1, &is_er_type); - if (error != 0) { - if_printf(priv->ifp, "%s: query port pddr failed: %d\n", - __func__, error); - } - if (error == 0 && is_er_type != 0) - subtype = IFM_40G_ER4; - break; - } - priv->media_active_last = subtype | IFM_ETHER | IFM_FDX; + for (j = 0; j != MLX5E_LINK_MODES_NUMBER; j++) { + media_entry = ext ? mlx5e_ext_mode_table[i][j] : + mlx5e_mode_table[i][j]; + if (media_entry.baudrate != 0) break; + } + + if (media_entry.subtype == 0) { + if_printf(priv->ifp, "%s: Could not find operational " + "media subtype\n", __func__); + return; + } + + switch (media_entry.subtype) { + case IFM_10G_ER: + error = mlx5_query_pddr_range_info(mdev, 1, &is_er_type); + if (error != 0) { + if_printf(priv->ifp, "%s: query port pddr failed: %d\n", + __func__, error); } + if (error != 0 || is_er_type == 0) + media_entry.subtype = IFM_10G_LR; + break; + case IFM_40G_LR4: + error = mlx5_query_pddr_range_info(mdev, 1, &is_er_type); + if (error != 0) { + if_printf(priv->ifp, "%s: query port pddr failed: %d\n", + __func__, error); + } + if (error == 0 && is_er_type != 0) + media_entry.subtype = IFM_40G_ER4; + break; } + priv->media_active_last = media_entry.subtype | IFM_ETHER | IFM_FDX; + priv->ifp->if_baudrate = media_entry.baudrate; + if_link_state_change(priv->ifp, LINK_STATE_UP); } @@ -242,10 +491,13 @@ mlx5e_media_status(struct ifnet *dev, struct ifmediare } static u32 -mlx5e_find_link_mode(u32 subtype) +mlx5e_find_link_mode(u32 subtype, bool ext) { u32 i; + u32 j; u32 link_mode = 0; + u32 speeds_num = 0; + struct media media_entry = {}; switch (subtype) { case IFM_10G_LR: @@ -256,11 +508,19 @@ mlx5e_find_link_mode(u32 subtype) break; } - for (i = 0; i < MLX5E_LINK_MODES_NUMBER; ++i) { - if (mlx5e_mode_table[i].baudrate == 0) - continue; - if (mlx5e_mode_table[i].subtype == subtype) - link_mode |= MLX5E_PROT_MASK(i); + speeds_num = ext ? MLX5E_EXT_LINK_SPEEDS_NUMBER : + MLX5E_LINK_SPEEDS_NUMBER; + + for (i = 0; i != speeds_num; i++) { + for (j = 0; j < MLX5E_LINK_MODES_NUMBER ; ++j) { + media_entry = ext ? mlx5e_ext_mode_table[i][j] : + mlx5e_mode_table[i][j]; + if (media_entry.baudrate == 0) + continue; + if (media_entry.subtype == subtype) { + link_mode |= MLX5E_PROT_MASK(i); + } + } } return (link_mode); @@ -286,7 +546,8 @@ mlx5e_set_port_pfc(struct mlx5e_priv *priv) } else if (priv->params.rx_pauseframe_control || priv->params.tx_pauseframe_control) { if_printf(priv->ifp, - "Global pauseframes must be disabled before enabling PFC.\n"); + "Global pauseframes must be disabled before " + "enabling PFC.\n"); error = -EINVAL; } else { error = mlx5e_set_port_pause_and_pfc(priv); @@ -301,9 +562,11 @@ mlx5e_media_change(struct ifnet *dev) struct mlx5_core_dev *mdev = priv->mdev; u32 eth_proto_cap; u32 link_mode; + u32 out[MLX5_ST_SZ_DW(ptys_reg)]; int was_opened; int locked; int error; + bool ext; locked = PRIV_LOCKED(priv); if (!locked) @@ -313,14 +576,21 @@ mlx5e_media_change(struct ifnet *dev) error = EINVAL; goto done; } - link_mode = mlx5e_find_link_mode(IFM_SUBTYPE(priv->media.ifm_media)); - /* query supported capabilities */ - error = mlx5_query_port_proto_cap(mdev, ð_proto_cap, MLX5_PTYS_EN); + error = mlx5_query_port_ptys(mdev, out, sizeof(out), + MLX5_PTYS_EN, 1); if (error != 0) { if_printf(dev, "Query port media capability failed\n"); goto done; } + + ext = MLX5_CAP_PCAM_FEATURE(mdev, ptys_extended_ethernet); + link_mode = mlx5e_find_link_mode(IFM_SUBTYPE(priv->media.ifm_media), ext); + + /* query supported capabilities */ + eth_proto_cap = MLX5_GET_ETH_PROTO(ptys_reg, out, ext, + eth_proto_capability); + /* check for autoselect */ if (IFM_SUBTYPE(priv->media.ifm_media) == IFM_AUTO) { link_mode = eth_proto_cap; @@ -357,7 +627,7 @@ mlx5e_media_change(struct ifnet *dev) /* reconfigure the hardware */ mlx5_set_port_status(mdev, MLX5_PORT_DOWN); - mlx5_set_port_proto(mdev, link_mode, MLX5_PTYS_EN); + mlx5_set_port_proto(mdev, link_mode, MLX5_PTYS_EN, ext); error = -mlx5e_set_port_pause_and_pfc(priv); if (was_opened) mlx5_set_port_status(mdev, MLX5_PORT_UP); @@ -3760,12 +4030,17 @@ mlx5e_create_ifp(struct mlx5_core_dev *mdev) struct ifnet *ifp; struct mlx5e_priv *priv; u8 dev_addr[ETHER_ADDR_LEN] __aligned(4); + u8 connector_type; struct sysctl_oid_list *child; int ncv = mdev->priv.eq_table.num_comp_vectors; char unit[16]; int err; - int i; + int i,j; u32 eth_proto_cap; + u32 out[MLX5_ST_SZ_DW(ptys_reg)]; + bool ext = 0; + u32 speeds_num; + struct media media_entry = {}; if (mlx5e_check_required_hca_cap(mdev)) { mlx5_core_dbg(mdev, "mlx5e_check_required_hca_cap() failed\n"); @@ -3918,28 +4193,41 @@ mlx5e_create_ifp(struct mlx5_core_dev *mdev) /* setup default pauseframes configuration */ mlx5e_setup_pauseframes(priv); - err = mlx5_query_port_proto_cap(mdev, ð_proto_cap, MLX5_PTYS_EN); - if (err) { + /* Setup supported medias */ + //TODO: If we failed to query ptys is it ok to proceed?? + if (!mlx5_query_port_ptys(mdev, out, sizeof(out), MLX5_PTYS_EN, 1)) { + ext = MLX5_CAP_PCAM_FEATURE(mdev, + ptys_extended_ethernet); + eth_proto_cap = MLX5_GET_ETH_PROTO(ptys_reg, out, ext, + eth_proto_capability); + if (MLX5_CAP_PCAM_FEATURE(mdev, ptys_connector_type)) + connector_type = MLX5_GET(ptys_reg, out, + connector_type); + } else { eth_proto_cap = 0; - if_printf(ifp, "%s: Query port media capability failed, %d\n", - __func__, err); + if_printf(ifp, "%s: Query port media capability failed," + " %d\n", __func__, err); } - /* Setup supported medias */ ifmedia_init(&priv->media, IFM_IMASK | IFM_ETH_FMASK, mlx5e_media_change, mlx5e_media_status); - for (i = 0; i < MLX5E_LINK_MODES_NUMBER; ++i) { - if (mlx5e_mode_table[i].baudrate == 0) - continue; - if (MLX5E_PROT_MASK(i) & eth_proto_cap) { - ifmedia_add(&priv->media, - mlx5e_mode_table[i].subtype | - IFM_ETHER, 0, NULL); - ifmedia_add(&priv->media, - mlx5e_mode_table[i].subtype | - IFM_ETHER | IFM_FDX | - IFM_ETH_RXPAUSE | IFM_ETH_TXPAUSE, 0, NULL); + speeds_num = ext ? MLX5E_EXT_LINK_SPEEDS_NUMBER : MLX5E_LINK_SPEEDS_NUMBER; + for (i = 0; i != speeds_num; i++) { + for (j = 0; j < MLX5E_LINK_MODES_NUMBER ; ++j) { + media_entry = ext ? mlx5e_ext_mode_table[i][j] : + mlx5e_mode_table[i][j]; + if (media_entry.baudrate == 0) + continue; + if (MLX5E_PROT_MASK(i) & eth_proto_cap) { + ifmedia_add(&priv->media, + media_entry.subtype | + IFM_ETHER, 0, NULL); + ifmedia_add(&priv->media, + media_entry.subtype | + IFM_ETHER | IFM_FDX | + IFM_ETH_RXPAUSE | IFM_ETH_TXPAUSE, 0, NULL); + } } } Modified: stable/12/sys/dev/mlx5/mlx5_ib/mlx5_ib_main.c ============================================================================== --- stable/12/sys/dev/mlx5/mlx5_ib/mlx5_ib_main.c Thu May 16 16:25:09 2019 (r347763) +++ stable/12/sys/dev/mlx5/mlx5_ib/mlx5_ib_main.c Thu May 16 16:26:09 2019 (r347764) @@ -180,7 +180,7 @@ static int translate_eth_proto_oper(u32 eth_proto_oper case MLX5E_PROT_MASK(MLX5E_10GBASE_KR): case MLX5E_PROT_MASK(MLX5E_10GBASE_CR): case MLX5E_PROT_MASK(MLX5E_10GBASE_SR): - case MLX5E_PROT_MASK(MLX5E_10GBASE_ER): + case MLX5E_PROT_MASK(MLX5E_10GBASE_ER_LR): *active_width = IB_WIDTH_1X; *active_speed = IB_SPEED_QDR; break; @@ -193,7 +193,7 @@ static int translate_eth_proto_oper(u32 eth_proto_oper case MLX5E_PROT_MASK(MLX5E_40GBASE_CR4): case MLX5E_PROT_MASK(MLX5E_40GBASE_KR4): case MLX5E_PROT_MASK(MLX5E_40GBASE_SR4): - case MLX5E_PROT_MASK(MLX5E_40GBASE_LR4): + case MLX5E_PROT_MASK(MLX5E_40GBASE_LR4_ER4): *active_width = IB_WIDTH_4X; *active_speed = IB_SPEED_QDR; break; Modified: stable/12/sys/dev/mlx5/mlx5_ifc.h ============================================================================== --- stable/12/sys/dev/mlx5/mlx5_ifc.h Thu May 16 16:25:09 2019 (r347763) +++ stable/12/sys/dev/mlx5/mlx5_ifc.h Thu May 16 16:26:09 2019 (r347764) @@ -7881,28 +7881,29 @@ struct mlx5_ifc_ptys_reg_bits { u8 reserved_3[0xc]; u8 data_rate_oper[0x10]; - u8 fc_proto_capability[0x20]; + u8 ext_eth_proto_capability[0x20]; u8 eth_proto_capability[0x20]; u8 ib_link_width_capability[0x10]; u8 ib_proto_capability[0x10]; - u8 fc_proto_admin[0x20]; + u8 ext_eth_proto_admin[0x20]; u8 eth_proto_admin[0x20]; u8 ib_link_width_admin[0x10]; u8 ib_proto_admin[0x10]; - u8 fc_proto_oper[0x20]; + u8 ext_eth_proto_oper[0x20]; u8 eth_proto_oper[0x20]; u8 ib_link_width_oper[0x10]; u8 ib_proto_oper[0x10]; - u8 reserved_4[0x20]; + u8 reserved_4[0x1c]; + u8 connector_type[0x4]; u8 eth_proto_lp_advertise[0x20]; @@ -8601,8 +8602,17 @@ struct mlx5_ifc_qcam_reg_bits { }; struct mlx5_ifc_pcam_enhanced_features_bits { - u8 reserved_at_0[0x7e]; - + u8 reserved_at_0[0x6d]; + u8 rx_icrc_encapsulated_counter[0x1]; + u8 reserved_at_6e[0x4]; + u8 ptys_extended_ethernet[0x1]; + u8 reserved_at_73[0x3]; + u8 pfcc_mask[0x1]; + u8 reserved_at_77[0x3]; + u8 per_lane_error_counters[0x1]; + u8 rx_buffer_fullness_counters[0x1]; + u8 ptys_connector_type[0x1]; + u8 reserved_at_7d[0x1]; u8 ppcnt_discard_group[0x1]; u8 ppcnt_statistical_group[0x1]; }; Modified: stable/12/sys/dev/mlx5/port.h ============================================================================== --- stable/12/sys/dev/mlx5/port.h Thu May 16 16:25:09 2019 (r347763) +++ stable/12/sys/dev/mlx5/port.h Thu May 16 16:26:09 2019 (r347764) @@ -58,7 +58,7 @@ enum mlx5_an_status { #define MLX5_I2C_ADDR_HIGH 0x51 #define MLX5_EEPROM_PAGE_LENGTH 256 -enum mlx5e_link_mode { +enum mlx5e_link_speed { MLX5E_1000BASE_CX_SGMII = 0, MLX5E_1000BASE_KX = 1, MLX5E_10GBASE_CX4 = 2, @@ -70,9 +70,9 @@ enum mlx5e_link_mode { MLX5E_56GBASE_R4 = 8, MLX5E_10GBASE_CR = 12, MLX5E_10GBASE_SR = 13, - MLX5E_10GBASE_ER = 14, + MLX5E_10GBASE_ER_LR = 14, MLX5E_40GBASE_SR4 = 15, - MLX5E_40GBASE_LR4 = 16, + MLX5E_40GBASE_LR4_ER4 = 16, MLX5E_50GBASE_SR2 = 18, MLX5E_100GBASE_CR4 = 20, MLX5E_100GBASE_SR4 = 21, @@ -86,6 +86,78 @@ enum mlx5e_link_mode { MLX5E_25GBASE_SR = 29, MLX5E_50GBASE_CR2 = 30, MLX5E_50GBASE_KR2 = 31, + MLX5E_LINK_SPEEDS_NUMBER, +}; + +enum mlx5e_ext_link_speed { + MLX5E_SGMII_100M = 0, + MLX5E_1000BASE_X_SGMII = 1, + MLX5E_5GBASE_R = 3, + MLX5E_10GBASE_XFI_XAUI_1 = 4, + MLX5E_40GBASE_XLAUI_4_XLPPI_4 = 5, + MLX5E_25GAUI_1_25GBASE_CR_KR = 6, + MLX5E_50GAUI_2_LAUI_2_50GBASE_CR2_KR2 = 7, + MLX5E_50GAUI_1_LAUI_1_50GBASE_CR_KR = 8, + MLX5E_CAUI_4_100GBASE_CR4_KR4 = 9, + MLX5E_100GAUI_2_100GBASE_CR2_KR2 = 10, + MLX5E_200GAUI_4_200GBASE_CR4_KR4 = 12, + MLX5E_400GAUI_8 = 15, + MLX5E_EXT_LINK_SPEEDS_NUMBER, +}; + +enum mlx5e_link_mode { + MLX5E_ACC, + MLX5E_AOC, + MLX5E_AUI, + MLX5E_AUI_AC, + MLX5E_AUI2, + MLX5E_AUI2_AC, + MLX5E_AUI4, + MLX5E_AUI4_AC, + MLX5E_CAUI2, + MLX5E_CAUI2_AC, + MLX5E_CAUI4, + MLX5E_CAUI4_AC, + MLX5E_CP, + MLX5E_CP2, + MLX5E_CR, + MLX5E_CR_S, + MLX5E_CR1, + MLX5E_CR2, + MLX5E_CR4, + MLX5E_CR_PAM4, + MLX5E_CR4_PAM4, + MLX5E_CX4, + MLX5E_CX, + MLX5E_CX_SGMII, + MLX5E_DR, + MLX5E_DR4, + MLX5E_ER, + MLX5E_ER4, + MLX5E_FR, + MLX5E_FR4, + MLX5E_KR, + MLX5E_KR1, + MLX5E_KR_PAM4, + MLX5E_KR_S, + MLX5E_KR2, + MLX5E_KR2_PAM4, + MLX5E_KR4, + MLX5E_KR4_PAM4, + MLX5E_KX, + MLX5E_KX4, + MLX5E_LR, + MLX5E_LR2, + MLX5E_LR4, + MLX5E_LX, + MLX5E_R, + MLX5E_SGMII, + MLX5E_SR, + MLX5E_SR2, + MLX5E_SR4, + MLX5E_SX, + MLX5E_T, + MLX5E_TX, MLX5E_LINK_MODES_NUMBER, }; @@ -113,6 +185,10 @@ enum mlx5_qpts_trust_state { #define PORT_MODULE_EVENT_MODULE_STATUS_MASK 0xF #define PORT_MODULE_EVENT_ERROR_TYPE_MASK 0xF +#define MLX5_GET_ETH_PROTO(reg, out, ext, field) \ + ((ext) ? MLX5_GET(reg, out, ext_##field) : \ + MLX5_GET(reg, out, field)) + int mlx5_set_port_caps(struct mlx5_core_dev *dev, u8 port_num, u32 caps); int mlx5_query_port_ptys(struct mlx5_core_dev *dev, u32 *ptys, int ptys_size, int proto_mask, u8 local_port); @@ -127,7 +203,7 @@ int mlx5_query_port_proto_admin(struct mlx5_core_dev * int mlx5_query_port_eth_proto_oper(struct mlx5_core_dev *dev, u32 *proto_oper, u8 local_port); int mlx5_set_port_proto(struct mlx5_core_dev *dev, u32 proto_admin, - int proto_mask); + int proto_mask, bool ext); int mlx5_set_port_status(struct mlx5_core_dev *dev, enum mlx5_port_status status); int mlx5_query_port_status(struct mlx5_core_dev *dev, u8 *status); From owner-svn-src-stable@freebsd.org Thu May 16 16:26:47 2019 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id A8E37159D679; Thu, 16 May 2019 16:26:47 +0000 (UTC) (envelope-from hselasky@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 32A98898AA; Thu, 16 May 2019 16:26:47 +0000 (UTC) (envelope-from hselasky@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 190C123569; Thu, 16 May 2019 16:26:47 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x4GGQkPN070296; Thu, 16 May 2019 16:26:46 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x4GGQkWT070295; Thu, 16 May 2019 16:26:46 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201905161626.x4GGQkWT070295@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Thu, 16 May 2019 16:26:46 +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: r347765 - stable/12/sys/dev/mlx5/mlx5_en X-SVN-Group: stable-12 X-SVN-Commit-Author: hselasky X-SVN-Commit-Paths: stable/12/sys/dev/mlx5/mlx5_en X-SVN-Commit-Revision: 347765 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 32A98898AA X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.98 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.998,0]; NEURAL_HAM_SHORT(-0.98)[-0.978,0]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US] X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 16 May 2019 16:26:47 -0000 Author: hselasky Date: Thu May 16 16:26:46 2019 New Revision: 347765 URL: https://svnweb.freebsd.org/changeset/base/347765 Log: MFC r347300: Do not add IFM_10G_LR and IFM_40G_ER4 to supported media types by default in mlx5en(4). IFM_10G_LR and IFM_40G_ER4 media should be added only if the device has the needed capability bit set for it. Submitted by: slavash@ Sponsored by: Mellanox Technologies Modified: stable/12/sys/dev/mlx5/mlx5_en/mlx5_en_main.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/dev/mlx5/mlx5_en/mlx5_en_main.c ============================================================================== --- stable/12/sys/dev/mlx5/mlx5_en/mlx5_en_main.c Thu May 16 16:26:09 2019 (r347764) +++ stable/12/sys/dev/mlx5/mlx5_en/mlx5_en_main.c Thu May 16 16:26:46 2019 (r347765) @@ -4231,17 +4231,6 @@ mlx5e_create_ifp(struct mlx5_core_dev *mdev) } } - /* Additional supported medias */ - ifmedia_add(&priv->media, IFM_10G_LR | IFM_ETHER, 0, NULL); - ifmedia_add(&priv->media, IFM_10G_LR | - IFM_ETHER | IFM_FDX | - IFM_ETH_RXPAUSE | IFM_ETH_TXPAUSE, 0, NULL); - - ifmedia_add(&priv->media, IFM_40G_ER4 | IFM_ETHER, 0, NULL); - ifmedia_add(&priv->media, IFM_40G_ER4 | - IFM_ETHER | IFM_FDX | - IFM_ETH_RXPAUSE | IFM_ETH_TXPAUSE, 0, NULL); - ifmedia_add(&priv->media, IFM_ETHER | IFM_AUTO, 0, NULL); ifmedia_add(&priv->media, IFM_ETHER | IFM_AUTO | IFM_FDX | IFM_ETH_RXPAUSE | IFM_ETH_TXPAUSE, 0, NULL); From owner-svn-src-stable@freebsd.org Thu May 16 16:27:22 2019 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 16D21159D6F9; Thu, 16 May 2019 16:27:22 +0000 (UTC) (envelope-from hselasky@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 AD48D899EC; Thu, 16 May 2019 16:27:21 +0000 (UTC) (envelope-from hselasky@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 9B9662356A; Thu, 16 May 2019 16:27:21 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x4GGRLPj070382; Thu, 16 May 2019 16:27:21 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x4GGRL3J070381; Thu, 16 May 2019 16:27:21 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201905161627.x4GGRL3J070381@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Thu, 16 May 2019 16:27:21 +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: r347766 - in stable/12/sys/ofed: drivers/infiniband/core include/rdma X-SVN-Group: stable-12 X-SVN-Commit-Author: hselasky X-SVN-Commit-Paths: in stable/12/sys/ofed: drivers/infiniband/core include/rdma X-SVN-Commit-Revision: 347766 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: AD48D899EC X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.98 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.998,0]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; NEURAL_HAM_SHORT(-0.98)[-0.979,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US] X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 16 May 2019 16:27:22 -0000 Author: hselasky Date: Thu May 16 16:27:21 2019 New Revision: 347766 URL: https://svnweb.freebsd.org/changeset/base/347766 Log: MFC r347301: Add new rates to ibcore. Add the new rates that were added to the Infiniband specification as part of HDR and 2x support. Submitted by: slavash@ Sponsored by: Mellanox Technologies Modified: stable/12/sys/ofed/drivers/infiniband/core/ib_verbs.c stable/12/sys/ofed/include/rdma/ib_verbs.h Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/ofed/drivers/infiniband/core/ib_verbs.c ============================================================================== --- stable/12/sys/ofed/drivers/infiniband/core/ib_verbs.c Thu May 16 16:26:46 2019 (r347765) +++ stable/12/sys/ofed/drivers/infiniband/core/ib_verbs.c Thu May 16 16:27:21 2019 (r347766) @@ -136,6 +136,10 @@ __attribute_const__ int ib_rate_to_mult(enum ib_rate r case IB_RATE_60_GBPS: return 24; case IB_RATE_80_GBPS: return 32; case IB_RATE_120_GBPS: return 48; + case IB_RATE_28_GBPS: return 11; + case IB_RATE_50_GBPS: return 20; + case IB_RATE_400_GBPS: return 160; + case IB_RATE_600_GBPS: return 240; default: return -1; } } @@ -153,6 +157,18 @@ __attribute_const__ enum ib_rate mult_to_ib_rate(int m case 24: return IB_RATE_60_GBPS; case 32: return IB_RATE_80_GBPS; case 48: return IB_RATE_120_GBPS; + case 6: return IB_RATE_14_GBPS; + case 22: return IB_RATE_56_GBPS; + case 45: return IB_RATE_112_GBPS; + case 67: return IB_RATE_168_GBPS; + case 10: return IB_RATE_25_GBPS; + case 40: return IB_RATE_100_GBPS; + case 80: return IB_RATE_200_GBPS; + case 120: return IB_RATE_300_GBPS; + case 11: return IB_RATE_28_GBPS; + case 20: return IB_RATE_50_GBPS; + case 160: return IB_RATE_400_GBPS; + case 240: return IB_RATE_600_GBPS; default: return IB_RATE_PORT_CURRENT; } } @@ -178,6 +194,10 @@ __attribute_const__ int ib_rate_to_mbps(enum ib_rate r case IB_RATE_100_GBPS: return 103125; case IB_RATE_200_GBPS: return 206250; case IB_RATE_300_GBPS: return 309375; + case IB_RATE_28_GBPS: return 28125; + case IB_RATE_50_GBPS: return 53125; + case IB_RATE_400_GBPS: return 425000; + case IB_RATE_600_GBPS: return 637500; default: return -1; } } Modified: stable/12/sys/ofed/include/rdma/ib_verbs.h ============================================================================== --- stable/12/sys/ofed/include/rdma/ib_verbs.h Thu May 16 16:26:46 2019 (r347765) +++ stable/12/sys/ofed/include/rdma/ib_verbs.h Thu May 16 16:27:21 2019 (r347766) @@ -398,6 +398,7 @@ enum ib_port_cap_flags { enum ib_port_width { IB_WIDTH_1X = 1, + IB_WIDTH_2X = 16, IB_WIDTH_4X = 2, IB_WIDTH_8X = 4, IB_WIDTH_12X = 8 @@ -407,6 +408,7 @@ static inline int ib_width_enum_to_int(enum ib_port_wi { switch (width) { case IB_WIDTH_1X: return 1; + case IB_WIDTH_2X: return 2; case IB_WIDTH_4X: return 4; case IB_WIDTH_8X: return 8; case IB_WIDTH_12X: return 12; @@ -672,7 +674,11 @@ enum ib_rate { IB_RATE_25_GBPS = 15, IB_RATE_100_GBPS = 16, IB_RATE_200_GBPS = 17, - IB_RATE_300_GBPS = 18 + IB_RATE_300_GBPS = 18, + IB_RATE_28_GBPS = 19, + IB_RATE_50_GBPS = 20, + IB_RATE_400_GBPS = 21, + IB_RATE_600_GBPS = 22, }; /** From owner-svn-src-stable@freebsd.org Thu May 16 16:29:13 2019 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id B4B3B159D809; Thu, 16 May 2019 16:29:13 +0000 (UTC) (envelope-from hselasky@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 50F5389B68; Thu, 16 May 2019 16:29:13 +0000 (UTC) (envelope-from hselasky@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 2B0FA2356B; Thu, 16 May 2019 16:29:13 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x4GGTDCe070512; Thu, 16 May 2019 16:29:13 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x4GGTCUb070510; Thu, 16 May 2019 16:29:12 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201905161629.x4GGTCUb070510@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Thu, 16 May 2019 16:29:12 +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: r347767 - in stable/12/contrib/ofed/libibverbs: . examples X-SVN-Group: stable-12 X-SVN-Commit-Author: hselasky X-SVN-Commit-Paths: in stable/12/contrib/ofed/libibverbs: . examples X-SVN-Commit-Revision: 347767 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 50F5389B68 X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.98 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.998,0]; NEURAL_HAM_SHORT(-0.98)[-0.979,0]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US] X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 16 May 2019 16:29:13 -0000 Author: hselasky Date: Thu May 16 16:29:12 2019 New Revision: 347767 URL: https://svnweb.freebsd.org/changeset/base/347767 Log: MFC r347302: Add support for 200Gbit speeds to libibverbs. Submitted by: slavash@ Sponsored by: Mellanox Technologies Modified: stable/12/contrib/ofed/libibverbs/examples/devinfo.c stable/12/contrib/ofed/libibverbs/verbs.c stable/12/contrib/ofed/libibverbs/verbs.h Directory Properties: stable/12/ (props changed) Modified: stable/12/contrib/ofed/libibverbs/examples/devinfo.c ============================================================================== --- stable/12/contrib/ofed/libibverbs/examples/devinfo.c Thu May 16 16:27:21 2019 (r347766) +++ stable/12/contrib/ofed/libibverbs/examples/devinfo.c Thu May 16 16:29:12 2019 (r347767) @@ -128,6 +128,7 @@ static const char *width_str(uint8_t width) case 2: return "4"; case 4: return "8"; case 8: return "12"; + case 16: return "2"; default: return "invalid width"; } } @@ -143,6 +144,7 @@ static const char *speed_str(uint8_t speed) case 16: return "14.0 Gbps"; case 32: return "25.0 Gbps"; + case 64: return "50.0 Gbps"; default: return "invalid speed"; } } Modified: stable/12/contrib/ofed/libibverbs/verbs.c ============================================================================== --- stable/12/contrib/ofed/libibverbs/verbs.c Thu May 16 16:27:21 2019 (r347766) +++ stable/12/contrib/ofed/libibverbs/verbs.c Thu May 16 16:29:12 2019 (r347767) @@ -111,6 +111,10 @@ int __attribute__((const)) ibv_rate_to_mult(enum ibv_r case IBV_RATE_60_GBPS: return 24; case IBV_RATE_80_GBPS: return 32; case IBV_RATE_120_GBPS: return 48; + case IBV_RATE_28_GBPS: return 11; + case IBV_RATE_50_GBPS: return 20; + case IBV_RATE_400_GBPS: return 160; + case IBV_RATE_600_GBPS: return 240; default: return -1; } } @@ -127,6 +131,10 @@ enum ibv_rate __attribute__((const)) mult_to_ibv_rate( case 24: return IBV_RATE_60_GBPS; case 32: return IBV_RATE_80_GBPS; case 48: return IBV_RATE_120_GBPS; + case 11: return IBV_RATE_28_GBPS; + case 20: return IBV_RATE_50_GBPS; + case 160: return IBV_RATE_400_GBPS; + case 240: return IBV_RATE_600_GBPS; default: return IBV_RATE_MAX; } } @@ -151,6 +159,10 @@ int __attribute__((const)) ibv_rate_to_mbps(enum ibv_ case IBV_RATE_100_GBPS: return 103125; case IBV_RATE_200_GBPS: return 206250; case IBV_RATE_300_GBPS: return 309375; + case IBV_RATE_28_GBPS: return 28125; + case IBV_RATE_50_GBPS: return 53125; + case IBV_RATE_400_GBPS: return 425000; + case IBV_RATE_600_GBPS: return 637500; default: return -1; } } @@ -175,6 +187,10 @@ enum ibv_rate __attribute__((const)) mbps_to_ibv_rate( case 103125: return IBV_RATE_100_GBPS; case 206250: return IBV_RATE_200_GBPS; case 309375: return IBV_RATE_300_GBPS; + case 28125: return IBV_RATE_28_GBPS; + case 53125: return IBV_RATE_50_GBPS; + case 425000: return IBV_RATE_400_GBPS; + case 637500: return IBV_RATE_600_GBPS; default: return IBV_RATE_MAX; } } Modified: stable/12/contrib/ofed/libibverbs/verbs.h ============================================================================== --- stable/12/contrib/ofed/libibverbs/verbs.h Thu May 16 16:27:21 2019 (r347766) +++ stable/12/contrib/ofed/libibverbs/verbs.h Thu May 16 16:29:12 2019 (r347767) @@ -590,7 +590,11 @@ enum ibv_rate { IBV_RATE_25_GBPS = 15, IBV_RATE_100_GBPS = 16, IBV_RATE_200_GBPS = 17, - IBV_RATE_300_GBPS = 18 + IBV_RATE_300_GBPS = 18, + IBV_RATE_28_GBPS = 19, + IBV_RATE_50_GBPS = 20, + IBV_RATE_400_GBPS = 21, + IBV_RATE_600_GBPS = 22, }; /** From owner-svn-src-stable@freebsd.org Thu May 16 16:29:49 2019 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 70D86159D8AC; Thu, 16 May 2019 16:29:49 +0000 (UTC) (envelope-from hselasky@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 1080489C8E; Thu, 16 May 2019 16:29:49 +0000 (UTC) (envelope-from hselasky@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 F161D2356D; Thu, 16 May 2019 16:29:48 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x4GGTmDw070594; Thu, 16 May 2019 16:29:48 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x4GGTmKM070592; Thu, 16 May 2019 16:29:48 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201905161629.x4GGTmKM070592@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Thu, 16 May 2019 16:29:48 +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: r347768 - stable/12/sys/dev/mlx5/mlx5_ib X-SVN-Group: stable-12 X-SVN-Commit-Author: hselasky X-SVN-Commit-Paths: stable/12/sys/dev/mlx5/mlx5_ib X-SVN-Commit-Revision: 347768 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 1080489C8E X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.98 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.998,0]; NEURAL_HAM_SHORT(-0.98)[-0.979,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US]; NEURAL_HAM_LONG(-1.00)[-1.000,0] X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 16 May 2019 16:29:49 -0000 Author: hselasky Date: Thu May 16 16:29:48 2019 New Revision: 347768 URL: https://svnweb.freebsd.org/changeset/base/347768 Log: MFC r347303: Add support for new rates to mlx5ib. Submitted by: slavash@ Sponsored by: Mellanox Technologies Modified: stable/12/sys/dev/mlx5/mlx5_ib/mlx5_ib_main.c stable/12/sys/dev/mlx5/mlx5_ib/mlx5_ib_qp.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/dev/mlx5/mlx5_ib/mlx5_ib_main.c ============================================================================== --- stable/12/sys/dev/mlx5/mlx5_ib/mlx5_ib_main.c Thu May 16 16:29:12 2019 (r347767) +++ stable/12/sys/dev/mlx5/mlx5_ib/mlx5_ib_main.c Thu May 16 16:29:48 2019 (r347768) @@ -223,14 +223,70 @@ static int translate_eth_proto_oper(u32 eth_proto_oper return 0; } +static int translate_eth_ext_proto_oper(u32 eth_proto_oper, u8 *active_speed, + u8 *active_width) +{ + switch (eth_proto_oper) { + case MLX5E_PROT_MASK(MLX5E_SGMII_100M): + case MLX5E_PROT_MASK(MLX5E_1000BASE_X_SGMII): + *active_width = IB_WIDTH_1X; + *active_speed = IB_SPEED_SDR; + break; + case MLX5E_PROT_MASK(MLX5E_5GBASE_R): + *active_width = IB_WIDTH_1X; + *active_speed = IB_SPEED_DDR; + break; + case MLX5E_PROT_MASK(MLX5E_10GBASE_XFI_XAUI_1): + *active_width = IB_WIDTH_1X; + *active_speed = IB_SPEED_QDR; + break; + case MLX5E_PROT_MASK(MLX5E_40GBASE_XLAUI_4_XLPPI_4): + *active_width = IB_WIDTH_4X; + *active_speed = IB_SPEED_QDR; + break; + case MLX5E_PROT_MASK(MLX5E_25GAUI_1_25GBASE_CR_KR): + *active_width = IB_WIDTH_1X; + *active_speed = IB_SPEED_EDR; + break; + case MLX5E_PROT_MASK(MLX5E_50GAUI_2_LAUI_2_50GBASE_CR2_KR2): + *active_width = IB_WIDTH_2X; + *active_speed = IB_SPEED_EDR; + break; + case MLX5E_PROT_MASK(MLX5E_50GAUI_1_LAUI_1_50GBASE_CR_KR): + *active_width = IB_WIDTH_1X; + *active_speed = IB_SPEED_HDR; + break; + case MLX5E_PROT_MASK(MLX5E_CAUI_4_100GBASE_CR4_KR4): + *active_width = IB_WIDTH_4X; + *active_speed = IB_SPEED_EDR; + break; + case MLX5E_PROT_MASK(MLX5E_100GAUI_2_100GBASE_CR2_KR2): + *active_width = IB_WIDTH_2X; + *active_speed = IB_SPEED_HDR; + break; + case MLX5E_PROT_MASK(MLX5E_200GAUI_4_200GBASE_CR4_KR4): + *active_width = IB_WIDTH_4X; + *active_speed = IB_SPEED_HDR; + break; + default: + *active_width = IB_WIDTH_4X; + *active_speed = IB_SPEED_QDR; + return -EINVAL; + } + + return 0; +} + static int mlx5_query_port_roce(struct ib_device *device, u8 port_num, struct ib_port_attr *props) { struct mlx5_ib_dev *dev = to_mdev(device); + u32 out[MLX5_ST_SZ_DW(ptys_reg)] = {}; struct net_device *ndev; enum ib_mtu ndev_ib_mtu; u16 qkey_viol_cntr; u32 eth_prot_oper; + bool ext; int err; memset(props, 0, sizeof(*props)); @@ -238,13 +294,21 @@ static int mlx5_query_port_roce(struct ib_device *devi /* Possible bad flows are checked before filling out props so in case * of an error it will still be zeroed out. */ - err = mlx5_query_port_eth_proto_oper(dev->mdev, ð_prot_oper, port_num); + err = mlx5_query_port_ptys(dev->mdev, out, sizeof(out), MLX5_PTYS_EN, + port_num); if (err) return err; - translate_eth_proto_oper(eth_prot_oper, &props->active_speed, - &props->active_width); + ext = MLX5_CAP_PCAM_FEATURE(dev->mdev, ptys_extended_ethernet); + eth_prot_oper = MLX5_GET_ETH_PROTO(ptys_reg, out, ext, eth_proto_oper); + if (ext) + translate_eth_ext_proto_oper(eth_prot_oper, &props->active_speed, + &props->active_width); + else + translate_eth_proto_oper(eth_prot_oper, &props->active_speed, + &props->active_width); + props->port_cap_flags |= IB_PORT_CM_SUP; props->port_cap_flags |= IB_PORT_IP_BASED_GIDS; @@ -772,9 +836,7 @@ static int translate_active_width(struct ib_device *ib if (active_width & MLX5_IB_WIDTH_1X) { *ib_width = IB_WIDTH_1X; } else if (active_width & MLX5_IB_WIDTH_2X) { - mlx5_ib_dbg(dev, "active_width %d is not supported by IB spec\n", - (int)active_width); - err = -EINVAL; + *ib_width = IB_WIDTH_2X; } else if (active_width & MLX5_IB_WIDTH_4X) { *ib_width = IB_WIDTH_4X; } else if (active_width & MLX5_IB_WIDTH_8X) { Modified: stable/12/sys/dev/mlx5/mlx5_ib/mlx5_ib_qp.c ============================================================================== --- stable/12/sys/dev/mlx5/mlx5_ib/mlx5_ib_qp.c Thu May 16 16:29:12 2019 (r347767) +++ stable/12/sys/dev/mlx5/mlx5_ib/mlx5_ib_qp.c Thu May 16 16:29:48 2019 (r347768) @@ -2125,7 +2125,7 @@ static int ib_rate_to_mlx5(struct mlx5_ib_dev *dev, u8 { if (rate == IB_RATE_PORT_CURRENT) { return 0; - } else if (rate < IB_RATE_2_5_GBPS || rate > IB_RATE_300_GBPS) { + } else if (rate < IB_RATE_2_5_GBPS || rate > IB_RATE_600_GBPS) { return -EINVAL; } else { while (rate != IB_RATE_2_5_GBPS && From owner-svn-src-stable@freebsd.org Thu May 16 16:30:27 2019 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 04E7A159D932; Thu, 16 May 2019 16:30:27 +0000 (UTC) (envelope-from hselasky@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 53A5689DCA; Thu, 16 May 2019 16:30:26 +0000 (UTC) (envelope-from hselasky@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 247FF23571; Thu, 16 May 2019 16:30:26 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x4GGUQbR070709; Thu, 16 May 2019 16:30:26 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x4GGUQG8070708; Thu, 16 May 2019 16:30:26 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201905161630.x4GGUQG8070708@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Thu, 16 May 2019 16:30:26 +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: r347769 - stable/12/sys/dev/mlx5/mlx5_ib X-SVN-Group: stable-12 X-SVN-Commit-Author: hselasky X-SVN-Commit-Paths: stable/12/sys/dev/mlx5/mlx5_ib X-SVN-Commit-Revision: 347769 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 53A5689DCA X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.98 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.998,0]; NEURAL_HAM_SHORT(-0.98)[-0.978,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US]; NEURAL_HAM_LONG(-1.00)[-1.000,0] X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 16 May 2019 16:30:27 -0000 Author: hselasky Date: Thu May 16 16:30:25 2019 New Revision: 347769 URL: https://svnweb.freebsd.org/changeset/base/347769 Log: MFC r347304: Always return success for RoCE modify port in mlx5ib. CM layer calls ib_modify_port() regardless of the link layer. For the Ethernet ports, qkey violation and Port capabilities are meaningless. Therefore, always return success for ib_modify_port calls on the Ethernet ports. Linux Commit: ec2558796d25e6024071b6bcb8e11392538d57bf Submitted by: slavash@ Sponsored by: Mellanox Technologies Modified: stable/12/sys/dev/mlx5/mlx5_ib/mlx5_ib_main.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/dev/mlx5/mlx5_ib/mlx5_ib_main.c ============================================================================== --- stable/12/sys/dev/mlx5/mlx5_ib/mlx5_ib_main.c Thu May 16 16:29:48 2019 (r347768) +++ stable/12/sys/dev/mlx5/mlx5_ib/mlx5_ib_main.c Thu May 16 16:30:25 2019 (r347769) @@ -1078,6 +1078,14 @@ static int mlx5_ib_modify_port(struct ib_device *ibdev u32 tmp; int err; + /* + * CM layer calls ib_modify_port() regardless of the link + * layer. For Ethernet ports, qkey violation and Port + * capabilities are meaningless. + */ + if (mlx5_ib_port_link_layer(ibdev, port) == IB_LINK_LAYER_ETHERNET) + return 0; + mutex_lock(&dev->cap_mask_mutex); err = mlx5_ib_query_port(ibdev, port, &attr); From owner-svn-src-stable@freebsd.org Thu May 16 16:31:04 2019 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 8ED24159D9E1; Thu, 16 May 2019 16:31:04 +0000 (UTC) (envelope-from hselasky@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 33D1189F6E; Thu, 16 May 2019 16:31:04 +0000 (UTC) (envelope-from hselasky@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 114FA236A7; Thu, 16 May 2019 16:31:04 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x4GGV3nN073049; Thu, 16 May 2019 16:31:03 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x4GGV3rC073046; Thu, 16 May 2019 16:31:03 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201905161631.x4GGV3rC073046@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Thu, 16 May 2019 16:31:03 +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: r347770 - in stable/12/sys/dev/mlx5: . mlx5_core mlx5_en X-SVN-Group: stable-12 X-SVN-Commit-Author: hselasky X-SVN-Commit-Paths: in stable/12/sys/dev/mlx5: . mlx5_core mlx5_en X-SVN-Commit-Revision: 347770 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 33D1189F6E X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.98 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.998,0]; NEURAL_HAM_SHORT(-0.98)[-0.979,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US]; NEURAL_HAM_LONG(-1.00)[-1.000,0] X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 16 May 2019 16:31:04 -0000 Author: hselasky Date: Thu May 16 16:31:03 2019 New Revision: 347770 URL: https://svnweb.freebsd.org/changeset/base/347770 Log: MFC r347305: Move workqueue from mlx5en(4) to mlx5core. This avoids creating more workqueues in mlx5core to do simple firmware command polling tasks. Sponsored by: Mellanox Technologies Modified: stable/12/sys/dev/mlx5/driver.h stable/12/sys/dev/mlx5/mlx5_core/mlx5_health.c stable/12/sys/dev/mlx5/mlx5_en/mlx5_en_main.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/dev/mlx5/driver.h ============================================================================== --- stable/12/sys/dev/mlx5/driver.h Thu May 16 16:30:25 2019 (r347769) +++ stable/12/sys/dev/mlx5/driver.h Thu May 16 16:31:03 2019 (r347770) @@ -1,5 +1,5 @@ /*- - * Copyright (c) 2013-2017, Mellanox Technologies, Ltd. All rights reserved. + * Copyright (c) 2013-2019, Mellanox Technologies, Ltd. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -505,6 +505,7 @@ struct mlx5_core_health { u32 prev; int miss_counter; u32 fatal_error; + struct workqueue_struct *wq_watchdog; /* wq spinlock to synchronize draining */ spinlock_t wq_lock; struct workqueue_struct *wq; Modified: stable/12/sys/dev/mlx5/mlx5_core/mlx5_health.c ============================================================================== --- stable/12/sys/dev/mlx5/mlx5_core/mlx5_health.c Thu May 16 16:30:25 2019 (r347769) +++ stable/12/sys/dev/mlx5/mlx5_core/mlx5_health.c Thu May 16 16:31:03 2019 (r347770) @@ -604,26 +604,27 @@ void mlx5_health_cleanup(struct mlx5_core_dev *dev) struct mlx5_core_health *health = &dev->priv.health; destroy_workqueue(health->wq); + destroy_workqueue(health->wq_watchdog); } -#define HEALTH_NAME "mlx5_health" int mlx5_health_init(struct mlx5_core_dev *dev) { struct mlx5_core_health *health; - char *name; - int len; + char name[64]; health = &dev->priv.health; - len = strlen(HEALTH_NAME) + strlen(dev_name(&dev->pdev->dev)); - name = kmalloc(len + 1, GFP_KERNEL); - if (!name) - return -ENOMEM; - snprintf(name, len, "%s:%s", HEALTH_NAME, dev_name(&dev->pdev->dev)); + snprintf(name, sizeof(name), "%s-rec", dev_name(&dev->pdev->dev)); health->wq = create_singlethread_workqueue(name); - kfree(name); if (!health->wq) return -ENOMEM; + + snprintf(name, sizeof(name), "%s-wdg", dev_name(&dev->pdev->dev)); + health->wq_watchdog = create_singlethread_workqueue(name); + if (!health->wq_watchdog) { + destroy_workqueue(health->wq); + return -ENOMEM; + } spin_lock_init(&health->wq_lock); INIT_WORK(&health->work, health_care); Modified: stable/12/sys/dev/mlx5/mlx5_en/mlx5_en_main.c ============================================================================== --- stable/12/sys/dev/mlx5/mlx5_en/mlx5_en_main.c Thu May 16 16:30:25 2019 (r347769) +++ stable/12/sys/dev/mlx5/mlx5_en/mlx5_en_main.c Thu May 16 16:31:03 2019 (r347770) @@ -4133,13 +4133,8 @@ mlx5e_create_ifp(struct mlx5_core_dev *mdev) goto err_free_sysctl; } - snprintf(unit, sizeof(unit), "mce%u_wq", - device_get_unit(mdev->pdev->dev.bsddev)); - priv->wq = alloc_workqueue(unit, 0, 1); - if (priv->wq == NULL) { - if_printf(ifp, "%s: alloc_workqueue failed\n", __func__); - goto err_free_sysctl; - } + /* reuse mlx5core's watchdog workqueue */ + priv->wq = mdev->priv.health.wq_watchdog; err = mlx5_alloc_map_uar(mdev, &priv->cq_uar); if (err) { @@ -4290,7 +4285,7 @@ err_unmap_free_uar: mlx5_unmap_free_uar(mdev, &priv->cq_uar); err_free_wq: - destroy_workqueue(priv->wq); + flush_workqueue(priv->wq); err_free_sysctl: sysctl_ctx_free(&priv->sysctl_ctx); @@ -4370,7 +4365,7 @@ mlx5e_destroy_ifp(struct mlx5_core_dev *mdev, void *vp mlx5_core_dealloc_pd(priv->mdev, priv->pdn); mlx5_unmap_free_uar(priv->mdev, &priv->cq_uar); mlx5e_disable_async_events(priv); - destroy_workqueue(priv->wq); + flush_workqueue(priv->wq); mlx5e_priv_mtx_destroy(priv); free(priv, M_MLX5EN); } From owner-svn-src-stable@freebsd.org Thu May 16 16:31:42 2019 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id DFB54159DA8D; Thu, 16 May 2019 16:31:41 +0000 (UTC) (envelope-from hselasky@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 857868A23E; Thu, 16 May 2019 16:31:41 +0000 (UTC) (envelope-from hselasky@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 47B4E236DA; Thu, 16 May 2019 16:31:41 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x4GGVfV2073138; Thu, 16 May 2019 16:31:41 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x4GGVddq073132; Thu, 16 May 2019 16:31:39 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201905161631.x4GGVddq073132@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Thu, 16 May 2019 16:31:39 +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: r347771 - in stable/12/sys/dev/mlx5: . mlx5_core X-SVN-Group: stable-12 X-SVN-Commit-Author: hselasky X-SVN-Commit-Paths: in stable/12/sys/dev/mlx5: . mlx5_core X-SVN-Commit-Revision: 347771 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 857868A23E X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.98 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.998,0]; NEURAL_HAM_SHORT(-0.98)[-0.980,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US]; NEURAL_HAM_LONG(-1.00)[-1.000,0] X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 16 May 2019 16:31:42 -0000 Author: hselasky Date: Thu May 16 16:31:39 2019 New Revision: 347771 URL: https://svnweb.freebsd.org/changeset/base/347771 Log: MFC r347306: Implement reading PCI power status in mlx5core. Implement a watchdog as part of the healtcare subsystem which reads the PCI power status during startup and upon the PCI power status change event and store it into the core device structure. This value is then exported to user-space via a read-only SYSCTL. A dmesg print has been added to inform the admin about the PCI power status. Sponsored by: Mellanox Technologies Modified: stable/12/sys/dev/mlx5/device.h stable/12/sys/dev/mlx5/driver.h stable/12/sys/dev/mlx5/mlx5_core/mlx5_eq.c stable/12/sys/dev/mlx5/mlx5_core/mlx5_health.c stable/12/sys/dev/mlx5/mlx5_core/mlx5_main.c stable/12/sys/dev/mlx5/mlx5_ifc.h Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/dev/mlx5/device.h ============================================================================== --- stable/12/sys/dev/mlx5/device.h Thu May 16 16:31:03 2019 (r347770) +++ stable/12/sys/dev/mlx5/device.h Thu May 16 16:31:39 2019 (r347771) @@ -1215,6 +1215,7 @@ static inline int mlx5_get_cqe_format(const struct mlx enum { MLX5_GEN_EVENT_SUBTYPE_DELAY_DROP_TIMEOUT = 0x1, + MLX5_GEN_EVENT_SUBTYPE_PCI_POWER_CHANGE_EVENT = 0x5, }; /* 8 regular priorities + 1 for multicast */ Modified: stable/12/sys/dev/mlx5/driver.h ============================================================================== --- stable/12/sys/dev/mlx5/driver.h Thu May 16 16:31:03 2019 (r347770) +++ stable/12/sys/dev/mlx5/driver.h Thu May 16 16:31:39 2019 (r347771) @@ -506,6 +506,7 @@ struct mlx5_core_health { int miss_counter; u32 fatal_error; struct workqueue_struct *wq_watchdog; + struct work_struct work_watchdog; /* wq spinlock to synchronize draining */ spinlock_t wq_lock; struct workqueue_struct *wq; @@ -705,6 +706,8 @@ struct mlx5_core_dev { struct sysctl_ctx_list sysctl_ctx; int msix_eqvec; + int pwr_status; + int pwr_value; struct { struct mlx5_rsvd_gids reserved_gids; @@ -955,6 +958,7 @@ void mlx5_stop_health_poll(struct mlx5_core_dev *dev, void mlx5_drain_health_wq(struct mlx5_core_dev *dev); void mlx5_drain_health_recovery(struct mlx5_core_dev *dev); void mlx5_trigger_health_work(struct mlx5_core_dev *dev); +void mlx5_trigger_health_watchdog(struct mlx5_core_dev *dev); #define mlx5_buf_alloc_node(dev, size, direct, buf, node) \ mlx5_buf_alloc(dev, size, direct, buf) @@ -1089,6 +1093,8 @@ int mlx5_vsc_write(struct mlx5_core_dev *mdev, u32 add int mlx5_vsc_read(struct mlx5_core_dev *mdev, u32 addr, u32 *data); int mlx5_vsc_lock_addr_space(struct mlx5_core_dev *mdev, u32 addr); int mlx5_vsc_unlock_addr_space(struct mlx5_core_dev *mdev, u32 addr); +int mlx5_pci_read_power_status(struct mlx5_core_dev *mdev, + u16 *p_power, u8 *p_status); static inline u32 mlx5_mkey_to_idx(u32 mkey) { Modified: stable/12/sys/dev/mlx5/mlx5_core/mlx5_eq.c ============================================================================== --- stable/12/sys/dev/mlx5/mlx5_core/mlx5_eq.c Thu May 16 16:31:03 2019 (r347770) +++ stable/12/sys/dev/mlx5/mlx5_core/mlx5_eq.c Thu May 16 16:31:39 2019 (r347771) @@ -561,6 +561,11 @@ int mlx5_start_eqs(struct mlx5_core_dev *dev) if (MLX5_CAP_GEN(dev, temp_warn_event)) async_event_mask |= (1ull << MLX5_EVENT_TYPE_TEMP_WARN_EVENT); + if (MLX5_CAP_GEN(dev, general_notification_event)) { + async_event_mask |= (1ull << + MLX5_EVENT_TYPE_CODING_GENERAL_NOTIFICATION_EVENT); + } + err = mlx5_create_map_eq(dev, &table->cmd_eq, MLX5_EQ_VEC_CMD, MLX5_NUM_CMD_EQE, 1ull << MLX5_EVENT_TYPE_CMD, "mlx5_cmd_eq", &dev->priv.uuari.uars[0]); @@ -716,14 +721,17 @@ static void mlx5_port_general_notification_event(struc struct mlx5_eqe *eqe) { u8 port = (eqe->data.port.port >> 4) & 0xf; - u32 rqn = 0; - struct mlx5_eqe_general_notification_event *general_event = NULL; + u32 rqn; + struct mlx5_eqe_general_notification_event *general_event; switch (eqe->sub_type) { case MLX5_GEN_EVENT_SUBTYPE_DELAY_DROP_TIMEOUT: general_event = &eqe->data.general_notifications; rqn = be32_to_cpu(general_event->rq_user_index_delay_drop) & 0xffffff; + break; + case MLX5_GEN_EVENT_SUBTYPE_PCI_POWER_CHANGE_EVENT: + mlx5_trigger_health_watchdog(dev); break; default: mlx5_core_warn(dev, Modified: stable/12/sys/dev/mlx5/mlx5_core/mlx5_health.c ============================================================================== --- stable/12/sys/dev/mlx5/mlx5_core/mlx5_health.c Thu May 16 16:31:03 2019 (r347770) +++ stable/12/sys/dev/mlx5/mlx5_core/mlx5_health.c Thu May 16 16:31:39 2019 (r347771) @@ -41,6 +41,7 @@ enum { MLX5_DROP_NEW_HEALTH_WORK, MLX5_DROP_NEW_RECOVERY_WORK, + MLX5_DROP_NEW_WATCHDOG_WORK, }; enum { @@ -506,6 +507,66 @@ static void print_health_info(struct mlx5_core_dev *de printf("mlx5_core: INFO: ""raw fw_ver 0x%08x\n", fw); } +static void health_watchdog(struct work_struct *work) +{ + struct mlx5_core_dev *dev; + u16 power; + u8 status; + int err; + + dev = container_of(work, struct mlx5_core_dev, priv.health.work_watchdog); + + if (!MLX5_CAP_GEN(dev, mcam_reg) || + !MLX5_CAP_MCAM_FEATURE(dev, pcie_status_and_power)) + return; + + err = mlx5_pci_read_power_status(dev, &power, &status); + if (err < 0) { + mlx5_core_warn(dev, "Failed reading power status: %d\n", err); + return; + } + + dev->pwr_value = power; + + if (dev->pwr_status != status) { + device_t bsddev = dev->pdev->dev.bsddev; + + switch (status) { + case 0: + dev->pwr_status = status; + device_printf(bsddev, "PCI power is not published by the PCIe slot.\n"); + break; + case 1: + dev->pwr_status = status; + device_printf(bsddev, "PCIe slot advertised sufficient power (%uW).\n", power); + break; + case 2: + dev->pwr_status = status; + device_printf(bsddev, "WARN: Detected insufficient power on the PCIe slot (%uW).\n", power); + break; + default: + dev->pwr_status = 0; + device_printf(bsddev, "WARN: Unknown power state detected(%d).\n", status); + break; + } + } +} + +void +mlx5_trigger_health_watchdog(struct mlx5_core_dev *dev) +{ + struct mlx5_core_health *health = &dev->priv.health; + unsigned long flags; + + spin_lock_irqsave(&health->wq_lock, flags); + if (!test_bit(MLX5_DROP_NEW_WATCHDOG_WORK, &health->flags)) + queue_work(health->wq_watchdog, &health->work_watchdog); + else + dev_err(&dev->pdev->dev, + "scheduling watchdog is not permitted at this stage\n"); + spin_unlock_irqrestore(&health->wq_lock, flags); +} + static void poll_health(unsigned long data) { struct mlx5_core_dev *dev = (struct mlx5_core_dev *)data; @@ -516,9 +577,6 @@ static void poll_health(unsigned long data) if (dev->state != MLX5_DEVICE_STATE_UP) return; - if (dev->state == MLX5_DEVICE_STATE_INTERNAL_ERROR) - goto out; - count = ioread32be(health->health_counter); if (count == health->prev) ++health->miss_counter; @@ -540,7 +598,6 @@ static void poll_health(unsigned long data) mlx5_trigger_health_work(dev); } -out: mod_timer(&health->timer, get_next_poll_jiffies()); } @@ -552,12 +609,16 @@ void mlx5_start_health_poll(struct mlx5_core_dev *dev) health->fatal_error = MLX5_SENSOR_NO_ERR; clear_bit(MLX5_DROP_NEW_HEALTH_WORK, &health->flags); clear_bit(MLX5_DROP_NEW_RECOVERY_WORK, &health->flags); + clear_bit(MLX5_DROP_NEW_WATCHDOG_WORK, &health->flags); health->health = &dev->iseg->health; health->health_counter = &dev->iseg->health_counter; setup_timer(&health->timer, poll_health, (unsigned long)dev); mod_timer(&health->timer, round_jiffies(jiffies + MLX5_HEALTH_POLL_INTERVAL)); + + /* do initial PCI power state readout */ + mlx5_trigger_health_watchdog(dev); } void mlx5_stop_health_poll(struct mlx5_core_dev *dev, bool disable_health) @@ -569,6 +630,7 @@ void mlx5_stop_health_poll(struct mlx5_core_dev *dev, spin_lock_irqsave(&health->wq_lock, flags); set_bit(MLX5_DROP_NEW_HEALTH_WORK, &health->flags); set_bit(MLX5_DROP_NEW_RECOVERY_WORK, &health->flags); + set_bit(MLX5_DROP_NEW_WATCHDOG_WORK, &health->flags); spin_unlock_irqrestore(&health->wq_lock, flags); } @@ -583,9 +645,11 @@ void mlx5_drain_health_wq(struct mlx5_core_dev *dev) spin_lock_irqsave(&health->wq_lock, flags); set_bit(MLX5_DROP_NEW_HEALTH_WORK, &health->flags); set_bit(MLX5_DROP_NEW_RECOVERY_WORK, &health->flags); + set_bit(MLX5_DROP_NEW_WATCHDOG_WORK, &health->flags); spin_unlock_irqrestore(&health->wq_lock, flags); cancel_delayed_work_sync(&health->recover_work); cancel_work_sync(&health->work); + cancel_work_sync(&health->work_watchdog); } void mlx5_drain_health_recovery(struct mlx5_core_dev *dev) @@ -628,6 +692,7 @@ int mlx5_health_init(struct mlx5_core_dev *dev) spin_lock_init(&health->wq_lock); INIT_WORK(&health->work, health_care); + INIT_WORK(&health->work_watchdog, health_watchdog); INIT_DELAYED_WORK(&health->recover_work, health_recover); return 0; Modified: stable/12/sys/dev/mlx5/mlx5_core/mlx5_main.c ============================================================================== --- stable/12/sys/dev/mlx5/mlx5_core/mlx5_main.c Thu May 16 16:31:03 2019 (r347770) +++ stable/12/sys/dev/mlx5/mlx5_core/mlx5_main.c Thu May 16 16:31:39 2019 (r347771) @@ -197,6 +197,21 @@ static int set_dma_caps(struct pci_dev *pdev) return err; } +int mlx5_pci_read_power_status(struct mlx5_core_dev *dev, + u16 *p_power, u8 *p_status) +{ + u32 in[MLX5_ST_SZ_DW(mpein_reg)] = {}; + u32 out[MLX5_ST_SZ_DW(mpein_reg)] = {}; + int err; + + err = mlx5_core_access_reg(dev, in, sizeof(in), out, sizeof(out), + MLX5_ACCESS_REG_SUMMARY_CTRL_ID_MPEIN, 0, 0); + + *p_status = MLX5_GET(mpein_reg, out, pwr_status); + *p_power = MLX5_GET(mpein_reg, out, pci_power); + return err; +} + static int mlx5_pci_enable_device(struct mlx5_core_dev *dev) { struct pci_dev *pdev = dev->pdev; @@ -1273,6 +1288,14 @@ static int init_one(struct pci_dev *pdev, SYSCTL_CHILDREN(device_get_sysctl_tree(bsddev)), OID_AUTO, "msix_eqvec", CTLFLAG_RDTUN, &dev->msix_eqvec, 0, "Maximum number of MSIX event queue vectors, if set"); + SYSCTL_ADD_INT(&dev->sysctl_ctx, + SYSCTL_CHILDREN(device_get_sysctl_tree(bsddev)), + OID_AUTO, "power_status", CTLFLAG_RD, &dev->pwr_status, 0, + "0:Invalid 1:Sufficient 2:Insufficient"); + SYSCTL_ADD_INT(&dev->sysctl_ctx, + SYSCTL_CHILDREN(device_get_sysctl_tree(bsddev)), + OID_AUTO, "power_value", CTLFLAG_RD, &dev->pwr_value, 0, + "Current power value in Watts"); INIT_LIST_HEAD(&priv->ctx_list); spin_lock_init(&priv->ctx_lock); Modified: stable/12/sys/dev/mlx5/mlx5_ifc.h ============================================================================== --- stable/12/sys/dev/mlx5/mlx5_ifc.h Thu May 16 16:31:03 2019 (r347770) +++ stable/12/sys/dev/mlx5/mlx5_ifc.h Thu May 16 16:31:39 2019 (r347771) @@ -8640,8 +8640,9 @@ struct mlx5_ifc_pcam_reg_bits { }; struct mlx5_ifc_mcam_enhanced_features_bits { - u8 reserved_at_0[0x7f]; - + u8 reserved_at_0[0x6e]; + u8 pcie_status_and_power[0x1]; + u8 reserved_at_111[0x10]; u8 pcie_performance_group[0x1]; }; @@ -9998,6 +9999,91 @@ struct mlx5_ifc_mpcnt_reg_bits { u8 reserved_2[0x1f]; union mlx5_ifc_mpcnt_cntrs_grp_data_layout_bits counter_set; +}; + +enum { + MLX5_ACCESS_REG_SUMMARY_CTRL_ID_MPEIN = 0x9050, + MLX5_MPEIN_PWR_STATUS_INVALID = 0, + MLX5_MPEIN_PWR_STATUS_SUFFICIENT = 1, + MLX5_MPEIN_PWR_STATUS_INSUFFICIENT = 2, +}; + +struct mlx5_ifc_mpein_reg_bits { + u8 reserved_at_0[0x2]; + u8 depth[0x6]; + u8 pcie_index[0x8]; + u8 node[0x8]; + u8 reserved_at_18[0x8]; + + u8 capability_mask[0x20]; + + u8 reserved_at_40[0x8]; + u8 link_width_enabled[0x8]; + u8 link_speed_enabled[0x10]; + + u8 lane0_physical_position[0x8]; + u8 link_width_active[0x8]; + u8 link_speed_active[0x10]; + + u8 num_of_pfs[0x10]; + u8 num_of_vfs[0x10]; + + u8 bdf0[0x10]; + u8 reserved_at_b0[0x10]; + + u8 max_read_request_size[0x4]; + u8 max_payload_size[0x4]; + u8 reserved_at_c8[0x5]; + u8 pwr_status[0x3]; + u8 port_type[0x4]; + u8 reserved_at_d4[0xb]; + u8 lane_reversal[0x1]; + + u8 reserved_at_e0[0x14]; + u8 pci_power[0xc]; + + u8 reserved_at_100[0x20]; + + u8 device_status[0x10]; + u8 port_state[0x8]; + u8 reserved_at_138[0x8]; + + u8 reserved_at_140[0x10]; + u8 receiver_detect_result[0x10]; + + u8 reserved_at_160[0x20]; +}; + +struct mlx5_ifc_mpein_reg_ext_bits { + u8 reserved_at_0[0x2]; + u8 depth[0x6]; + u8 pcie_index[0x8]; + u8 node[0x8]; + u8 reserved_at_18[0x8]; + + u8 reserved_at_20[0x20]; + + u8 reserved_at_40[0x8]; + u8 link_width_enabled[0x8]; + u8 link_speed_enabled[0x10]; + + u8 lane0_physical_position[0x8]; + u8 link_width_active[0x8]; + u8 link_speed_active[0x10]; + + u8 num_of_pfs[0x10]; + u8 num_of_vfs[0x10]; + + u8 bdf0[0x10]; + u8 reserved_at_b0[0x10]; + + u8 max_read_request_size[0x4]; + u8 max_payload_size[0x4]; + u8 reserved_at_c8[0x5]; + u8 pwr_status[0x3]; + u8 port_type[0x4]; + u8 reserved_at_d4[0xb]; + u8 lane_reversal[0x1]; }; struct mlx5_ifc_mcqi_cap_bits { From owner-svn-src-stable@freebsd.org Thu May 16 16:32:24 2019 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id C7E4F159DC90; Thu, 16 May 2019 16:32:23 +0000 (UTC) (envelope-from hselasky@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 6EFF18A3FF; Thu, 16 May 2019 16:32:23 +0000 (UTC) (envelope-from hselasky@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 4A0A623700; Thu, 16 May 2019 16:32:23 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x4GGWNoq075145; Thu, 16 May 2019 16:32:23 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x4GGWMLm075060; Thu, 16 May 2019 16:32:22 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201905161632.x4GGWMLm075060@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Thu, 16 May 2019 16:32:22 +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: r347772 - in stable/12/sys/dev/mlx5: . mlx5_core X-SVN-Group: stable-12 X-SVN-Commit-Author: hselasky X-SVN-Commit-Paths: in stable/12/sys/dev/mlx5: . mlx5_core X-SVN-Commit-Revision: 347772 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 6EFF18A3FF X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.98 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.998,0]; NEURAL_HAM_SHORT(-0.98)[-0.980,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US]; NEURAL_HAM_LONG(-1.00)[-1.000,0] X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 16 May 2019 16:32:24 -0000 Author: hselasky Date: Thu May 16 16:32:22 2019 New Revision: 347772 URL: https://svnweb.freebsd.org/changeset/base/347772 Log: MFC r347307: Update performance counter bits in mlx5core. Sponsored by: Mellanox Technologies Modified: stable/12/sys/dev/mlx5/mlx5_core/mlx5_diagnostics.c stable/12/sys/dev/mlx5/mlx5_ifc.h Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/dev/mlx5/mlx5_core/mlx5_diagnostics.c ============================================================================== --- stable/12/sys/dev/mlx5/mlx5_core/mlx5_diagnostics.c Thu May 16 16:31:39 2019 (r347771) +++ stable/12/sys/dev/mlx5/mlx5_core/mlx5_diagnostics.c Thu May 16 16:32:22 2019 (r347772) @@ -231,13 +231,13 @@ int mlx5_core_get_diagnostics_full(struct mlx5_core_de MLX5_REG_MPCNT, 0, 0); if (err == 0) { void *pcounters = MLX5_ADDR_OF(mpcnt_reg, out, - counter_set.pcie_performance_counters_data_layout); + counter_set.pcie_perf_counters); pdiag->counter.rx_pci_errors = - MLX5_GET(pcie_performance_counters_data_layout, + MLX5_GET(pcie_perf_counters, pcounters, rx_errors); pdiag->counter.tx_pci_errors = - MLX5_GET(pcie_performance_counters_data_layout, + MLX5_GET(pcie_perf_counters, pcounters, tx_errors); } MLX5_SET(mpcnt_reg, in, grp, @@ -247,13 +247,13 @@ int mlx5_core_get_diagnostics_full(struct mlx5_core_de MLX5_REG_MPCNT, 0, 0); if (err == 0) { void *pcounters = MLX5_ADDR_OF(mpcnt_reg, out, - counter_set.pcie_timers_and_states_data_layout); + counter_set.pcie_timers_states); pdiag->counter.tx_pci_non_fatal_errors = - MLX5_GET(pcie_timers_and_states_data_layout, + MLX5_GET(pcie_timers_states, pcounters, non_fatal_err_msg_sent); pdiag->counter.tx_pci_fatal_errors = - MLX5_GET(pcie_timers_and_states_data_layout, + MLX5_GET(pcie_timers_states, pcounters, fatal_err_msg_sent); } kvfree(in); Modified: stable/12/sys/dev/mlx5/mlx5_ifc.h ============================================================================== --- stable/12/sys/dev/mlx5/mlx5_ifc.h Thu May 16 16:31:39 2019 (r347771) +++ stable/12/sys/dev/mlx5/mlx5_ifc.h Thu May 16 16:32:22 2019 (r347772) @@ -9868,11 +9868,89 @@ struct mlx5_ifc_ppcnt_reg_bits { union mlx5_ifc_eth_cntrs_grp_data_layout_auto_bits counter_set; }; -struct mlx5_ifc_pcie_performance_counters_data_layout_bits { +struct mlx5_ifc_pcie_lanes_counters_bits { u8 life_time_counter_high[0x20]; u8 life_time_counter_low[0x20]; + u8 error_counter_lane0[0x20]; + + u8 error_counter_lane1[0x20]; + + u8 error_counter_lane2[0x20]; + + u8 error_counter_lane3[0x20]; + + u8 error_counter_lane4[0x20]; + + u8 error_counter_lane5[0x20]; + + u8 error_counter_lane6[0x20]; + + u8 error_counter_lane7[0x20]; + + u8 error_counter_lane8[0x20]; + + u8 error_counter_lane9[0x20]; + + u8 error_counter_lane10[0x20]; + + u8 error_counter_lane11[0x20]; + + u8 error_counter_lane12[0x20]; + + u8 error_counter_lane13[0x20]; + + u8 error_counter_lane14[0x20]; + + u8 error_counter_lane15[0x20]; + + u8 reserved_at_240[0x580]; +}; + +struct mlx5_ifc_pcie_lanes_counters_ext_bits { + u8 reserved_at_0[0x40]; + + u8 error_counter_lane0[0x20]; + + u8 error_counter_lane1[0x20]; + + u8 error_counter_lane2[0x20]; + + u8 error_counter_lane3[0x20]; + + u8 error_counter_lane4[0x20]; + + u8 error_counter_lane5[0x20]; + + u8 error_counter_lane6[0x20]; + + u8 error_counter_lane7[0x20]; + + u8 error_counter_lane8[0x20]; + + u8 error_counter_lane9[0x20]; + + u8 error_counter_lane10[0x20]; + + u8 error_counter_lane11[0x20]; + + u8 error_counter_lane12[0x20]; + + u8 error_counter_lane13[0x20]; + + u8 error_counter_lane14[0x20]; + + u8 error_counter_lane15[0x20]; + + u8 reserved_at_240[0x580]; +}; + +struct mlx5_ifc_pcie_perf_counters_bits { + u8 life_time_counter_high[0x20]; + + u8 life_time_counter_low[0x20]; + u8 rx_errors[0x20]; u8 tx_errors[0x20]; @@ -9889,10 +9967,46 @@ struct mlx5_ifc_pcie_performance_counters_data_layout_ u8 crc_error_tlp[0x20]; - u8 reserved_0[0x680]; + u8 tx_overflow_buffer_pkt[0x40]; + + u8 outbound_stalled_reads[0x20]; + + u8 outbound_stalled_writes[0x20]; + + u8 outbound_stalled_reads_events[0x20]; + + u8 outbound_stalled_writes_events[0x20]; + + u8 tx_overflow_buffer_marked_pkt[0x40]; + + u8 reserved_at_240[0x580]; }; -struct mlx5_ifc_pcie_timers_and_states_data_layout_bits { +struct mlx5_ifc_pcie_perf_counters_ext_bits { + u8 reserved_at_0[0x40]; + + u8 rx_errors[0x20]; + + u8 tx_errors[0x20]; + + u8 reserved_at_80[0xc0]; + + u8 tx_overflow_buffer_pkt[0x40]; + + u8 outbound_stalled_reads[0x20]; + + u8 outbound_stalled_writes[0x20]; + + u8 outbound_stalled_reads_events[0x20]; + + u8 outbound_stalled_writes_events[0x20]; + + u8 tx_overflow_buffer_marked_pkt[0x40]; + + u8 reserved_at_240[0x580]; +}; + +struct mlx5_ifc_pcie_timers_states_bits { u8 life_time_counter_high[0x20]; u8 life_time_counter_low[0x20]; @@ -9939,66 +10053,97 @@ struct mlx5_ifc_pcie_timers_and_states_data_layout_bit u8 fatal_err_msg_sent[0x20]; - u8 reserved_0[0x4e0]; + u8 reserved_at_2e0[0x4e0]; }; -struct mlx5_ifc_pcie_lanes_counters_data_layout_bits { - u8 life_time_counter_high[0x20]; +struct mlx5_ifc_pcie_timers_states_ext_bits { + u8 reserved_at_0[0x40]; - u8 life_time_counter_low[0x20]; + u8 time_to_boot_image_start[0x20]; - u8 error_counter_lane0[0x20]; + u8 time_to_link_image[0x20]; - u8 error_counter_lane1[0x20]; + u8 calibration_time[0x20]; - u8 error_counter_lane2[0x20]; + u8 time_to_first_perst[0x20]; - u8 error_counter_lane3[0x20]; + u8 time_to_detect_state[0x20]; - u8 error_counter_lane4[0x20]; + u8 time_to_l0[0x20]; - u8 error_counter_lane5[0x20]; + u8 time_to_crs_en[0x20]; - u8 error_counter_lane6[0x20]; + u8 time_to_plastic_image_start[0x20]; - u8 error_counter_lane7[0x20]; + u8 time_to_iron_image_start[0x20]; - u8 error_counter_lane8[0x20]; + u8 perst_handler[0x20]; - u8 error_counter_lane9[0x20]; + u8 times_in_l1[0x20]; - u8 error_counter_lane10[0x20]; + u8 times_in_l23[0x20]; - u8 error_counter_lane11[0x20]; + u8 dl_down[0x20]; - u8 error_counter_lane12[0x20]; + u8 config_cycle1usec[0x20]; - u8 error_counter_lane13[0x20]; + u8 config_cycle2to7usec[0x20]; - u8 error_counter_lane14[0x20]; + u8 config_cycle8to15usec[0x20]; - u8 error_counter_lane15[0x20]; + u8 config_cycle16to63usec[0x20]; - u8 reserved_0[0x580]; + u8 config_cycle64usec[0x20]; + + u8 correctable_err_msg_sent[0x20]; + + u8 non_fatal_err_msg_sent[0x20]; + + u8 fatal_err_msg_sent[0x20]; + + u8 reserved_at_2e0[0x4e0]; }; -union mlx5_ifc_mpcnt_cntrs_grp_data_layout_bits { - struct mlx5_ifc_pcie_performance_counters_data_layout_bits pcie_performance_counters_data_layout; - struct mlx5_ifc_pcie_timers_and_states_data_layout_bits pcie_timers_and_states_data_layout; - struct mlx5_ifc_pcie_lanes_counters_data_layout_bits pcie_lanes_counters_data_layout; - u8 reserved_0[0xf8]; +union mlx5_ifc_mpcnt_reg_counter_set_auto_bits { + struct mlx5_ifc_pcie_perf_counters_bits pcie_perf_counters; + struct mlx5_ifc_pcie_lanes_counters_bits pcie_lanes_counters; + struct mlx5_ifc_pcie_timers_states_bits pcie_timers_states; + u8 reserved_at_0[0x7c0]; }; +union mlx5_ifc_mpcnt_reg_counter_set_auto_ext_bits { + struct mlx5_ifc_pcie_perf_counters_ext_bits pcie_perf_counters_ext; + struct mlx5_ifc_pcie_lanes_counters_ext_bits pcie_lanes_counters_ext; + struct mlx5_ifc_pcie_timers_states_ext_bits pcie_timers_states_ext; + u8 reserved_at_0[0x7c0]; +}; + struct mlx5_ifc_mpcnt_reg_bits { - u8 reserved_0[0x8]; + u8 reserved_at_0[0x2]; + u8 depth[0x6]; u8 pcie_index[0x8]; - u8 reserved_1[0xa]; + u8 node[0x8]; + u8 reserved_at_18[0x2]; u8 grp[0x6]; u8 clr[0x1]; - u8 reserved_2[0x1f]; + u8 reserved_at_21[0x1f]; - union mlx5_ifc_mpcnt_cntrs_grp_data_layout_bits counter_set; + union mlx5_ifc_mpcnt_reg_counter_set_auto_bits counter_set; +}; + +struct mlx5_ifc_mpcnt_reg_ext_bits { + u8 reserved_at_0[0x2]; + u8 depth[0x6]; + u8 pcie_index[0x8]; + u8 node[0x8]; + u8 reserved_at_18[0x2]; + u8 grp[0x6]; + + u8 clr[0x1]; + u8 reserved_at_21[0x1f]; + + union mlx5_ifc_mpcnt_reg_counter_set_auto_ext_bits counter_set; }; enum { From owner-svn-src-stable@freebsd.org Thu May 16 16:33:01 2019 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id D2982159DD15; Thu, 16 May 2019 16:33:00 +0000 (UTC) (envelope-from hselasky@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 85BD08A56A; Thu, 16 May 2019 16:33:00 +0000 (UTC) (envelope-from hselasky@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 5D4D223711; Thu, 16 May 2019 16:33:00 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x4GGX0Bh076059; Thu, 16 May 2019 16:33:00 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x4GGX0JI076050; Thu, 16 May 2019 16:33:00 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201905161633.x4GGX0JI076050@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Thu, 16 May 2019 16:33:00 +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: r347773 - stable/12/sys/dev/mlx5/mlx5_en X-SVN-Group: stable-12 X-SVN-Commit-Author: hselasky X-SVN-Commit-Paths: stable/12/sys/dev/mlx5/mlx5_en X-SVN-Commit-Revision: 347773 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 85BD08A56A X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.98 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.998,0]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; NEURAL_HAM_SHORT(-0.98)[-0.983,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US] X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 16 May 2019 16:33:01 -0000 Author: hselasky Date: Thu May 16 16:32:59 2019 New Revision: 347773 URL: https://svnweb.freebsd.org/changeset/base/347773 Log: MFC r347308: Extend the counters framework in mlx5en(4). Allow more macro arguments and split the variable type and name into separate arguments. This allows simple and powerful copy and extraction of values from IFC based structures into SYSCTLs with the use of a single macro. Sponsored by: Mellanox Technologies Modified: stable/12/sys/dev/mlx5/mlx5_en/en.h stable/12/sys/dev/mlx5/mlx5_en/en_rl.h Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/dev/mlx5/mlx5_en/en.h ============================================================================== --- stable/12/sys/dev/mlx5/mlx5_en/en.h Thu May 16 16:32:22 2019 (r347772) +++ stable/12/sys/dev/mlx5/mlx5_en/en.h Thu May 16 16:32:59 2019 (r347773) @@ -1,5 +1,5 @@ /*- - * Copyright (c) 2015-2018 Mellanox Technologies. All rights reserved. + * Copyright (c) 2015-2019 Mellanox Technologies. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -146,48 +146,48 @@ struct mlx5e_cq; typedef void (mlx5e_cq_comp_t)(struct mlx5_core_cq *); -#define MLX5E_STATS_COUNT(a,b,c,d) a -#define MLX5E_STATS_VAR(a,b,c,d) b; -#define MLX5E_STATS_DESC(a,b,c,d) c, d, +#define MLX5E_STATS_COUNT(a, ...) a +#define MLX5E_STATS_VAR(a, b, c, ...) b c; +#define MLX5E_STATS_DESC(a, b, c, d, e, ...) d, e, #define MLX5E_VPORT_STATS(m) \ /* HW counters */ \ - m(+1, u64 rx_packets, "rx_packets", "Received packets") \ - m(+1, u64 rx_bytes, "rx_bytes", "Received bytes") \ - m(+1, u64 tx_packets, "tx_packets", "Transmitted packets") \ - m(+1, u64 tx_bytes, "tx_bytes", "Transmitted bytes") \ - m(+1, u64 rx_error_packets, "rx_error_packets", "Received error packets") \ - m(+1, u64 rx_error_bytes, "rx_error_bytes", "Received error bytes") \ - m(+1, u64 tx_error_packets, "tx_error_packets", "Transmitted error packets") \ - m(+1, u64 tx_error_bytes, "tx_error_bytes", "Transmitted error bytes") \ - m(+1, u64 rx_unicast_packets, "rx_unicast_packets", "Received unicast packets") \ - m(+1, u64 rx_unicast_bytes, "rx_unicast_bytes", "Received unicast bytes") \ - m(+1, u64 tx_unicast_packets, "tx_unicast_packets", "Transmitted unicast packets") \ - m(+1, u64 tx_unicast_bytes, "tx_unicast_bytes", "Transmitted unicast bytes") \ - m(+1, u64 rx_multicast_packets, "rx_multicast_packets", "Received multicast packets") \ - m(+1, u64 rx_multicast_bytes, "rx_multicast_bytes", "Received multicast bytes") \ - m(+1, u64 tx_multicast_packets, "tx_multicast_packets", "Transmitted multicast packets") \ - m(+1, u64 tx_multicast_bytes, "tx_multicast_bytes", "Transmitted multicast bytes") \ - m(+1, u64 rx_broadcast_packets, "rx_broadcast_packets", "Received broadcast packets") \ - m(+1, u64 rx_broadcast_bytes, "rx_broadcast_bytes", "Received broadcast bytes") \ - m(+1, u64 tx_broadcast_packets, "tx_broadcast_packets", "Transmitted broadcast packets") \ - m(+1, u64 tx_broadcast_bytes, "tx_broadcast_bytes", "Transmitted broadcast bytes") \ - m(+1, u64 rx_out_of_buffer, "rx_out_of_buffer", "Receive out of buffer, no recv wqes events") \ + m(+1, u64, rx_packets, "rx_packets", "Received packets") \ + m(+1, u64, rx_bytes, "rx_bytes", "Received bytes") \ + m(+1, u64, tx_packets, "tx_packets", "Transmitted packets") \ + m(+1, u64, tx_bytes, "tx_bytes", "Transmitted bytes") \ + m(+1, u64, rx_error_packets, "rx_error_packets", "Received error packets") \ + m(+1, u64, rx_error_bytes, "rx_error_bytes", "Received error bytes") \ + m(+1, u64, tx_error_packets, "tx_error_packets", "Transmitted error packets") \ + m(+1, u64, tx_error_bytes, "tx_error_bytes", "Transmitted error bytes") \ + m(+1, u64, rx_unicast_packets, "rx_unicast_packets", "Received unicast packets") \ + m(+1, u64, rx_unicast_bytes, "rx_unicast_bytes", "Received unicast bytes") \ + m(+1, u64, tx_unicast_packets, "tx_unicast_packets", "Transmitted unicast packets") \ + m(+1, u64, tx_unicast_bytes, "tx_unicast_bytes", "Transmitted unicast bytes") \ + m(+1, u64, rx_multicast_packets, "rx_multicast_packets", "Received multicast packets") \ + m(+1, u64, rx_multicast_bytes, "rx_multicast_bytes", "Received multicast bytes") \ + m(+1, u64, tx_multicast_packets, "tx_multicast_packets", "Transmitted multicast packets") \ + m(+1, u64, tx_multicast_bytes, "tx_multicast_bytes", "Transmitted multicast bytes") \ + m(+1, u64, rx_broadcast_packets, "rx_broadcast_packets", "Received broadcast packets") \ + m(+1, u64, rx_broadcast_bytes, "rx_broadcast_bytes", "Received broadcast bytes") \ + m(+1, u64, tx_broadcast_packets, "tx_broadcast_packets", "Transmitted broadcast packets") \ + m(+1, u64, tx_broadcast_bytes, "tx_broadcast_bytes", "Transmitted broadcast bytes") \ + m(+1, u64, rx_out_of_buffer, "rx_out_of_buffer", "Receive out of buffer, no recv wqes events") \ /* SW counters */ \ - m(+1, u64 tso_packets, "tso_packets", "Transmitted TSO packets") \ - m(+1, u64 tso_bytes, "tso_bytes", "Transmitted TSO bytes") \ - m(+1, u64 lro_packets, "lro_packets", "Received LRO packets") \ - m(+1, u64 lro_bytes, "lro_bytes", "Received LRO bytes") \ - m(+1, u64 sw_lro_queued, "sw_lro_queued", "Packets queued for SW LRO") \ - m(+1, u64 sw_lro_flushed, "sw_lro_flushed", "Packets flushed from SW LRO") \ - m(+1, u64 rx_csum_good, "rx_csum_good", "Received checksum valid packets") \ - m(+1, u64 rx_csum_none, "rx_csum_none", "Received no checksum packets") \ - m(+1, u64 tx_csum_offload, "tx_csum_offload", "Transmit checksum offload packets") \ - m(+1, u64 tx_queue_dropped, "tx_queue_dropped", "Transmit queue dropped") \ - m(+1, u64 tx_defragged, "tx_defragged", "Transmit queue defragged") \ - m(+1, u64 rx_wqe_err, "rx_wqe_err", "Receive WQE errors") \ - m(+1, u64 tx_jumbo_packets, "tx_jumbo_packets", "TX packets greater than 1518 octets") \ - m(+1, u64 rx_steer_missed_packets, "rx_steer_missed_packets", "RX packets dropped by steering rule(s)") + m(+1, u64, tso_packets, "tso_packets", "Transmitted TSO packets") \ + m(+1, u64, tso_bytes, "tso_bytes", "Transmitted TSO bytes") \ + m(+1, u64, lro_packets, "lro_packets", "Received LRO packets") \ + m(+1, u64, lro_bytes, "lro_bytes", "Received LRO bytes") \ + m(+1, u64, sw_lro_queued, "sw_lro_queued", "Packets queued for SW LRO") \ + m(+1, u64, sw_lro_flushed, "sw_lro_flushed", "Packets flushed from SW LRO") \ + m(+1, u64, rx_csum_good, "rx_csum_good", "Received checksum valid packets") \ + m(+1, u64, rx_csum_none, "rx_csum_none", "Received no checksum packets") \ + m(+1, u64, tx_csum_offload, "tx_csum_offload", "Transmit checksum offload packets") \ + m(+1, u64, tx_queue_dropped, "tx_queue_dropped", "Transmit queue dropped") \ + m(+1, u64, tx_defragged, "tx_defragged", "Transmit queue defragged") \ + m(+1, u64, rx_wqe_err, "rx_wqe_err", "Receive WQE errors") \ + m(+1, u64, tx_jumbo_packets, "tx_jumbo_packets", "TX packets greater than 1518 octets") \ + m(+1, u64, rx_steer_missed_packets, "rx_steer_missed_packets", "RX packets dropped by steering rule(s)") #define MLX5E_VPORT_STATS_NUM (0 MLX5E_VPORT_STATS(MLX5E_STATS_COUNT)) @@ -198,128 +198,129 @@ struct mlx5e_vport_stats { }; #define MLX5E_PPORT_IEEE802_3_STATS(m) \ - m(+1, u64 frames_tx, "frames_tx", "Frames transmitted") \ - m(+1, u64 frames_rx, "frames_rx", "Frames received") \ - m(+1, u64 check_seq_err, "check_seq_err", "Sequence errors") \ - m(+1, u64 alignment_err, "alignment_err", "Alignment errors") \ - m(+1, u64 octets_tx, "octets_tx", "Bytes transmitted") \ - m(+1, u64 octets_received, "octets_received", "Bytes received") \ - m(+1, u64 multicast_xmitted, "multicast_xmitted", "Multicast transmitted") \ - m(+1, u64 broadcast_xmitted, "broadcast_xmitted", "Broadcast transmitted") \ - m(+1, u64 multicast_rx, "multicast_rx", "Multicast received") \ - m(+1, u64 broadcast_rx, "broadcast_rx", "Broadcast received") \ - m(+1, u64 in_range_len_errors, "in_range_len_errors", "In range length errors") \ - m(+1, u64 out_of_range_len, "out_of_range_len", "Out of range length errors") \ - m(+1, u64 too_long_errors, "too_long_errors", "Too long errors") \ - m(+1, u64 symbol_err, "symbol_err", "Symbol errors") \ - m(+1, u64 mac_control_tx, "mac_control_tx", "MAC control transmitted") \ - m(+1, u64 mac_control_rx, "mac_control_rx", "MAC control received") \ - m(+1, u64 unsupported_op_rx, "unsupported_op_rx", "Unsupported operation received") \ - m(+1, u64 pause_ctrl_rx, "pause_ctrl_rx", "Pause control received") \ - m(+1, u64 pause_ctrl_tx, "pause_ctrl_tx", "Pause control transmitted") + m(+1, u64, frames_tx, "frames_tx", "Frames transmitted") \ + m(+1, u64, frames_rx, "frames_rx", "Frames received") \ + m(+1, u64, check_seq_err, "check_seq_err", "Sequence errors") \ + m(+1, u64, alignment_err, "alignment_err", "Alignment errors") \ + m(+1, u64, octets_tx, "octets_tx", "Bytes transmitted") \ + m(+1, u64, octets_received, "octets_received", "Bytes received") \ + m(+1, u64, multicast_xmitted, "multicast_xmitted", "Multicast transmitted") \ + m(+1, u64, broadcast_xmitted, "broadcast_xmitted", "Broadcast transmitted") \ + m(+1, u64, multicast_rx, "multicast_rx", "Multicast received") \ + m(+1, u64, broadcast_rx, "broadcast_rx", "Broadcast received") \ + m(+1, u64, in_range_len_errors, "in_range_len_errors", "In range length errors") \ + m(+1, u64, out_of_range_len, "out_of_range_len", "Out of range length errors") \ + m(+1, u64, too_long_errors, "too_long_errors", "Too long errors") \ + m(+1, u64, symbol_err, "symbol_err", "Symbol errors") \ + m(+1, u64, mac_control_tx, "mac_control_tx", "MAC control transmitted") \ + m(+1, u64, mac_control_rx, "mac_control_rx", "MAC control received") \ + m(+1, u64, unsupported_op_rx, "unsupported_op_rx", "Unsupported operation received") \ + m(+1, u64, pause_ctrl_rx, "pause_ctrl_rx", "Pause control received") \ + m(+1, u64, pause_ctrl_tx, "pause_ctrl_tx", "Pause control transmitted") #define MLX5E_PPORT_RFC2819_STATS(m) \ - m(+1, u64 drop_events, "drop_events", "Dropped events") \ - m(+1, u64 octets, "octets", "Octets") \ - m(+1, u64 pkts, "pkts", "Packets") \ - m(+1, u64 broadcast_pkts, "broadcast_pkts", "Broadcast packets") \ - m(+1, u64 multicast_pkts, "multicast_pkts", "Multicast packets") \ - m(+1, u64 crc_align_errors, "crc_align_errors", "CRC alignment errors") \ - m(+1, u64 undersize_pkts, "undersize_pkts", "Undersized packets") \ - m(+1, u64 oversize_pkts, "oversize_pkts", "Oversized packets") \ - m(+1, u64 fragments, "fragments", "Fragments") \ - m(+1, u64 jabbers, "jabbers", "Jabbers") \ - m(+1, u64 collisions, "collisions", "Collisions") + m(+1, u64, drop_events, "drop_events", "Dropped events") \ + m(+1, u64, octets, "octets", "Octets") \ + m(+1, u64, pkts, "pkts", "Packets") \ + m(+1, u64, broadcast_pkts, "broadcast_pkts", "Broadcast packets") \ + m(+1, u64, multicast_pkts, "multicast_pkts", "Multicast packets") \ + m(+1, u64, crc_align_errors, "crc_align_errors", "CRC alignment errors") \ + m(+1, u64, undersize_pkts, "undersize_pkts", "Undersized packets") \ + m(+1, u64, oversize_pkts, "oversize_pkts", "Oversized packets") \ + m(+1, u64, fragments, "fragments", "Fragments") \ + m(+1, u64, jabbers, "jabbers", "Jabbers") \ + m(+1, u64, collisions, "collisions", "Collisions") #define MLX5E_PPORT_RFC2819_STATS_DEBUG(m) \ - m(+1, u64 p64octets, "p64octets", "Bytes") \ - m(+1, u64 p65to127octets, "p65to127octets", "Bytes") \ - m(+1, u64 p128to255octets, "p128to255octets", "Bytes") \ - m(+1, u64 p256to511octets, "p256to511octets", "Bytes") \ - m(+1, u64 p512to1023octets, "p512to1023octets", "Bytes") \ - m(+1, u64 p1024to1518octets, "p1024to1518octets", "Bytes") \ - m(+1, u64 p1519to2047octets, "p1519to2047octets", "Bytes") \ - m(+1, u64 p2048to4095octets, "p2048to4095octets", "Bytes") \ - m(+1, u64 p4096to8191octets, "p4096to8191octets", "Bytes") \ - m(+1, u64 p8192to10239octets, "p8192to10239octets", "Bytes") + m(+1, u64, p64octets, "p64octets", "Bytes") \ + m(+1, u64, p65to127octets, "p65to127octets", "Bytes") \ + m(+1, u64, p128to255octets, "p128to255octets", "Bytes") \ + m(+1, u64, p256to511octets, "p256to511octets", "Bytes") \ + m(+1, u64, p512to1023octets, "p512to1023octets", "Bytes") \ + m(+1, u64, p1024to1518octets, "p1024to1518octets", "Bytes") \ + m(+1, u64, p1519to2047octets, "p1519to2047octets", "Bytes") \ + m(+1, u64, p2048to4095octets, "p2048to4095octets", "Bytes") \ + m(+1, u64, p4096to8191octets, "p4096to8191octets", "Bytes") \ + m(+1, u64, p8192to10239octets, "p8192to10239octets", "Bytes") #define MLX5E_PPORT_RFC2863_STATS_DEBUG(m) \ - m(+1, u64 in_octets, "in_octets", "In octets") \ - m(+1, u64 in_ucast_pkts, "in_ucast_pkts", "In unicast packets") \ - m(+1, u64 in_discards, "in_discards", "In discards") \ - m(+1, u64 in_errors, "in_errors", "In errors") \ - m(+1, u64 in_unknown_protos, "in_unknown_protos", "In unknown protocols") \ - m(+1, u64 out_octets, "out_octets", "Out octets") \ - m(+1, u64 out_ucast_pkts, "out_ucast_pkts", "Out unicast packets") \ - m(+1, u64 out_discards, "out_discards", "Out discards") \ - m(+1, u64 out_errors, "out_errors", "Out errors") \ - m(+1, u64 in_multicast_pkts, "in_multicast_pkts", "In multicast packets") \ - m(+1, u64 in_broadcast_pkts, "in_broadcast_pkts", "In broadcast packets") \ - m(+1, u64 out_multicast_pkts, "out_multicast_pkts", "Out multicast packets") \ - m(+1, u64 out_broadcast_pkts, "out_broadcast_pkts", "Out broadcast packets") + m(+1, u64, in_octets, "in_octets", "In octets") \ + m(+1, u64, in_ucast_pkts, "in_ucast_pkts", "In unicast packets") \ + m(+1, u64, in_discards, "in_discards", "In discards") \ + m(+1, u64, in_errors, "in_errors", "In errors") \ + m(+1, u64, in_unknown_protos, "in_unknown_protos", "In unknown protocols") \ + m(+1, u64, out_octets, "out_octets", "Out octets") \ + m(+1, u64, out_ucast_pkts, "out_ucast_pkts", "Out unicast packets") \ + m(+1, u64, out_discards, "out_discards", "Out discards") \ + m(+1, u64, out_errors, "out_errors", "Out errors") \ + m(+1, u64, in_multicast_pkts, "in_multicast_pkts", "In multicast packets") \ + m(+1, u64, in_broadcast_pkts, "in_broadcast_pkts", "In broadcast packets") \ + m(+1, u64, out_multicast_pkts, "out_multicast_pkts", "Out multicast packets") \ + m(+1, u64, out_broadcast_pkts, "out_broadcast_pkts", "Out broadcast packets") #define MLX5E_PPORT_ETHERNET_EXTENDED_STATS_DEBUG(m) \ - m(+1, u64 port_transmit_wait_high, "port_transmit_wait_high", "Port transmit wait high") \ - m(+1, u64 ecn_marked, "ecn_marked", "ECN marked") \ - m(+1, u64 no_buffer_discard_mc, "no_buffer_discard_mc", "No buffer discard mc") \ - m(+1, u64 rx_ebp, "rx_ebp", "RX EBP") \ - m(+1, u64 tx_ebp, "tx_ebp", "TX EBP") \ - m(+1, u64 rx_buffer_almost_full, "rx_buffer_almost_full", "RX buffer almost full") \ - m(+1, u64 rx_buffer_full, "rx_buffer_full", "RX buffer full") \ - m(+1, u64 rx_icrc_encapsulated, "rx_icrc_encapsulated", "RX ICRC encapsulated") \ - m(+1, u64 ex_reserved_0, "ex_reserved_0", "Reserved") \ - m(+1, u64 ex_reserved_1, "ex_reserved_1", "Reserved") \ - m(+1, u64 tx_stat_p64octets, "tx_stat_p64octets", "Bytes") \ - m(+1, u64 tx_stat_p65to127octets, "tx_stat_p65to127octets", "Bytes") \ - m(+1, u64 tx_stat_p128to255octets, "tx_stat_p128to255octets", "Bytes") \ - m(+1, u64 tx_stat_p256to511octets, "tx_stat_p256to511octets", "Bytes") \ - m(+1, u64 tx_stat_p512to1023octets, "tx_stat_p512to1023octets", "Bytes") \ - m(+1, u64 tx_stat_p1024to1518octets, "tx_stat_p1024to1518octets", "Bytes") \ - m(+1, u64 tx_stat_p1519to2047octets, "tx_stat_p1519to2047octets", "Bytes") \ - m(+1, u64 tx_stat_p2048to4095octets, "tx_stat_p2048to4095octets", "Bytes") \ - m(+1, u64 tx_stat_p4096to8191octets, "tx_stat_p4096to8191octets", "Bytes") \ - m(+1, u64 tx_stat_p8192to10239octets, "tx_stat_p8192to10239octets", "Bytes") + m(+1, u64, port_transmit_wait_high, "port_transmit_wait_high", "Port transmit wait high") \ + m(+1, u64, ecn_marked, "ecn_marked", "ECN marked") \ + m(+1, u64, no_buffer_discard_mc, "no_buffer_discard_mc", "No buffer discard mc") \ + m(+1, u64, rx_ebp, "rx_ebp", "RX EBP") \ + m(+1, u64, tx_ebp, "tx_ebp", "TX EBP") \ + m(+1, u64, rx_buffer_almost_full, "rx_buffer_almost_full", "RX buffer almost full") \ + m(+1, u64, rx_buffer_full, "rx_buffer_full", "RX buffer full") \ + m(+1, u64, rx_icrc_encapsulated, "rx_icrc_encapsulated", "RX ICRC encapsulated") \ + m(+1, u64, ex_reserved_0, "ex_reserved_0", "Reserved") \ + m(+1, u64, ex_reserved_1, "ex_reserved_1", "Reserved") \ + m(+1, u64, tx_stat_p64octets, "tx_stat_p64octets", "Bytes") \ + m(+1, u64, tx_stat_p65to127octets, "tx_stat_p65to127octets", "Bytes") \ + m(+1, u64, tx_stat_p128to255octets, "tx_stat_p128to255octets", "Bytes") \ + m(+1, u64, tx_stat_p256to511octets, "tx_stat_p256to511octets", "Bytes") \ + m(+1, u64, tx_stat_p512to1023octets, "tx_stat_p512to1023octets", "Bytes") \ + m(+1, u64, tx_stat_p1024to1518octets, "tx_stat_p1024to1518octets", "Bytes") \ + m(+1, u64, tx_stat_p1519to2047octets, "tx_stat_p1519to2047octets", "Bytes") \ + m(+1, u64, tx_stat_p2048to4095octets, "tx_stat_p2048to4095octets", "Bytes") \ + m(+1, u64, tx_stat_p4096to8191octets, "tx_stat_p4096to8191octets", "Bytes") \ + m(+1, u64, tx_stat_p8192to10239octets, "tx_stat_p8192to10239octets", "Bytes") -#define MLX5E_PPORT_PHYSICAL_LAYER_STATS_DEBUG(m) \ - m(+1, u64 time_since_last_clear, "time_since_last_clear", \ - "Time since the last counters clear event (msec)") \ - m(+1, u64 symbol_errors, "symbol_errors", "Symbol errors") \ - m(+1, u64 sync_headers_errors, "sync_headers_errors", "Sync header error counter") \ - m(+1, u64 bip_errors_lane0, "edpl_bip_errors_lane0", \ - "Indicates the number of PRBS errors on lane 0") \ - m(+1, u64 bip_errors_lane1, "edpl_bip_errors_lane1", \ - "Indicates the number of PRBS errors on lane 1") \ - m(+1, u64 bip_errors_lane2, "edpl_bip_errors_lane2", \ - "Indicates the number of PRBS errors on lane 2") \ - m(+1, u64 bip_errors_lane3, "edpl_bip_errors_lane3", \ - "Indicates the number of PRBS errors on lane 3") \ - m(+1, u64 fc_corrected_blocks_lane0, "fc_corrected_blocks_lane0", \ - "FEC correctable block counter lane 0") \ - m(+1, u64 fc_corrected_blocks_lane1, "fc_corrected_blocks_lane1", \ - "FEC correctable block counter lane 1") \ - m(+1, u64 fc_corrected_blocks_lane2, "fc_corrected_blocks_lane2", \ - "FEC correctable block counter lane 2") \ - m(+1, u64 fc_corrected_blocks_lane3, "fc_corrected_blocks_lane3", \ - "FEC correctable block counter lane 3") \ - m(+1, u64 rs_corrected_blocks, "rs_corrected_blocks", \ - "FEC correcable block counter") \ - m(+1, u64 rs_uncorrectable_blocks, "rs_uncorrectable_blocks", \ - "FEC uncorrecable block counter") \ - m(+1, u64 rs_no_errors_blocks, "rs_no_errors_blocks", \ - "The number of RS-FEC blocks received that had no errors") \ - m(+1, u64 rs_single_error_blocks, "rs_single_error_blocks", \ - "The number of corrected RS-FEC blocks received that had" \ - "exactly 1 error symbol") \ - m(+1, u64 rs_corrected_symbols_total, "rs_corrected_symbols_total", \ - "Port FEC corrected symbol counter") \ - m(+1, u64 rs_corrected_symbols_lane0, "rs_corrected_symbols_lane0", \ - "FEC corrected symbol counter lane 0") \ - m(+1, u64 rs_corrected_symbols_lane1, "rs_corrected_symbols_lane1", \ - "FEC corrected symbol counter lane 1") \ - m(+1, u64 rs_corrected_symbols_lane2, "rs_corrected_symbols_lane2", \ - "FEC corrected symbol counter lane 2") \ - m(+1, u64 rs_corrected_symbols_lane3, "rs_corrected_symbols_lane3", \ - "FEC corrected symbol counter lane 3") +#define MLX5E_PPORT_PHYSICAL_LAYER_STATS_DEBUG(m) \ + m(+1, u64, time_since_last_clear, "time_since_last_clear", \ + "Time since the last counters clear event (msec)") \ + m(+1, u64, symbol_errors, "symbol_errors", "Symbol errors") \ + m(+1, u64, sync_headers_errors, "sync_headers_errors", \ + "Sync header error counter") \ + m(+1, u64, bip_errors_lane0, "edpl_bip_errors_lane0", \ + "Indicates the number of PRBS errors on lane 0") \ + m(+1, u64, bip_errors_lane1, "edpl_bip_errors_lane1", \ + "Indicates the number of PRBS errors on lane 1") \ + m(+1, u64, bip_errors_lane2, "edpl_bip_errors_lane2", \ + "Indicates the number of PRBS errors on lane 2") \ + m(+1, u64, bip_errors_lane3, "edpl_bip_errors_lane3", \ + "Indicates the number of PRBS errors on lane 3") \ + m(+1, u64, fc_corrected_blocks_lane0, "fc_corrected_blocks_lane0", \ + "FEC correctable block counter lane 0") \ + m(+1, u64, fc_corrected_blocks_lane1, "fc_corrected_blocks_lane1", \ + "FEC correctable block counter lane 1") \ + m(+1, u64, fc_corrected_blocks_lane2, "fc_corrected_blocks_lane2", \ + "FEC correctable block counter lane 2") \ + m(+1, u64, fc_corrected_blocks_lane3, "fc_corrected_blocks_lane3", \ + "FEC correctable block counter lane 3") \ + m(+1, u64, rs_corrected_blocks, "rs_corrected_blocks", \ + "FEC correcable block counter") \ + m(+1, u64, rs_uncorrectable_blocks, "rs_uncorrectable_blocks", \ + "FEC uncorrecable block counter") \ + m(+1, u64, rs_no_errors_blocks, "rs_no_errors_blocks", \ + "The number of RS-FEC blocks received that had no errors") \ + m(+1, u64, rs_single_error_blocks, "rs_single_error_blocks", \ + "The number of corrected RS-FEC blocks received that had" \ + "exactly 1 error symbol") \ + m(+1, u64, rs_corrected_symbols_total, "rs_corrected_symbols_total", \ + "Port FEC corrected symbol counter") \ + m(+1, u64, rs_corrected_symbols_lane0, "rs_corrected_symbols_lane0", \ + "FEC corrected symbol counter lane 0") \ + m(+1, u64, rs_corrected_symbols_lane1, "rs_corrected_symbols_lane1", \ + "FEC corrected symbol counter lane 1") \ + m(+1, u64, rs_corrected_symbols_lane2, "rs_corrected_symbols_lane2", \ + "FEC corrected symbol counter lane 2") \ + m(+1, u64, rs_corrected_symbols_lane3, "rs_corrected_symbols_lane3", \ + "FEC corrected symbol counter lane 3") /* Per priority statistics for PFC */ #define MLX5E_PPORT_PER_PRIO_STATS_SUB(m,n,p) \ @@ -348,7 +349,7 @@ struct mlx5e_vport_stats { "device_stall_critical_watermark", "Device stall critical watermark") #define MLX5E_PPORT_PER_PRIO_STATS_PREFIX(m,p,c,t,f,s,d) \ - m(c, t pri_##p##_##f, "prio" #p "_" s, "Priority " #p " - " d) + m(c, t, pri_##p##_##f, "prio" #p "_" s, "Priority " #p " - " d) #define MLX5E_PPORT_PER_PRIO_STATS_NUM_PRIO 8 @@ -410,14 +411,14 @@ struct mlx5e_port_stats_debug { }; #define MLX5E_RQ_STATS(m) \ - m(+1, u64 packets, "packets", "Received packets") \ - m(+1, u64 bytes, "bytes", "Received bytes") \ - m(+1, u64 csum_none, "csum_none", "Received packets") \ - m(+1, u64 lro_packets, "lro_packets", "Received LRO packets") \ - m(+1, u64 lro_bytes, "lro_bytes", "Received LRO bytes") \ - m(+1, u64 sw_lro_queued, "sw_lro_queued", "Packets queued for SW LRO") \ - m(+1, u64 sw_lro_flushed, "sw_lro_flushed", "Packets flushed from SW LRO") \ - m(+1, u64 wqe_err, "wqe_err", "Received packets") + m(+1, u64, packets, "packets", "Received packets") \ + m(+1, u64, bytes, "bytes", "Received bytes") \ + m(+1, u64, csum_none, "csum_none", "Received packets") \ + m(+1, u64, lro_packets, "lro_packets", "Received LRO packets") \ + m(+1, u64, lro_bytes, "lro_bytes", "Received LRO bytes") \ + m(+1, u64, sw_lro_queued, "sw_lro_queued", "Packets queued for SW LRO") \ + m(+1, u64, sw_lro_flushed, "sw_lro_flushed", "Packets flushed from SW LRO") \ + m(+1, u64, wqe_err, "wqe_err", "Received packets") #define MLX5E_RQ_STATS_NUM (0 MLX5E_RQ_STATS(MLX5E_STATS_COUNT)) @@ -428,14 +429,14 @@ struct mlx5e_rq_stats { }; #define MLX5E_SQ_STATS(m) \ - m(+1, u64 packets, "packets", "Transmitted packets") \ - m(+1, u64 bytes, "bytes", "Transmitted bytes") \ - m(+1, u64 tso_packets, "tso_packets", "Transmitted packets") \ - m(+1, u64 tso_bytes, "tso_bytes", "Transmitted bytes") \ - m(+1, u64 csum_offload_none, "csum_offload_none", "Transmitted packets") \ - m(+1, u64 defragged, "defragged", "Transmitted packets") \ - m(+1, u64 dropped, "dropped", "Transmitted packets") \ - m(+1, u64 nop, "nop", "Transmitted packets") + m(+1, u64, packets, "packets", "Transmitted packets") \ + m(+1, u64, bytes, "bytes", "Transmitted bytes") \ + m(+1, u64, tso_packets, "tso_packets", "Transmitted packets") \ + m(+1, u64, tso_bytes, "tso_bytes", "Transmitted bytes") \ + m(+1, u64, csum_offload_none, "csum_offload_none", "Transmitted packets") \ + m(+1, u64, defragged, "defragged", "Transmitted packets") \ + m(+1, u64, dropped, "dropped", "Transmitted packets") \ + m(+1, u64, nop, "nop", "Transmitted packets") #define MLX5E_SQ_STATS_NUM (0 MLX5E_SQ_STATS(MLX5E_STATS_COUNT)) @@ -493,32 +494,31 @@ struct mlx5e_params { }; #define MLX5E_PARAMS(m) \ - m(+1, u64 tx_queue_size_max, "tx_queue_size_max", "Max send queue size") \ - m(+1, u64 rx_queue_size_max, "rx_queue_size_max", "Max receive queue size") \ - m(+1, u64 tx_queue_size, "tx_queue_size", "Default send queue size") \ - m(+1, u64 rx_queue_size, "rx_queue_size", "Default receive queue size") \ - m(+1, u64 channels, "channels", "Default number of channels") \ - m(+1, u64 channels_rsss, "channels_rsss", "Default channels receive side scaling stride") \ - m(+1, u64 coalesce_usecs_max, "coalesce_usecs_max", "Maximum usecs for joining packets") \ - m(+1, u64 coalesce_pkts_max, "coalesce_pkts_max", "Maximum packets to join") \ - m(+1, u64 rx_coalesce_usecs, "rx_coalesce_usecs", "Limit in usec for joining rx packets") \ - m(+1, u64 rx_coalesce_pkts, "rx_coalesce_pkts", "Maximum number of rx packets to join") \ - m(+1, u64 rx_coalesce_mode, "rx_coalesce_mode", "0: EQE fixed mode 1: CQE fixed mode 2: EQE auto mode 3: CQE auto mode") \ - m(+1, u64 tx_coalesce_usecs, "tx_coalesce_usecs", "Limit in usec for joining tx packets") \ - m(+1, u64 tx_coalesce_pkts, "tx_coalesce_pkts", "Maximum number of tx packets to join") \ - m(+1, u64 tx_coalesce_mode, "tx_coalesce_mode", "0: EQE mode 1: CQE mode") \ - m(+1, u64 tx_completion_fact, "tx_completion_fact", "1..MAX: Completion event ratio") \ - m(+1, u64 tx_completion_fact_max, "tx_completion_fact_max", "Maximum completion event ratio") \ - m(+1, u64 hw_lro, "hw_lro", "set to enable hw_lro") \ - m(+1, u64 cqe_zipping, "cqe_zipping", "0 : CQE zipping disabled") \ - m(+1, u64 modify_tx_dma, "modify_tx_dma", "0: Enable TX 1: Disable TX") \ - m(+1, u64 modify_rx_dma, "modify_rx_dma", "0: Enable RX 1: Disable RX") \ - m(+1, u64 diag_pci_enable, "diag_pci_enable", "0: Disabled 1: Enabled") \ - m(+1, u64 diag_general_enable, "diag_general_enable", "0: Disabled 1: Enabled") \ - m(+1, u64 hw_mtu, "hw_mtu", "Current hardware MTU value") \ - m(+1, u64 mc_local_lb, "mc_local_lb", "0: Local multicast loopback enabled 1: Disabled") \ - m(+1, u64 uc_local_lb, "uc_local_lb", "0: Local unicast loopback enabled 1: Disabled") - + m(+1, u64, tx_queue_size_max, "tx_queue_size_max", "Max send queue size") \ + m(+1, u64, rx_queue_size_max, "rx_queue_size_max", "Max receive queue size") \ + m(+1, u64, tx_queue_size, "tx_queue_size", "Default send queue size") \ + m(+1, u64, rx_queue_size, "rx_queue_size", "Default receive queue size") \ + m(+1, u64, channels, "channels", "Default number of channels") \ + m(+1, u64, channels_rsss, "channels_rsss", "Default channels receive side scaling stride") \ + m(+1, u64, coalesce_usecs_max, "coalesce_usecs_max", "Maximum usecs for joining packets") \ + m(+1, u64, coalesce_pkts_max, "coalesce_pkts_max", "Maximum packets to join") \ + m(+1, u64, rx_coalesce_usecs, "rx_coalesce_usecs", "Limit in usec for joining rx packets") \ + m(+1, u64, rx_coalesce_pkts, "rx_coalesce_pkts", "Maximum number of rx packets to join") \ + m(+1, u64, rx_coalesce_mode, "rx_coalesce_mode", "0: EQE fixed mode 1: CQE fixed mode 2: EQE auto mode 3: CQE auto mode") \ + m(+1, u64, tx_coalesce_usecs, "tx_coalesce_usecs", "Limit in usec for joining tx packets") \ + m(+1, u64, tx_coalesce_pkts, "tx_coalesce_pkts", "Maximum number of tx packets to join") \ + m(+1, u64, tx_coalesce_mode, "tx_coalesce_mode", "0: EQE mode 1: CQE mode") \ + m(+1, u64, tx_completion_fact, "tx_completion_fact", "1..MAX: Completion event ratio") \ + m(+1, u64, tx_completion_fact_max, "tx_completion_fact_max", "Maximum completion event ratio") \ + m(+1, u64, hw_lro, "hw_lro", "set to enable hw_lro") \ + m(+1, u64, cqe_zipping, "cqe_zipping", "0 : CQE zipping disabled") \ + m(+1, u64, modify_tx_dma, "modify_tx_dma", "0: Enable TX 1: Disable TX") \ + m(+1, u64, modify_rx_dma, "modify_rx_dma", "0: Enable RX 1: Disable RX") \ + m(+1, u64, diag_pci_enable, "diag_pci_enable", "0: Disabled 1: Enabled") \ + m(+1, u64, diag_general_enable, "diag_general_enable", "0: Disabled 1: Enabled") \ + m(+1, u64, hw_mtu, "hw_mtu", "Current hardware MTU value") \ + m(+1, u64, mc_local_lb, "mc_local_lb", "0: Local multicast loopback enabled 1: Disabled") \ + m(+1, u64, uc_local_lb, "uc_local_lb", "0: Local unicast loopback enabled 1: Disabled") #define MLX5E_PARAMS_NUM (0 MLX5E_PARAMS(MLX5E_STATS_COUNT)) Modified: stable/12/sys/dev/mlx5/mlx5_en/en_rl.h ============================================================================== --- stable/12/sys/dev/mlx5/mlx5_en/en_rl.h Thu May 16 16:32:22 2019 (r347772) +++ stable/12/sys/dev/mlx5/mlx5_en/en_rl.h Thu May 16 16:32:59 2019 (r347773) @@ -59,42 +59,42 @@ #define MLX5E_RL_WUNLOCK(rl) sx_xunlock(&(rl)->rl_sxlock) #define MLX5E_RL_PARAMS(m) \ - m(+1, u64 tx_queue_size, "tx_queue_size", "Default send queue size") \ - m(+1, u64 tx_coalesce_usecs, "tx_coalesce_usecs", "Limit in usec for joining TX packets") \ - m(+1, u64 tx_coalesce_pkts, "tx_coalesce_pkts", "Maximum number of TX packets to join") \ - m(+1, u64 tx_coalesce_mode, "tx_coalesce_mode", "0: EQE mode 1: CQE mode") \ - m(+1, u64 tx_completion_fact, "tx_completion_fact", "1..MAX: Completion event ratio") \ - m(+1, u64 tx_completion_fact_max, "tx_completion_fact_max", "Maximum completion event ratio") \ - m(+1, u64 tx_worker_threads_max, "tx_worker_threads_max", "Max number of TX worker threads") \ - m(+1, u64 tx_worker_threads_def, "tx_worker_threads_def", "Default number of TX worker threads") \ - m(+1, u64 tx_channels_per_worker_max, "tx_channels_per_worker_max", "Max number of TX channels per worker") \ - m(+1, u64 tx_channels_per_worker_def, "tx_channels_per_worker_def", "Default number of TX channels per worker") \ - m(+1, u64 tx_rates_max, "tx_rates_max", "Max number of TX rates") \ - m(+1, u64 tx_rates_def, "tx_rates_def", "Default number of TX rates") \ - m(+1, u64 tx_limit_min, "tx_limit_min", "Minimum TX rate in bits/s") \ - m(+1, u64 tx_limit_max, "tx_limit_max", "Maximum TX rate in bits/s") \ - m(+1, u64 tx_burst_size, "tx_burst_size", "Current burst size in number of packets. A value of zero means use firmware default.") \ - m(+1, u64 tx_burst_size_max, "tx_burst_size_max", "Maximum burst size in number of packets") \ - m(+1, u64 tx_burst_size_min, "tx_burst_size_min", "Minimum burst size in number of packets") + m(+1, u64, tx_queue_size, "tx_queue_size", "Default send queue size") \ + m(+1, u64, tx_coalesce_usecs, "tx_coalesce_usecs", "Limit in usec for joining TX packets") \ + m(+1, u64, tx_coalesce_pkts, "tx_coalesce_pkts", "Maximum number of TX packets to join") \ + m(+1, u64, tx_coalesce_mode, "tx_coalesce_mode", "0: EQE mode 1: CQE mode") \ + m(+1, u64, tx_completion_fact, "tx_completion_fact", "1..MAX: Completion event ratio") \ + m(+1, u64, tx_completion_fact_max, "tx_completion_fact_max", "Maximum completion event ratio") \ + m(+1, u64, tx_worker_threads_max, "tx_worker_threads_max", "Max number of TX worker threads") \ + m(+1, u64, tx_worker_threads_def, "tx_worker_threads_def", "Default number of TX worker threads") \ + m(+1, u64, tx_channels_per_worker_max, "tx_channels_per_worker_max", "Max number of TX channels per worker") \ + m(+1, u64, tx_channels_per_worker_def, "tx_channels_per_worker_def", "Default number of TX channels per worker") \ + m(+1, u64, tx_rates_max, "tx_rates_max", "Max number of TX rates") \ + m(+1, u64, tx_rates_def, "tx_rates_def", "Default number of TX rates") \ + m(+1, u64, tx_limit_min, "tx_limit_min", "Minimum TX rate in bits/s") \ + m(+1, u64, tx_limit_max, "tx_limit_max", "Maximum TX rate in bits/s") \ + m(+1, u64, tx_burst_size, "tx_burst_size", "Current burst size in number of packets. A value of zero means use firmware default.") \ + m(+1, u64, tx_burst_size_max, "tx_burst_size_max", "Maximum burst size in number of packets") \ + m(+1, u64, tx_burst_size_min, "tx_burst_size_min", "Minimum burst size in number of packets") #define MLX5E_RL_PARAMS_NUM (0 MLX5E_RL_PARAMS(MLX5E_STATS_COUNT)) #define MLX5E_RL_STATS(m) \ - m(+1, u64 tx_allocate_resource_failure, "tx_allocate_resource_failure", "Number of times firmware resource allocation failed") \ - m(+1, u64 tx_add_new_rate_failure, "tx_add_new_rate_failure", "Number of times adding a new firmware rate failed") \ - m(+1, u64 tx_modify_rate_failure, "tx_modify_rate_failure", "Number of times modifying a firmware rate failed") \ - m(+1, u64 tx_active_connections, "tx_active_connections", "Number of active connections") \ - m(+1, u64 tx_open_queues, "tx_open_queues", "Number of open TX queues") \ - m(+1, u64 tx_available_resource_failure, "tx_available_resource_failure", "Number of times TX resources were not available") + m(+1, u64, tx_allocate_resource_failure, "tx_allocate_resource_failure", "Number of times firmware resource allocation failed") \ + m(+1, u64, tx_add_new_rate_failure, "tx_add_new_rate_failure", "Number of times adding a new firmware rate failed") \ + m(+1, u64, tx_modify_rate_failure, "tx_modify_rate_failure", "Number of times modifying a firmware rate failed") \ + m(+1, u64, tx_active_connections, "tx_active_connections", "Number of active connections") \ + m(+1, u64, tx_open_queues, "tx_open_queues", "Number of open TX queues") \ + m(+1, u64, tx_available_resource_failure, "tx_available_resource_failure", "Number of times TX resources were not available") #define MLX5E_RL_STATS_NUM (0 MLX5E_RL_STATS(MLX5E_STATS_COUNT)) #define MLX5E_RL_TABLE_PARAMS(m) \ - m(+1, u64 tx_limit_add, "tx_limit_add", "Add TX rate limit in bits/s to empty slot") \ - m(+1, u64 tx_limit_clr, "tx_limit_clr", "Clear all TX rates in table") \ - m(+1, u64 tx_allowed_deviation, "tx_allowed_deviation", "Relative rate deviation allowed in 1/1000") \ - m(+1, u64 tx_allowed_deviation_min, "tx_allowed_deviation_min", "Minimum allowed rate deviation in 1/1000") \ - m(+1, u64 tx_allowed_deviation_max, "tx_allowed_deviation_max", "Maximum allowed rate deviation in 1/1000") + m(+1, u64, tx_limit_add, "tx_limit_add", "Add TX rate limit in bits/s to empty slot") \ + m(+1, u64, tx_limit_clr, "tx_limit_clr", "Clear all TX rates in table") \ + m(+1, u64, tx_allowed_deviation, "tx_allowed_deviation", "Relative rate deviation allowed in 1/1000") \ + m(+1, u64, tx_allowed_deviation_min, "tx_allowed_deviation_min", "Minimum allowed rate deviation in 1/1000") \ + m(+1, u64, tx_allowed_deviation_max, "tx_allowed_deviation_max", "Maximum allowed rate deviation in 1/1000") #define MLX5E_RL_TABLE_PARAMS_NUM (0 MLX5E_RL_TABLE_PARAMS(MLX5E_STATS_COUNT)) From owner-svn-src-stable@freebsd.org Thu May 16 16:33:36 2019 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 42CB9159DDD3; Thu, 16 May 2019 16:33:36 +0000 (UTC) (envelope-from hselasky@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 D58998A6C2; Thu, 16 May 2019 16:33:35 +0000 (UTC) (envelope-from hselasky@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 AF7D923717; Thu, 16 May 2019 16:33:35 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x4GGXZh4076142; Thu, 16 May 2019 16:33:35 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x4GGXZfL076140; Thu, 16 May 2019 16:33:35 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201905161633.x4GGXZfL076140@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Thu, 16 May 2019 16:33:35 +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: r347774 - stable/12/sys/dev/mlx5/mlx5_en X-SVN-Group: stable-12 X-SVN-Commit-Author: hselasky X-SVN-Commit-Paths: stable/12/sys/dev/mlx5/mlx5_en X-SVN-Commit-Revision: 347774 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: D58998A6C2 X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.98 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.998,0]; NEURAL_HAM_SHORT(-0.98)[-0.980,0]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US] X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 16 May 2019 16:33:36 -0000 Author: hselasky Date: Thu May 16 16:33:35 2019 New Revision: 347774 URL: https://svnweb.freebsd.org/changeset/base/347774 Log: MFC r347309: Add support for extended PCIe counters in mlx5en(4). Sponsored by: Mellanox Technologies Modified: stable/12/sys/dev/mlx5/mlx5_en/en.h stable/12/sys/dev/mlx5/mlx5_en/mlx5_en_main.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/dev/mlx5/mlx5_en/en.h ============================================================================== --- stable/12/sys/dev/mlx5/mlx5_en/en.h Thu May 16 16:32:59 2019 (r347773) +++ stable/12/sys/dev/mlx5/mlx5_en/en.h Thu May 16 16:33:35 2019 (r347774) @@ -363,6 +363,151 @@ struct mlx5e_vport_stats { MLX5E_PPORT_PER_PRIO_STATS_SUB(MLX5E_PPORT_PER_PRIO_STATS_PREFIX,m,6) \ MLX5E_PPORT_PER_PRIO_STATS_SUB(MLX5E_PPORT_PER_PRIO_STATS_PREFIX,m,7) +#define MLX5E_PCIE_PERFORMANCE_COUNTERS_64(m) \ + m(+1, u64, life_time_counter_high, "life_time_counter", \ + "Life time counter.", pcie_perf_counters) \ + m(+1, u64, tx_overflow_buffer_pkt, "tx_overflow_buffer_pkt", \ + "The number of packets dropped due to lack of PCIe buffers " \ + "in receive path from NIC port toward the hosts.", \ + pcie_perf_counters) \ + m(+1, u64, tx_overflow_buffer_marked_pkt, \ + "tx_overflow_buffer_marked_pkt", \ + "The number of packets marked due to lack of PCIe buffers " \ + "in receive path from NIC port toward the hosts.", \ + pcie_perf_counters) + +#define MLX5E_PCIE_PERFORMANCE_COUNTERS_32(m) \ + m(+1, u64, rx_errors, "rx_errors", \ + "Number of transitions to recovery due to Framing " \ + "errors and CRC errors.", pcie_perf_counters) \ + m(+1, u64, tx_errors, "tx_errors", "Number of transitions " \ + "to recovery due to EIEOS and TS errors.", pcie_perf_counters) \ + m(+1, u64, l0_to_recovery_eieos, "l0_to_recovery_eieos", "Number of " \ + "transitions to recovery due to getting EIEOS.", pcie_perf_counters)\ + m(+1, u64, l0_to_recovery_ts, "l0_to_recovery_ts", "Number of " \ + "transitions to recovery due to getting TS.", pcie_perf_counters) \ + m(+1, u64, l0_to_recovery_framing, "l0_to_recovery_framing", "Number "\ + "of transitions to recovery due to identifying framing " \ + "errors at gen3/4.", pcie_perf_counters) \ + m(+1, u64, l0_to_recovery_retrain, "l0_to_recovery_retrain", \ + "Number of transitions to recovery due to link retrain request " \ + "from data link.", pcie_perf_counters) \ + m(+1, u64, crc_error_dllp, "crc_error_dllp", "Number of transitions " \ + "to recovery due to identifying CRC DLLP errors.", \ + pcie_perf_counters) \ + m(+1, u64, crc_error_tlp, "crc_error_tlp", "Number of transitions to "\ + "recovery due to identifying CRC TLP errors.", pcie_perf_counters) \ + m(+1, u64, outbound_stalled_reads, "outbound_stalled_reads", \ + "The percentage of time within the last second that the NIC had " \ + "outbound non-posted read requests but could not perform the " \ + "operation due to insufficient non-posted credits.", \ + pcie_perf_counters) \ + m(+1, u64, outbound_stalled_writes, "outbound_stalled_writes", \ + "The percentage of time within the last second that the NIC had " \ + "outbound posted writes requests but could not perform the " \ + "operation due to insufficient posted credits.", \ + pcie_perf_counters) \ + m(+1, u64, outbound_stalled_reads_events, \ + "outbound_stalled_reads_events", "The number of events where " \ + "outbound_stalled_reads was above a threshold.", \ + pcie_perf_counters) \ + m(+1, u64, outbound_stalled_writes_events, \ + "outbound_stalled_writes_events", \ + "The number of events where outbound_stalled_writes was above " \ + "a threshold.", pcie_perf_counters) + +#define MLX5E_PCIE_TIMERS_AND_STATES_COUNTERS_32(m) \ + m(+1, u64, time_to_boot_image_start, "time_to_boot_image_start", \ + "Time from start until FW boot image starts running in usec.", \ + pcie_timers_states) \ + m(+1, u64, time_to_link_image, "time_to_link_image", \ + "Time from start until FW pci_link image starts running in usec.", \ + pcie_timers_states) \ + m(+1, u64, calibration_time, "calibration_time", \ + "Time it took FW to do calibration in usec.", \ + pcie_timers_states) \ + m(+1, u64, time_to_first_perst, "time_to_first_perst", \ + "Time form start until FW handle first perst. in usec.", \ + pcie_timers_states) \ + m(+1, u64, time_to_detect_state, "time_to_detect_state", \ + "Time from start until first transition to LTSSM.Detect_Q in usec", \ + pcie_timers_states) \ + m(+1, u64, time_to_l0, "time_to_l0", \ + "Time from start until first transition to LTSSM.L0 in usec", \ + pcie_timers_states) \ + m(+1, u64, time_to_crs_en, "time_to_crs_en", \ + "Time from start until crs is enabled in usec", \ + pcie_timers_states) \ + m(+1, u64, time_to_plastic_image_start, "time_to_plastic_image_start",\ + "Time form start until FW plastic image starts running in usec.", \ + pcie_timers_states) \ + m(+1, u64, time_to_iron_image_start, "time_to_iron_image_start", \ + "Time form start until FW iron image starts running in usec.", \ + pcie_timers_states) \ + m(+1, u64, perst_handler, "perst_handler", \ + "Number of persts arrived.", pcie_timers_states) \ + m(+1, u64, times_in_l1, "times_in_l1", \ + "Number of times LTSSM entered L1 flow.", pcie_timers_states) \ + m(+1, u64, times_in_l23, "times_in_l23", \ + "Number of times LTSSM entered L23 flow.", pcie_timers_states) \ + m(+1, u64, dl_down, "dl_down", \ + "Number of moves for DL_active to DL_down.", pcie_timers_states) \ + m(+1, u64, config_cycle1usec, "config_cycle1usec", \ + "Number of configuration requests that firmware " \ + "handled in less than 1 usec.", pcie_timers_states) \ + m(+1, u64, config_cycle2to7usec, "config_cycle2to7usec", \ + "Number of configuration requests that firmware " \ + "handled within 2 to 7 usec.", pcie_timers_states) \ + m(+1, u64, config_cycle8to15usec, "config_cycle8to15usec", \ + "Number of configuration requests that firmware " \ + "handled within 8 to 15 usec.", pcie_timers_states) \ + m(+1, u64, config_cycle16to63usec, "config_cycle16to63usec", \ + "Number of configuration requests that firmware " \ + "handled within 16 to 63 usec.", pcie_timers_states) \ + m(+1, u64, config_cycle64usec, "config_cycle64usec", \ + "Number of configuration requests that firmware " \ + "handled took more than 64 usec.", pcie_timers_states) \ + m(+1, u64, correctable_err_msg_sent, "correctable_err_msg_sent", \ + "Number of correctable error messages sent.", pcie_timers_states) \ + m(+1, u64, non_fatal_err_msg_sent, "non_fatal_err_msg_sent", \ + "Number of non-Fatal error msg sent.", pcie_timers_states) \ + m(+1, u64, fatal_err_msg_sent, "fatal_err_msg_sent", \ + "Number of fatal error msg sent.", pcie_timers_states) + +#define MLX5E_PCIE_LANE_COUNTERS_32(m) \ + m(+1, u64, error_counter_lane0, "error_counter_lane0", \ + "Error counter for PCI lane 0", pcie_lanes_counters) \ + m(+1, u64, error_counter_lane1, "error_counter_lane1", \ + "Error counter for PCI lane 1", pcie_lanes_counters) \ + m(+1, u64, error_counter_lane2, "error_counter_lane2", \ + "Error counter for PCI lane 2", pcie_lanes_counters) \ + m(+1, u64, error_counter_lane3, "error_counter_lane3", \ + "Error counter for PCI lane 3", pcie_lanes_counters) \ + m(+1, u64, error_counter_lane4, "error_counter_lane4", \ + "Error counter for PCI lane 4", pcie_lanes_counters) \ + m(+1, u64, error_counter_lane5, "error_counter_lane5", \ + "Error counter for PCI lane 5", pcie_lanes_counters) \ + m(+1, u64, error_counter_lane6, "error_counter_lane6", \ + "Error counter for PCI lane 6", pcie_lanes_counters) \ + m(+1, u64, error_counter_lane7, "error_counter_lane7", \ + "Error counter for PCI lane 7", pcie_lanes_counters) \ + m(+1, u64, error_counter_lane8, "error_counter_lane8", \ + "Error counter for PCI lane 8", pcie_lanes_counters) \ + m(+1, u64, error_counter_lane9, "error_counter_lane9", \ + "Error counter for PCI lane 9", pcie_lanes_counters) \ + m(+1, u64, error_counter_lane10, "error_counter_lane10", \ + "Error counter for PCI lane 10", pcie_lanes_counters) \ + m(+1, u64, error_counter_lane11, "error_counter_lane11", \ + "Error counter for PCI lane 11", pcie_lanes_counters) \ + m(+1, u64, error_counter_lane12, "error_counter_lane12", \ + "Error counter for PCI lane 12", pcie_lanes_counters) \ + m(+1, u64, error_counter_lane13, "error_counter_lane13", \ + "Error counter for PCI lane 13", pcie_lanes_counters) \ + m(+1, u64, error_counter_lane14, "error_counter_lane14", \ + "Error counter for PCI lane 14", pcie_lanes_counters) \ + m(+1, u64, error_counter_lane15, "error_counter_lane15", \ + "Error counter for PCI lane 15", pcie_lanes_counters) + /* * Make sure to update mlx5e_update_pport_counters() * when adding a new MLX5E_PPORT_STATS block @@ -376,7 +521,11 @@ struct mlx5e_vport_stats { MLX5E_PPORT_RFC2819_STATS_DEBUG(m) \ MLX5E_PPORT_RFC2863_STATS_DEBUG(m) \ MLX5E_PPORT_PHYSICAL_LAYER_STATS_DEBUG(m) \ - MLX5E_PPORT_ETHERNET_EXTENDED_STATS_DEBUG(m) + MLX5E_PPORT_ETHERNET_EXTENDED_STATS_DEBUG(m) \ + MLX5E_PCIE_PERFORMANCE_COUNTERS_64(m) \ + MLX5E_PCIE_PERFORMANCE_COUNTERS_32(m) \ + MLX5E_PCIE_TIMERS_AND_STATES_COUNTERS_32(m) \ + MLX5E_PCIE_LANE_COUNTERS_32(m) #define MLX5E_PPORT_IEEE802_3_STATS_NUM \ (0 MLX5E_PPORT_IEEE802_3_STATS(MLX5E_STATS_COUNT)) Modified: stable/12/sys/dev/mlx5/mlx5_en/mlx5_en_main.c ============================================================================== --- stable/12/sys/dev/mlx5/mlx5_en/mlx5_en_main.c Thu May 16 16:32:59 2019 (r347773) +++ stable/12/sys/dev/mlx5/mlx5_en/mlx5_en_main.c Thu May 16 16:33:35 2019 (r347774) @@ -650,6 +650,56 @@ mlx5e_update_carrier_work(struct work_struct *work) PRIV_UNLOCK(priv); } +#define MLX5E_PCIE_PERF_GET_64(a,b,c,d,e,f) \ + s_debug->c = MLX5_GET64(mpcnt_reg, out, counter_set.f.c); + +#define MLX5E_PCIE_PERF_GET_32(a,b,c,d,e,f) \ + s_debug->c = MLX5_GET(mpcnt_reg, out, counter_set.f.c); + +static void +mlx5e_update_pcie_counters(struct mlx5e_priv *priv) +{ + struct mlx5_core_dev *mdev = priv->mdev; + struct mlx5e_port_stats_debug *s_debug = &priv->stats.port_stats_debug; + const unsigned sz = MLX5_ST_SZ_BYTES(mpcnt_reg); + void *out; + void *in; + int err; + + /* allocate firmware request structures */ + in = mlx5_vzalloc(sz); + out = mlx5_vzalloc(sz); + if (in == NULL || out == NULL) + goto free_out; + + MLX5_SET(mpcnt_reg, in, grp, MLX5_PCIE_PERFORMANCE_COUNTERS_GROUP); + err = mlx5_core_access_reg(mdev, in, sz, out, sz, MLX5_REG_MPCNT, 0, 0); + if (err != 0) + goto free_out; + + MLX5E_PCIE_PERFORMANCE_COUNTERS_64(MLX5E_PCIE_PERF_GET_64) + MLX5E_PCIE_PERFORMANCE_COUNTERS_32(MLX5E_PCIE_PERF_GET_32) + + MLX5_SET(mpcnt_reg, in, grp, MLX5_PCIE_TIMERS_AND_STATES_COUNTERS_GROUP); + err = mlx5_core_access_reg(mdev, in, sz, out, sz, MLX5_REG_MPCNT, 0, 0); + if (err != 0) + goto free_out; + + MLX5E_PCIE_TIMERS_AND_STATES_COUNTERS_32(MLX5E_PCIE_PERF_GET_32) + + MLX5_SET(mpcnt_reg, in, grp, MLX5_PCIE_LANE_COUNTERS_GROUP); + err = mlx5_core_access_reg(mdev, in, sz, out, sz, MLX5_REG_MPCNT, 0, 0); + if (err != 0) + goto free_out; + + MLX5E_PCIE_LANE_COUNTERS_32(MLX5E_PCIE_PERF_GET_32) + +free_out: + /* free firmware request structures */ + kvfree(in); + kvfree(out); +} + /* * This function reads the physical port counters from the firmware * using a pre-defined layout defined by various MLX5E_PPORT_XXX() @@ -696,6 +746,7 @@ mlx5e_update_pport_counters(struct mlx5e_priv *priv) mlx5_core_access_reg(mdev, in, sz, out, sz, MLX5_REG_PPCNT, 0, 0); for (x = 0; x != MLX5E_PPORT_RFC2819_STATS_NUM; x++, y++) s->arg[y] = be64toh(ptr[x]); + for (y = 0; x != MLX5E_PPORT_RFC2819_STATS_NUM + MLX5E_PPORT_RFC2819_STATS_DEBUG_NUM; x++, y++) s_debug->arg[y] = be64toh(ptr[x]); @@ -717,6 +768,9 @@ mlx5e_update_pport_counters(struct mlx5e_priv *priv) mlx5_core_access_reg(mdev, in, sz, out, sz, MLX5_REG_PPCNT, 0, 0); for (x = 0; x != MLX5E_PPORT_ETHERNET_EXTENDED_STATS_DEBUG_NUM; x++, y++) s_debug->arg[y] = be64toh(ptr[x]); + + /* read PCIE counters */ + mlx5e_update_pcie_counters(priv); /* read per-priority counters */ MLX5_SET(ppcnt_reg, in, grp, MLX5_PER_PRIORITY_COUNTERS_GROUP); From owner-svn-src-stable@freebsd.org Thu May 16 16:34:13 2019 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 1DC04159DE66; Thu, 16 May 2019 16:34:13 +0000 (UTC) (envelope-from hselasky@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 B61BC8A80C; Thu, 16 May 2019 16:34:12 +0000 (UTC) (envelope-from hselasky@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 8FEC423718; Thu, 16 May 2019 16:34:12 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x4GGYCur076231; Thu, 16 May 2019 16:34:12 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x4GGYCFn076229; Thu, 16 May 2019 16:34:12 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201905161634.x4GGYCFn076229@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Thu, 16 May 2019 16:34:12 +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: r347775 - stable/12/sys/dev/mlx5/mlx5_en X-SVN-Group: stable-12 X-SVN-Commit-Author: hselasky X-SVN-Commit-Paths: stable/12/sys/dev/mlx5/mlx5_en X-SVN-Commit-Revision: 347775 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: B61BC8A80C X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.98 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.998,0]; NEURAL_HAM_SHORT(-0.98)[-0.979,0]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US] X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 16 May 2019 16:34:13 -0000 Author: hselasky Date: Thu May 16 16:34:11 2019 New Revision: 347775 URL: https://svnweb.freebsd.org/changeset/base/347775 Log: MFC r347310: Expose per-lane counters before correction mechanism in mlx5en(4). Sponsored by: Mellanox Technologies Modified: stable/12/sys/dev/mlx5/mlx5_en/en.h stable/12/sys/dev/mlx5/mlx5_en/mlx5_en_main.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/dev/mlx5/mlx5_en/en.h ============================================================================== --- stable/12/sys/dev/mlx5/mlx5_en/en.h Thu May 16 16:33:35 2019 (r347774) +++ stable/12/sys/dev/mlx5/mlx5_en/en.h Thu May 16 16:34:11 2019 (r347775) @@ -280,6 +280,24 @@ struct mlx5e_vport_stats { m(+1, u64, tx_stat_p4096to8191octets, "tx_stat_p4096to8191octets", "Bytes") \ m(+1, u64, tx_stat_p8192to10239octets, "tx_stat_p8192to10239octets", "Bytes") +#define MLX5E_PPORT_STATISTICAL_DEBUG(m) \ + m(+1, u64, phy_time_since_last_clear, "phy_time_since_last_clear", \ + "Time since last clear in milliseconds") \ + m(+1, u64, phy_received_bits, "phy_received_bits", \ + "Total amount of traffic received in bits before error correction") \ + m(+1, u64, phy_symbol_errors, "phy_symbol_errors", \ + "Total number of symbol errors before error correction") \ + m(+1, u64, phy_corrected_bits, "phy_corrected_bits", \ + "Total number of corrected bits ") \ + m(+1, u64, phy_corrected_bits_lane0, "phy_corrected_bits_lane0", \ + "Total number of corrected bits for lane 0") \ + m(+1, u64, phy_corrected_bits_lane1, "phy_corrected_bits_lane1", \ + "Total number of corrected bits for lane 1") \ + m(+1, u64, phy_corrected_bits_lane2, "phy_corrected_bits_lane2", \ + "Total number of corrected bits for lane 2") \ + m(+1, u64, phy_corrected_bits_lane3, "phy_corrected_bits_lane3", \ + "Total number of corrected bits for lane 3") + #define MLX5E_PPORT_PHYSICAL_LAYER_STATS_DEBUG(m) \ m(+1, u64, time_since_last_clear, "time_since_last_clear", \ "Time since the last counters clear event (msec)") \ @@ -522,6 +540,7 @@ struct mlx5e_vport_stats { MLX5E_PPORT_RFC2863_STATS_DEBUG(m) \ MLX5E_PPORT_PHYSICAL_LAYER_STATS_DEBUG(m) \ MLX5E_PPORT_ETHERNET_EXTENDED_STATS_DEBUG(m) \ + MLX5E_PPORT_STATISTICAL_DEBUG(m) \ MLX5E_PCIE_PERFORMANCE_COUNTERS_64(m) \ MLX5E_PCIE_PERFORMANCE_COUNTERS_32(m) \ MLX5E_PCIE_TIMERS_AND_STATES_COUNTERS_32(m) \ @@ -544,6 +563,8 @@ struct mlx5e_vport_stats { (0 MLX5E_PPORT_PHYSICAL_LAYER_STATS_DEBUG(MLX5E_STATS_COUNT)) #define MLX5E_PPORT_ETHERNET_EXTENDED_STATS_DEBUG_NUM \ (0 MLX5E_PPORT_ETHERNET_EXTENDED_STATS_DEBUG(MLX5E_STATS_COUNT)) +#define MLX5E_PPORT_STATISTICAL_DEBUG_NUM \ + (0 MLX5E_PPORT_STATISTICAL_DEBUG(MLX5E_STATS_COUNT)) #define MLX5E_PORT_STATS_DEBUG_NUM \ (0 MLX5E_PORT_STATS_DEBUG(MLX5E_STATS_COUNT)) Modified: stable/12/sys/dev/mlx5/mlx5_en/mlx5_en_main.c ============================================================================== --- stable/12/sys/dev/mlx5/mlx5_en/mlx5_en_main.c Thu May 16 16:33:35 2019 (r347774) +++ stable/12/sys/dev/mlx5/mlx5_en/mlx5_en_main.c Thu May 16 16:34:11 2019 (r347775) @@ -769,6 +769,18 @@ mlx5e_update_pport_counters(struct mlx5e_priv *priv) for (x = 0; x != MLX5E_PPORT_ETHERNET_EXTENDED_STATS_DEBUG_NUM; x++, y++) s_debug->arg[y] = be64toh(ptr[x]); + /* read Extended Statistical Group */ + if (MLX5_CAP_GEN(mdev, pcam_reg) && + MLX5_CAP_PCAM_FEATURE(mdev, ppcnt_statistical_group) && + MLX5_CAP_PCAM_FEATURE(mdev, per_lane_error_counters)) { + /* read Extended Statistical counter group using predefined counter layout */ + MLX5_SET(ppcnt_reg, in, grp, MLX5_PHYSICAL_LAYER_STATISTICAL_GROUP); + mlx5_core_access_reg(mdev, in, sz, out, sz, MLX5_REG_PPCNT, 0, 0); + + for (x = 0; x != MLX5E_PPORT_STATISTICAL_DEBUG_NUM; x++, y++) + s_debug->arg[y] = be64toh(ptr[x]); + } + /* read PCIE counters */ mlx5e_update_pcie_counters(priv); From owner-svn-src-stable@freebsd.org Thu May 16 16:34:49 2019 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id B9D09159DEF5; Thu, 16 May 2019 16:34:49 +0000 (UTC) (envelope-from hselasky@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 5E1C08A945; Thu, 16 May 2019 16:34:49 +0000 (UTC) (envelope-from hselasky@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 38EA623719; Thu, 16 May 2019 16:34:49 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x4GGYnns076314; Thu, 16 May 2019 16:34:49 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x4GGYmI3076313; Thu, 16 May 2019 16:34:49 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201905161634.x4GGYmI3076313@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Thu, 16 May 2019 16:34:48 +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: r347776 - stable/12/contrib/ofed/libmlx5 X-SVN-Group: stable-12 X-SVN-Commit-Author: hselasky X-SVN-Commit-Paths: stable/12/contrib/ofed/libmlx5 X-SVN-Commit-Revision: 347776 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 5E1C08A945 X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.98 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.998,0]; NEURAL_HAM_SHORT(-0.98)[-0.978,0]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US] X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 16 May 2019 16:34:49 -0000 Author: hselasky Date: Thu May 16 16:34:48 2019 New Revision: 347776 URL: https://svnweb.freebsd.org/changeset/base/347776 Log: MFC r347311: Add ConnectX-6 DX HCA ID to libmlx5. In addition, add "ConnectX family mlx5Gen Virtual Function" device ID. Every new HCA VF will be identified with this device ID. Submitted by: slavash@ Sponsored by: Mellanox Technologies Modified: stable/12/contrib/ofed/libmlx5/mlx5.c Directory Properties: stable/12/ (props changed) Modified: stable/12/contrib/ofed/libmlx5/mlx5.c ============================================================================== --- stable/12/contrib/ofed/libmlx5/mlx5.c Thu May 16 16:34:11 2019 (r347775) +++ stable/12/contrib/ofed/libmlx5/mlx5.c Thu May 16 16:34:48 2019 (r347776) @@ -79,6 +79,8 @@ static struct { HCA(MELLANOX, 4122), /* ConnectX-5 Ex VF */ HCA(MELLANOX, 4123), /* ConnectX-6 */ HCA(MELLANOX, 4124), /* ConnectX-6 VF */ + HCA(MELLANOX, 4125), /* ConnectX-6 DX */ + HCA(MELLANOX, 4126), /* ConnectX family mlx5Gen Virtual Function */ HCA(MELLANOX, 41682), /* BlueField integrated ConnectX-5 network controller */ HCA(MELLANOX, 41683), /* BlueField integrated ConnectX-5 network controller VF */ }; From owner-svn-src-stable@freebsd.org Thu May 16 16:35:29 2019 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 182B0159DFB1; Thu, 16 May 2019 16:35:29 +0000 (UTC) (envelope-from hselasky@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 B2BB28AAAB; Thu, 16 May 2019 16:35:28 +0000 (UTC) (envelope-from hselasky@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 742362371D; Thu, 16 May 2019 16:35:28 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x4GGZSF4076417; Thu, 16 May 2019 16:35:28 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x4GGZRpg076410; Thu, 16 May 2019 16:35:27 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201905161635.x4GGZRpg076410@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Thu, 16 May 2019 16:35:27 +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: r347777 - in stable/12/sys/dev/mlx5: . mlx5_core X-SVN-Group: stable-12 X-SVN-Commit-Author: hselasky X-SVN-Commit-Paths: in stable/12/sys/dev/mlx5: . mlx5_core X-SVN-Commit-Revision: 347777 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: B2BB28AAAB X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.98 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.998,0]; NEURAL_HAM_SHORT(-0.98)[-0.979,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US]; NEURAL_HAM_LONG(-1.00)[-1.000,0] X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 16 May 2019 16:35:29 -0000 Author: hselasky Date: Thu May 16 16:35:27 2019 New Revision: 347777 URL: https://svnweb.freebsd.org/changeset/base/347777 Log: MFC r347312: Add Firmware Reset Level, MFRL, register accessors in mlx5core. Submitted by: kib@ Sponsored by: Mellanox Technologies Modified: stable/12/sys/dev/mlx5/device.h stable/12/sys/dev/mlx5/driver.h stable/12/sys/dev/mlx5/mlx5_core/mlx5_core.h stable/12/sys/dev/mlx5/mlx5_core/mlx5_port.c stable/12/sys/dev/mlx5/mlx5_ifc.h Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/dev/mlx5/device.h ============================================================================== --- stable/12/sys/dev/mlx5/device.h Thu May 16 16:34:48 2019 (r347776) +++ stable/12/sys/dev/mlx5/device.h Thu May 16 16:35:27 2019 (r347777) @@ -1218,6 +1218,11 @@ enum { MLX5_GEN_EVENT_SUBTYPE_PCI_POWER_CHANGE_EVENT = 0x5, }; +enum { + MLX5_FRL_LEVEL3 = 0x8, + MLX5_FRL_LEVEL6 = 0x40, +}; + /* 8 regular priorities + 1 for multicast */ #define MLX5_NUM_BYPASS_FTS 9 Modified: stable/12/sys/dev/mlx5/driver.h ============================================================================== --- stable/12/sys/dev/mlx5/driver.h Thu May 16 16:34:48 2019 (r347776) +++ stable/12/sys/dev/mlx5/driver.h Thu May 16 16:35:27 2019 (r347777) @@ -154,6 +154,7 @@ enum { MLX5_REG_HOST_ENDIANNESS = 0x7004, MLX5_REG_MTMP = 0x900a, MLX5_REG_MCIA = 0x9014, + MLX5_REG_MFRL = 0x9028, MLX5_REG_MPCNT = 0x9051, MLX5_REG_MCQI = 0x9061, MLX5_REG_MCC = 0x9062, Modified: stable/12/sys/dev/mlx5/mlx5_core/mlx5_core.h ============================================================================== --- stable/12/sys/dev/mlx5/mlx5_core/mlx5_core.h Thu May 16 16:34:48 2019 (r347776) +++ stable/12/sys/dev/mlx5/mlx5_core/mlx5_core.h Thu May 16 16:35:27 2019 (r347777) @@ -82,6 +82,8 @@ int mlx5_query_pcam_reg(struct mlx5_core_dev *dev, u32 u8 feature_group, u8 access_reg_group); int mlx5_query_mcam_reg(struct mlx5_core_dev *dev, u32 *mcap, u8 feature_group, u8 access_reg_group); +int mlx5_query_mfrl_reg(struct mlx5_core_dev *mdev, u8 *reset_level); +int mlx5_set_mfrl_reg(struct mlx5_core_dev *mdev, u8 reset_level); int mlx5_cmd_init_hca(struct mlx5_core_dev *dev); int mlx5_cmd_teardown_hca(struct mlx5_core_dev *dev); int mlx5_cmd_force_teardown_hca(struct mlx5_core_dev *dev); Modified: stable/12/sys/dev/mlx5/mlx5_core/mlx5_port.c ============================================================================== --- stable/12/sys/dev/mlx5/mlx5_core/mlx5_port.c Thu May 16 16:34:48 2019 (r347776) +++ stable/12/sys/dev/mlx5/mlx5_core/mlx5_port.c Thu May 16 16:35:27 2019 (r347777) @@ -1210,3 +1210,29 @@ int mlx5_query_pddr_range_info(struct mlx5_core_dev *m return (0); } EXPORT_SYMBOL_GPL(mlx5_query_pddr_range_info); + +int +mlx5_query_mfrl_reg(struct mlx5_core_dev *mdev, u8 *reset_level) +{ + u32 mfrl[MLX5_ST_SZ_DW(mfrl_reg)] = {}; + int sz = MLX5_ST_SZ_BYTES(mfrl_reg); + int err; + + err = mlx5_core_access_reg(mdev, mfrl, sz, mfrl, sz, MLX5_REG_MFRL, + 0, 0); + if (err == 0) + *reset_level = MLX5_GET(mfrl_reg, mfrl, reset_level); + return (err); +} + +int +mlx5_set_mfrl_reg(struct mlx5_core_dev *mdev, u8 reset_level) +{ + u32 mfrl[MLX5_ST_SZ_DW(mfrl_reg)] = {}; + int sz = MLX5_ST_SZ_BYTES(mfrl_reg); + + MLX5_SET(mfrl_reg, mfrl, reset_level, reset_level); + + return (mlx5_core_access_reg(mdev, mfrl, sz, mfrl, sz, MLX5_REG_MFRL, + 0, 1)); +} Modified: stable/12/sys/dev/mlx5/mlx5_ifc.h ============================================================================== --- stable/12/sys/dev/mlx5/mlx5_ifc.h Thu May 16 16:34:48 2019 (r347776) +++ stable/12/sys/dev/mlx5/mlx5_ifc.h Thu May 16 16:35:27 2019 (r347777) @@ -10409,4 +10409,9 @@ struct mlx5_ifc_qpts_reg_bits { u8 trust_state[0x3]; }; +struct mlx5_ifc_mfrl_reg_bits { + u8 reserved_at_0[0x38]; + u8 reset_level[0x8]; +}; + #endif /* MLX5_IFC_H */ From owner-svn-src-stable@freebsd.org Thu May 16 16:36:12 2019 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 2B0E5159E05A; Thu, 16 May 2019 16:36:12 +0000 (UTC) (envelope-from hselasky@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 C494F8ABEF; Thu, 16 May 2019 16:36:11 +0000 (UTC) (envelope-from hselasky@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 94CBD2371E; Thu, 16 May 2019 16:36:11 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x4GGaB9F076511; Thu, 16 May 2019 16:36:11 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x4GGaALe076506; Thu, 16 May 2019 16:36:10 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201905161636.x4GGaALe076506@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Thu, 16 May 2019 16:36:10 +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: r347778 - in stable/12: share/man/man4 sys/dev/mlx5 sys/dev/mlx5/mlx5_core usr.sbin/mlx5tool X-SVN-Group: stable-12 X-SVN-Commit-Author: hselasky X-SVN-Commit-Paths: in stable/12: share/man/man4 sys/dev/mlx5 sys/dev/mlx5/mlx5_core usr.sbin/mlx5tool X-SVN-Commit-Revision: 347778 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: C494F8ABEF X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.98 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.998,0]; NEURAL_HAM_SHORT(-0.98)[-0.979,0]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US] X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 16 May 2019 16:36:12 -0000 Author: hselasky Date: Thu May 16 16:36:10 2019 New Revision: 347778 URL: https://svnweb.freebsd.org/changeset/base/347778 Log: MFC r347313: Implement firmware reset from userspace in mlx5tool(8). Submitted by: kib@ Sponsored by: Mellanox Technologies Modified: stable/12/share/man/man4/mlx5io.4 stable/12/sys/dev/mlx5/mlx5_core/mlx5_fwdump.c stable/12/sys/dev/mlx5/mlx5io.h stable/12/usr.sbin/mlx5tool/mlx5tool.8 stable/12/usr.sbin/mlx5tool/mlx5tool.c Directory Properties: stable/12/ (props changed) Modified: stable/12/share/man/man4/mlx5io.4 ============================================================================== --- stable/12/share/man/man4/mlx5io.4 Thu May 16 16:35:27 2019 (r347777) +++ stable/12/share/man/man4/mlx5io.4 Thu May 16 16:36:10 2019 (r347778) @@ -142,6 +142,11 @@ Image address in memory is passed in the length of the image is specified in .Dv img_fw_data_len field. +.It Dv MLX5_FW_RESET +Requests PCIe link-level reset on the device. +The address of the device is specified by the +.Vt struct mlx5_tool_addr +structure, which should be passed as an argument. .El .Sh FILES The Modified: stable/12/sys/dev/mlx5/mlx5_core/mlx5_fwdump.c ============================================================================== --- stable/12/sys/dev/mlx5/mlx5_core/mlx5_fwdump.c Thu May 16 16:35:27 2019 (r347777) +++ stable/12/sys/dev/mlx5/mlx5_core/mlx5_fwdump.c Thu May 16 16:36:10 2019 (r347778) @@ -226,6 +226,24 @@ out: } static int +mlx5_fw_reset(struct mlx5_core_dev *mdev) +{ + device_t dev, bus; + int error; + + error = -mlx5_set_mfrl_reg(mdev, MLX5_FRL_LEVEL3); + if (error == 0) { + dev = mdev->pdev->dev.bsddev; + mtx_lock(&Giant); + bus = device_get_parent(dev); + error = BUS_RESET_CHILD(device_get_parent(bus), bus, + DEVF_RESET_DETACH); + mtx_unlock(&Giant); + } + return (error); +} + +static int mlx5_fwdump_ioctl(struct cdev *dev, u_long cmd, caddr_t data, int fflag, struct thread *td) { @@ -306,6 +324,17 @@ mlx5_fwdump_ioctl(struct cdev *dev, u_long cmd, caddr_ if (error == 0) error = -mlx5_firmware_flash(mdev, &fake_fw); kmem_free((vm_offset_t)fake_fw.data, fu->img_fw_data_len); + break; + case MLX5_FW_RESET: + if ((fflag & FWRITE) == 0) { + error = EBADF; + break; + } + devaddr = (struct mlx5_tool_addr *)data; + error = mlx5_dbsf_to_core(devaddr, &mdev); + if (error != 0) + break; + error = mlx5_fw_reset(mdev); break; default: error = ENOTTY; Modified: stable/12/sys/dev/mlx5/mlx5io.h ============================================================================== --- stable/12/sys/dev/mlx5/mlx5io.h Thu May 16 16:35:27 2019 (r347777) +++ stable/12/sys/dev/mlx5/mlx5io.h Thu May 16 16:36:10 2019 (r347778) @@ -59,6 +59,7 @@ struct mlx5_fw_update { #define MLX5_FWDUMP_RESET _IOW('m', 2, struct mlx5_tool_addr) #define MLX5_FWDUMP_FORCE _IOW('m', 3, struct mlx5_tool_addr) #define MLX5_FW_UPDATE _IOW('m', 4, struct mlx5_fw_update) +#define MLX5_FW_RESET _IOW('m', 5, struct mlx5_tool_addr) #ifndef _KERNEL #define MLX5_DEV_PATH _PATH_DEV"mlx5ctl" Modified: stable/12/usr.sbin/mlx5tool/mlx5tool.8 ============================================================================== --- stable/12/usr.sbin/mlx5tool/mlx5tool.8 Thu May 16 16:35:27 2019 (r347777) +++ stable/12/usr.sbin/mlx5tool/mlx5tool.8 Thu May 16 16:36:10 2019 (r347778) @@ -45,6 +45,9 @@ .Nm .Fl d Ar domain:bus:slot:func .Fl f Ar file.mfa2 +.Nm +.Fl d Ar domain:bus:slot:func +.Fl z .Sh DESCRIPTION The .Nm @@ -91,6 +94,14 @@ Flashes the firmware image to the specified adapter. Image must be in MFA2 pack format and contain a component suitable for the adapter hardware. +.Pp +Typically, PCIe link-level reset is required to activate the +newly flashed image, which can be performed by the system reboot +or using the +.Fl z +option. +.It Fl z +Performs PCIe link-level reset on the specified device. .El .Sh FILES The Modified: stable/12/usr.sbin/mlx5tool/mlx5tool.c ============================================================================== --- stable/12/usr.sbin/mlx5tool/mlx5tool.c Thu May 16 16:35:27 2019 (r347777) +++ stable/12/usr.sbin/mlx5tool/mlx5tool.c Thu May 16 16:36:10 2019 (r347778) @@ -189,17 +189,29 @@ close_fd: return (res); } +static int +mlx5tool_fw_reset(int ctldev, const struct mlx5_tool_addr *addr) +{ + + if (ioctl(ctldev, MLX5_FW_RESET, addr) == -1) { + warn("MLX5_FW_RESET"); + return (1); + } + return (0); +} + static void usage(void) { fprintf(stderr, "Usage: mlx5tool -d pci [-w -o dump.file | -r |" - " -e | -f fw.mfa2]\n"); + " -e | -f fw.mfa2 | -z]\n"); fprintf(stderr, "\t-w - write firmware dump to the specified file\n"); fprintf(stderr, "\t-r - reset dump\n"); fprintf(stderr, "\t-e - force dump\n"); fprintf(stderr, "\t-f fw.img - flash firmware from fw.img\n"); + fprintf(stderr, "\t-z - initiate firmware reset\n"); exit(1); } @@ -208,6 +220,7 @@ enum mlx5_action { ACTION_DUMP_RESET, ACTION_DUMP_FORCE, ACTION_FW_UPDATE, + ACTION_FW_RESET, ACTION_NONE, }; @@ -225,7 +238,7 @@ main(int argc, char *argv[]) addrstr = NULL; dumpname = NULL; img_fw_path = NULL; - while ((c = getopt(argc, argv, "d:ef:ho:rw")) != -1) { + while ((c = getopt(argc, argv, "d:ef:ho:rwz")) != -1) { switch (c) { case 'd': addrstr = optarg; @@ -246,6 +259,9 @@ main(int argc, char *argv[]) act = ACTION_FW_UPDATE; img_fw_path = optarg; break; + case 'z': + act = ACTION_FW_RESET; + break; case 'h': default: usage(); @@ -273,6 +289,9 @@ main(int argc, char *argv[]) break; case ACTION_FW_UPDATE: res = mlx5tool_fw_update(ctldev, &addr, img_fw_path); + break; + case ACTION_FW_RESET: + res = mlx5tool_fw_reset(ctldev, &addr); break; default: res = 0; From owner-svn-src-stable@freebsd.org Thu May 16 16:37:01 2019 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id BA219159E0F7; Thu, 16 May 2019 16:37:01 +0000 (UTC) (envelope-from hselasky@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 0A37C8AD3F; Thu, 16 May 2019 16:37:01 +0000 (UTC) (envelope-from hselasky@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 CC5082371F; Thu, 16 May 2019 16:37:00 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x4GGb0U3076604; Thu, 16 May 2019 16:37:00 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x4GGb0tW076603; Thu, 16 May 2019 16:37:00 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201905161637.x4GGb0tW076603@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Thu, 16 May 2019 16:37:00 +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: r347779 - stable/12/usr.sbin/mlx5tool X-SVN-Group: stable-12 X-SVN-Commit-Author: hselasky X-SVN-Commit-Paths: stable/12/usr.sbin/mlx5tool X-SVN-Commit-Revision: 347779 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 0A37C8AD3F X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.98 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.998,0]; NEURAL_HAM_SHORT(-0.98)[-0.978,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US]; NEURAL_HAM_LONG(-1.00)[-1.000,0] X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 16 May 2019 16:37:01 -0000 Author: hselasky Date: Thu May 16 16:37:00 2019 New Revision: 347779 URL: https://svnweb.freebsd.org/changeset/base/347779 Log: MFC r347314: Ensure that only one command is specified at a time in mlx5tool(8). Submitted by: kib@ Sponsored by: Mellanox Technologies Modified: stable/12/usr.sbin/mlx5tool/mlx5tool.c Directory Properties: stable/12/ (props changed) Modified: stable/12/usr.sbin/mlx5tool/mlx5tool.c ============================================================================== --- stable/12/usr.sbin/mlx5tool/mlx5tool.c Thu May 16 16:36:10 2019 (r347778) +++ stable/12/usr.sbin/mlx5tool/mlx5tool.c Thu May 16 16:37:00 2019 (r347779) @@ -244,22 +244,32 @@ main(int argc, char *argv[]) addrstr = optarg; break; case 'w': + if (act != ACTION_NONE) + usage(); act = ACTION_DUMP_GET; break; case 'e': + if (act != ACTION_NONE) + usage(); act = ACTION_DUMP_FORCE; break; case 'o': dumpname = optarg; break; case 'r': + if (act != ACTION_NONE) + usage(); act = ACTION_DUMP_RESET; break; case 'f': + if (act != ACTION_NONE) + usage(); act = ACTION_FW_UPDATE; img_fw_path = optarg; break; case 'z': + if (act != ACTION_NONE) + usage(); act = ACTION_FW_RESET; break; case 'h': From owner-svn-src-stable@freebsd.org Thu May 16 16:37:38 2019 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id D698B159E16E; Thu, 16 May 2019 16:37:37 +0000 (UTC) (envelope-from hselasky@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 7D06C8AE73; Thu, 16 May 2019 16:37:37 +0000 (UTC) (envelope-from hselasky@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 5620723720; Thu, 16 May 2019 16:37:37 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x4GGbbMq076690; Thu, 16 May 2019 16:37:37 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x4GGba5K076685; Thu, 16 May 2019 16:37:36 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201905161637.x4GGba5K076685@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Thu, 16 May 2019 16:37:36 +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: r347780 - stable/12/sys/dev/mlx5/mlx5_core X-SVN-Group: stable-12 X-SVN-Commit-Author: hselasky X-SVN-Commit-Paths: stable/12/sys/dev/mlx5/mlx5_core X-SVN-Commit-Revision: 347780 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 7D06C8AE73 X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.98 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.998,0]; NEURAL_HAM_SHORT(-0.98)[-0.979,0]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US] X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 16 May 2019 16:37:38 -0000 Author: hselasky Date: Thu May 16 16:37:36 2019 New Revision: 347780 URL: https://svnweb.freebsd.org/changeset/base/347780 Log: MFC r347315: Rename functions from mlx5_fwdump to mlx5_ctl in mlx5core. Submitted by: kib@ Sponsored by: Mellanox Technologies Modified: stable/12/sys/dev/mlx5/mlx5_core/mlx5_core.h stable/12/sys/dev/mlx5/mlx5_core/mlx5_fwdump.c stable/12/sys/dev/mlx5/mlx5_core/mlx5_main.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/dev/mlx5/mlx5_core/mlx5_core.h ============================================================================== --- stable/12/sys/dev/mlx5/mlx5_core/mlx5_core.h Thu May 16 16:37:00 2019 (r347779) +++ stable/12/sys/dev/mlx5/mlx5_core/mlx5_core.h Thu May 16 16:37:36 2019 (r347780) @@ -104,8 +104,8 @@ void mlx5e_cleanup(void); int mlx5_rename_eq(struct mlx5_core_dev *dev, int eq_ix, char *name); -int mlx5_fwdump_init(void); -void mlx5_fwdump_fini(void); +int mlx5_ctl_init(void); +void mlx5_ctl_fini(void); void mlx5_fwdump_prep(struct mlx5_core_dev *mdev); void mlx5_fwdump(struct mlx5_core_dev *mdev); void mlx5_fwdump_clean(struct mlx5_core_dev *mdev); Modified: stable/12/sys/dev/mlx5/mlx5_core/mlx5_fwdump.c ============================================================================== --- stable/12/sys/dev/mlx5/mlx5_core/mlx5_fwdump.c Thu May 16 16:37:00 2019 (r347779) +++ stable/12/sys/dev/mlx5/mlx5_core/mlx5_fwdump.c Thu May 16 16:37:36 2019 (r347780) @@ -244,7 +244,7 @@ mlx5_fw_reset(struct mlx5_core_dev *mdev) } static int -mlx5_fwdump_ioctl(struct cdev *dev, u_long cmd, caddr_t data, int fflag, +mlx5_ctl_ioctl(struct cdev *dev, u_long cmd, caddr_t data, int fflag, struct thread *td) { struct mlx5_core_dev *mdev; @@ -343,34 +343,34 @@ mlx5_fwdump_ioctl(struct cdev *dev, u_long cmd, caddr_ return (error); } -static struct cdevsw mlx5_fwdump_devsw = { +static struct cdevsw mlx5_ctl_devsw = { .d_version = D_VERSION, - .d_ioctl = mlx5_fwdump_ioctl, + .d_ioctl = mlx5_ctl_ioctl, }; -static struct cdev *mlx5_fwdump_dev; +static struct cdev *mlx5_ctl_dev; int -mlx5_fwdump_init(void) +mlx5_ctl_init(void) { struct make_dev_args mda; int error; make_dev_args_init(&mda); mda.mda_flags = MAKEDEV_WAITOK | MAKEDEV_CHECKNAME; - mda.mda_devsw = &mlx5_fwdump_devsw; + mda.mda_devsw = &mlx5_ctl_devsw; mda.mda_uid = UID_ROOT; mda.mda_gid = GID_OPERATOR; mda.mda_mode = 0640; - error = make_dev_s(&mda, &mlx5_fwdump_dev, "mlx5ctl"); + error = make_dev_s(&mda, &mlx5_ctl_dev, "mlx5ctl"); return (-error); } void -mlx5_fwdump_fini(void) +mlx5_ctl_fini(void) { - if (mlx5_fwdump_dev != NULL) - destroy_dev(mlx5_fwdump_dev); + if (mlx5_ctl_dev != NULL) + destroy_dev(mlx5_ctl_dev); } Modified: stable/12/sys/dev/mlx5/mlx5_core/mlx5_main.c ============================================================================== --- stable/12/sys/dev/mlx5/mlx5_core/mlx5_main.c Thu May 16 16:37:00 2019 (r347779) +++ stable/12/sys/dev/mlx5/mlx5_core/mlx5_main.c Thu May 16 16:37:36 2019 (r347780) @@ -1608,13 +1608,13 @@ static int __init init(void) if (err) goto err_debug; - err = mlx5_fwdump_init(); + err = mlx5_ctl_init(); if (err) - goto err_fwdump; + goto err_ctl; return 0; -err_fwdump: +err_ctl: pci_unregister_driver(&mlx5_core_driver); err_debug: @@ -1623,7 +1623,7 @@ err_debug: static void __exit cleanup(void) { - mlx5_fwdump_fini(); + mlx5_ctl_fini(); pci_unregister_driver(&mlx5_core_driver); } From owner-svn-src-stable@freebsd.org Thu May 16 16:38:21 2019 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 55E04159E21A; Thu, 16 May 2019 16:38:21 +0000 (UTC) (envelope-from hselasky@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 ED1088AFDB; Thu, 16 May 2019 16:38:20 +0000 (UTC) (envelope-from hselasky@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 C78A323721; Thu, 16 May 2019 16:38:20 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x4GGcKkb076780; Thu, 16 May 2019 16:38:20 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x4GGcKIu076777; Thu, 16 May 2019 16:38:20 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201905161638.x4GGcKIu076777@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Thu, 16 May 2019 16:38:20 +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: r347781 - stable/12/sys/dev/mlx5/mlx5_en X-SVN-Group: stable-12 X-SVN-Commit-Author: hselasky X-SVN-Commit-Paths: stable/12/sys/dev/mlx5/mlx5_en X-SVN-Commit-Revision: 347781 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: ED1088AFDB X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.98 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.998,0]; NEURAL_HAM_SHORT(-0.98)[-0.978,0]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US] X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 16 May 2019 16:38:21 -0000 Author: hselasky Date: Thu May 16 16:38:19 2019 New Revision: 347781 URL: https://svnweb.freebsd.org/changeset/base/347781 Log: MFC r347316: Fix for compilation warning in mlx5en(4). Function 'mlx5e_alloc_rx_wqe' can never be inlined because it uses alloca (override using the always_inline attribute) Sponsored by: Mellanox Technologies Modified: stable/12/sys/dev/mlx5/mlx5_en/en.h stable/12/sys/dev/mlx5/mlx5_en/mlx5_en_main.c stable/12/sys/dev/mlx5/mlx5_en/mlx5_en_rx.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/dev/mlx5/mlx5_en/en.h ============================================================================== --- stable/12/sys/dev/mlx5/mlx5_en/en.h Thu May 16 16:37:36 2019 (r347780) +++ stable/12/sys/dev/mlx5/mlx5_en/en.h Thu May 16 16:38:19 2019 (r347781) @@ -86,6 +86,8 @@ #define MLX5E_PARAMS_DEFAULT_LOG_RQ_SIZE 0xa #define MLX5E_PARAMS_MAXIMUM_LOG_RQ_SIZE 0xe +#define MLX5E_MAX_BUSDMA_RX_SEGS 15 + #define MLX5E_MAX_RX_SEGS 7 #ifndef MLX5E_MAX_RX_BYTES Modified: stable/12/sys/dev/mlx5/mlx5_en/mlx5_en_main.c ============================================================================== --- stable/12/sys/dev/mlx5/mlx5_en/mlx5_en_main.c Thu May 16 16:37:36 2019 (r347780) +++ stable/12/sys/dev/mlx5/mlx5_en/mlx5_en_main.c Thu May 16 16:38:19 2019 (r347781) @@ -2243,6 +2243,9 @@ mlx5e_get_wqe_sz(struct mlx5e_priv *priv, u32 *wqe_sz, for (n = howmany(r, MLX5E_MAX_RX_BYTES); !powerof2(n + 1); n++) ; + if (n > MLX5E_MAX_BUSDMA_RX_SEGS) + return (-ENOMEM); + *wqe_sz = r; *nsegs = n; return (0); Modified: stable/12/sys/dev/mlx5/mlx5_en/mlx5_en_rx.c ============================================================================== --- stable/12/sys/dev/mlx5/mlx5_en/mlx5_en_rx.c Thu May 16 16:37:36 2019 (r347780) +++ stable/12/sys/dev/mlx5/mlx5_en/mlx5_en_rx.c Thu May 16 16:38:19 2019 (r347781) @@ -32,7 +32,7 @@ static inline int mlx5e_alloc_rx_wqe(struct mlx5e_rq *rq, struct mlx5e_rx_wqe *wqe, u16 ix) { - bus_dma_segment_t segs[rq->nsegs]; + bus_dma_segment_t segs[MLX5E_MAX_BUSDMA_RX_SEGS]; struct mbuf *mb; int nsegs; int err; From owner-svn-src-stable@freebsd.org Thu May 16 16:39:03 2019 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id A24C2159E2AE; Thu, 16 May 2019 16:39:03 +0000 (UTC) (envelope-from hselasky@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 47A348B151; Thu, 16 May 2019 16:39:03 +0000 (UTC) (envelope-from hselasky@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 23B7223722; Thu, 16 May 2019 16:39:03 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x4GGd36o076870; Thu, 16 May 2019 16:39:03 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x4GGd2aE076867; Thu, 16 May 2019 16:39:02 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201905161639.x4GGd2aE076867@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Thu, 16 May 2019 16:39:02 +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: r347782 - stable/12/sys/dev/mlx5/mlx5_en X-SVN-Group: stable-12 X-SVN-Commit-Author: hselasky X-SVN-Commit-Paths: stable/12/sys/dev/mlx5/mlx5_en X-SVN-Commit-Revision: 347782 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 47A348B151 X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.98 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.998,0]; NEURAL_HAM_SHORT(-0.98)[-0.979,0]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US] X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 16 May 2019 16:39:03 -0000 Author: hselasky Date: Thu May 16 16:39:02 2019 New Revision: 347782 URL: https://svnweb.freebsd.org/changeset/base/347782 Log: MFC r347317: Remove non-functional MLX5E_MAX_RX_SEGS macro in mlx5en(4). Sponsored by: Mellanox Technologies Modified: stable/12/sys/dev/mlx5/mlx5_en/en.h stable/12/sys/dev/mlx5/mlx5_en/mlx5_en_main.c stable/12/sys/dev/mlx5/mlx5_en/mlx5_en_rx.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/dev/mlx5/mlx5_en/en.h ============================================================================== --- stable/12/sys/dev/mlx5/mlx5_en/en.h Thu May 16 16:38:19 2019 (r347781) +++ stable/12/sys/dev/mlx5/mlx5_en/en.h Thu May 16 16:39:02 2019 (r347782) @@ -88,19 +88,13 @@ #define MLX5E_MAX_BUSDMA_RX_SEGS 15 -#define MLX5E_MAX_RX_SEGS 7 - #ifndef MLX5E_MAX_RX_BYTES #define MLX5E_MAX_RX_BYTES MCLBYTES #endif -#if (MLX5E_MAX_RX_SEGS == 1) -/* FreeBSD HW LRO is limited by 16KB - the size of max mbuf */ -#define MLX5E_PARAMS_DEFAULT_LRO_WQE_SZ MJUM16BYTES -#else #define MLX5E_PARAMS_DEFAULT_LRO_WQE_SZ \ - MIN(65535, MLX5E_MAX_RX_SEGS * MLX5E_MAX_RX_BYTES) -#endif + MIN(65535, 7 * MLX5E_MAX_RX_BYTES) + #define MLX5E_DIM_DEFAULT_PROFILE 3 #define MLX5E_DIM_MAX_RX_CQ_MODERATION_PKTS_WITH_LRO 16 #define MLX5E_PARAMS_DEFAULT_RX_CQ_MODERATION_USEC 0x10 Modified: stable/12/sys/dev/mlx5/mlx5_en/mlx5_en_main.c ============================================================================== --- stable/12/sys/dev/mlx5/mlx5_en/mlx5_en_main.c Thu May 16 16:38:19 2019 (r347781) +++ stable/12/sys/dev/mlx5/mlx5_en/mlx5_en_main.c Thu May 16 16:39:02 2019 (r347782) @@ -1253,11 +1253,7 @@ mlx5e_create_rq(struct mlx5e_channel *c, rq->mbuf = malloc(wq_sz * sizeof(rq->mbuf[0]), M_MLX5EN, M_WAITOK | M_ZERO); for (i = 0; i != wq_sz; i++) { struct mlx5e_rx_wqe *wqe = mlx5_wq_ll_get_wqe(&rq->wq, i); -#if (MLX5E_MAX_RX_SEGS == 1) - uint32_t byte_count = rq->wqe_sz - MLX5E_NET_IP_ALIGN; -#else int j; -#endif err = -bus_dmamap_create(rq->dma_tag, 0, &rq->mbuf[i].dma_map); if (err != 0) { @@ -1267,13 +1263,8 @@ mlx5e_create_rq(struct mlx5e_channel *c, } /* set value for constant fields */ -#if (MLX5E_MAX_RX_SEGS == 1) - wqe->data[0].lkey = c->mkey_be; - wqe->data[0].byte_count = cpu_to_be32(byte_count | MLX5_HW_START_PADDING); -#else for (j = 0; j < rq->nsegs; j++) wqe->data[j].lkey = c->mkey_be; -#endif } INIT_WORK(&rq->dim.work, mlx5e_dim_work); Modified: stable/12/sys/dev/mlx5/mlx5_en/mlx5_en_rx.c ============================================================================== --- stable/12/sys/dev/mlx5/mlx5_en/mlx5_en_rx.c Thu May 16 16:38:19 2019 (r347781) +++ stable/12/sys/dev/mlx5/mlx5_en/mlx5_en_rx.c Thu May 16 16:39:02 2019 (r347782) @@ -36,20 +36,12 @@ mlx5e_alloc_rx_wqe(struct mlx5e_rq *rq, struct mbuf *mb; int nsegs; int err; -#if (MLX5E_MAX_RX_SEGS != 1) struct mbuf *mb_head; int i; -#endif + if (rq->mbuf[ix].mbuf != NULL) return (0); -#if (MLX5E_MAX_RX_SEGS == 1) - mb = m_getjcl(M_NOWAIT, MT_DATA, M_PKTHDR, rq->wqe_sz); - if (unlikely(!mb)) - return (-ENOMEM); - - mb->m_pkthdr.len = mb->m_len = rq->wqe_sz; -#else mb_head = mb = m_getjcl(M_NOWAIT, MT_DATA, M_PKTHDR, MLX5E_MAX_RX_BYTES); if (unlikely(mb == NULL)) @@ -72,7 +64,7 @@ mlx5e_alloc_rx_wqe(struct mlx5e_rq *rq, } /* rewind to first mbuf in chain */ mb = mb_head; -#endif + /* get IP header aligned */ m_adj(mb, MLX5E_NET_IP_ALIGN); @@ -85,10 +77,7 @@ mlx5e_alloc_rx_wqe(struct mlx5e_rq *rq, err = -ENOMEM; goto err_free_mbuf; } -#if (MLX5E_MAX_RX_SEGS == 1) wqe->data[0].addr = cpu_to_be64(segs[0].ds_addr); -#else - wqe->data[0].addr = cpu_to_be64(segs[0].ds_addr); wqe->data[0].byte_count = cpu_to_be32(segs[0].ds_len | MLX5_HW_START_PADDING); for (i = 1; i != nsegs; i++) { @@ -99,7 +88,6 @@ mlx5e_alloc_rx_wqe(struct mlx5e_rq *rq, wqe->data[i].addr = 0; wqe->data[i].byte_count = 0; } -#endif rq->mbuf[ix].mbuf = mb; rq->mbuf[ix].data = mb->m_data; @@ -257,9 +245,7 @@ mlx5e_build_rx_mbuf(struct mlx5_cqe64 *cqe, { struct ifnet *ifp = rq->ifp; struct mlx5e_channel *c; -#if (MLX5E_MAX_RX_SEGS != 1) struct mbuf *mb_head; -#endif int lro_num_seg; /* HW LRO session aggregated packets counter */ uint64_t tstmp; @@ -270,9 +256,6 @@ mlx5e_build_rx_mbuf(struct mlx5_cqe64 *cqe, rq->stats.lro_bytes += cqe_bcnt; } -#if (MLX5E_MAX_RX_SEGS == 1) - mb->m_pkthdr.len = mb->m_len = cqe_bcnt; -#else mb->m_pkthdr.len = cqe_bcnt; for (mb_head = mb; mb != NULL; mb = mb->m_next) { if (mb->m_len > cqe_bcnt) @@ -289,7 +272,7 @@ mlx5e_build_rx_mbuf(struct mlx5_cqe64 *cqe, } /* rewind to first mbuf in chain */ mb = mb_head; -#endif + /* check if a Toeplitz hash was computed */ if (cqe->rss_hash_type != 0) { mb->m_pkthdr.flowid = be32_to_cpu(cqe->rss_hash_result); @@ -472,10 +455,8 @@ mlx5e_poll_rx_cq(struct mlx5e_rq *rq, int budget) } if ((MHLEN - MLX5E_NET_IP_ALIGN) >= byte_cnt && (mb = m_gethdr(M_NOWAIT, MT_DATA)) != NULL) { -#if (MLX5E_MAX_RX_SEGS != 1) /* set maximum mbuf length */ mb->m_len = MHLEN - MLX5E_NET_IP_ALIGN; -#endif /* get IP header aligned */ mb->m_data += MLX5E_NET_IP_ALIGN; From owner-svn-src-stable@freebsd.org Thu May 16 16:39:38 2019 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 26D70159E344; Thu, 16 May 2019 16:39:38 +0000 (UTC) (envelope-from hselasky@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 BF4358B29D; Thu, 16 May 2019 16:39:37 +0000 (UTC) (envelope-from hselasky@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 8D9DB23723; Thu, 16 May 2019 16:39:37 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x4GGdbdX076951; Thu, 16 May 2019 16:39:37 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x4GGdb5Y076950; Thu, 16 May 2019 16:39:37 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201905161639.x4GGdb5Y076950@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Thu, 16 May 2019 16:39:37 +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: r347783 - stable/12/sys/dev/mlx5 X-SVN-Group: stable-12 X-SVN-Commit-Author: hselasky X-SVN-Commit-Paths: stable/12/sys/dev/mlx5 X-SVN-Commit-Revision: 347783 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: BF4358B29D X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.98 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.998,0]; NEURAL_HAM_SHORT(-0.98)[-0.978,0]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US] X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 16 May 2019 16:39:38 -0000 Author: hselasky Date: Thu May 16 16:39:37 2019 New Revision: 347783 URL: https://svnweb.freebsd.org/changeset/base/347783 Log: MFC r347318: Make command timeout way shorter in mlx5core. The command timeout is terribly long, whole two hours. Make it 60s so if things do go wrong, the user gets feedback in relatively short time, so they can take corrective actions and/or investigate using tools and such. Linux commit: 6b6c07bdcdc97ccac2596063bfc32a5faddfe884 Sponsored by: Mellanox Technologies Modified: stable/12/sys/dev/mlx5/driver.h Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/dev/mlx5/driver.h ============================================================================== --- stable/12/sys/dev/mlx5/driver.h Thu May 16 16:39:02 2019 (r347782) +++ stable/12/sys/dev/mlx5/driver.h Thu May 16 16:39:37 2019 (r347783) @@ -55,7 +55,7 @@ enum { }; enum { - MLX5_CMD_TIMEOUT_MSEC = 8 * 60 * 1000, + MLX5_CMD_TIMEOUT_MSEC = 60 * 1000, MLX5_CMD_WQ_MAX_NAME = 32, }; From owner-svn-src-stable@freebsd.org Thu May 16 16:40:13 2019 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 75E32159E3F2; Thu, 16 May 2019 16:40:13 +0000 (UTC) (envelope-from hselasky@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 177AF8B3DD; Thu, 16 May 2019 16:40:13 +0000 (UTC) (envelope-from hselasky@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 CEC8D23727; Thu, 16 May 2019 16:40:12 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x4GGeCT3077069; Thu, 16 May 2019 16:40:12 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x4GGeCKB077067; Thu, 16 May 2019 16:40:12 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201905161640.x4GGeCKB077067@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Thu, 16 May 2019 16:40:12 +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: r347784 - in stable/12/sys/dev/mlx5: . mlx5_core X-SVN-Group: stable-12 X-SVN-Commit-Author: hselasky X-SVN-Commit-Paths: in stable/12/sys/dev/mlx5: . mlx5_core X-SVN-Commit-Revision: 347784 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 177AF8B3DD X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.98 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.998,0]; NEURAL_HAM_SHORT(-0.98)[-0.979,0]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US] X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 16 May 2019 16:40:13 -0000 Author: hselasky Date: Thu May 16 16:40:12 2019 New Revision: 347784 URL: https://svnweb.freebsd.org/changeset/base/347784 Log: MFC r347319: Flush command workqueue when command completion is triggered in mlx5core. Avoid race for command completion when triggering a command completions event. Serialize operation by queueing all commands on the same work queue. This can happen when healthcare triggers. Sponsored by: Mellanox Technologies Modified: stable/12/sys/dev/mlx5/driver.h stable/12/sys/dev/mlx5/mlx5_core/mlx5_health.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/dev/mlx5/driver.h ============================================================================== --- stable/12/sys/dev/mlx5/driver.h Thu May 16 16:39:37 2019 (r347783) +++ stable/12/sys/dev/mlx5/driver.h Thu May 16 16:40:12 2019 (r347784) @@ -515,6 +515,7 @@ struct mlx5_core_health { struct work_struct work; struct delayed_work recover_work; unsigned int last_reset_req; + struct work_struct work_cmd_completion; }; #ifdef RATELIMIT Modified: stable/12/sys/dev/mlx5/mlx5_core/mlx5_health.c ============================================================================== --- stable/12/sys/dev/mlx5/mlx5_core/mlx5_health.c Thu May 16 16:39:37 2019 (r347783) +++ stable/12/sys/dev/mlx5/mlx5_core/mlx5_health.c Thu May 16 16:40:12 2019 (r347784) @@ -135,8 +135,10 @@ static bool sensor_fw_synd_rfr(struct mlx5_core_dev *d return rfr && synd; } -static void mlx5_trigger_cmd_completions(struct mlx5_core_dev *dev) +static void mlx5_trigger_cmd_completions(struct work_struct *work) { + struct mlx5_core_dev *dev = + container_of(work, struct mlx5_core_dev, priv.health.work_cmd_completion); unsigned long flags; u64 vector; @@ -271,7 +273,15 @@ void mlx5_enter_error_state(struct mlx5_core_dev *dev, return; if (!force) mlx5_core_err(dev, "internal state error detected\n"); - mlx5_trigger_cmd_completions(dev); + + /* + * Queue the command completion handler on the command + * work queue to avoid racing with the real command + * completion handler and then wait for it to + * complete: + */ + queue_work(dev->cmd.wq, &dev->priv.health.work_cmd_completion); + flush_workqueue(dev->cmd.wq); } mutex_lock(&dev->intf_state_mutex); @@ -693,6 +703,7 @@ int mlx5_health_init(struct mlx5_core_dev *dev) spin_lock_init(&health->wq_lock); INIT_WORK(&health->work, health_care); INIT_WORK(&health->work_watchdog, health_watchdog); + INIT_WORK(&health->work_cmd_completion, mlx5_trigger_cmd_completions); INIT_DELAYED_WORK(&health->recover_work, health_recover); return 0; From owner-svn-src-stable@freebsd.org Thu May 16 16:40:48 2019 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 85182159E5D8; Thu, 16 May 2019 16:40:48 +0000 (UTC) (envelope-from hselasky@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 2B6838B553; Thu, 16 May 2019 16:40:48 +0000 (UTC) (envelope-from hselasky@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 04C2523737; Thu, 16 May 2019 16:40:48 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x4GGelPL077150; Thu, 16 May 2019 16:40:47 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x4GGelnL077149; Thu, 16 May 2019 16:40:47 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201905161640.x4GGelnL077149@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Thu, 16 May 2019 16:40:47 +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: r347785 - stable/12/sys/dev/mlx5/mlx5_en X-SVN-Group: stable-12 X-SVN-Commit-Author: hselasky X-SVN-Commit-Paths: stable/12/sys/dev/mlx5/mlx5_en X-SVN-Commit-Revision: 347785 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 2B6838B553 X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.98 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.998,0]; NEURAL_HAM_SHORT(-0.98)[-0.978,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US]; NEURAL_HAM_LONG(-1.00)[-1.000,0] X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 16 May 2019 16:40:48 -0000 Author: hselasky Date: Thu May 16 16:40:47 2019 New Revision: 347785 URL: https://svnweb.freebsd.org/changeset/base/347785 Log: MFC r347320: Make sure the flow destination structure does not use values off the stack in mlx5en(4). Sponsored by: Mellanox Technologies Modified: stable/12/sys/dev/mlx5/mlx5_en/mlx5_en_flow_table.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/dev/mlx5/mlx5_en/mlx5_en_flow_table.c ============================================================================== --- stable/12/sys/dev/mlx5/mlx5_en/mlx5_en_flow_table.c Thu May 16 16:40:12 2019 (r347784) +++ stable/12/sys/dev/mlx5/mlx5_en/mlx5_en_flow_table.c Thu May 16 16:40:47 2019 (r347785) @@ -227,7 +227,7 @@ mlx5e_add_eth_addr_rule_sub(struct mlx5e_priv *priv, struct mlx5e_eth_addr_info *ai, int type, u32 *mc, u32 *mv) { - struct mlx5_flow_destination dest; + struct mlx5_flow_destination dest = {}; u8 mc_enable = 0; struct mlx5_flow_rule **rule_p; struct mlx5_flow_table *ft = priv->fts.main.t; @@ -507,7 +507,7 @@ mlx5e_add_vlan_rule_sub(struct mlx5e_priv *priv, u32 *mc, u32 *mv) { struct mlx5_flow_table *ft = priv->fts.vlan.t; - struct mlx5_flow_destination dest; + struct mlx5_flow_destination dest = {}; u8 mc_enable = 0; struct mlx5_flow_rule **rule_p; int err = 0; From owner-svn-src-stable@freebsd.org Thu May 16 16:41:22 2019 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id EFEE8159E669; Thu, 16 May 2019 16:41:21 +0000 (UTC) (envelope-from hselasky@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 949A08B6F3; Thu, 16 May 2019 16:41:21 +0000 (UTC) (envelope-from hselasky@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 6ECDE2375D; Thu, 16 May 2019 16:41:21 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x4GGfLqh078686; Thu, 16 May 2019 16:41:21 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x4GGfLeo078685; Thu, 16 May 2019 16:41:21 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201905161641.x4GGfLeo078685@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Thu, 16 May 2019 16:41:21 +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: r347786 - stable/12/sys/dev/mlx5/mlx5_en X-SVN-Group: stable-12 X-SVN-Commit-Author: hselasky X-SVN-Commit-Paths: stable/12/sys/dev/mlx5/mlx5_en X-SVN-Commit-Revision: 347786 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 949A08B6F3 X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.98 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.998,0]; NEURAL_HAM_SHORT(-0.98)[-0.978,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US]; NEURAL_HAM_LONG(-1.00)[-1.000,0] X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 16 May 2019 16:41:22 -0000 Author: hselasky Date: Thu May 16 16:41:21 2019 New Revision: 347786 URL: https://svnweb.freebsd.org/changeset/base/347786 Log: MFC r347321: Undo previous steps upon returning failure in mlx5en(4). Else flowtable resources may not be properly freed. Sponsored by: Mellanox Technologies Modified: stable/12/sys/dev/mlx5/mlx5_en/mlx5_en_flow_table.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/dev/mlx5/mlx5_en/mlx5_en_flow_table.c ============================================================================== --- stable/12/sys/dev/mlx5/mlx5_en/mlx5_en_flow_table.c Thu May 16 16:40:47 2019 (r347785) +++ stable/12/sys/dev/mlx5/mlx5_en/mlx5_en_flow_table.c Thu May 16 16:41:21 2019 (r347786) @@ -633,7 +633,11 @@ mlx5e_add_any_vid_rules(struct mlx5e_priv *priv) if (err) return (err); - return (mlx5e_add_vlan_rule(priv, MLX5E_VLAN_RULE_TYPE_ANY_STAG_VID, 0)); + err = mlx5e_add_vlan_rule(priv, MLX5E_VLAN_RULE_TYPE_ANY_STAG_VID, 0); + if (err) + mlx5e_del_vlan_rule(priv, MLX5E_VLAN_RULE_TYPE_ANY_CTAG_VID, 0); + + return (err); } void @@ -701,19 +705,22 @@ mlx5e_add_all_vlan_rules(struct mlx5e_priv *priv) err = mlx5e_add_vlan_rule(priv, MLX5E_VLAN_RULE_TYPE_MATCH_VID, i); if (err) - return (err); + goto error; } err = mlx5e_add_vlan_rule(priv, MLX5E_VLAN_RULE_TYPE_UNTAGGED, 0); if (err) - return (err); + goto error; if (priv->vlan.filter_disabled) { err = mlx5e_add_any_vid_rules(priv); if (err) - return (err); + goto error; } return (0); +error: + mlx5e_del_all_vlan_rules(priv); + return (err); } void From owner-svn-src-stable@freebsd.org Thu May 16 16:41:56 2019 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id E25E0159E710; Thu, 16 May 2019 16:41:55 +0000 (UTC) (envelope-from hselasky@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 87FDA8B8B6; Thu, 16 May 2019 16:41:55 +0000 (UTC) (envelope-from hselasky@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 6288523895; Thu, 16 May 2019 16:41:55 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x4GGfth2081012; Thu, 16 May 2019 16:41:55 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x4GGftPK081011; Thu, 16 May 2019 16:41:55 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201905161641.x4GGftPK081011@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Thu, 16 May 2019 16:41:55 +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: r347787 - stable/12/sys/dev/mlx5/mlx5_en X-SVN-Group: stable-12 X-SVN-Commit-Author: hselasky X-SVN-Commit-Paths: stable/12/sys/dev/mlx5/mlx5_en X-SVN-Commit-Revision: 347787 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 87FDA8B8B6 X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.98 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.998,0]; NEURAL_HAM_SHORT(-0.98)[-0.978,0]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US] X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 16 May 2019 16:41:56 -0000 Author: hselasky Date: Thu May 16 16:41:54 2019 New Revision: 347787 URL: https://svnweb.freebsd.org/changeset/base/347787 Log: MFC r347322: Ensure the flowtable rules are not freed twice in mlx5en(4). This can happen when re-loading the driver. Sponsored by: Mellanox Technologies Modified: stable/12/sys/dev/mlx5/mlx5_en/mlx5_en_flow_table.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/dev/mlx5/mlx5_en/mlx5_en_flow_table.c ============================================================================== --- stable/12/sys/dev/mlx5/mlx5_en/mlx5_en_flow_table.c Thu May 16 16:41:21 2019 (r347786) +++ stable/12/sys/dev/mlx5/mlx5_en/mlx5_en_flow_table.c Thu May 16 16:41:54 2019 (r347787) @@ -131,6 +131,9 @@ mlx5e_del_eth_addr_from_flow_table(struct mlx5e_priv * if (ai->tt_vec & (1 << MLX5E_TT_ANY)) mlx5_del_flow_rule(ai->ft_rule[MLX5E_TT_ANY]); + + /* ensure the rules are not freed again */ + ai->tt_vec = 0; } static int From owner-svn-src-stable@freebsd.org Thu May 16 16:42:42 2019 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 4ECDE159E7F8; Thu, 16 May 2019 16:42:42 +0000 (UTC) (envelope-from hselasky@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 E88C38BBE3; Thu, 16 May 2019 16:42:41 +0000 (UTC) (envelope-from hselasky@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 DCF4E238C7; Thu, 16 May 2019 16:42:41 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x4GGgfN6081913; Thu, 16 May 2019 16:42:41 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x4GGgfgG081910; Thu, 16 May 2019 16:42:41 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201905161642.x4GGgfgG081910@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Thu, 16 May 2019 16:42:41 +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: r347788 - in stable/12/sys/dev/mlx5: . mlx5_core X-SVN-Group: stable-12 X-SVN-Commit-Author: hselasky X-SVN-Commit-Paths: in stable/12/sys/dev/mlx5: . mlx5_core X-SVN-Commit-Revision: 347788 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: E88C38BBE3 X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.98 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.998,0]; NEURAL_HAM_SHORT(-0.98)[-0.980,0]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US] X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 16 May 2019 16:42:42 -0000 Author: hselasky Date: Thu May 16 16:42:40 2019 New Revision: 347788 URL: https://svnweb.freebsd.org/changeset/base/347788 Log: MFC r347323: Fix race between driver unload and dumping firmware in mlx5core. Present code uses lock-less accesses to the dump data to prevent top level ioctls from blocking bottom-level call to dump. Unfortunately, this depends on the type stability of the dump data structure, which makes it non-functional during driver teardown. Switch to the mutex locking scheme where top levels use the mutex in the bound regions, while copyouts and drain for completion utilize condvars. The mutex lifetime is guaranteed to be strictly larger than the time interval where driver can initiate dump, and most of the control fields of the old struct mlx5_dump_data are directly embedded into struct mlx5_core_dev. Submitted by: kib@ Sponsored by: Mellanox Technologies Modified: stable/12/sys/dev/mlx5/driver.h stable/12/sys/dev/mlx5/mlx5_core/mlx5_fwdump.c stable/12/sys/dev/mlx5/mlx5_core/mlx5_main.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/dev/mlx5/driver.h ============================================================================== --- stable/12/sys/dev/mlx5/driver.h Thu May 16 16:41:54 2019 (r347787) +++ stable/12/sys/dev/mlx5/driver.h Thu May 16 16:42:40 2019 (r347788) @@ -664,7 +664,6 @@ struct mlx5_special_contexts { }; struct mlx5_flow_root_namespace; -struct mlx5_dump_data; struct mlx5_core_dev { struct pci_dev *pdev; /* sync pci state */ @@ -704,7 +703,12 @@ struct mlx5_core_dev { struct mlx5_flow_root_namespace *sniffer_rx_root_ns; struct mlx5_flow_root_namespace *sniffer_tx_root_ns; u32 num_q_counter_allocated[MLX5_INTERFACE_NUMBER]; - struct mlx5_dump_data *dump_data; + const struct mlx5_crspace_regmap *dump_rege; + uint32_t *dump_data; + unsigned dump_size; + bool dump_valid; + bool dump_copyout; + struct mtx dump_lock; struct sysctl_ctx_list sysctl_ctx; int msix_eqvec; Modified: stable/12/sys/dev/mlx5/mlx5_core/mlx5_fwdump.c ============================================================================== --- stable/12/sys/dev/mlx5/mlx5_core/mlx5_fwdump.c Thu May 16 16:41:54 2019 (r347787) +++ stable/12/sys/dev/mlx5/mlx5_core/mlx5_fwdump.c Thu May 16 16:42:40 2019 (r347788) @@ -39,14 +39,6 @@ extern const struct mlx5_crspace_regmap mlx5_crspace_r extern const struct mlx5_crspace_regmap mlx5_crspace_regmap_mt4115[]; extern const struct mlx5_crspace_regmap mlx5_crspace_regmap_connectx5[]; -struct mlx5_dump_data { - const struct mlx5_crspace_regmap *rege; - uint32_t *dump; - unsigned dump_size; - int dump_valid; - struct mtx dump_lock; -}; - static MALLOC_DEFINE(M_MLX5_DUMP, "MLX5DUMP", "MLX5 Firmware dump"); static unsigned @@ -61,20 +53,20 @@ mlx5_fwdump_getsize(const struct mlx5_crspace_regmap * } static void -mlx5_fwdump_destroy_dd(struct mlx5_dump_data *dd) +mlx5_fwdump_destroy_dd(struct mlx5_core_dev *mdev) { - mtx_destroy(&dd->dump_lock); - free(dd->dump, M_MLX5_DUMP); - free(dd, M_MLX5_DUMP); + mtx_assert(&mdev->dump_lock, MA_OWNED); + free(mdev->dump_data, M_MLX5_DUMP); + mdev->dump_data = NULL; } void mlx5_fwdump_prep(struct mlx5_core_dev *mdev) { - struct mlx5_dump_data *dd; int error; + mdev->dump_data = NULL; error = mlx5_vsc_find_cap(mdev); if (error != 0) { /* Inability to create a firmware dump is not fatal. */ @@ -82,47 +74,39 @@ mlx5_fwdump_prep(struct mlx5_core_dev *mdev) "mlx5_fwdump_prep failed %d\n", error); return; } - dd = malloc(sizeof(struct mlx5_dump_data), M_MLX5_DUMP, M_WAITOK); switch (pci_get_device(mdev->pdev->dev.bsddev)) { case 0x1013: - dd->rege = mlx5_crspace_regmap_mt4115; + mdev->dump_rege = mlx5_crspace_regmap_mt4115; break; case 0x1015: - dd->rege = mlx5_crspace_regmap_mt4117; + mdev->dump_rege = mlx5_crspace_regmap_mt4117; break; case 0x1017: case 0x1019: - dd->rege = mlx5_crspace_regmap_connectx5; + mdev->dump_rege = mlx5_crspace_regmap_connectx5; break; default: - free(dd, M_MLX5_DUMP); return; /* silently fail, do not prevent driver attach */ } - dd->dump_size = mlx5_fwdump_getsize(dd->rege); - dd->dump = malloc(dd->dump_size * sizeof(uint32_t), M_MLX5_DUMP, - M_WAITOK | M_ZERO); - dd->dump_valid = 0; - mtx_init(&dd->dump_lock, "mlx5dmp", NULL, MTX_DEF | MTX_NEW); - if (atomic_cmpset_rel_ptr((uintptr_t *)&mdev->dump_data, 0, - (uintptr_t)dd) == 0) - mlx5_fwdump_destroy_dd(dd); + mdev->dump_size = mlx5_fwdump_getsize(mdev->dump_rege); + mdev->dump_data = malloc(mdev->dump_size * sizeof(uint32_t), + M_MLX5_DUMP, M_WAITOK | M_ZERO); + mdev->dump_valid = false; + mdev->dump_copyout = false; } void mlx5_fwdump(struct mlx5_core_dev *mdev) { - struct mlx5_dump_data *dd; const struct mlx5_crspace_regmap *r; uint32_t i, ri; int error; dev_info(&mdev->pdev->dev, "Issuing FW dump\n"); - dd = (struct mlx5_dump_data *)atomic_load_acq_ptr((uintptr_t *) - &mdev->dump_data); - if (dd == NULL) - return; - mtx_lock(&dd->dump_lock); - if (dd->dump_valid) { + mtx_lock(&mdev->dump_lock); + if (mdev->dump_data == NULL) + goto failed; + if (mdev->dump_valid) { /* only one dump */ dev_warn(&mdev->pdev->dev, "Only one FW dump can be captured aborting FW dump\n"); @@ -136,37 +120,51 @@ mlx5_fwdump(struct mlx5_core_dev *mdev) error = mlx5_vsc_set_space(mdev, MLX5_VSC_DOMAIN_PROTECTED_CRSPACE); if (error != 0) goto unlock_vsc; - for (i = 0, r = dd->rege; r->cnt != 0; r++) { + for (i = 0, r = mdev->dump_rege; r->cnt != 0; r++) { for (ri = 0; ri < r->cnt; ri++) { error = mlx5_vsc_read(mdev, r->addr + ri * 4, - &dd->dump[i]); + &mdev->dump_data[i]); if (error != 0) goto unlock_vsc; i++; } } - atomic_store_rel_int(&dd->dump_valid, 1); + mdev->dump_valid = true; unlock_vsc: mlx5_vsc_unlock(mdev); failed: - mtx_unlock(&dd->dump_lock); + mtx_unlock(&mdev->dump_lock); } void mlx5_fwdump_clean(struct mlx5_core_dev *mdev) { - struct mlx5_dump_data *dd; - for (;;) { - dd = mdev->dump_data; - if (dd == NULL) - return; - if (atomic_cmpset_ptr((uintptr_t *)&mdev->dump_data, - (uintptr_t)dd, 0) == 1) { - mlx5_fwdump_destroy_dd(dd); - return; + mtx_lock(&mdev->dump_lock); + while (mdev->dump_copyout) + msleep(&mdev->dump_copyout, &mdev->dump_lock, 0, "mlx5fwc", 0); + mlx5_fwdump_destroy_dd(mdev); + mtx_unlock(&mdev->dump_lock); +} + +static int +mlx5_fwdump_reset(struct mlx5_core_dev *mdev) +{ + int error; + + error = 0; + mtx_lock(&mdev->dump_lock); + if (mdev->dump_data != NULL) { + while (mdev->dump_copyout) { + msleep(&mdev->dump_copyout, &mdev->dump_lock, + 0, "mlx5fwr", 0); } + mdev->dump_valid = false; + } else { + error = ENOENT; } + mtx_unlock(&mdev->dump_lock); + return (error); } static int @@ -190,29 +188,37 @@ mlx5_dbsf_to_core(const struct mlx5_tool_addr *devaddr } static int -mlx5_fwdump_copyout(struct mlx5_dump_data *dd, struct mlx5_fwdump_get *fwg) +mlx5_fwdump_copyout(struct mlx5_core_dev *mdev, struct mlx5_fwdump_get *fwg) { const struct mlx5_crspace_regmap *r; struct mlx5_fwdump_reg rv, *urv; uint32_t i, ri; int error; - if (dd == NULL) + mtx_lock(&mdev->dump_lock); + if (mdev->dump_data == NULL) { + mtx_unlock(&mdev->dump_lock); return (ENOENT); + } if (fwg->buf == NULL) { - fwg->reg_filled = dd->dump_size; + fwg->reg_filled = mdev->dump_size; + mtx_unlock(&mdev->dump_lock); return (0); } - if (atomic_load_acq_int(&dd->dump_valid) == 0) + if (!mdev->dump_valid) { + mtx_unlock(&mdev->dump_lock); return (ENOENT); + } + mdev->dump_copyout = true; + mtx_unlock(&mdev->dump_lock); urv = fwg->buf; - for (i = 0, r = dd->rege; r->cnt != 0; r++) { + for (i = 0, r = mdev->dump_rege; r->cnt != 0; r++) { for (ri = 0; ri < r->cnt; ri++) { if (i >= fwg->reg_cnt) goto out; rv.addr = r->addr + ri * 4; - rv.val = dd->dump[i]; + rv.val = mdev->dump_data[i]; error = copyout(&rv, urv, sizeof(rv)); if (error != 0) return (error); @@ -222,6 +228,10 @@ mlx5_fwdump_copyout(struct mlx5_dump_data *dd, struct } out: fwg->reg_filled = i; + mtx_lock(&mdev->dump_lock); + mdev->dump_copyout = false; + wakeup(&mdev->dump_copyout); + mtx_unlock(&mdev->dump_lock); return (0); } @@ -250,7 +260,6 @@ mlx5_ctl_ioctl(struct cdev *dev, u_long cmd, caddr_t d struct mlx5_core_dev *mdev; struct mlx5_fwdump_get *fwg; struct mlx5_tool_addr *devaddr; - struct mlx5_dump_data *dd; struct mlx5_fw_update *fu; struct firmware fake_fw; int error; @@ -267,7 +276,7 @@ mlx5_ctl_ioctl(struct cdev *dev, u_long cmd, caddr_t d error = mlx5_dbsf_to_core(devaddr, &mdev); if (error != 0) break; - error = mlx5_fwdump_copyout(mdev->dump_data, fwg); + error = mlx5_fwdump_copyout(mdev, fwg); break; case MLX5_FWDUMP_RESET: if ((fflag & FWRITE) == 0) { @@ -276,13 +285,8 @@ mlx5_ctl_ioctl(struct cdev *dev, u_long cmd, caddr_t d } devaddr = (struct mlx5_tool_addr *)data; error = mlx5_dbsf_to_core(devaddr, &mdev); - if (error != 0) - break; - dd = mdev->dump_data; - if (dd != NULL) - atomic_store_rel_int(&dd->dump_valid, 0); - else - error = ENOENT; + if (error == 0) + error = mlx5_fwdump_reset(mdev); break; case MLX5_FWDUMP_FORCE: if ((fflag & FWRITE) == 0) { Modified: stable/12/sys/dev/mlx5/mlx5_core/mlx5_main.c ============================================================================== --- stable/12/sys/dev/mlx5/mlx5_core/mlx5_main.c Thu May 16 16:41:54 2019 (r347787) +++ stable/12/sys/dev/mlx5/mlx5_core/mlx5_main.c Thu May 16 16:42:40 2019 (r347788) @@ -1301,6 +1301,7 @@ static int init_one(struct pci_dev *pdev, spin_lock_init(&priv->ctx_lock); mutex_init(&dev->pci_status_mutex); mutex_init(&dev->intf_state_mutex); + mtx_init(&dev->dump_lock, "mlx5dmp", NULL, MTX_DEF | MTX_NEW); err = mlx5_pci_init(dev, priv); if (err) { device_printf(bsddev, "ERR: mlx5_pci_init failed %d\n", err); @@ -1335,6 +1336,7 @@ close_pci: mlx5_pci_close(dev, priv); clean_dev: sysctl_ctx_free(&dev->sysctl_ctx); + mtx_destroy(&dev->dump_lock); kfree(dev); return err; } @@ -1350,10 +1352,11 @@ static void remove_one(struct pci_dev *pdev) return; } - mlx5_fwdump_clean(dev); mlx5_pagealloc_cleanup(dev); mlx5_health_cleanup(dev); + mlx5_fwdump_clean(dev); mlx5_pci_close(dev, priv); + mtx_destroy(&dev->dump_lock); pci_set_drvdata(pdev, NULL); sysctl_ctx_free(&dev->sysctl_ctx); kfree(dev); From owner-svn-src-stable@freebsd.org Thu May 16 16:43:17 2019 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id CFBBC159E8B5; Thu, 16 May 2019 16:43:17 +0000 (UTC) (envelope-from hselasky@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 73A328BD3D; Thu, 16 May 2019 16:43:17 +0000 (UTC) (envelope-from hselasky@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 47326238C8; Thu, 16 May 2019 16:43:17 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x4GGhHGr082001; Thu, 16 May 2019 16:43:17 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x4GGhGBi081998; Thu, 16 May 2019 16:43:16 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201905161643.x4GGhGBi081998@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Thu, 16 May 2019 16:43:16 +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: r347789 - in stable/12/sys/dev/mlx5: . mlx5_core X-SVN-Group: stable-12 X-SVN-Commit-Author: hselasky X-SVN-Commit-Paths: in stable/12/sys/dev/mlx5: . mlx5_core X-SVN-Commit-Revision: 347789 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 73A328BD3D X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.98 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.998,0]; NEURAL_HAM_SHORT(-0.98)[-0.979,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US]; NEURAL_HAM_LONG(-1.00)[-1.000,0] X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 16 May 2019 16:43:18 -0000 Author: hselasky Date: Thu May 16 16:43:16 2019 New Revision: 347789 URL: https://svnweb.freebsd.org/changeset/base/347789 Log: MFC r347324: Make command workqueue persistant in mlx5core. There is no reason to re-create the command workqueue during healthcare. This also fixes an issue where a previous work struct may refer to a destroyed workqueue. Sponsored by: Mellanox Technologies Modified: stable/12/sys/dev/mlx5/driver.h stable/12/sys/dev/mlx5/mlx5_core/mlx5_cmd.c stable/12/sys/dev/mlx5/mlx5_core/mlx5_health.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/dev/mlx5/driver.h ============================================================================== --- stable/12/sys/dev/mlx5/driver.h Thu May 16 16:42:40 2019 (r347788) +++ stable/12/sys/dev/mlx5/driver.h Thu May 16 16:43:16 2019 (r347789) @@ -56,7 +56,6 @@ enum { enum { MLX5_CMD_TIMEOUT_MSEC = 60 * 1000, - MLX5_CMD_WQ_MAX_NAME = 32, }; enum { @@ -353,8 +352,6 @@ struct mlx5_cmd { spinlock_t token_lock; u8 token; unsigned long bitmask; - char wq_name[MLX5_CMD_WQ_MAX_NAME]; - struct workqueue_struct *wq; struct semaphore sem; struct semaphore pages_sem; enum mlx5_cmd_mode mode; @@ -516,6 +513,7 @@ struct mlx5_core_health { struct delayed_work recover_work; unsigned int last_reset_req; struct work_struct work_cmd_completion; + struct workqueue_struct *wq_cmd; }; #ifdef RATELIMIT Modified: stable/12/sys/dev/mlx5/mlx5_core/mlx5_cmd.c ============================================================================== --- stable/12/sys/dev/mlx5/mlx5_core/mlx5_cmd.c Thu May 16 16:42:40 2019 (r347788) +++ stable/12/sys/dev/mlx5/mlx5_core/mlx5_cmd.c Thu May 16 16:43:16 2019 (r347789) @@ -1,5 +1,5 @@ /*- - * Copyright (c) 2013-2017, Mellanox Technologies, Ltd. All rights reserved. + * Copyright (c) 2013-2019, Mellanox Technologies, Ltd. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -997,7 +997,7 @@ static int mlx5_cmd_invoke(struct mlx5_core_dev *dev, INIT_WORK(&ent->work, cmd_work_handler); if (page_queue) { cmd_work_handler(&ent->work); - } else if (!queue_work(cmd->wq, &ent->work)) { + } else if (!queue_work(dev->priv.health.wq_cmd, &ent->work)) { mlx5_core_warn(dev, "failed to queue work\n"); err = -ENOMEM; goto out_free; @@ -1127,14 +1127,6 @@ mlx5_free_cmd_msg(struct mlx5_core_dev *dev, struct ml mlx5_fwp_free(msg); } -static void set_wqname(struct mlx5_core_dev *dev) -{ - struct mlx5_cmd *cmd = &dev->cmd; - - snprintf(cmd->wq_name, sizeof(cmd->wq_name), "mlx5_cmd_%s", - dev_name(&dev->pdev->dev)); -} - static void clean_debug_files(struct mlx5_core_dev *dev) { } @@ -1562,20 +1554,8 @@ int mlx5_cmd_init(struct mlx5_core_dev *dev) device_printf((&dev->pdev->dev)->bsddev, "ERR: ""failed to create command cache\n"); goto err_free_page; } - - set_wqname(dev); - cmd->wq = create_singlethread_workqueue(cmd->wq_name); - if (!cmd->wq) { - device_printf((&dev->pdev->dev)->bsddev, "ERR: ""failed to create command workqueue\n"); - err = -ENOMEM; - goto err_cache; - } - return 0; -err_cache: - destroy_msg_cache(dev); - err_free_page: free_cmd_page(dev, cmd); @@ -1589,7 +1569,7 @@ void mlx5_cmd_cleanup(struct mlx5_core_dev *dev) struct mlx5_cmd *cmd = &dev->cmd; clean_debug_files(dev); - destroy_workqueue(cmd->wq); + flush_workqueue(dev->priv.health.wq_cmd); destroy_msg_cache(dev); free_cmd_page(dev, cmd); } Modified: stable/12/sys/dev/mlx5/mlx5_core/mlx5_health.c ============================================================================== --- stable/12/sys/dev/mlx5/mlx5_core/mlx5_health.c Thu May 16 16:42:40 2019 (r347788) +++ stable/12/sys/dev/mlx5/mlx5_core/mlx5_health.c Thu May 16 16:43:16 2019 (r347789) @@ -1,5 +1,5 @@ /*- - * Copyright (c) 2013-2017, Mellanox Technologies, Ltd. All rights reserved. + * Copyright (c) 2013-2019, Mellanox Technologies, Ltd. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -280,8 +280,8 @@ void mlx5_enter_error_state(struct mlx5_core_dev *dev, * completion handler and then wait for it to * complete: */ - queue_work(dev->cmd.wq, &dev->priv.health.work_cmd_completion); - flush_workqueue(dev->cmd.wq); + queue_work(dev->priv.health.wq_cmd, &dev->priv.health.work_cmd_completion); + flush_workqueue(dev->priv.health.wq_cmd); } mutex_lock(&dev->intf_state_mutex); @@ -679,6 +679,7 @@ void mlx5_health_cleanup(struct mlx5_core_dev *dev) destroy_workqueue(health->wq); destroy_workqueue(health->wq_watchdog); + destroy_workqueue(health->wq_cmd); } int mlx5_health_init(struct mlx5_core_dev *dev) @@ -691,15 +692,18 @@ int mlx5_health_init(struct mlx5_core_dev *dev) snprintf(name, sizeof(name), "%s-rec", dev_name(&dev->pdev->dev)); health->wq = create_singlethread_workqueue(name); if (!health->wq) - return -ENOMEM; + goto err_recovery; snprintf(name, sizeof(name), "%s-wdg", dev_name(&dev->pdev->dev)); health->wq_watchdog = create_singlethread_workqueue(name); - if (!health->wq_watchdog) { - destroy_workqueue(health->wq); - return -ENOMEM; - } + if (!health->wq_watchdog) + goto err_watchdog; + snprintf(name, sizeof(name), "%s-cmd", dev_name(&dev->pdev->dev)); + health->wq_cmd = create_singlethread_workqueue(name); + if (!health->wq_cmd) + goto err_cmd; + spin_lock_init(&health->wq_lock); INIT_WORK(&health->work, health_care); INIT_WORK(&health->work_watchdog, health_watchdog); @@ -707,4 +711,11 @@ int mlx5_health_init(struct mlx5_core_dev *dev) INIT_DELAYED_WORK(&health->recover_work, health_recover); return 0; + +err_cmd: + destroy_workqueue(health->wq_watchdog); +err_watchdog: + destroy_workqueue(health->wq); +err_recovery: + return -ENOMEM; } From owner-svn-src-stable@freebsd.org Thu May 16 16:44:42 2019 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 57F04159EA02; Thu, 16 May 2019 16:44:42 +0000 (UTC) (envelope-from hselasky@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 EE69F8BEDF; Thu, 16 May 2019 16:44:41 +0000 (UTC) (envelope-from hselasky@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 BEF7E238CA; Thu, 16 May 2019 16:44:41 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x4GGifJc082139; Thu, 16 May 2019 16:44:41 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x4GGiex2082132; Thu, 16 May 2019 16:44:40 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201905161644.x4GGiex2082132@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Thu, 16 May 2019 16:44:40 +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: r347790 - in stable/12/sys: dev/mlx4/mlx4_core dev/mlx4/mlx4_ib dev/mlx5/mlx5_core dev/mlx5/mlx5_en dev/mlx5/mlx5_ib sys X-SVN-Group: stable-12 X-SVN-Commit-Author: hselasky X-SVN-Commit-Paths: in stable/12/sys: dev/mlx4/mlx4_core dev/mlx4/mlx4_ib dev/mlx5/mlx5_core dev/mlx5/mlx5_en dev/mlx5/mlx5_ib sys X-SVN-Commit-Revision: 347790 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: EE69F8BEDF X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.98 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.998,0]; NEURAL_HAM_SHORT(-0.98)[-0.979,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US]; NEURAL_HAM_LONG(-1.00)[-1.000,0] X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 16 May 2019 16:44:42 -0000 Author: hselasky Date: Thu May 16 16:44:40 2019 New Revision: 347790 URL: https://svnweb.freebsd.org/changeset/base/347790 Log: MFC r347325: Bump the Mellanox driver version numbers and the FreeBSD version number. Sponsored by: Mellanox Technologies Modified: stable/12/sys/dev/mlx4/mlx4_core/mlx4.h stable/12/sys/dev/mlx4/mlx4_ib/mlx4_ib_main.c stable/12/sys/dev/mlx5/mlx5_core/mlx5_core.h stable/12/sys/dev/mlx5/mlx5_en/mlx5_en_main.c stable/12/sys/dev/mlx5/mlx5_ib/mlx5_ib_main.c stable/12/sys/sys/param.h Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/dev/mlx4/mlx4_core/mlx4.h ============================================================================== --- stable/12/sys/dev/mlx4/mlx4_core/mlx4.h Thu May 16 16:43:16 2019 (r347789) +++ stable/12/sys/dev/mlx4/mlx4_core/mlx4.h Thu May 16 16:44:40 2019 (r347790) @@ -53,8 +53,8 @@ #define DRV_NAME "mlx4_core" #define PFX DRV_NAME ": " -#define DRV_VERSION "3.5.0" -#define DRV_RELDATE "November 2018" +#define DRV_VERSION "3.5.1" +#define DRV_RELDATE "April 2019" #define MLX4_FS_UDP_UC_EN (1 << 1) #define MLX4_FS_TCP_UC_EN (1 << 2) Modified: stable/12/sys/dev/mlx4/mlx4_ib/mlx4_ib_main.c ============================================================================== --- stable/12/sys/dev/mlx4/mlx4_ib/mlx4_ib_main.c Thu May 16 16:43:16 2019 (r347789) +++ stable/12/sys/dev/mlx4/mlx4_ib/mlx4_ib_main.c Thu May 16 16:44:40 2019 (r347790) @@ -64,9 +64,9 @@ #define DRV_NAME MLX4_IB_DRV_NAME #ifndef DRV_VERSION -#define DRV_VERSION "3.5.0" +#define DRV_VERSION "3.5.1" #endif -#define DRV_RELDATE "November 2018" +#define DRV_RELDATE "April 2019" #define MLX4_IB_FLOW_MAX_PRIO 0xFFF #define MLX4_IB_FLOW_QPN_MASK 0xFFFFFF Modified: stable/12/sys/dev/mlx5/mlx5_core/mlx5_core.h ============================================================================== --- stable/12/sys/dev/mlx5/mlx5_core/mlx5_core.h Thu May 16 16:43:16 2019 (r347789) +++ stable/12/sys/dev/mlx5/mlx5_core/mlx5_core.h Thu May 16 16:44:40 2019 (r347790) @@ -36,9 +36,9 @@ #define DRIVER_NAME "mlx5_core" #ifndef DRIVER_VERSION -#define DRIVER_VERSION "3.5.0" +#define DRIVER_VERSION "3.5.1" #endif -#define DRIVER_RELDATE "November 2018" +#define DRIVER_RELDATE "April 2019" extern int mlx5_core_debug_mask; Modified: stable/12/sys/dev/mlx5/mlx5_en/mlx5_en_main.c ============================================================================== --- stable/12/sys/dev/mlx5/mlx5_en/mlx5_en_main.c Thu May 16 16:43:16 2019 (r347789) +++ stable/12/sys/dev/mlx5/mlx5_en/mlx5_en_main.c Thu May 16 16:44:40 2019 (r347790) @@ -31,9 +31,9 @@ #include #ifndef ETH_DRIVER_VERSION -#define ETH_DRIVER_VERSION "3.5.0" +#define ETH_DRIVER_VERSION "3.5.1" #endif -#define DRIVER_RELDATE "November 2018" +#define DRIVER_RELDATE "April 2019" static const char mlx5e_version[] = "mlx5en: Mellanox Ethernet driver " ETH_DRIVER_VERSION " (" DRIVER_RELDATE ")\n"; Modified: stable/12/sys/dev/mlx5/mlx5_ib/mlx5_ib_main.c ============================================================================== --- stable/12/sys/dev/mlx5/mlx5_ib/mlx5_ib_main.c Thu May 16 16:43:16 2019 (r347789) +++ stable/12/sys/dev/mlx5/mlx5_ib/mlx5_ib_main.c Thu May 16 16:44:40 2019 (r347790) @@ -52,9 +52,9 @@ #define DRIVER_NAME "mlx5ib" #ifndef DRIVER_VERSION -#define DRIVER_VERSION "3.5.0" +#define DRIVER_VERSION "3.5.1" #endif -#define DRIVER_RELDATE "November 2018" +#define DRIVER_RELDATE "April 2019" MODULE_DESCRIPTION("Mellanox Connect-IB HCA IB driver"); MODULE_LICENSE("Dual BSD/GPL"); Modified: stable/12/sys/sys/param.h ============================================================================== --- stable/12/sys/sys/param.h Thu May 16 16:43:16 2019 (r347789) +++ stable/12/sys/sys/param.h Thu May 16 16:44:40 2019 (r347790) @@ -60,7 +60,7 @@ * in the range 5 to 9. */ #undef __FreeBSD_version -#define __FreeBSD_version 1200508 /* Master, propagated to newvers */ +#define __FreeBSD_version 1200509 /* Master, propagated to newvers */ /* * __FreeBSD_kernel__ indicates that this system uses the kernel of FreeBSD, From owner-svn-src-stable@freebsd.org Thu May 16 17:01:40 2019 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 4A0EE159F12D; Thu, 16 May 2019 17:01:40 +0000 (UTC) (envelope-from hselasky@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 DE4B08C717; Thu, 16 May 2019 17:01:39 +0000 (UTC) (envelope-from hselasky@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 B98E223AEC; Thu, 16 May 2019 17:01:39 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x4GH1dNj089363; Thu, 16 May 2019 17:01:39 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x4GH1dhL089361; Thu, 16 May 2019 17:01:39 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201905161701.x4GH1dhL089361@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Thu, 16 May 2019 17:01:39 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r347791 - in stable/11/sys/compat/linuxkpi/common: include/linux src X-SVN-Group: stable-11 X-SVN-Commit-Author: hselasky X-SVN-Commit-Paths: in stable/11/sys/compat/linuxkpi/common: include/linux src X-SVN-Commit-Revision: 347791 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: DE4B08C717 X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.98 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_SHORT(-0.99)[-0.985,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US]; NEURAL_HAM_MEDIUM(-1.00)[-0.998,0]; NEURAL_HAM_LONG(-1.00)[-1.000,0] X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 16 May 2019 17:01:40 -0000 Author: hselasky Date: Thu May 16 17:01:39 2019 New Revision: 347791 URL: https://svnweb.freebsd.org/changeset/base/347791 Log: MFC r347185: Allow controlling pr_debug at runtime in the LinuxKPI. Turning on pr_debug at compile time make it non-optional at runtime. This often means that the amount of the debugging is unbearable. Allow developer to turn on pr_debug output only when needed. Build tested drm-current-kmod prior to commit. Submitted by: kib@ Sponsored by: Mellanox Technologies Modified: stable/11/sys/compat/linuxkpi/common/include/linux/kernel.h stable/11/sys/compat/linuxkpi/common/src/linux_compat.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/compat/linuxkpi/common/include/linux/kernel.h ============================================================================== --- stable/11/sys/compat/linuxkpi/common/include/linux/kernel.h Thu May 16 16:44:40 2019 (r347790) +++ stable/11/sys/compat/linuxkpi/common/include/linux/kernel.h Thu May 16 17:01:39 2019 (r347791) @@ -177,8 +177,12 @@ scnprintf(char *buf, size_t size, const char *fmt, ... * unless DEBUG is defined: */ #ifdef DEBUG -#define pr_debug(fmt, ...) \ - log(LOG_DEBUG, fmt, ##__VA_ARGS__) +extern int linuxkpi_debug; +#define pr_debug(fmt, ...) \ + do { \ + if (linuxkpi_debug) \ + log(LOG_DEBUG, fmt, ##__VA_ARGS__); \ + } while (0) #define pr_devel(fmt, ...) \ log(LOG_DEBUG, pr_fmt(fmt), ##__VA_ARGS__) #else Modified: stable/11/sys/compat/linuxkpi/common/src/linux_compat.c ============================================================================== --- stable/11/sys/compat/linuxkpi/common/src/linux_compat.c Thu May 16 16:44:40 2019 (r347790) +++ stable/11/sys/compat/linuxkpi/common/src/linux_compat.c Thu May 16 17:01:39 2019 (r347791) @@ -92,6 +92,10 @@ __FBSDID("$FreeBSD$"); SYSCTL_NODE(_compat, OID_AUTO, linuxkpi, CTLFLAG_RW, 0, "LinuxKPI parameters"); +int linuxkpi_debug; +SYSCTL_INT(_compat_linuxkpi, OID_AUTO, debug, CTLFLAG_RWTUN, + &linuxkpi_debug, 0, "Set to enable pr_debug() prints. Clear to disable."); + MALLOC_DEFINE(M_KMALLOC, "linux", "Linux kmalloc compat"); #include From owner-svn-src-stable@freebsd.org Thu May 16 17:02:32 2019 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 65FC9159F199; Thu, 16 May 2019 17:02:32 +0000 (UTC) (envelope-from hselasky@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 073038C8E6; Thu, 16 May 2019 17:02:32 +0000 (UTC) (envelope-from hselasky@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 EEB5423C31; Thu, 16 May 2019 17:02:31 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x4GH2Voo092427; Thu, 16 May 2019 17:02:31 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x4GH2VLM092426; Thu, 16 May 2019 17:02:31 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201905161702.x4GH2VLM092426@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Thu, 16 May 2019 17:02:31 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r347792 - stable/11/sys/compat/linuxkpi/common/include/linux X-SVN-Group: stable-11 X-SVN-Commit-Author: hselasky X-SVN-Commit-Paths: stable/11/sys/compat/linuxkpi/common/include/linux X-SVN-Commit-Revision: 347792 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 073038C8E6 X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.98 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.998,0]; NEURAL_HAM_SHORT(-0.99)[-0.985,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US]; NEURAL_HAM_LONG(-1.00)[-1.000,0] X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 16 May 2019 17:02:32 -0000 Author: hselasky Date: Thu May 16 17:02:31 2019 New Revision: 347792 URL: https://svnweb.freebsd.org/changeset/base/347792 Log: MFC r347187: Implement print_hex_dump_debug() function macro in the LinuxKPI. Build tested drm-current-kmod prior to commit. Submitted by: slavash@ Sponsored by: Mellanox Technologies Modified: stable/11/sys/compat/linuxkpi/common/include/linux/printk.h Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/compat/linuxkpi/common/include/linux/printk.h ============================================================================== --- stable/11/sys/compat/linuxkpi/common/include/linux/printk.h Thu May 16 17:01:39 2019 (r347791) +++ stable/11/sys/compat/linuxkpi/common/include/linux/printk.h Thu May 16 17:02:31 2019 (r347792) @@ -121,6 +121,9 @@ print_hex_dump_bytes(const char *prefix_str, const int #define pr_err_ratelimited(fmt, ...) \ printk_ratelimited(KERN_ERR pr_fmt(fmt), ##__VA_ARGS__) +#define print_hex_dump_debug(...) \ + print_hex_dump(KERN_DEBUG, ##__VA_ARGS__) + #define pr_info_ratelimited(fmt, ...) \ printk_ratelimited(KERN_INFO pr_fmt(fmt), ##__VA_ARGS__) From owner-svn-src-stable@freebsd.org Thu May 16 17:03:17 2019 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 46D75159F221; Thu, 16 May 2019 17:03:17 +0000 (UTC) (envelope-from hselasky@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 E3EE88CA2B; Thu, 16 May 2019 17:03:16 +0000 (UTC) (envelope-from hselasky@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 BD11923C33; Thu, 16 May 2019 17:03:16 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x4GH3GZM092520; Thu, 16 May 2019 17:03:16 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x4GH3Gkj092519; Thu, 16 May 2019 17:03:16 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201905161703.x4GH3Gkj092519@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Thu, 16 May 2019 17:03:16 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r347793 - stable/11/sys/compat/linuxkpi/common/include/linux X-SVN-Group: stable-11 X-SVN-Commit-Author: hselasky X-SVN-Commit-Paths: stable/11/sys/compat/linuxkpi/common/include/linux X-SVN-Commit-Revision: 347793 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: E3EE88CA2B X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.98 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.998,0]; NEURAL_HAM_SHORT(-0.99)[-0.985,0]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US] X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 16 May 2019 17:03:17 -0000 Author: hselasky Date: Thu May 16 17:03:16 2019 New Revision: 347793 URL: https://svnweb.freebsd.org/changeset/base/347793 Log: MFC r347188: Disabling a PCI device should only disable busmaster in the LinuxKPI. As Linux comment for this function point: Signal to the system that the PCI device is not in use by the system anymore. This only involves disabling PCI bus-mastering, if active. Build tested drm-current-kmod prior to commit. Submitted by: slavash@ Sponsored by: Mellanox Technologies Modified: stable/11/sys/compat/linuxkpi/common/include/linux/pci.h Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/compat/linuxkpi/common/include/linux/pci.h ============================================================================== --- stable/11/sys/compat/linuxkpi/common/include/linux/pci.h Thu May 16 17:02:31 2019 (r347792) +++ stable/11/sys/compat/linuxkpi/common/include/linux/pci.h Thu May 16 17:03:16 2019 (r347793) @@ -342,8 +342,6 @@ static inline void pci_disable_device(struct pci_dev *pdev) { - pci_disable_io(pdev->dev.bsddev, SYS_RES_IOPORT); - pci_disable_io(pdev->dev.bsddev, SYS_RES_MEMORY); pci_disable_busmaster(pdev->dev.bsddev); } From owner-svn-src-stable@freebsd.org Thu May 16 17:04:16 2019 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 912C8159F432; Thu, 16 May 2019 17:04:16 +0000 (UTC) (envelope-from hselasky@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 2D4498CC29; Thu, 16 May 2019 17:04:16 +0000 (UTC) (envelope-from hselasky@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 B03B623C34; Thu, 16 May 2019 17:04:15 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x4GH4FLi092633; Thu, 16 May 2019 17:04:15 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x4GH4FHP092632; Thu, 16 May 2019 17:04:15 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201905161704.x4GH4FHP092632@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Thu, 16 May 2019 17:04:15 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r347794 - stable/11/sys/compat/linuxkpi/common/include/linux X-SVN-Group: stable-11 X-SVN-Commit-Author: hselasky X-SVN-Commit-Paths: stable/11/sys/compat/linuxkpi/common/include/linux X-SVN-Commit-Revision: 347794 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 2D4498CC29 X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.98 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.998,0]; NEURAL_HAM_SHORT(-0.99)[-0.985,0]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US] X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 16 May 2019 17:04:16 -0000 Author: hselasky Date: Thu May 16 17:04:15 2019 New Revision: 347794 URL: https://svnweb.freebsd.org/changeset/base/347794 Log: MFC r347190: Use PCIV_INVALID in pci_channel_offline() in the LinuxKPI. Build tested drm-current-kmod prior to commit. Submitted by: slavash@ Sponsored by: Mellanox Technologies Modified: stable/11/sys/compat/linuxkpi/common/include/linux/pci.h Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/compat/linuxkpi/common/include/linux/pci.h ============================================================================== --- stable/11/sys/compat/linuxkpi/common/include/linux/pci.h Thu May 16 17:03:16 2019 (r347793) +++ stable/11/sys/compat/linuxkpi/common/include/linux/pci.h Thu May 16 17:04:15 2019 (r347794) @@ -603,7 +603,7 @@ static inline int pci_channel_offline(struct pci_dev *pdev) { - return (pci_get_vendor(pdev->dev.bsddev) == 0xffff); + return (pci_get_vendor(pdev->dev.bsddev) == PCIV_INVALID); } static inline int pci_enable_sriov(struct pci_dev *dev, int nr_virtfn) From owner-svn-src-stable@freebsd.org Thu May 16 17:09:08 2019 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 6DF8A159F73A; Thu, 16 May 2019 17:09:08 +0000 (UTC) (envelope-from hselasky@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 0C1188D071; Thu, 16 May 2019 17:09:08 +0000 (UTC) (envelope-from hselasky@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 BAD7D23C37; Thu, 16 May 2019 17:09:07 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x4GH97wf092939; Thu, 16 May 2019 17:09:07 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x4GH96BT092931; Thu, 16 May 2019 17:09:06 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201905161709.x4GH96BT092931@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Thu, 16 May 2019 17:09:06 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r347796 - in stable/11/sys: compat/linuxkpi/common/include/linux conf dev/mlx5/mlx5_en modules/mlx5en X-SVN-Group: stable-11 X-SVN-Commit-Author: hselasky X-SVN-Commit-Paths: in stable/11/sys: compat/linuxkpi/common/include/linux conf dev/mlx5/mlx5_en modules/mlx5en X-SVN-Commit-Revision: 347796 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 0C1188D071 X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.99 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.998,0]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; NEURAL_HAM_SHORT(-0.99)[-0.988,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US] X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 16 May 2019 17:09:08 -0000 Author: hselasky Date: Thu May 16 17:09:06 2019 New Revision: 347796 URL: https://svnweb.freebsd.org/changeset/base/347796 Log: MFC r347246: Add support for Dynamic Interrupt Moderation, DIM, in mlx5en(4). Add support for DIM based on Linux, with some minor adaptions specific to FreeBSD. Linux commit f97c3dc3c0e8d23a5c4357d182afeef4c67f5c33 Sponsored by: Mellanox Technologies Added: stable/11/sys/compat/linuxkpi/common/include/linux/net_dim.h - copied unchanged from r347246, head/sys/compat/linuxkpi/common/include/linux/net_dim.h stable/11/sys/dev/mlx5/mlx5_en/mlx5_en_dim.c - copied unchanged from r347246, head/sys/dev/mlx5/mlx5_en/mlx5_en_dim.c Modified: stable/11/sys/conf/files stable/11/sys/dev/mlx5/mlx5_en/en.h stable/11/sys/dev/mlx5/mlx5_en/mlx5_en_ethtool.c stable/11/sys/dev/mlx5/mlx5_en/mlx5_en_main.c stable/11/sys/dev/mlx5/mlx5_en/mlx5_en_rx.c stable/11/sys/modules/mlx5en/Makefile Directory Properties: stable/11/ (props changed) Copied: stable/11/sys/compat/linuxkpi/common/include/linux/net_dim.h (from r347246, head/sys/compat/linuxkpi/common/include/linux/net_dim.h) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/11/sys/compat/linuxkpi/common/include/linux/net_dim.h Thu May 16 17:09:06 2019 (r347796, copy of r347246, head/sys/compat/linuxkpi/common/include/linux/net_dim.h) @@ -0,0 +1,410 @@ +/*- + * SPDX-License-Identifier: BSD-2-Clause OR GPL-2.0 + * + * Copyright (c) 2016, Mellanox Technologies. All rights reserved. + * Copyright (c) 2017-2018, Broadcom Limited. All rights reserved. + * + * This software is available to you under a choice of one of two + * licenses. You may choose to be licensed under the terms of the GNU + * General Public License (GPL) Version 2, available from the file + * COPYING in the main directory of this source tree, or the + * OpenIB.org BSD license below: + * + * Redistribution and use in source and binary forms, with or + * without modification, are permitted provided that the following + * conditions are met: + * + * - Redistributions of source code must retain the above + * copyright notice, this list of conditions and the following + * disclaimer. + * + * - Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following + * disclaimer in the documentation and/or other materials + * provided with the distribution. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS + * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN + * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + * $FreeBSD$ + */ + +/* This file implements Dynamic Interrupt Moderation, DIM */ + +#ifndef NET_DIM_H +#define NET_DIM_H + +#include + +#include +#include + +struct net_dim_cq_moder { + u16 usec; + u16 pkts; + u8 cq_period_mode; +}; + +struct net_dim_sample { + ktime_t time; + u32 pkt_ctr; + u32 byte_ctr; + u16 event_ctr; +}; + +struct net_dim_stats { + int ppms; /* packets per msec */ + int bpms; /* bytes per msec */ + int epms; /* events per msec */ +}; + +struct net_dim { /* Adaptive Moderation */ + u8 state; + struct net_dim_stats prev_stats; + struct net_dim_sample start_sample; + struct work_struct work; + u16 event_ctr; + u8 profile_ix; + u8 mode; + u8 tune_state; + u8 steps_right; + u8 steps_left; + u8 tired; +}; + +enum { + NET_DIM_CQ_PERIOD_MODE_START_FROM_EQE = 0x0, + NET_DIM_CQ_PERIOD_MODE_START_FROM_CQE = 0x1, + NET_DIM_CQ_PERIOD_NUM_MODES = 0x2, + NET_DIM_CQ_PERIOD_MODE_DISABLED = 0xFF, +}; + +/* Adaptive moderation logic */ +enum { + NET_DIM_START_MEASURE, + NET_DIM_MEASURE_IN_PROGRESS, + NET_DIM_APPLY_NEW_PROFILE, +}; + +enum { + NET_DIM_PARKING_ON_TOP, + NET_DIM_PARKING_TIRED, + NET_DIM_GOING_RIGHT, + NET_DIM_GOING_LEFT, +}; + +enum { + NET_DIM_STATS_WORSE, + NET_DIM_STATS_SAME, + NET_DIM_STATS_BETTER, +}; + +enum { + NET_DIM_STEPPED, + NET_DIM_TOO_TIRED, + NET_DIM_ON_EDGE, +}; + +#define NET_DIM_PARAMS_NUM_PROFILES 5 +/* Adaptive moderation profiles */ +#define NET_DIM_DEFAULT_RX_CQ_MODERATION_PKTS_FROM_EQE 256 +#define NET_DIM_DEF_PROFILE_CQE 1 +#define NET_DIM_DEF_PROFILE_EQE 1 + +/* All profiles sizes must be NET_PARAMS_DIM_NUM_PROFILES */ +#define NET_DIM_EQE_PROFILES { \ + {1, NET_DIM_DEFAULT_RX_CQ_MODERATION_PKTS_FROM_EQE}, \ + {8, NET_DIM_DEFAULT_RX_CQ_MODERATION_PKTS_FROM_EQE}, \ + {64, NET_DIM_DEFAULT_RX_CQ_MODERATION_PKTS_FROM_EQE}, \ + {128, NET_DIM_DEFAULT_RX_CQ_MODERATION_PKTS_FROM_EQE}, \ + {256, NET_DIM_DEFAULT_RX_CQ_MODERATION_PKTS_FROM_EQE}, \ +} + +#define NET_DIM_CQE_PROFILES { \ + {2, 256}, \ + {8, 128}, \ + {16, 64}, \ + {32, 64}, \ + {64, 64} \ +} + +static const struct net_dim_cq_moder + net_dim_profile[NET_DIM_CQ_PERIOD_NUM_MODES][NET_DIM_PARAMS_NUM_PROFILES] = { + NET_DIM_EQE_PROFILES, + NET_DIM_CQE_PROFILES, +}; + +static inline struct net_dim_cq_moder +net_dim_get_profile(u8 cq_period_mode, + int ix) +{ + struct net_dim_cq_moder cq_moder; + + cq_moder = net_dim_profile[cq_period_mode][ix]; + cq_moder.cq_period_mode = cq_period_mode; + return cq_moder; +} + +static inline struct net_dim_cq_moder +net_dim_get_def_profile(u8 rx_cq_period_mode) +{ + int default_profile_ix; + + if (rx_cq_period_mode == NET_DIM_CQ_PERIOD_MODE_START_FROM_CQE) + default_profile_ix = NET_DIM_DEF_PROFILE_CQE; + else /* NET_DIM_CQ_PERIOD_MODE_START_FROM_EQE */ + default_profile_ix = NET_DIM_DEF_PROFILE_EQE; + + return net_dim_get_profile(rx_cq_period_mode, default_profile_ix); +} + +static inline bool +net_dim_on_top(struct net_dim *dim) +{ + switch (dim->tune_state) { + case NET_DIM_PARKING_ON_TOP: + case NET_DIM_PARKING_TIRED: + return true; + case NET_DIM_GOING_RIGHT: + return (dim->steps_left > 1) && (dim->steps_right == 1); + default: /* NET_DIM_GOING_LEFT */ + return (dim->steps_right > 1) && (dim->steps_left == 1); + } +} + +static inline void +net_dim_turn(struct net_dim *dim) +{ + switch (dim->tune_state) { + case NET_DIM_PARKING_ON_TOP: + case NET_DIM_PARKING_TIRED: + break; + case NET_DIM_GOING_RIGHT: + dim->tune_state = NET_DIM_GOING_LEFT; + dim->steps_left = 0; + break; + case NET_DIM_GOING_LEFT: + dim->tune_state = NET_DIM_GOING_RIGHT; + dim->steps_right = 0; + break; + } +} + +static inline int +net_dim_step(struct net_dim *dim) +{ + if (dim->tired == (NET_DIM_PARAMS_NUM_PROFILES * 2)) + return NET_DIM_TOO_TIRED; + + switch (dim->tune_state) { + case NET_DIM_PARKING_ON_TOP: + case NET_DIM_PARKING_TIRED: + break; + case NET_DIM_GOING_RIGHT: + if (dim->profile_ix == (NET_DIM_PARAMS_NUM_PROFILES - 1)) + return NET_DIM_ON_EDGE; + dim->profile_ix++; + dim->steps_right++; + break; + case NET_DIM_GOING_LEFT: + if (dim->profile_ix == 0) + return NET_DIM_ON_EDGE; + dim->profile_ix--; + dim->steps_left++; + break; + } + + dim->tired++; + return NET_DIM_STEPPED; +} + +static inline void +net_dim_park_on_top(struct net_dim *dim) +{ + dim->steps_right = 0; + dim->steps_left = 0; + dim->tired = 0; + dim->tune_state = NET_DIM_PARKING_ON_TOP; +} + +static inline void +net_dim_park_tired(struct net_dim *dim) +{ + dim->steps_right = 0; + dim->steps_left = 0; + dim->tune_state = NET_DIM_PARKING_TIRED; +} + +static inline void +net_dim_exit_parking(struct net_dim *dim) +{ + dim->tune_state = dim->profile_ix ? NET_DIM_GOING_LEFT : + NET_DIM_GOING_RIGHT; + net_dim_step(dim); +} + +#define IS_SIGNIFICANT_DIFF(val, ref) \ + (((100UL * abs((val) - (ref))) / (ref)) > 10) /* more than 10% + * difference */ + +static inline int +net_dim_stats_compare(struct net_dim_stats *curr, + struct net_dim_stats *prev) +{ + if (!prev->bpms) + return curr->bpms ? NET_DIM_STATS_BETTER : + NET_DIM_STATS_SAME; + + if (IS_SIGNIFICANT_DIFF(curr->bpms, prev->bpms)) + return (curr->bpms > prev->bpms) ? NET_DIM_STATS_BETTER : + NET_DIM_STATS_WORSE; + + if (!prev->ppms) + return curr->ppms ? NET_DIM_STATS_BETTER : + NET_DIM_STATS_SAME; + + if (IS_SIGNIFICANT_DIFF(curr->ppms, prev->ppms)) + return (curr->ppms > prev->ppms) ? NET_DIM_STATS_BETTER : + NET_DIM_STATS_WORSE; + + if (!prev->epms) + return NET_DIM_STATS_SAME; + + if (IS_SIGNIFICANT_DIFF(curr->epms, prev->epms)) + return (curr->epms < prev->epms) ? NET_DIM_STATS_BETTER : + NET_DIM_STATS_WORSE; + + return NET_DIM_STATS_SAME; +} + +static inline bool +net_dim_decision(struct net_dim_stats *curr_stats, + struct net_dim *dim) +{ + int prev_state = dim->tune_state; + int prev_ix = dim->profile_ix; + int stats_res; + int step_res; + + switch (dim->tune_state) { + case NET_DIM_PARKING_ON_TOP: + stats_res = net_dim_stats_compare(curr_stats, &dim->prev_stats); + if (stats_res != NET_DIM_STATS_SAME) + net_dim_exit_parking(dim); + break; + + case NET_DIM_PARKING_TIRED: + dim->tired--; + if (!dim->tired) + net_dim_exit_parking(dim); + break; + + case NET_DIM_GOING_RIGHT: + case NET_DIM_GOING_LEFT: + stats_res = net_dim_stats_compare(curr_stats, &dim->prev_stats); + if (stats_res != NET_DIM_STATS_BETTER) + net_dim_turn(dim); + + if (net_dim_on_top(dim)) { + net_dim_park_on_top(dim); + break; + } + step_res = net_dim_step(dim); + switch (step_res) { + case NET_DIM_ON_EDGE: + net_dim_park_on_top(dim); + break; + case NET_DIM_TOO_TIRED: + net_dim_park_tired(dim); + break; + } + + break; + } + + if ((prev_state != NET_DIM_PARKING_ON_TOP) || + (dim->tune_state != NET_DIM_PARKING_ON_TOP)) + dim->prev_stats = *curr_stats; + + return dim->profile_ix != prev_ix; +} + +static inline void +net_dim_sample(u16 event_ctr, + u64 packets, + u64 bytes, + struct net_dim_sample *s) +{ + s->time = ktime_get(); + s->pkt_ctr = packets; + s->byte_ctr = bytes; + s->event_ctr = event_ctr; +} + +#define NET_DIM_NEVENTS 64 +#define BIT_GAP(bits, end, start) ((((end) - (start)) + BIT_ULL(bits)) & (BIT_ULL(bits) - 1)) + +static inline void +net_dim_calc_stats(struct net_dim_sample *start, + struct net_dim_sample *end, + struct net_dim_stats *curr_stats) +{ + /* u32 holds up to 71 minutes, should be enough */ + u32 delta_us = ktime_us_delta(end->time, start->time); + u32 npkts = BIT_GAP(BITS_PER_TYPE(u32), end->pkt_ctr, start->pkt_ctr); + u32 nbytes = BIT_GAP(BITS_PER_TYPE(u32), end->byte_ctr, + start->byte_ctr); + + if (!delta_us) + return; + + curr_stats->ppms = DIV_ROUND_UP(npkts * USEC_PER_MSEC, delta_us); + curr_stats->bpms = DIV_ROUND_UP(nbytes * USEC_PER_MSEC, delta_us); + curr_stats->epms = DIV_ROUND_UP(NET_DIM_NEVENTS * USEC_PER_MSEC, + delta_us); +} + +static inline void +net_dim(struct net_dim *dim, + u64 packets, u64 bytes) +{ + struct net_dim_stats curr_stats; + struct net_dim_sample end_sample; + u16 nevents; + + dim->event_ctr++; + + switch (dim->state) { + case NET_DIM_MEASURE_IN_PROGRESS: + nevents = BIT_GAP(BITS_PER_TYPE(u16), + dim->event_ctr, + dim->start_sample.event_ctr); + if (nevents < NET_DIM_NEVENTS) + break; + net_dim_sample(dim->event_ctr, packets, bytes, &end_sample); + net_dim_calc_stats(&dim->start_sample, &end_sample, + &curr_stats); + if (net_dim_decision(&curr_stats, dim)) { + dim->state = NET_DIM_APPLY_NEW_PROFILE; + schedule_work(&dim->work); + break; + } + /* FALLTHROUGH */ + case NET_DIM_START_MEASURE: + net_dim_sample(dim->event_ctr, packets, bytes, &dim->start_sample); + dim->state = NET_DIM_MEASURE_IN_PROGRESS; + break; + case NET_DIM_APPLY_NEW_PROFILE: + break; + default: + break; + } +} + +#endif /* NET_DIM_H */ Modified: stable/11/sys/conf/files ============================================================================== --- stable/11/sys/conf/files Thu May 16 17:04:29 2019 (r347795) +++ stable/11/sys/conf/files Thu May 16 17:09:06 2019 (r347796) @@ -4606,6 +4606,8 @@ dev/mlx5/mlx5_core/mlx5_wq.c optional mlx5 pci \ dev/mlx5/mlx5_lib/mlx5_gid.c optional mlx5 pci \ compile-with "${OFED_C}" +dev/mlx5/mlx5_en/mlx5_en_dim.c optional mlx5en pci inet inet6 \ + compile-with "${OFED_C}" dev/mlx5/mlx5_en/mlx5_en_ethtool.c optional mlx5en pci inet inet6 \ compile-with "${OFED_C}" dev/mlx5/mlx5_en/mlx5_en_main.c optional mlx5en pci inet inet6 \ Modified: stable/11/sys/dev/mlx5/mlx5_en/en.h ============================================================================== --- stable/11/sys/dev/mlx5/mlx5_en/en.h Thu May 16 17:04:29 2019 (r347795) +++ stable/11/sys/dev/mlx5/mlx5_en/en.h Thu May 16 17:09:06 2019 (r347796) @@ -1,5 +1,5 @@ /*- - * Copyright (c) 2015 Mellanox Technologies. All rights reserved. + * Copyright (c) 2015-2018 Mellanox Technologies. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -38,6 +38,8 @@ #include #include #include +#include +#include #include #include @@ -93,6 +95,8 @@ #define MLX5E_PARAMS_DEFAULT_LRO_WQE_SZ \ MIN(65535, MLX5E_MAX_RX_SEGS * MLX5E_MAX_RX_BYTES) #endif +#define MLX5E_DIM_DEFAULT_PROFILE 3 +#define MLX5E_DIM_MAX_RX_CQ_MODERATION_PKTS_WITH_LRO 16 #define MLX5E_PARAMS_DEFAULT_RX_CQ_MODERATION_USEC 0x10 #define MLX5E_PARAMS_DEFAULT_RX_CQ_MODERATION_USEC_FROM_CQE 0x3 #define MLX5E_PARAMS_DEFAULT_RX_CQ_MODERATION_PKTS 0x20 @@ -470,7 +474,7 @@ struct mlx5e_params { m(+1, u64 coalesce_pkts_max, "coalesce_pkts_max", "Maximum packets to join") \ m(+1, u64 rx_coalesce_usecs, "rx_coalesce_usecs", "Limit in usec for joining rx packets") \ m(+1, u64 rx_coalesce_pkts, "rx_coalesce_pkts", "Maximum number of rx packets to join") \ - m(+1, u64 rx_coalesce_mode, "rx_coalesce_mode", "0: EQE mode 1: CQE mode") \ + m(+1, u64 rx_coalesce_mode, "rx_coalesce_mode", "0: EQE fixed mode 1: CQE fixed mode 2: EQE auto mode 3: CQE auto mode") \ m(+1, u64 tx_coalesce_usecs, "tx_coalesce_usecs", "Limit in usec for joining tx packets") \ m(+1, u64 tx_coalesce_pkts, "tx_coalesce_pkts", "Maximum number of tx packets to join") \ m(+1, u64 tx_coalesce_mode, "tx_coalesce_mode", "0: EQE mode 1: CQE mode") \ @@ -560,6 +564,9 @@ struct mlx5e_rq { volatile int enabled; int ix; + /* Dynamic Interrupt Moderation */ + struct net_dim dim; + /* control */ struct mlx5_wq_ctrl wq_ctrl; u32 rqn; @@ -833,6 +840,9 @@ void mlx5e_cq_error_event(struct mlx5_core_cq *mcq, in void mlx5e_rx_cq_comp(struct mlx5_core_cq *); void mlx5e_tx_cq_comp(struct mlx5_core_cq *); struct mlx5_cqe64 *mlx5e_get_cqe(struct mlx5e_cq *cq); + +void mlx5e_dim_work(struct work_struct *); +void mlx5e_dim_build_cq_param(struct mlx5e_priv *, struct mlx5e_cq_param *); int mlx5e_open_flow_table(struct mlx5e_priv *priv); void mlx5e_close_flow_table(struct mlx5e_priv *priv); Copied: stable/11/sys/dev/mlx5/mlx5_en/mlx5_en_dim.c (from r347246, head/sys/dev/mlx5/mlx5_en/mlx5_en_dim.c) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/11/sys/dev/mlx5/mlx5_en/mlx5_en_dim.c Thu May 16 17:09:06 2019 (r347796, copy of r347246, head/sys/dev/mlx5/mlx5_en/mlx5_en_dim.c) @@ -0,0 +1,92 @@ +/*- + * Copyright (c) 2018 Mellanox Technologies. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY AUTHOR AND CONTRIBUTORS `AS IS' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * $FreeBSD$ + */ + +#include "en.h" + +void +mlx5e_dim_build_cq_param(struct mlx5e_priv *priv, + struct mlx5e_cq_param *param) +{ + struct net_dim_cq_moder prof; + void *cqc = param->cqc; + + if (priv->params.rx_cq_moderation_mode < 2) + return; + + switch (MLX5_GET(cqc, cqc, cq_period_mode)) { + case MLX5_CQ_PERIOD_MODE_START_FROM_CQE: + prof = net_dim_profile[NET_DIM_CQ_PERIOD_MODE_START_FROM_CQE] + [NET_DIM_DEF_PROFILE_CQE]; + MLX5_SET(cqc, cqc, cq_period, prof.usec); + MLX5_SET(cqc, cqc, cq_max_count, prof.pkts); + break; + + case MLX5_CQ_PERIOD_MODE_START_FROM_EQE: + prof = net_dim_profile[NET_DIM_CQ_PERIOD_MODE_START_FROM_EQE] + [NET_DIM_DEF_PROFILE_EQE]; + MLX5_SET(cqc, cqc, cq_period, prof.usec); + MLX5_SET(cqc, cqc, cq_max_count, prof.pkts); + break; + default: + break; + } +} + +void +mlx5e_dim_work(struct work_struct *work) +{ + struct net_dim *dim = container_of(work, struct net_dim, work); + struct mlx5e_rq *rq = container_of(dim, struct mlx5e_rq, dim); + struct mlx5e_channel *c = container_of(rq, struct mlx5e_channel, rq); + struct net_dim_cq_moder cur_profile; + u8 profile_ix; + u8 mode; + + /* copy current auto moderation settings and set new state */ + mtx_lock(&rq->mtx); + profile_ix = dim->profile_ix; + mode = dim->mode; + dim->state = NET_DIM_START_MEASURE; + mtx_unlock(&rq->mtx); + + /* check for invalid mode */ + if (mode == 255) + return; + + /* get current profile */ + cur_profile = net_dim_profile[mode][profile_ix]; + + /* apply LRO restrictions */ + if (c->priv->params.hw_lro_en && + cur_profile.pkts > MLX5E_DIM_MAX_RX_CQ_MODERATION_PKTS_WITH_LRO) { + cur_profile.pkts = MLX5E_DIM_MAX_RX_CQ_MODERATION_PKTS_WITH_LRO; + } + + /* modify CQ */ + mlx5_core_modify_cq_moderation(c->priv->mdev, &rq->cq.mcq, + cur_profile.usec, cur_profile.pkts); +} Modified: stable/11/sys/dev/mlx5/mlx5_en/mlx5_en_ethtool.c ============================================================================== --- stable/11/sys/dev/mlx5/mlx5_en/mlx5_en_ethtool.c Thu May 16 17:04:29 2019 (r347795) +++ stable/11/sys/dev/mlx5/mlx5_en/mlx5_en_ethtool.c Thu May 16 17:09:06 2019 (r347796) @@ -629,8 +629,8 @@ mlx5e_ethtool_handler(SYSCTL_HANDLER_ARGS) mlx5e_close_locked(priv->ifp); /* import RX coalesce mode */ - if (priv->params_ethtool.rx_coalesce_mode != 0) - priv->params_ethtool.rx_coalesce_mode = 1; + if (priv->params_ethtool.rx_coalesce_mode > 3) + priv->params_ethtool.rx_coalesce_mode = 3; priv->params.rx_cq_moderation_mode = priv->params_ethtool.rx_coalesce_mode; Modified: stable/11/sys/dev/mlx5/mlx5_en/mlx5_en_main.c ============================================================================== --- stable/11/sys/dev/mlx5/mlx5_en/mlx5_en_main.c Thu May 16 17:04:29 2019 (r347795) +++ stable/11/sys/dev/mlx5/mlx5_en/mlx5_en_main.c Thu May 16 17:09:06 2019 (r347796) @@ -812,6 +812,26 @@ mlx5e_create_rq(struct mlx5e_channel *c, #endif } + INIT_WORK(&rq->dim.work, mlx5e_dim_work); + if (priv->params.rx_cq_moderation_mode < 2) { + rq->dim.mode = NET_DIM_CQ_PERIOD_MODE_DISABLED; + } else { + void *cqc = container_of(param, + struct mlx5e_channel_param, rq)->rx_cq.cqc; + + switch (MLX5_GET(cqc, cqc, cq_period_mode)) { + case MLX5_CQ_PERIOD_MODE_START_FROM_EQE: + rq->dim.mode = NET_DIM_CQ_PERIOD_MODE_START_FROM_EQE; + break; + case MLX5_CQ_PERIOD_MODE_START_FROM_CQE: + rq->dim.mode = NET_DIM_CQ_PERIOD_MODE_START_FROM_CQE; + break; + default: + rq->dim.mode = NET_DIM_CQ_PERIOD_MODE_DISABLED; + break; + } + } + rq->ifp = c->ifp; rq->channel = c; rq->ix = c->ix; @@ -1013,6 +1033,7 @@ mlx5e_close_rq_wait(struct mlx5e_rq *rq) rq->cq.mcq.comp(&rq->cq.mcq); } + cancel_work_sync(&rq->dim.work); mlx5e_disable_rq(rq); mlx5e_destroy_rq(rq); } @@ -1811,9 +1832,23 @@ mlx5e_build_common_cq_param(struct mlx5e_priv *priv, } static void +mlx5e_get_default_profile(struct mlx5e_priv *priv, int mode, struct net_dim_cq_moder *ptr) +{ + + *ptr = net_dim_get_profile(mode, MLX5E_DIM_DEFAULT_PROFILE); + + /* apply LRO restrictions */ + if (priv->params.hw_lro_en && + ptr->pkts > MLX5E_DIM_MAX_RX_CQ_MODERATION_PKTS_WITH_LRO) { + ptr->pkts = MLX5E_DIM_MAX_RX_CQ_MODERATION_PKTS_WITH_LRO; + } +} + +static void mlx5e_build_rx_cq_param(struct mlx5e_priv *priv, struct mlx5e_cq_param *param) { + struct net_dim_cq_moder curr; void *cqc = param->cqc; @@ -1827,21 +1862,42 @@ mlx5e_build_rx_cq_param(struct mlx5e_priv *priv, } MLX5_SET(cqc, cqc, log_cq_size, priv->params.log_rq_size); - MLX5_SET(cqc, cqc, cq_period, priv->params.rx_cq_moderation_usec); - MLX5_SET(cqc, cqc, cq_max_count, priv->params.rx_cq_moderation_pkts); switch (priv->params.rx_cq_moderation_mode) { case 0: + MLX5_SET(cqc, cqc, cq_period, priv->params.rx_cq_moderation_usec); + MLX5_SET(cqc, cqc, cq_max_count, priv->params.rx_cq_moderation_pkts); MLX5_SET(cqc, cqc, cq_period_mode, MLX5_CQ_PERIOD_MODE_START_FROM_EQE); break; - default: + case 1: + MLX5_SET(cqc, cqc, cq_period, priv->params.rx_cq_moderation_usec); + MLX5_SET(cqc, cqc, cq_max_count, priv->params.rx_cq_moderation_pkts); if (MLX5_CAP_GEN(priv->mdev, cq_period_start_from_cqe)) MLX5_SET(cqc, cqc, cq_period_mode, MLX5_CQ_PERIOD_MODE_START_FROM_CQE); else MLX5_SET(cqc, cqc, cq_period_mode, MLX5_CQ_PERIOD_MODE_START_FROM_EQE); break; + case 2: + mlx5e_get_default_profile(priv, NET_DIM_CQ_PERIOD_MODE_START_FROM_EQE, &curr); + MLX5_SET(cqc, cqc, cq_period, curr.usec); + MLX5_SET(cqc, cqc, cq_max_count, curr.pkts); + MLX5_SET(cqc, cqc, cq_period_mode, MLX5_CQ_PERIOD_MODE_START_FROM_EQE); + break; + case 3: + mlx5e_get_default_profile(priv, NET_DIM_CQ_PERIOD_MODE_START_FROM_CQE, &curr); + MLX5_SET(cqc, cqc, cq_period, curr.usec); + MLX5_SET(cqc, cqc, cq_max_count, curr.pkts); + if (MLX5_CAP_GEN(priv->mdev, cq_period_start_from_cqe)) + MLX5_SET(cqc, cqc, cq_period_mode, MLX5_CQ_PERIOD_MODE_START_FROM_CQE); + else + MLX5_SET(cqc, cqc, cq_period_mode, MLX5_CQ_PERIOD_MODE_START_FROM_EQE); + break; + default: + break; } + mlx5e_dim_build_cq_param(priv, param); + mlx5e_build_common_cq_param(priv, param); } @@ -1933,6 +1989,7 @@ mlx5e_refresh_sq_params(struct mlx5e_priv *priv, struc switch (priv->params.tx_cq_moderation_mode) { case 0: + case 2: cq_mode = MLX5_CQ_PERIOD_MODE_START_FROM_EQE; break; default: @@ -1957,22 +2014,49 @@ mlx5e_refresh_rq_params(struct mlx5e_priv *priv, struc if (MLX5_CAP_GEN(priv->mdev, cq_period_mode_modify)) { uint8_t cq_mode; + uint8_t dim_mode; int retval; switch (priv->params.rx_cq_moderation_mode) { case 0: + case 2: cq_mode = MLX5_CQ_PERIOD_MODE_START_FROM_EQE; + dim_mode = NET_DIM_CQ_PERIOD_MODE_START_FROM_EQE; break; default: cq_mode = MLX5_CQ_PERIOD_MODE_START_FROM_CQE; + dim_mode = NET_DIM_CQ_PERIOD_MODE_START_FROM_CQE; break; } - retval = mlx5_core_modify_cq_moderation_mode(priv->mdev, &rq->cq.mcq, - priv->params.rx_cq_moderation_usec, - priv->params.rx_cq_moderation_pkts, - cq_mode); + /* tear down dynamic interrupt moderation */ + mtx_lock(&rq->mtx); + rq->dim.mode = NET_DIM_CQ_PERIOD_MODE_DISABLED; + mtx_unlock(&rq->mtx); + /* wait for dynamic interrupt moderation work task, if any */ + cancel_work_sync(&rq->dim.work); + + if (priv->params.rx_cq_moderation_mode >= 2) { + struct net_dim_cq_moder curr; + + mlx5e_get_default_profile(priv, dim_mode, &curr); + + retval = mlx5_core_modify_cq_moderation_mode(priv->mdev, &rq->cq.mcq, + curr.usec, curr.pkts, cq_mode); + + /* set dynamic interrupt moderation mode and zero defaults */ + mtx_lock(&rq->mtx); + rq->dim.mode = dim_mode; + rq->dim.state = 0; + rq->dim.profile_ix = MLX5E_DIM_DEFAULT_PROFILE; + mtx_unlock(&rq->mtx); + } else { + retval = mlx5_core_modify_cq_moderation_mode(priv->mdev, &rq->cq.mcq, + priv->params.rx_cq_moderation_usec, + priv->params.rx_cq_moderation_pkts, + cq_mode); + } return (retval); } Modified: stable/11/sys/dev/mlx5/mlx5_en/mlx5_en_rx.c ============================================================================== --- stable/11/sys/dev/mlx5/mlx5_en/mlx5_en_rx.c Thu May 16 17:04:29 2019 (r347795) +++ stable/11/sys/dev/mlx5/mlx5_en/mlx5_en_rx.c Thu May 16 17:09:06 2019 (r347796) @@ -500,6 +500,9 @@ mlx5e_rx_cq_comp(struct mlx5_core_cq *mcq) mlx5e_post_rx_wqes(rq); } mlx5e_post_rx_wqes(rq); + /* check for dynamic interrupt moderation callback */ + if (rq->dim.mode != NET_DIM_CQ_PERIOD_MODE_DISABLED) + net_dim(&rq->dim, rq->stats.packets, rq->stats.bytes); mlx5e_cq_arm(&rq->cq, MLX5_GET_DOORBELL_LOCK(&rq->channel->priv->doorbell_lock)); tcp_lro_flush_all(&rq->lro); mtx_unlock(&rq->mtx); Modified: stable/11/sys/modules/mlx5en/Makefile ============================================================================== --- stable/11/sys/modules/mlx5en/Makefile Thu May 16 17:04:29 2019 (r347795) +++ stable/11/sys/modules/mlx5en/Makefile Thu May 16 17:09:06 2019 (r347796) @@ -3,6 +3,7 @@ KMOD=mlx5en SRCS= \ +mlx5_en_dim.c \ mlx5_en_ethtool.c \ mlx5_en_main.c \ mlx5_en_tx.c \ From owner-svn-src-stable@freebsd.org Thu May 16 17:11:04 2019 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id AAF1A159F956; Thu, 16 May 2019 17:11:04 +0000 (UTC) (envelope-from hselasky@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 4FF558D20B; Thu, 16 May 2019 17:11:04 +0000 (UTC) (envelope-from hselasky@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 20C8223C5F; Thu, 16 May 2019 17:11:04 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x4GHB3e3096197; Thu, 16 May 2019 17:11:03 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x4GHB3ju096193; Thu, 16 May 2019 17:11:03 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201905161711.x4GHB3ju096193@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Thu, 16 May 2019 17:11:03 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r347797 - in stable/11/sys/dev/mlx5: . mlx5_fpga mlx5_fpga_tools X-SVN-Group: stable-11 X-SVN-Commit-Author: hselasky X-SVN-Commit-Paths: in stable/11/sys/dev/mlx5: . mlx5_fpga mlx5_fpga_tools X-SVN-Commit-Revision: 347797 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 4FF558D20B X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.98 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.998,0]; NEURAL_HAM_SHORT(-0.99)[-0.986,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US]; NEURAL_HAM_LONG(-1.00)[-1.000,0] X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 16 May 2019 17:11:04 -0000 Author: hselasky Date: Thu May 16 17:11:02 2019 New Revision: 347797 URL: https://svnweb.freebsd.org/changeset/base/347797 Log: MFC r347247: Add MLX5_FPGA_RELOAD IOCTL(2) to mlx5fpga. Submitted by: kib@ Sponsored by: Mellanox Technologies Modified: stable/11/sys/dev/mlx5/mlx5_fpga/mlx5_ifc_fpga.h stable/11/sys/dev/mlx5/mlx5_fpga/mlx5fpga_sdk.c stable/11/sys/dev/mlx5/mlx5_fpga_tools/mlx5fpga_tools_char.c stable/11/sys/dev/mlx5/mlx5io.h Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/dev/mlx5/mlx5_fpga/mlx5_ifc_fpga.h ============================================================================== --- stable/11/sys/dev/mlx5/mlx5_fpga/mlx5_ifc_fpga.h Thu May 16 17:09:06 2019 (r347796) +++ stable/11/sys/dev/mlx5/mlx5_fpga/mlx5_ifc_fpga.h Thu May 16 17:11:02 2019 (r347797) @@ -135,6 +135,7 @@ enum { MLX5_FPGA_CTRL_OPERATION_RESET_SANDBOX = 0x6, MLX5_FPGA_CTRL_OPERATION_DISCONNECT = 0x9, MLX5_FPGA_CTRL_OPERATION_CONNECT = 0xA, + MLX5_FPGA_CTRL_OPERATION_RELOAD = 0xB, }; struct mlx5_ifc_fpga_ctrl_bits { Modified: stable/11/sys/dev/mlx5/mlx5_fpga/mlx5fpga_sdk.c ============================================================================== --- stable/11/sys/dev/mlx5/mlx5_fpga/mlx5fpga_sdk.c Thu May 16 17:09:06 2019 (r347796) +++ stable/11/sys/dev/mlx5/mlx5_fpga/mlx5fpga_sdk.c Thu May 16 17:11:02 2019 (r347797) @@ -324,6 +324,45 @@ void mlx5_fpga_device_query(struct mlx5_fpga_device *f } EXPORT_SYMBOL(mlx5_fpga_device_query); +static int mlx5_fpga_device_reload_cmd(struct mlx5_fpga_device *fdev) +{ + struct mlx5_core_dev *mdev = fdev->mdev; + unsigned long timeout; + unsigned long flags; + int err = 0; + + mlx5_fpga_info(fdev, "mlx5/fpga - reload started\n"); + fdev->fdev_state = MLX5_FDEV_STATE_IN_PROGRESS; + reinit_completion(&fdev->load_event); + err = mlx5_fpga_ctrl_op(mdev, MLX5_FPGA_CTRL_OPERATION_RELOAD); + if (err) { + mlx5_fpga_err(fdev, "Failed to request reload: %d\n", + err); + goto out; + } + timeout = jiffies + msecs_to_jiffies(MLX5_FPGA_LOAD_TIMEOUT); + err = wait_for_completion_timeout(&fdev->load_event, + timeout - jiffies); + if (err < 0) { + mlx5_fpga_err(fdev, "Failed waiting for reload: %d\n", err); + fdev->fdev_state = MLX5_FDEV_STATE_FAILURE; + goto out; + } + /* Check device loaded successful */ + err = mlx5_fpga_device_start(mdev); + if (err) { + mlx5_fpga_err(fdev, "Failed load check for reload: %d\n", err); + fdev->fdev_state = MLX5_FDEV_STATE_FAILURE; + goto out; + } + spin_lock_irqsave(&fdev->state_lock, flags); + fdev->fdev_state = MLX5_FDEV_STATE_SUCCESS; + spin_unlock_irqrestore(&fdev->state_lock, flags); + mlx5_fpga_info(fdev, "mlx5/fpga - reload ended\n"); +out: + return err; +} + int mlx5_fpga_device_reload(struct mlx5_fpga_device *fdev, enum mlx5_fpga_image image) { @@ -350,6 +389,12 @@ int mlx5_fpga_device_reload(struct mlx5_fpga_device *f return err; mutex_lock(&mdev->intf_state_mutex); + + if (image == MLX5_FPGA_IMAGE_RELOAD) { + err = mlx5_fpga_device_reload_cmd(fdev); + goto out; + } + clear_bit(MLX5_INTERFACE_STATE_UP, &mdev->intf_state); mlx5_unregister_device(mdev); @@ -359,7 +404,7 @@ int mlx5_fpga_device_reload(struct mlx5_fpga_device *f fdev->fdev_state = MLX5_FDEV_STATE_IN_PROGRESS; reinit_completion(&fdev->load_event); - if (image <= MLX5_FPGA_IMAGE_MAX) { + if (image <= MLX5_FPGA_IMAGE_FACTORY) { mlx5_fpga_info(fdev, "Loading from flash\n"); err = mlx5_fpga_load(mdev, image); if (err) { @@ -367,7 +412,7 @@ int mlx5_fpga_device_reload(struct mlx5_fpga_device *f err); goto out; } - } else { + } else if (image == MLX5_FPGA_IMAGE_RESET) { mlx5_fpga_info(fdev, "Resetting\n"); err = mlx5_fpga_ctrl_op(mdev, MLX5_FPGA_CTRL_OPERATION_RESET); if (err) { @@ -375,6 +420,10 @@ int mlx5_fpga_device_reload(struct mlx5_fpga_device *f err); goto out; } + } else { + mlx5_fpga_err(fdev, "Unknown command: %d\n", + image); + goto out; } timeout = jiffies + msecs_to_jiffies(MLX5_FPGA_LOAD_TIMEOUT); Modified: stable/11/sys/dev/mlx5/mlx5_fpga_tools/mlx5fpga_tools_char.c ============================================================================== --- stable/11/sys/dev/mlx5/mlx5_fpga_tools/mlx5fpga_tools_char.c Thu May 16 17:09:06 2019 (r347796) +++ stable/11/sys/dev/mlx5/mlx5_fpga_tools/mlx5fpga_tools_char.c Thu May 16 17:11:02 2019 (r347797) @@ -225,7 +225,7 @@ tools_char_ioctl(struct cdev *dev, u_long cmd, caddr_t break; case MLX5_FPGA_LOAD: arg = *(int *)data; - if (arg > MLX5_FPGA_IMAGE_MAX) { + if (arg > MLX5_FPGA_IMAGE_FACTORY) { dev_err(mlx5_fpga_dev(fdev), "unknown image type %u\n", arg); err = EINVAL; @@ -234,11 +234,14 @@ tools_char_ioctl(struct cdev *dev, u_long cmd, caddr_t err = mlx5_fpga_device_reload(fdev, arg); break; case MLX5_FPGA_RESET: - err = mlx5_fpga_device_reload(fdev, MLX5_FPGA_IMAGE_MAX + 1); + err = mlx5_fpga_device_reload(fdev, MLX5_FPGA_IMAGE_RESET); break; + case MLX5_FPGA_RELOAD: + err = mlx5_fpga_device_reload(fdev, MLX5_FPGA_IMAGE_RELOAD); + break; case MLX5_FPGA_IMAGE_SEL: arg = *(int *)data; - if (arg > MLX5_FPGA_IMAGE_MAX) { + if (arg > MLX5_FPGA_IMAGE_FACTORY) { dev_err(mlx5_fpga_dev(fdev), "unknown image type %u\n", arg); err = EINVAL; Modified: stable/11/sys/dev/mlx5/mlx5io.h ============================================================================== --- stable/11/sys/dev/mlx5/mlx5io.h Thu May 16 17:09:06 2019 (r347796) +++ stable/11/sys/dev/mlx5/mlx5io.h Thu May 16 17:11:02 2019 (r347797) @@ -67,8 +67,9 @@ enum mlx5_fpga_id { enum mlx5_fpga_image { MLX5_FPGA_IMAGE_USER = 0, MLX5_FPGA_IMAGE_FACTORY = 1, - MLX5_FPGA_IMAGE_MAX = MLX5_FPGA_IMAGE_FACTORY, MLX5_FPGA_IMAGE_FACTORY_FAILOVER = 2, + MLX5_FPGA_IMAGE_RESET = 17, + MLX5_FPGA_IMAGE_RELOAD = 18, }; enum mlx5_fpga_status { @@ -135,6 +136,7 @@ struct mlx5_fpga_temperature { #define MLX5_FPGA_CAP _IOR('m', 0x85, uint32_t[MLX5_FPGA_CAP_ARR_SZ]) #define MLX5_FPGA_TEMPERATURE _IOWR('m', 0x86, struct mlx5_fpga_temperature) #define MLX5_FPGA_CONNECT _IOWR('m', 0x87, enum mlx5_fpga_connect) +#define MLX5_FPGA_RELOAD _IO('m', 0x88) #define MLX5_FPGA_TOOLS_NAME_SUFFIX "_mlx5_fpga_tools" From owner-svn-src-stable@freebsd.org Thu May 16 17:11:46 2019 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 716E0159F9C8; Thu, 16 May 2019 17:11:46 +0000 (UTC) (envelope-from hselasky@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 14D008D4E9; Thu, 16 May 2019 17:11:46 +0000 (UTC) (envelope-from hselasky@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 E1B8223DA1; Thu, 16 May 2019 17:11:45 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x4GHBjTi096282; Thu, 16 May 2019 17:11:45 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x4GHBjHN096281; Thu, 16 May 2019 17:11:45 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201905161711.x4GHBjHN096281@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Thu, 16 May 2019 17:11:45 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r347798 - stable/11/sys/dev/mlx5/mlx5_core X-SVN-Group: stable-11 X-SVN-Commit-Author: hselasky X-SVN-Commit-Paths: stable/11/sys/dev/mlx5/mlx5_core X-SVN-Commit-Revision: 347798 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 14D008D4E9 X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.98 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.998,0]; NEURAL_HAM_SHORT(-0.99)[-0.985,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US]; NEURAL_HAM_LONG(-1.00)[-1.000,0] X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 16 May 2019 17:11:46 -0000 Author: hselasky Date: Thu May 16 17:11:45 2019 New Revision: 347798 URL: https://svnweb.freebsd.org/changeset/base/347798 Log: MFC r347248: Enable FPGA and FPGA QP errors for EQ and call the handler in mlx5core. Submitted by: kib@ Sponsored by: Mellanox Technologies Modified: stable/11/sys/dev/mlx5/mlx5_core/mlx5_eq.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/dev/mlx5/mlx5_core/mlx5_eq.c ============================================================================== --- stable/11/sys/dev/mlx5/mlx5_core/mlx5_eq.c Thu May 16 17:11:02 2019 (r347797) +++ stable/11/sys/dev/mlx5/mlx5_core/mlx5_eq.c Thu May 16 17:11:45 2019 (r347798) @@ -29,6 +29,7 @@ #include #include #include +#include #include "mlx5_core.h" #include "opt_rss.h" @@ -153,6 +154,10 @@ static const char *eqe_type_str(u8 type) return "MLX5_EVENT_TYPE_PAGE_REQUEST"; case MLX5_EVENT_TYPE_NIC_VPORT_CHANGE: return "MLX5_EVENT_TYPE_NIC_VPORT_CHANGE"; + case MLX5_EVENT_TYPE_FPGA_ERROR: + return "MLX5_EVENT_TYPE_FPGA_ERROR"; + case MLX5_EVENT_TYPE_FPGA_QP_ERROR: + return "MLX5_EVENT_TYPE_FPGA_QP_ERROR"; case MLX5_EVENT_TYPE_CODING_DCBX_CHANGE_EVENT: return "MLX5_EVENT_TYPE_CODING_DCBX_CHANGE_EVENT"; case MLX5_EVENT_TYPE_CODING_GENERAL_NOTIFICATION_EVENT: @@ -338,6 +343,11 @@ static int mlx5_eq_int(struct mlx5_core_dev *dev, stru } break; + case MLX5_EVENT_TYPE_FPGA_ERROR: + case MLX5_EVENT_TYPE_FPGA_QP_ERROR: + mlx5_fpga_event(dev, eqe->type, &eqe->data.raw); + break; + default: mlx5_core_warn(dev, "Unhandled event 0x%x on EQ 0x%x\n", eqe->type, eq->eqn); @@ -526,6 +536,10 @@ int mlx5_start_eqs(struct mlx5_core_dev *dev) if (MLX5_CAP_GEN(dev, dcbx)) async_event_mask |= (1ull << MLX5_EVENT_TYPE_CODING_DCBX_CHANGE_EVENT); + + if (MLX5_CAP_GEN(dev, fpga)) + async_event_mask |= (1ull << MLX5_EVENT_TYPE_FPGA_ERROR) | + (1ull << MLX5_EVENT_TYPE_FPGA_QP_ERROR); err = mlx5_create_map_eq(dev, &table->cmd_eq, MLX5_EQ_VEC_CMD, MLX5_NUM_CMD_EQE, 1ull << MLX5_EVENT_TYPE_CMD, From owner-svn-src-stable@freebsd.org Thu May 16 17:12:39 2019 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 6F119159FA69; Thu, 16 May 2019 17:12:39 +0000 (UTC) (envelope-from hselasky@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 168148D786; Thu, 16 May 2019 17:12:39 +0000 (UTC) (envelope-from hselasky@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 E4B1D23DDD; Thu, 16 May 2019 17:12:38 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x4GHCcpk098457; Thu, 16 May 2019 17:12:38 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x4GHCc5U098455; Thu, 16 May 2019 17:12:38 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201905161712.x4GHCc5U098455@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Thu, 16 May 2019 17:12:38 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r347799 - in stable/11/sys/dev/mlx5: . mlx5_core X-SVN-Group: stable-11 X-SVN-Commit-Author: hselasky X-SVN-Commit-Paths: in stable/11/sys/dev/mlx5: . mlx5_core X-SVN-Commit-Revision: 347799 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 168148D786 X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.98 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.998,0]; NEURAL_HAM_SHORT(-0.99)[-0.986,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US]; NEURAL_HAM_LONG(-1.00)[-1.000,0] X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 16 May 2019 17:12:39 -0000 Author: hselasky Date: Thu May 16 17:12:38 2019 New Revision: 347799 URL: https://svnweb.freebsd.org/changeset/base/347799 Log: MFC r347249: Correctly define the interface state bits in mlx5en(4). While at it remove unused interface state bits. This also fixes and issue during shutdown: There is an issue where the firmware fails during mlx5_load_one, the health_care timer detects the issue and schedules a health_care call. Then the mlx5_load_one detects the issue, cleans up and quits. Then the health_care starts and calls mlx5_unload_one to clean up the resources that no longer exist and causes kernel panic. The root cause is that the bit MLX5_INTERFACE_STATE_DOWN is not set after mlx5_load_one fails. The solution is removing the bit MLX5_INTERFACE_STATE_DOWN and quit mlx5_unload_one if the bit MLX5_INTERFACE_STATE_UP is not set. The bit MLX5_INTERFACE_STATE_DOWN is redundant and we can use MLX5_INTERFACE_STATE_UP instead. Linux commit: 10a8d00707082955b177164d4b4e758ffcbd4017 b3cb5388499c5e219324bfe7da2e46cbad82bfcf Sponsored by: Mellanox Technologies Modified: stable/11/sys/dev/mlx5/driver.h stable/11/sys/dev/mlx5/mlx5_core/mlx5_main.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/dev/mlx5/driver.h ============================================================================== --- stable/11/sys/dev/mlx5/driver.h Thu May 16 17:11:45 2019 (r347798) +++ stable/11/sys/dev/mlx5/driver.h Thu May 16 17:12:38 2019 (r347799) @@ -636,9 +636,7 @@ enum mlx5_device_state { }; enum mlx5_interface_state { - MLX5_INTERFACE_STATE_DOWN = BIT(0), - MLX5_INTERFACE_STATE_UP = BIT(1), - MLX5_INTERFACE_STATE_SHUTDOWN = BIT(2), + MLX5_INTERFACE_STATE_UP, }; enum mlx5_pci_status { Modified: stable/11/sys/dev/mlx5/mlx5_core/mlx5_main.c ============================================================================== --- stable/11/sys/dev/mlx5/mlx5_core/mlx5_main.c Thu May 16 17:11:45 2019 (r347798) +++ stable/11/sys/dev/mlx5/mlx5_core/mlx5_main.c Thu May 16 17:12:38 2019 (r347799) @@ -1078,7 +1078,6 @@ static int mlx5_load_one(struct mlx5_core_dev *dev, st goto err_fs; } - clear_bit(MLX5_INTERFACE_STATE_DOWN, &dev->intf_state); set_bit(MLX5_INTERFACE_STATE_UP, &dev->intf_state); out: @@ -1141,7 +1140,7 @@ static int mlx5_unload_one(struct mlx5_core_dev *dev, mlx5_drain_health_recovery(dev); mutex_lock(&dev->intf_state_mutex); - if (test_bit(MLX5_INTERFACE_STATE_DOWN, &dev->intf_state)) { + if (!test_bit(MLX5_INTERFACE_STATE_UP, &dev->intf_state)) { dev_warn(&dev->pdev->dev, "%s: interface is down, NOP\n", __func__); if (cleanup) mlx5_cleanup_once(dev); @@ -1173,7 +1172,6 @@ static int mlx5_unload_one(struct mlx5_core_dev *dev, out: clear_bit(MLX5_INTERFACE_STATE_UP, &dev->intf_state); - set_bit(MLX5_INTERFACE_STATE_DOWN, &dev->intf_state); mutex_unlock(&dev->intf_state_mutex); return err; } @@ -1433,7 +1431,6 @@ static void shutdown_one(struct pci_dev *pdev) struct mlx5_priv *priv = &dev->priv; int err; - set_bit(MLX5_INTERFACE_STATE_SHUTDOWN, &dev->intf_state); err = mlx5_try_fast_unload(dev); if (err) mlx5_unload_one(dev, priv, false); From owner-svn-src-stable@freebsd.org Thu May 16 17:13:23 2019 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 4B19F159FAF7; Thu, 16 May 2019 17:13:23 +0000 (UTC) (envelope-from hselasky@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 E57AD8D8ED; Thu, 16 May 2019 17:13:22 +0000 (UTC) (envelope-from hselasky@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 BEAC423DE0; Thu, 16 May 2019 17:13:22 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x4GHDMCm098550; Thu, 16 May 2019 17:13:22 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x4GHDMld098546; Thu, 16 May 2019 17:13:22 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201905161713.x4GHDMld098546@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Thu, 16 May 2019 17:13:22 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r347800 - in stable/11/sys/dev/mlx5: . mlx5_core X-SVN-Group: stable-11 X-SVN-Commit-Author: hselasky X-SVN-Commit-Paths: in stable/11/sys/dev/mlx5: . mlx5_core X-SVN-Commit-Revision: 347800 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: E57AD8D8ED X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.98 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.998,0]; NEURAL_HAM_SHORT(-0.99)[-0.986,0]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US] X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 16 May 2019 17:13:23 -0000 Author: hselasky Date: Thu May 16 17:13:21 2019 New Revision: 347800 URL: https://svnweb.freebsd.org/changeset/base/347800 Log: MFC r347250: Add temperature warning event to log in mlx5core. Temperature warning event is sent by FW to indicate high temperature as detected by one of the sensors on the board. Add handling of this event by writing the numbers of the alert sensors to the kernel log. Linux commit: 1865ea9adbfaf341c5cd5d8f7d384f19948b2fe9 Submitted by: slavash@ Sponsored by: Mellanox Technologies Modified: stable/11/sys/dev/mlx5/device.h stable/11/sys/dev/mlx5/mlx5_core/mlx5_eq.c stable/11/sys/dev/mlx5/mlx5_ifc.h Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/dev/mlx5/device.h ============================================================================== --- stable/11/sys/dev/mlx5/device.h Thu May 16 17:12:38 2019 (r347799) +++ stable/11/sys/dev/mlx5/device.h Thu May 16 17:13:21 2019 (r347800) @@ -566,6 +566,11 @@ struct mlx5_eqe_general_notification_event { u32 rsvd0[6]; }; +struct mlx5_eqe_temp_warning { + __be64 sensor_warning_msb; + __be64 sensor_warning_lsb; +} __packed; + union ev_data { __be32 raw[7]; struct mlx5_eqe_cmd cmd; @@ -580,6 +585,7 @@ union ev_data { struct mlx5_eqe_port_module_event port_module_event; struct mlx5_eqe_vport_change vport_change; struct mlx5_eqe_general_notification_event general_notifications; + struct mlx5_eqe_temp_warning temp_warning; } __packed; struct mlx5_eqe { Modified: stable/11/sys/dev/mlx5/mlx5_core/mlx5_eq.c ============================================================================== --- stable/11/sys/dev/mlx5/mlx5_core/mlx5_eq.c Thu May 16 17:12:38 2019 (r347799) +++ stable/11/sys/dev/mlx5/mlx5_core/mlx5_eq.c Thu May 16 17:13:21 2019 (r347800) @@ -142,6 +142,8 @@ static const char *eqe_type_str(u8 type) return "MLX5_EVENT_TYPE_GPIO_EVENT"; case MLX5_EVENT_TYPE_CODING_PORT_MODULE_EVENT: return "MLX5_EVENT_TYPE_PORT_MODULE_EVENT"; + case MLX5_EVENT_TYPE_TEMP_WARN_EVENT: + return "MLX5_EVENT_TYPE_TEMP_WARN_EVENT"; case MLX5_EVENT_TYPE_REMOTE_CONFIG: return "MLX5_EVENT_TYPE_REMOTE_CONFIG"; case MLX5_EVENT_TYPE_DB_BF_CONGESTION: @@ -212,6 +214,16 @@ static void eq_update_ci(struct mlx5_eq *eq, int arm) mb(); } +static void +mlx5_temp_warning_event(struct mlx5_core_dev *dev, struct mlx5_eqe *eqe) +{ + + mlx5_core_warn(dev, + "High temperature on sensors with bit set %#jx %#jx", + (uintmax_t)be64_to_cpu(eqe->data.temp_warning.sensor_warning_msb), + (uintmax_t)be64_to_cpu(eqe->data.temp_warning.sensor_warning_lsb)); +} + static int mlx5_eq_int(struct mlx5_core_dev *dev, struct mlx5_eq *eq) { struct mlx5_eqe *eqe; @@ -347,6 +359,9 @@ static int mlx5_eq_int(struct mlx5_core_dev *dev, stru case MLX5_EVENT_TYPE_FPGA_QP_ERROR: mlx5_fpga_event(dev, eqe->type, &eqe->data.raw); break; + case MLX5_EVENT_TYPE_TEMP_WARN_EVENT: + mlx5_temp_warning_event(dev, eqe); + break; default: mlx5_core_warn(dev, "Unhandled event 0x%x on EQ 0x%x\n", @@ -540,6 +555,9 @@ int mlx5_start_eqs(struct mlx5_core_dev *dev) if (MLX5_CAP_GEN(dev, fpga)) async_event_mask |= (1ull << MLX5_EVENT_TYPE_FPGA_ERROR) | (1ull << MLX5_EVENT_TYPE_FPGA_QP_ERROR); + + if (MLX5_CAP_GEN(dev, temp_warn_event)) + async_event_mask |= (1ull << MLX5_EVENT_TYPE_TEMP_WARN_EVENT); err = mlx5_create_map_eq(dev, &table->cmd_eq, MLX5_EQ_VEC_CMD, MLX5_NUM_CMD_EQE, 1ull << MLX5_EVENT_TYPE_CMD, Modified: stable/11/sys/dev/mlx5/mlx5_ifc.h ============================================================================== --- stable/11/sys/dev/mlx5/mlx5_ifc.h Thu May 16 17:12:38 2019 (r347799) +++ stable/11/sys/dev/mlx5/mlx5_ifc.h Thu May 16 17:13:21 2019 (r347800) @@ -50,7 +50,7 @@ enum { MLX5_EVENT_TYPE_PORT_CHANGE = 0x9, MLX5_EVENT_TYPE_GPIO_EVENT = 0x15, MLX5_EVENT_TYPE_CODING_PORT_MODULE_EVENT = 0x16, - MLX5_EVENT_TYPE_CODING_TEMP_WARNING_EVENT = 0x17, + MLX5_EVENT_TYPE_TEMP_WARN_EVENT = 0x17, MLX5_EVENT_TYPE_REMOTE_CONFIG = 0x19, MLX5_EVENT_TYPE_CODING_DCBX_CHANGE_EVENT = 0x1e, MLX5_EVENT_TYPE_CODING_PPS_EVENT = 0x25, From owner-svn-src-stable@freebsd.org Thu May 16 17:14:09 2019 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id BC965159FB98; Thu, 16 May 2019 17:14:09 +0000 (UTC) (envelope-from hselasky@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 648798DA2B; Thu, 16 May 2019 17:14:09 +0000 (UTC) (envelope-from hselasky@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 24AD823DE2; Thu, 16 May 2019 17:14:09 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x4GHE9J2098639; Thu, 16 May 2019 17:14:09 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x4GHE9AW098638; Thu, 16 May 2019 17:14:09 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201905161714.x4GHE9AW098638@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Thu, 16 May 2019 17:14:09 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r347801 - stable/11/sys/dev/mlx5/mlx5_ib X-SVN-Group: stable-11 X-SVN-Commit-Author: hselasky X-SVN-Commit-Paths: stable/11/sys/dev/mlx5/mlx5_ib X-SVN-Commit-Revision: 347801 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 648798DA2B X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.98 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.998,0]; NEURAL_HAM_SHORT(-0.99)[-0.986,0]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US] X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 16 May 2019 17:14:10 -0000 Author: hselasky Date: Thu May 16 17:14:08 2019 New Revision: 347801 URL: https://svnweb.freebsd.org/changeset/base/347801 Log: MFC r347251: Import Linux code to implement mlx5_ib_disassociate_ucontext() in mlx5ib. Submitted by: kib@ Sponsored by: Mellanox Technologies Modified: stable/11/sys/dev/mlx5/mlx5_ib/mlx5_ib_main.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/dev/mlx5/mlx5_ib/mlx5_ib_main.c ============================================================================== --- stable/11/sys/dev/mlx5/mlx5_ib/mlx5_ib_main.c Thu May 16 17:13:21 2019 (r347800) +++ stable/11/sys/dev/mlx5/mlx5_ib/mlx5_ib_main.c Thu May 16 17:14:08 2019 (r347801) @@ -1335,6 +1335,70 @@ static int mlx5_ib_set_vma_data(struct vm_area_struct return 0; } +static void mlx5_ib_disassociate_ucontext(struct ib_ucontext *ibcontext) +{ + int ret; + struct vm_area_struct *vma; + struct mlx5_ib_vma_private_data *vma_private, *n; + struct mlx5_ib_ucontext *context = to_mucontext(ibcontext); + struct task_struct *owning_process = NULL; + struct mm_struct *owning_mm = NULL; + + owning_process = get_pid_task(ibcontext->tgid, PIDTYPE_PID); + if (!owning_process) + return; + + owning_mm = get_task_mm(owning_process); + if (!owning_mm) { + pr_info("no mm, disassociate ucontext is pending task termination\n"); + while (1) { + put_task_struct(owning_process); + usleep_range(1000, 2000); + owning_process = get_pid_task(ibcontext->tgid, + PIDTYPE_PID); + if (!owning_process || owning_process->task_thread-> + td_proc->p_state == PRS_ZOMBIE) { + pr_info("disassociate ucontext done, task was terminated\n"); + /* in case task was dead need to release the + * task struct. + */ + if (owning_process) + put_task_struct(owning_process); + return; + } + } + } + + /* need to protect from a race on closing the vma as part of + * mlx5_ib_vma_close. + */ + down_write(&owning_mm->mmap_sem); + list_for_each_entry_safe(vma_private, n, &context->vma_private_list, + list) { + vma = vma_private->vma; + ret = zap_vma_ptes(vma, vma->vm_start, + PAGE_SIZE); + if (ret == -ENOTSUP) { + if (bootverbose) + WARN_ONCE( + "%s: zap_vma_ptes not implemented for unmanaged mappings", __func__); + } else { + WARN(ret, "%s: zap_vma_ptes failed, error %d", + __func__, -ret); + } + /* context going to be destroyed, should + * not access ops any more. + */ + /* XXXKIB vma->vm_flags &= ~(VM_SHARED | VM_MAYSHARE); */ + vma->vm_ops = NULL; + list_del(&vma_private->list); + kfree(vma_private); + } + up_write(&owning_mm->mmap_sem); + mmput(owning_mm); + put_task_struct(owning_process); +} + static inline char *mmap_cmd2str(enum mlx5_ib_mmap_cmd cmd) { switch (cmd) { @@ -3084,6 +3148,8 @@ static void *mlx5_ib_add(struct mlx5_core_dev *mdev) dev->ib_dev.get_vf_stats = mlx5_ib_get_vf_stats; dev->ib_dev.set_vf_guid = mlx5_ib_set_vf_guid; } + + dev->ib_dev.disassociate_ucontext = mlx5_ib_disassociate_ucontext; mlx5_ib_internal_fill_odp_caps(dev); From owner-svn-src-stable@freebsd.org Thu May 16 17:15:02 2019 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 7DBC1159FC96; Thu, 16 May 2019 17:15:02 +0000 (UTC) (envelope-from hselasky@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 203488DBD8; Thu, 16 May 2019 17:15:02 +0000 (UTC) (envelope-from hselasky@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 ED6A023DE3; Thu, 16 May 2019 17:15:01 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x4GHF1ff098744; Thu, 16 May 2019 17:15:01 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x4GHF1se098741; Thu, 16 May 2019 17:15:01 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201905161715.x4GHF1se098741@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Thu, 16 May 2019 17:15:01 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r347802 - in stable/11/sys/dev/mlx5: . mlx5_core X-SVN-Group: stable-11 X-SVN-Commit-Author: hselasky X-SVN-Commit-Paths: in stable/11/sys/dev/mlx5: . mlx5_core X-SVN-Commit-Revision: 347802 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 203488DBD8 X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.98 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.998,0]; NEURAL_HAM_SHORT(-0.99)[-0.986,0]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US] X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 16 May 2019 17:15:02 -0000 Author: hselasky Date: Thu May 16 17:15:00 2019 New Revision: 347802 URL: https://svnweb.freebsd.org/changeset/base/347802 Log: MFC r347252: Disable all MSIX interrupts before shutdown in mlx5. Make sure the interrupt handlers don't race with the fast unload one code in the shutdown handler. Sponsored by: Mellanox Technologies Modified: stable/11/sys/dev/mlx5/driver.h stable/11/sys/dev/mlx5/mlx5_core/mlx5_cmd.c stable/11/sys/dev/mlx5/mlx5_core/mlx5_eq.c stable/11/sys/dev/mlx5/mlx5_core/mlx5_main.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/dev/mlx5/driver.h ============================================================================== --- stable/11/sys/dev/mlx5/driver.h Thu May 16 17:14:08 2019 (r347801) +++ stable/11/sys/dev/mlx5/driver.h Thu May 16 17:15:00 2019 (r347802) @@ -583,6 +583,7 @@ struct mlx5_priv { struct mlx5_irq_info *irq_info; struct mlx5_uuar_info uuari; MLX5_DECLARE_DOORBELL_LOCK(cq_uar_lock); + int disable_irqs; struct io_mapping *bf_mapping; Modified: stable/11/sys/dev/mlx5/mlx5_core/mlx5_cmd.c ============================================================================== --- stable/11/sys/dev/mlx5/mlx5_core/mlx5_cmd.c Thu May 16 17:14:08 2019 (r347801) +++ stable/11/sys/dev/mlx5/mlx5_core/mlx5_cmd.c Thu May 16 17:15:00 2019 (r347802) @@ -1143,6 +1143,9 @@ static void mlx5_cmd_change_mod(struct mlx5_core_dev * struct mlx5_cmd *cmd = &dev->cmd; int i; + if (cmd->mode == mode) + return; + for (i = 0; i < cmd->max_reg_cmds; i++) down(&cmd->sem); Modified: stable/11/sys/dev/mlx5/mlx5_core/mlx5_eq.c ============================================================================== --- stable/11/sys/dev/mlx5/mlx5_core/mlx5_eq.c Thu May 16 17:14:08 2019 (r347801) +++ stable/11/sys/dev/mlx5/mlx5_core/mlx5_eq.c Thu May 16 17:15:00 2019 (r347802) @@ -395,7 +395,9 @@ static irqreturn_t mlx5_msix_handler(int irq, void *eq struct mlx5_eq *eq = eq_ptr; struct mlx5_core_dev *dev = eq->dev; - mlx5_eq_int(dev, eq); + /* check if IRQs are not disabled */ + if (likely(dev->priv.disable_irqs == 0)) + mlx5_eq_int(dev, eq); /* MSI-X vectors always belong to us */ return IRQ_HANDLED; Modified: stable/11/sys/dev/mlx5/mlx5_core/mlx5_main.c ============================================================================== --- stable/11/sys/dev/mlx5/mlx5_core/mlx5_main.c Thu May 16 17:14:08 2019 (r347801) +++ stable/11/sys/dev/mlx5/mlx5_core/mlx5_main.c Thu May 16 17:15:00 2019 (r347802) @@ -35,6 +35,7 @@ #include #include #include +#include #include #include #include @@ -1425,11 +1426,29 @@ static int mlx5_try_fast_unload(struct mlx5_core_dev * return 0; } +static void mlx5_disable_interrupts(struct mlx5_core_dev *mdev) +{ + int nvec = mdev->priv.eq_table.num_comp_vectors + MLX5_EQ_VEC_COMP_BASE; + int x; + + mdev->priv.disable_irqs = 1; + + /* wait for all IRQ handlers to finish processing */ + for (x = 0; x != nvec; x++) + synchronize_irq(mdev->priv.msix_arr[x].vector); +} + static void shutdown_one(struct pci_dev *pdev) { struct mlx5_core_dev *dev = pci_get_drvdata(pdev); struct mlx5_priv *priv = &dev->priv; int err; + + /* enter polling mode */ + mlx5_cmd_use_polling(dev); + + /* disable all interrupts */ + mlx5_disable_interrupts(dev); err = mlx5_try_fast_unload(dev); if (err) From owner-svn-src-stable@freebsd.org Thu May 16 17:15:42 2019 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 24EA8159FD5B; Thu, 16 May 2019 17:15:42 +0000 (UTC) (envelope-from hselasky@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 BE9C38DD1E; Thu, 16 May 2019 17:15:41 +0000 (UTC) (envelope-from hselasky@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 B0FBD23DE4; Thu, 16 May 2019 17:15:41 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x4GHFfDi098830; Thu, 16 May 2019 17:15:41 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x4GHFfmn098828; Thu, 16 May 2019 17:15:41 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201905161715.x4GHFfmn098828@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Thu, 16 May 2019 17:15:41 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r347803 - in stable/11/sys/dev/mlx5: . mlx5_core X-SVN-Group: stable-11 X-SVN-Commit-Author: hselasky X-SVN-Commit-Paths: in stable/11/sys/dev/mlx5: . mlx5_core X-SVN-Commit-Revision: 347803 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: BE9C38DD1E X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.98 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.998,0]; NEURAL_HAM_SHORT(-0.99)[-0.986,0]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US] X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 16 May 2019 17:15:42 -0000 Author: hselasky Date: Thu May 16 17:15:41 2019 New Revision: 347803 URL: https://svnweb.freebsd.org/changeset/base/347803 Log: MFC r347253: Protect from infinite sw-reset loop in mlx5core. Avoid an infinite software firmware reset loop that may be caused by a hardware bug by limiting the maximum number of resets. The counter between resets is reset by request for reset, and not by a successful reset. The interval between two resets can be configured via sysctl: hw.mlx5.sw_reset_timeout which is global to all mlx5 devices in the system. Submitted by: slavash@ Sponsored by: Mellanox Technologies Modified: stable/11/sys/dev/mlx5/driver.h stable/11/sys/dev/mlx5/mlx5_core/mlx5_health.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/dev/mlx5/driver.h ============================================================================== --- stable/11/sys/dev/mlx5/driver.h Thu May 16 17:15:00 2019 (r347802) +++ stable/11/sys/dev/mlx5/driver.h Thu May 16 17:15:41 2019 (r347803) @@ -534,6 +534,7 @@ struct mlx5_core_health { unsigned long flags; struct work_struct work; struct delayed_work recover_work; + unsigned int last_reset_req; }; #define MLX5_CQ_LINEAR_ARRAY_SIZE 1024 Modified: stable/11/sys/dev/mlx5/mlx5_core/mlx5_health.c ============================================================================== --- stable/11/sys/dev/mlx5/mlx5_core/mlx5_health.c Thu May 16 17:15:00 2019 (r347802) +++ stable/11/sys/dev/mlx5/mlx5_core/mlx5_health.c Thu May 16 17:15:41 2019 (r347803) @@ -64,6 +64,12 @@ SYSCTL_INT(_hw_mlx5, OID_AUTO, fw_reset_enable, CTLFLA &mlx5_fw_reset_enable, 0, "Enable firmware reset"); +static unsigned int sw_reset_to = 1200; +SYSCTL_UINT(_hw_mlx5, OID_AUTO, sw_reset_timeout, CTLFLAG_RWTUN, + &sw_reset_to, 0, + "Minimum timeout in seconds between two firmware resets"); + + static int lock_sem_sw_reset(struct mlx5_core_dev *dev) { int ret; @@ -218,6 +224,32 @@ static void reset_fw_if_needed(struct mlx5_core_dev *d &dev->iseg->cmdq_addr_l_sz); } +static bool +mlx5_health_allow_reset(struct mlx5_core_dev *dev) +{ + struct mlx5_core_health *health = &dev->priv.health; + unsigned int delta; + bool ret; + + if (health->last_reset_req != 0) { + delta = ticks - health->last_reset_req; + delta /= hz; + ret = delta >= sw_reset_to; + } else { + ret = true; + } + + /* + * In principle, ticks may be 0. Setting it to off by one (-1) + * to prevent certain reset in next request. + */ + health->last_reset_req = ticks ? : -1; + if (!ret) + mlx5_core_warn(dev, "Firmware reset elided due to " + "auto-reset frequency threshold.\n"); + return (ret); +} + #define MLX5_CRDUMP_WAIT_MS 60000 #define MLX5_FW_RESET_WAIT_MS 1000 #define MLX5_NIC_STATE_POLL_MS 5 @@ -243,7 +275,8 @@ void mlx5_enter_error_state(struct mlx5_core_dev *dev, if (force) goto err_state_done; - if (fatal_error == MLX5_SENSOR_FW_SYND_RFR) { + if (fatal_error == MLX5_SENSOR_FW_SYND_RFR && + mlx5_health_allow_reset(dev)) { /* Get cr-dump and reset FW semaphore */ if (mlx5_core_is_pf(dev)) lock = lock_sem_sw_reset(dev); From owner-svn-src-stable@freebsd.org Thu May 16 17:16:33 2019 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 550FE159FE28; Thu, 16 May 2019 17:16:33 +0000 (UTC) (envelope-from hselasky@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 E65418DE7E; Thu, 16 May 2019 17:16:32 +0000 (UTC) (envelope-from hselasky@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 BD4E623DE6; Thu, 16 May 2019 17:16:32 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x4GHGWva099049; Thu, 16 May 2019 17:16:32 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x4GHGWWO099047; Thu, 16 May 2019 17:16:32 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201905161716.x4GHGWWO099047@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Thu, 16 May 2019 17:16:32 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r347804 - in stable/11/sys/dev/mlx5: . mlx5_en X-SVN-Group: stable-11 X-SVN-Commit-Author: hselasky X-SVN-Commit-Paths: in stable/11/sys/dev/mlx5: . mlx5_en X-SVN-Commit-Revision: 347804 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: E65418DE7E X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.98 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.998,0]; NEURAL_HAM_SHORT(-0.99)[-0.986,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US]; NEURAL_HAM_LONG(-1.00)[-1.000,0] X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 16 May 2019 17:16:33 -0000 Author: hselasky Date: Thu May 16 17:16:31 2019 New Revision: 347804 URL: https://svnweb.freebsd.org/changeset/base/347804 Log: MFC r347254: Update Ethernet extended counters in mlx5en(4). Expose all Ethernet extended counters those counters via debug_stats sysctl: dev.mce.X.debug_stats Submitted by: slavash@ Sponsored by: Mellanox Technologies Modified: stable/11/sys/dev/mlx5/mlx5_en/en.h stable/11/sys/dev/mlx5/mlx5_en/mlx5_en_main.c stable/11/sys/dev/mlx5/mlx5_ifc.h Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/dev/mlx5/mlx5_en/en.h ============================================================================== --- stable/11/sys/dev/mlx5/mlx5_en/en.h Thu May 16 17:15:41 2019 (r347803) +++ stable/11/sys/dev/mlx5/mlx5_en/en.h Thu May 16 17:16:31 2019 (r347804) @@ -254,6 +254,28 @@ struct mlx5e_vport_stats { m(+1, u64 out_multicast_pkts, "out_multicast_pkts", "Out multicast packets") \ m(+1, u64 out_broadcast_pkts, "out_broadcast_pkts", "Out broadcast packets") +#define MLX5E_PPORT_ETHERNET_EXTENDED_STATS_DEBUG(m) \ + m(+1, u64 port_transmit_wait_high, "port_transmit_wait_high", "Port transmit wait high") \ + m(+1, u64 ecn_marked, "ecn_marked", "ECN marked") \ + m(+1, u64 no_buffer_discard_mc, "no_buffer_discard_mc", "No buffer discard mc") \ + m(+1, u64 rx_ebp, "rx_ebp", "RX EBP") \ + m(+1, u64 tx_ebp, "tx_ebp", "TX EBP") \ + m(+1, u64 rx_buffer_almost_full, "rx_buffer_almost_full", "RX buffer almost full") \ + m(+1, u64 rx_buffer_full, "rx_buffer_full", "RX buffer full") \ + m(+1, u64 rx_icrc_encapsulated, "rx_icrc_encapsulated", "RX ICRC encapsulated") \ + m(+1, u64 ex_reserved_0, "ex_reserved_0", "Reserved") \ + m(+1, u64 ex_reserved_1, "ex_reserved_1", "Reserved") \ + m(+1, u64 tx_stat_p64octets, "tx_stat_p64octets", "Bytes") \ + m(+1, u64 tx_stat_p65to127octets, "tx_stat_p65to127octets", "Bytes") \ + m(+1, u64 tx_stat_p128to255octets, "tx_stat_p128to255octets", "Bytes") \ + m(+1, u64 tx_stat_p256to511octets, "tx_stat_p256to511octets", "Bytes") \ + m(+1, u64 tx_stat_p512to1023octets, "tx_stat_p512to1023octets", "Bytes") \ + m(+1, u64 tx_stat_p1024to1518octets, "tx_stat_p1024to1518octets", "Bytes") \ + m(+1, u64 tx_stat_p1519to2047octets, "tx_stat_p1519to2047octets", "Bytes") \ + m(+1, u64 tx_stat_p2048to4095octets, "tx_stat_p2048to4095octets", "Bytes") \ + m(+1, u64 tx_stat_p4096to8191octets, "tx_stat_p4096to8191octets", "Bytes") \ + m(+1, u64 tx_stat_p8192to10239octets, "tx_stat_p8192to10239octets", "Bytes") + #define MLX5E_PPORT_PHYSICAL_LAYER_STATS_DEBUG(m) \ m(+1, u64 time_since_last_clear, "time_since_last_clear", \ "Time since the last counters clear event (msec)") \ @@ -348,7 +370,8 @@ struct mlx5e_vport_stats { #define MLX5E_PORT_STATS_DEBUG(m) \ MLX5E_PPORT_RFC2819_STATS_DEBUG(m) \ MLX5E_PPORT_RFC2863_STATS_DEBUG(m) \ - MLX5E_PPORT_PHYSICAL_LAYER_STATS_DEBUG(m) + MLX5E_PPORT_PHYSICAL_LAYER_STATS_DEBUG(m) \ + MLX5E_PPORT_ETHERNET_EXTENDED_STATS_DEBUG(m) #define MLX5E_PPORT_IEEE802_3_STATS_NUM \ (0 MLX5E_PPORT_IEEE802_3_STATS(MLX5E_STATS_COUNT)) @@ -365,6 +388,8 @@ struct mlx5e_vport_stats { (0 MLX5E_PPORT_RFC2863_STATS_DEBUG(MLX5E_STATS_COUNT)) #define MLX5E_PPORT_PHYSICAL_LAYER_STATS_DEBUG_NUM \ (0 MLX5E_PPORT_PHYSICAL_LAYER_STATS_DEBUG(MLX5E_STATS_COUNT)) +#define MLX5E_PPORT_ETHERNET_EXTENDED_STATS_DEBUG_NUM \ + (0 MLX5E_PPORT_ETHERNET_EXTENDED_STATS_DEBUG(MLX5E_STATS_COUNT)) #define MLX5E_PORT_STATS_DEBUG_NUM \ (0 MLX5E_PORT_STATS_DEBUG(MLX5E_STATS_COUNT)) Modified: stable/11/sys/dev/mlx5/mlx5_en/mlx5_en_main.c ============================================================================== --- stable/11/sys/dev/mlx5/mlx5_en/mlx5_en_main.c Thu May 16 17:15:41 2019 (r347803) +++ stable/11/sys/dev/mlx5/mlx5_en/mlx5_en_main.c Thu May 16 17:16:31 2019 (r347804) @@ -440,6 +440,12 @@ mlx5e_update_pport_counters(struct mlx5e_priv *priv) for (x = 0; x != MLX5E_PPORT_PHYSICAL_LAYER_STATS_DEBUG_NUM; x++, y++) s_debug->arg[y] = be64toh(ptr[x]); + /* read Extended Ethernet counter group using predefined counter layout */ + MLX5_SET(ppcnt_reg, in, grp, MLX5_ETHERNET_EXTENDED_COUNTERS_GROUP); + mlx5_core_access_reg(mdev, in, sz, out, sz, MLX5_REG_PPCNT, 0, 0); + for (x = 0; x != MLX5E_PPORT_ETHERNET_EXTENDED_STATS_DEBUG_NUM; x++, y++) + s_debug->arg[y] = be64toh(ptr[x]); + /* read per-priority counters */ MLX5_SET(ppcnt_reg, in, grp, MLX5_PER_PRIORITY_COUNTERS_GROUP); @@ -453,6 +459,7 @@ mlx5e_update_pport_counters(struct mlx5e_priv *priv) MLX5E_PPORT_PER_PRIO_STATS_NUM_PRIO); x++, y++) s->arg[y] = be64toh(ptr[x]); } + free_out: /* free firmware request structures */ kvfree(in); Modified: stable/11/sys/dev/mlx5/mlx5_ifc.h ============================================================================== --- stable/11/sys/dev/mlx5/mlx5_ifc.h Thu May 16 17:15:41 2019 (r347803) +++ stable/11/sys/dev/mlx5/mlx5_ifc.h Thu May 16 17:16:31 2019 (r347804) @@ -8752,7 +8752,69 @@ struct mlx5_ifc_eth_extended_cntrs_grp_data_layout_bit u8 no_buffer_discard_mc_low[0x20]; - u8 reserved_0[0x700]; + u8 rx_ebp_high[0x20]; + + u8 rx_ebp_low[0x20]; + + u8 tx_ebp_high[0x20]; + + u8 tx_ebp_low[0x20]; + + u8 rx_buffer_almost_full_high[0x20]; + + u8 rx_buffer_almost_full_low[0x20]; + + u8 rx_buffer_full_high[0x20]; + + u8 rx_buffer_full_low[0x20]; + + u8 rx_icrc_encapsulated_high[0x20]; + + u8 rx_icrc_encapsulated_low[0x20]; + + u8 reserved_0[0x80]; + + u8 tx_stats_pkts64octets_high[0x20]; + + u8 tx_stats_pkts64octets_low[0x20]; + + u8 tx_stats_pkts65to127octets_high[0x20]; + + u8 tx_stats_pkts65to127octets_low[0x20]; + + u8 tx_stats_pkts128to255octets_high[0x20]; + + u8 tx_stats_pkts128to255octets_low[0x20]; + + u8 tx_stats_pkts256to511octets_high[0x20]; + + u8 tx_stats_pkts256to511octets_low[0x20]; + + u8 tx_stats_pkts512to1023octets_high[0x20]; + + u8 tx_stats_pkts512to1023octets_low[0x20]; + + u8 tx_stats_pkts1024to1518octets_high[0x20]; + + u8 tx_stats_pkts1024to1518octets_low[0x20]; + + u8 tx_stats_pkts1519to2047octets_high[0x20]; + + u8 tx_stats_pkts1519to2047octets_low[0x20]; + + u8 tx_stats_pkts2048to4095octets_high[0x20]; + + u8 tx_stats_pkts2048to4095octets_low[0x20]; + + u8 tx_stats_pkts4096to8191octets_high[0x20]; + + u8 tx_stats_pkts4096to8191octets_low[0x20]; + + u8 tx_stats_pkts8192to10239octets_high[0x20]; + + u8 tx_stats_pkts8192to10239octets_low[0x20]; + + u8 reserved_1[0x2C0]; }; struct mlx5_ifc_eth_802_3_cntrs_grp_data_layout_bits { From owner-svn-src-stable@freebsd.org Thu May 16 17:17:13 2019 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 6FF38159FE9B; Thu, 16 May 2019 17:17:13 +0000 (UTC) (envelope-from hselasky@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 152BF8E068; Thu, 16 May 2019 17:17:13 +0000 (UTC) (envelope-from hselasky@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 E376223DE7; Thu, 16 May 2019 17:17:12 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x4GHHCaa099137; Thu, 16 May 2019 17:17:12 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x4GHHC5P099136; Thu, 16 May 2019 17:17:12 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201905161717.x4GHHC5P099136@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Thu, 16 May 2019 17:17:12 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r347805 - stable/11/sys/dev/mlx5/mlx5_en X-SVN-Group: stable-11 X-SVN-Commit-Author: hselasky X-SVN-Commit-Paths: stable/11/sys/dev/mlx5/mlx5_en X-SVN-Commit-Revision: 347805 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 152BF8E068 X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.98 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.998,0]; NEURAL_HAM_SHORT(-0.99)[-0.985,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US]; NEURAL_HAM_LONG(-1.00)[-1.000,0] X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 16 May 2019 17:17:13 -0000 Author: hselasky Date: Thu May 16 17:17:12 2019 New Revision: 347805 URL: https://svnweb.freebsd.org/changeset/base/347805 Log: MFC r347255: Fix tx_jumbo_packets counter in mlx5en(4). Instead of reading Ethernet RFC 2819 pXtoYoctets counters from hardware which counts RX octets, count tx_stat_pXtoYoctets from Ethernet extended counters which counts TX octets. TX jumbo counters should be accumulated only after the PPCNT counters were fetched from hardware with their latest value. Submitted by: slavash@ Sponsored by: Mellanox Technologies Modified: stable/11/sys/dev/mlx5/mlx5_en/mlx5_en_main.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/dev/mlx5/mlx5_en/mlx5_en_main.c ============================================================================== --- stable/11/sys/dev/mlx5/mlx5_en/mlx5_en_main.c Thu May 16 17:16:31 2019 (r347804) +++ stable/11/sys/dev/mlx5/mlx5_en/mlx5_en_main.c Thu May 16 17:17:12 2019 (r347805) @@ -540,12 +540,6 @@ mlx5e_update_stats_work(struct work_struct *work) } } - s->tx_jumbo_packets = - priv->stats.port_stats_debug.p1519to2047octets + - priv->stats.port_stats_debug.p2048to4095octets + - priv->stats.port_stats_debug.p4096to8191octets + - priv->stats.port_stats_debug.p8192to10239octets; - /* update counters */ s->tso_packets = tso_packets; s->tso_bytes = tso_bytes; @@ -644,6 +638,12 @@ mlx5e_update_stats_work(struct work_struct *work) /* Get physical port counters */ mlx5e_update_pport_counters(priv); + + s->tx_jumbo_packets = + priv->stats.port_stats_debug.tx_stat_p1519to2047octets + + priv->stats.port_stats_debug.tx_stat_p2048to4095octets + + priv->stats.port_stats_debug.tx_stat_p4096to8191octets + + priv->stats.port_stats_debug.tx_stat_p8192to10239octets; #if (__FreeBSD_version < 1100000) /* no get_counters interface in fbsd 10 */ From owner-svn-src-stable@freebsd.org Thu May 16 17:17:54 2019 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 2D2F6159FF56; Thu, 16 May 2019 17:17:54 +0000 (UTC) (envelope-from hselasky@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 AB4BA8E1B7; Thu, 16 May 2019 17:17:53 +0000 (UTC) (envelope-from hselasky@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 8660E23DE9; Thu, 16 May 2019 17:17:53 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x4GHHr0k099224; Thu, 16 May 2019 17:17:53 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x4GHHr5O099222; Thu, 16 May 2019 17:17:53 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201905161717.x4GHHr5O099222@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Thu, 16 May 2019 17:17:53 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r347806 - stable/11/sys/dev/mlx5/mlx5_en X-SVN-Group: stable-11 X-SVN-Commit-Author: hselasky X-SVN-Commit-Paths: stable/11/sys/dev/mlx5/mlx5_en X-SVN-Commit-Revision: 347806 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: AB4BA8E1B7 X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.98 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.998,0]; NEURAL_HAM_SHORT(-0.99)[-0.985,0]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US] X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 16 May 2019 17:17:54 -0000 Author: hselasky Date: Thu May 16 17:17:52 2019 New Revision: 347806 URL: https://svnweb.freebsd.org/changeset/base/347806 Log: MFC r347256: Destroy port stats debug context in correct order in mlx5en(4). Destroy children nodes before parent nodes. Sponsored by: Mellanox Technologies Modified: stable/11/sys/dev/mlx5/mlx5_en/mlx5_en_ethtool.c stable/11/sys/dev/mlx5/mlx5_en/mlx5_en_main.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/dev/mlx5/mlx5_en/mlx5_en_ethtool.c ============================================================================== --- stable/11/sys/dev/mlx5/mlx5_en/mlx5_en_ethtool.c Thu May 16 17:17:12 2019 (r347805) +++ stable/11/sys/dev/mlx5/mlx5_en/mlx5_en_ethtool.c Thu May 16 17:17:52 2019 (r347806) @@ -1063,6 +1063,10 @@ mlx5e_ethtool_debug_stats(SYSCTL_HANDLER_ARGS) int error; PRIV_LOCK(priv); + if (priv->gone != 0) { + error = ENODEV; + goto done; + } sys_debug = priv->sysctl_debug; error = sysctl_handle_int(oidp, &sys_debug, 0, req); if (error != 0 || !req->newptr) Modified: stable/11/sys/dev/mlx5/mlx5_en/mlx5_en_main.c ============================================================================== --- stable/11/sys/dev/mlx5/mlx5_en/mlx5_en_main.c Thu May 16 17:17:12 2019 (r347805) +++ stable/11/sys/dev/mlx5/mlx5_en/mlx5_en_main.c Thu May 16 17:17:52 2019 (r347806) @@ -3779,9 +3779,9 @@ mlx5e_destroy_ifp(struct mlx5_core_dev *mdev, void *vp /* destroy all remaining sysctl nodes */ sysctl_ctx_free(&priv->stats.vport.ctx); sysctl_ctx_free(&priv->stats.pport.ctx); - sysctl_ctx_free(&priv->sysctl_ctx); if (priv->sysctl_debug) sysctl_ctx_free(&priv->stats.port_stats_debug.ctx); + sysctl_ctx_free(&priv->sysctl_ctx); mlx5_core_destroy_mkey(priv->mdev, &priv->mr); mlx5_dealloc_transport_domain(priv->mdev, priv->tdn); From owner-svn-src-stable@freebsd.org Thu May 16 17:18:31 2019 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id E8757159FFEA; Thu, 16 May 2019 17:18:30 +0000 (UTC) (envelope-from hselasky@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 8EAD78E2F4; Thu, 16 May 2019 17:18:30 +0000 (UTC) (envelope-from hselasky@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 5C4A923DEA; Thu, 16 May 2019 17:18:30 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x4GHIU4R099309; Thu, 16 May 2019 17:18:30 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x4GHIU4v099308; Thu, 16 May 2019 17:18:30 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201905161718.x4GHIU4v099308@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Thu, 16 May 2019 17:18:30 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r347807 - stable/11/sys/ofed/drivers/infiniband/core X-SVN-Group: stable-11 X-SVN-Commit-Author: hselasky X-SVN-Commit-Paths: stable/11/sys/ofed/drivers/infiniband/core X-SVN-Commit-Revision: 347807 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 8EAD78E2F4 X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.98 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.998,0]; NEURAL_HAM_SHORT(-0.99)[-0.985,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US]; NEURAL_HAM_LONG(-1.00)[-1.000,0] X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 16 May 2019 17:18:31 -0000 Author: hselasky Date: Thu May 16 17:18:29 2019 New Revision: 347807 URL: https://svnweb.freebsd.org/changeset/base/347807 Log: MFC r347257: Make sure to error out when arming the CQ fails in ibcore. Sponsored by: Mellanox Technologies Modified: stable/11/sys/ofed/drivers/infiniband/core/ib_uverbs_cmd.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/ofed/drivers/infiniband/core/ib_uverbs_cmd.c ============================================================================== --- stable/11/sys/ofed/drivers/infiniband/core/ib_uverbs_cmd.c Thu May 16 17:17:52 2019 (r347806) +++ stable/11/sys/ofed/drivers/infiniband/core/ib_uverbs_cmd.c Thu May 16 17:18:29 2019 (r347807) @@ -1692,6 +1692,7 @@ ssize_t ib_uverbs_req_notify_cq(struct ib_uverbs_file { struct ib_uverbs_req_notify_cq cmd; struct ib_cq *cq; + int retval; if (copy_from_user(&cmd, buf, sizeof cmd)) return -EFAULT; @@ -1700,12 +1701,15 @@ ssize_t ib_uverbs_req_notify_cq(struct ib_uverbs_file if (!cq) return -EINVAL; - ib_req_notify_cq(cq, cmd.solicited_only ? - IB_CQ_SOLICITED : IB_CQ_NEXT_COMP); + if (ib_req_notify_cq(cq, cmd.solicited_only ? + IB_CQ_SOLICITED : IB_CQ_NEXT_COMP) < 0) + retval = -ENXIO; + else + retval = in_len; put_cq_read(cq); - return in_len; + return retval; } ssize_t ib_uverbs_destroy_cq(struct ib_uverbs_file *file, From owner-svn-src-stable@freebsd.org Thu May 16 17:19:05 2019 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id DED0A15A006A; Thu, 16 May 2019 17:19:04 +0000 (UTC) (envelope-from hselasky@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 877BE8E412; Thu, 16 May 2019 17:19:04 +0000 (UTC) (envelope-from hselasky@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 2EDD123DEC; Thu, 16 May 2019 17:19:04 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x4GHJ4G9099397; Thu, 16 May 2019 17:19:04 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x4GHJ3sE099396; Thu, 16 May 2019 17:19:03 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201905161719.x4GHJ3sE099396@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Thu, 16 May 2019 17:19:03 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r347808 - in stable/11/sys/dev: mlx4/mlx4_ib mlx5/mlx5_ib X-SVN-Group: stable-11 X-SVN-Commit-Author: hselasky X-SVN-Commit-Paths: in stable/11/sys/dev: mlx4/mlx4_ib mlx5/mlx5_ib X-SVN-Commit-Revision: 347808 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 877BE8E412 X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.98 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.998,0]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; NEURAL_HAM_SHORT(-0.99)[-0.986,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US] X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 16 May 2019 17:19:05 -0000 Author: hselasky Date: Thu May 16 17:19:03 2019 New Revision: 347808 URL: https://svnweb.freebsd.org/changeset/base/347808 Log: MFC r347258: Make sure to error out when arming the CQ fails in mlx4ib and mlx5ib. Sponsored by: Mellanox Technologies Modified: stable/11/sys/dev/mlx4/mlx4_ib/mlx4_ib_cq.c stable/11/sys/dev/mlx5/mlx5_ib/mlx5_ib_cq.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/dev/mlx4/mlx4_ib/mlx4_ib_cq.c ============================================================================== --- stable/11/sys/dev/mlx4/mlx4_ib/mlx4_ib_cq.c Thu May 16 17:18:29 2019 (r347807) +++ stable/11/sys/dev/mlx4/mlx4_ib/mlx4_ib_cq.c Thu May 16 17:19:03 2019 (r347808) @@ -878,7 +878,8 @@ int mlx4_ib_poll_cq(struct ib_cq *ibcq, int num_entrie struct mlx4_ib_dev *mdev = to_mdev(cq->ibcq.device); spin_lock_irqsave(&cq->lock, flags); - if (mdev->dev->persist->state & MLX4_DEVICE_STATE_INTERNAL_ERROR) { + if (unlikely(mdev->dev->persist->state & + MLX4_DEVICE_STATE_INTERNAL_ERROR)) { mlx4_ib_poll_sw_comp(cq, num_entries, wc, &npolled); goto out; } @@ -898,11 +899,18 @@ out: int mlx4_ib_arm_cq(struct ib_cq *ibcq, enum ib_cq_notify_flags flags) { - mlx4_cq_arm(&to_mcq(ibcq)->mcq, + struct mlx4_ib_cq *cq = to_mcq(ibcq); + struct mlx4_ib_dev *mdev = to_mdev(cq->ibcq.device); + + if (unlikely(mdev->dev->persist->state & + MLX4_DEVICE_STATE_INTERNAL_ERROR)) + return -1; + + mlx4_cq_arm(&cq->mcq, (flags & IB_CQ_SOLICITED_MASK) == IB_CQ_SOLICITED ? MLX4_CQ_DB_REQ_NOT_SOL : MLX4_CQ_DB_REQ_NOT, - to_mdev(ibcq->device)->uar_map, - MLX4_GET_DOORBELL_LOCK(&to_mdev(ibcq->device)->uar_lock)); + mdev->uar_map, + MLX4_GET_DOORBELL_LOCK(&mdev->uar_lock)); return 0; } Modified: stable/11/sys/dev/mlx5/mlx5_ib/mlx5_ib_cq.c ============================================================================== --- stable/11/sys/dev/mlx5/mlx5_ib/mlx5_ib_cq.c Thu May 16 17:18:29 2019 (r347807) +++ stable/11/sys/dev/mlx5/mlx5_ib/mlx5_ib_cq.c Thu May 16 17:19:03 2019 (r347808) @@ -673,7 +673,7 @@ int mlx5_ib_poll_cq(struct ib_cq *ibcq, int num_entrie int npolled; spin_lock_irqsave(&cq->lock, flags); - if (mdev->state == MLX5_DEVICE_STATE_INTERNAL_ERROR) { + if (unlikely(mdev->state == MLX5_DEVICE_STATE_INTERNAL_ERROR)) { mlx5_ib_poll_sw_comp(cq, num_entries, wc, &npolled); goto out; } @@ -702,6 +702,9 @@ int mlx5_ib_arm_cq(struct ib_cq *ibcq, enum ib_cq_noti unsigned long irq_flags; int ret = 0; + if (unlikely(mdev->state == MLX5_DEVICE_STATE_INTERNAL_ERROR)) + return -1; + spin_lock_irqsave(&cq->lock, irq_flags); if (cq->notify_flags != IB_CQ_NEXT_COMP) cq->notify_flags = flags & IB_CQ_SOLICITED_MASK; @@ -715,7 +718,7 @@ int mlx5_ib_arm_cq(struct ib_cq *ibcq, enum ib_cq_noti MLX5_CQ_DB_REQ_NOT_SOL : MLX5_CQ_DB_REQ_NOT, uar_page, MLX5_GET_DOORBELL_LOCK(&mdev->priv.cq_uar_lock), - to_mcq(ibcq)->mcq.cons_index); + cq->mcq.cons_index); return ret; } From owner-svn-src-stable@freebsd.org Thu May 16 17:19:50 2019 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 3A6B115A0107; Thu, 16 May 2019 17:19:50 +0000 (UTC) (envelope-from hselasky@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 D14FD8E569; Thu, 16 May 2019 17:19:49 +0000 (UTC) (envelope-from hselasky@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 75CAC23DEE; Thu, 16 May 2019 17:19:49 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x4GHJnTo099484; Thu, 16 May 2019 17:19:49 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x4GHJnSd099483; Thu, 16 May 2019 17:19:49 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201905161719.x4GHJnSd099483@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Thu, 16 May 2019 17:19:49 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r347809 - stable/11/sys/dev/mlx5/mlx5_ib X-SVN-Group: stable-11 X-SVN-Commit-Author: hselasky X-SVN-Commit-Paths: stable/11/sys/dev/mlx5/mlx5_ib X-SVN-Commit-Revision: 347809 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: D14FD8E569 X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.98 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.998,0]; NEURAL_HAM_SHORT(-0.99)[-0.985,0]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US] X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 16 May 2019 17:19:50 -0000 Author: hselasky Date: Thu May 16 17:19:48 2019 New Revision: 347809 URL: https://svnweb.freebsd.org/changeset/base/347809 Log: MFC r347259: Remove unused module parameter in mlx5ib. Sponsored by: Mellanox Technologies Modified: stable/11/sys/dev/mlx5/mlx5_ib/mlx5_ib_main.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/dev/mlx5/mlx5_ib/mlx5_ib_main.c ============================================================================== --- stable/11/sys/dev/mlx5/mlx5_ib/mlx5_ib_main.c Thu May 16 17:19:03 2019 (r347808) +++ stable/11/sys/dev/mlx5/mlx5_ib/mlx5_ib_main.c Thu May 16 17:19:48 2019 (r347809) @@ -63,10 +63,6 @@ MODULE_DEPEND(mlx5ib, mlx5, 1, 1, 1); MODULE_DEPEND(mlx5ib, ibcore, 1, 1, 1); MODULE_VERSION(mlx5ib, 1); -static int deprecated_prof_sel = 2; -module_param_named(prof_sel, deprecated_prof_sel, int, 0444); -MODULE_PARM_DESC(prof_sel, "profile selector. Deprecated here. Moved to module mlx5_core"); - static const char mlx5_version[] = DRIVER_NAME ": Mellanox Connect-IB Infiniband driver " DRIVER_VERSION " (" DRIVER_RELDATE ")\n"; @@ -3301,9 +3297,6 @@ static struct mlx5_interface mlx5_ib_interface = { static int __init mlx5_ib_init(void) { int err; - - if (deprecated_prof_sel != 2) - pr_warn("prof_sel is deprecated for mlx5_ib, set it for mlx5_core\n"); err = mlx5_ib_odp_init(); if (err) From owner-svn-src-stable@freebsd.org Thu May 16 17:21:28 2019 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id BFF8115A0367; Thu, 16 May 2019 17:21:28 +0000 (UTC) (envelope-from hselasky@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 6435F8E8A4; Thu, 16 May 2019 17:21:28 +0000 (UTC) (envelope-from hselasky@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 3F0F223F53; Thu, 16 May 2019 17:21:28 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x4GHLS8r004267; Thu, 16 May 2019 17:21:28 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x4GHLRLH004264; Thu, 16 May 2019 17:21:27 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201905161721.x4GHLRLH004264@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Thu, 16 May 2019 17:21:27 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r347810 - stable/11/sys/dev/mlx5/mlx5_en X-SVN-Group: stable-11 X-SVN-Commit-Author: hselasky X-SVN-Commit-Paths: stable/11/sys/dev/mlx5/mlx5_en X-SVN-Commit-Revision: 347810 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 6435F8E8A4 X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.99 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.998,0]; NEURAL_HAM_SHORT(-0.99)[-0.987,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US]; NEURAL_HAM_LONG(-1.00)[-1.000,0] X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 16 May 2019 17:21:29 -0000 Author: hselasky Date: Thu May 16 17:21:27 2019 New Revision: 347810 URL: https://svnweb.freebsd.org/changeset/base/347810 Log: MFC r347260 and r347326: Correct number of elements for priority to traffic class mappings in mlx5en(4). The number of priorities is always 8, while the number of traffic classes supported can vary. While at it convert the sysctl node into an array. Sponsored by: Mellanox Technologies Modified: stable/11/sys/dev/mlx5/mlx5_en/en.h stable/11/sys/dev/mlx5/mlx5_en/mlx5_en_ethtool.c stable/11/sys/dev/mlx5/mlx5_en/mlx5_en_main.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/dev/mlx5/mlx5_en/en.h ============================================================================== --- stable/11/sys/dev/mlx5/mlx5_en/en.h Thu May 16 17:19:48 2019 (r347809) +++ stable/11/sys/dev/mlx5/mlx5_en/en.h Thu May 16 17:21:27 2019 (r347810) @@ -72,6 +72,9 @@ #include #include +#define MLX5E_MAX_PRIORITY 8 + +/* IEEE 802.1Qaz standard supported values */ #define IEEE_8021QAZ_MAX_TCS 8 #define MLX5E_PARAMS_MINIMUM_LOG_SQ_SIZE 0x7 @@ -481,10 +484,10 @@ struct mlx5e_params { u16 rx_hash_log_tbl_sz; u32 tx_pauseframe_control __aligned(4); u32 rx_pauseframe_control __aligned(4); - u32 tx_priority_flow_control __aligned(4); - u32 rx_priority_flow_control __aligned(4); u16 tx_max_inline; u8 tx_min_inline_mode; + u8 tx_priority_flow_control; + u8 rx_priority_flow_control; u8 channels_rsss; }; @@ -523,7 +526,7 @@ struct mlx5e_params_ethtool { MLX5E_PARAMS(MLX5E_STATS_VAR) u64 max_bw_value[IEEE_8021QAZ_MAX_TCS]; u8 max_bw_share[IEEE_8021QAZ_MAX_TCS]; - u8 prio_tc[IEEE_8021QAZ_MAX_TCS]; + u8 prio_tc[MLX5E_MAX_PRIORITY]; u8 dscp2prio[MLX5_MAX_SUPPORTED_DSCP]; u8 trust_state; }; Modified: stable/11/sys/dev/mlx5/mlx5_en/mlx5_en_ethtool.c ============================================================================== --- stable/11/sys/dev/mlx5/mlx5_en/mlx5_en_ethtool.c Thu May 16 17:19:48 2019 (r347809) +++ stable/11/sys/dev/mlx5/mlx5_en/mlx5_en_ethtool.c Thu May 16 17:21:27 2019 (r347810) @@ -298,8 +298,8 @@ mlx5e_get_prio_tc(struct mlx5e_priv *priv) return (EOPNOTSUPP); } - for (i = 0; i <= mlx5_max_tc(priv->mdev); i++) { - err = -mlx5_query_port_prio_tc(mdev, i, &(priv->params_ethtool.prio_tc[i])); + for (i = 0; i != MLX5E_MAX_PRIORITY; i++) { + err = -mlx5_query_port_prio_tc(mdev, i, priv->params_ethtool.prio_tc + i); if (err) break; } @@ -311,29 +311,35 @@ static int mlx5e_prio_to_tc_handler(SYSCTL_HANDLER_ARGS) { struct mlx5e_priv *priv = arg1; - int prio_index = arg2; struct mlx5_core_dev *mdev = priv->mdev; + uint8_t temp[MLX5E_MAX_PRIORITY]; int err; - uint8_t result; + int i; PRIV_LOCK(priv); - result = priv->params_ethtool.prio_tc[prio_index]; - err = sysctl_handle_8(oidp, &result, 0, req); - if (err || !req->newptr || - result == priv->params_ethtool.prio_tc[prio_index]) + err = SYSCTL_OUT(req, priv->params_ethtool.prio_tc, MLX5E_MAX_PRIORITY); + if (err || !req->newptr) goto done; - - if (result > mlx5_max_tc(mdev)) { - err = ERANGE; - goto done; - } - - err = -mlx5_set_port_prio_tc(mdev, prio_index, result); + err = SYSCTL_IN(req, temp, MLX5E_MAX_PRIORITY); if (err) goto done; - priv->params_ethtool.prio_tc[prio_index] = result; + for (i = 0; i != MLX5E_MAX_PRIORITY; i++) { + if (temp[i] > mlx5_max_tc(mdev)) { + err = ERANGE; + goto done; + } + } + for (i = 0; i != MLX5E_MAX_PRIORITY; i++) { + if (temp[i] == priv->params_ethtool.prio_tc[i]) + continue; + err = -mlx5_set_port_prio_tc(mdev, i, temp[i]); + if (err) + goto done; + /* update cached value */ + priv->params_ethtool.prio_tc[i] = temp[i]; + } done: PRIV_UNLOCK(priv); return (err); @@ -1135,7 +1141,6 @@ mlx5e_create_diagnostics(struct mlx5e_priv *priv) void mlx5e_create_ethtool(struct mlx5e_priv *priv) { - struct mlx5_core_dev *mdev = priv->mdev; struct sysctl_oid *node, *qos_node; const char *pnameunit; unsigned x; @@ -1262,14 +1267,10 @@ mlx5e_create_ethtool(struct mlx5e_priv *priv) /* Priority to traffic class mapping */ if (mlx5e_get_prio_tc(priv) == 0) { - for (i = 0; i <= mlx5_max_tc(mdev); i++) { - char name[32]; - snprintf(name, sizeof(name), "prio_%d_to_tc", i); - SYSCTL_ADD_PROC(&priv->sysctl_ctx, SYSCTL_CHILDREN(qos_node), - OID_AUTO, name, CTLTYPE_U8 | CTLFLAG_RWTUN | CTLFLAG_MPSAFE, - priv, i, mlx5e_prio_to_tc_handler, "CU", - "Set priority to traffic class"); - } + SYSCTL_ADD_PROC(&priv->sysctl_ctx, SYSCTL_CHILDREN(qos_node), + OID_AUTO, "prio_0_7_tc", CTLTYPE_U8 | CTLFLAG_RWTUN | CTLFLAG_MPSAFE, + priv, 0, mlx5e_prio_to_tc_handler, "CU", + "Set traffic class 0 to 7 for priority 0 to 7 inclusivly"); } /* DSCP support */ @@ -1287,7 +1288,7 @@ mlx5e_create_ethtool(struct mlx5e_priv *priv) SYSCTL_ADD_PROC(&priv->sysctl_ctx, SYSCTL_CHILDREN(qos_node), OID_AUTO, "trust_state", CTLTYPE_U8 | CTLFLAG_RWTUN | CTLFLAG_MPSAFE, priv, 0, mlx5e_trust_state_handler, "CU", - MLX5_CAP_QCAM_FEATURE(mdev, qpts_trust_both) ? + MLX5_CAP_QCAM_FEATURE(priv->mdev, qpts_trust_both) ? A B : A); #undef B #undef A Modified: stable/11/sys/dev/mlx5/mlx5_en/mlx5_en_main.c ============================================================================== --- stable/11/sys/dev/mlx5/mlx5_en/mlx5_en_main.c Thu May 16 17:19:48 2019 (r347809) +++ stable/11/sys/dev/mlx5/mlx5_en/mlx5_en_main.c Thu May 16 17:21:27 2019 (r347810) @@ -281,7 +281,9 @@ mlx5e_set_port_pfc(struct mlx5e_priv *priv) { int error; - if (priv->params.rx_pauseframe_control || + if (priv->gone != 0) { + error = -ENXIO; + } else if (priv->params.rx_pauseframe_control || priv->params.tx_pauseframe_control) { if_printf(priv->ifp, "Global pauseframes must be disabled before enabling PFC.\n"); @@ -3329,79 +3331,98 @@ static int mlx5e_sysctl_tx_priority_flow_control(SYSCTL_HANDLER_ARGS) { struct mlx5e_priv *priv = arg1; + uint8_t temp[MLX5E_MAX_PRIORITY]; uint32_t tx_pfc; - uint32_t value; - int error; + int err; + int i; PRIV_LOCK(priv); tx_pfc = priv->params.tx_priority_flow_control; - /* get current value */ - value = (tx_pfc >> arg2) & 1; + for (i = 0; i != MLX5E_MAX_PRIORITY; i++) + temp[i] = (tx_pfc >> i) & 1; - error = sysctl_handle_32(oidp, &value, 0, req); + err = SYSCTL_OUT(req, temp, MLX5E_MAX_PRIORITY); + if (err || !req->newptr) + goto done; + err = SYSCTL_IN(req, temp, MLX5E_MAX_PRIORITY); + if (err) + goto done; - /* range check value */ - if (value != 0) - priv->params.tx_priority_flow_control |= (1 << arg2); - else - priv->params.tx_priority_flow_control &= ~(1 << arg2); + priv->params.tx_priority_flow_control = 0; - /* check if update is required */ - if (error == 0 && priv->gone == 0 && - tx_pfc != priv->params.tx_priority_flow_control) { - error = -mlx5e_set_port_pfc(priv); - /* restore previous value */ - if (error != 0) - priv->params.tx_priority_flow_control= tx_pfc; + /* range check input value */ + for (i = 0; i != MLX5E_MAX_PRIORITY; i++) { + if (temp[i] > 1) { + err = ERANGE; + goto done; + } + priv->params.tx_priority_flow_control |= (temp[i] << i); } + + /* check if update is required */ + if (tx_pfc != priv->params.tx_priority_flow_control) + err = -mlx5e_set_port_pfc(priv); +done: + if (err != 0) + priv->params.tx_priority_flow_control= tx_pfc; PRIV_UNLOCK(priv); - return (error); + return (err); } static int mlx5e_sysctl_rx_priority_flow_control(SYSCTL_HANDLER_ARGS) { struct mlx5e_priv *priv = arg1; + uint8_t temp[MLX5E_MAX_PRIORITY]; uint32_t rx_pfc; - uint32_t value; - int error; + int err; + int i; PRIV_LOCK(priv); rx_pfc = priv->params.rx_priority_flow_control; - /* get current value */ - value = (rx_pfc >> arg2) & 1; + for (i = 0; i != MLX5E_MAX_PRIORITY; i++) + temp[i] = (rx_pfc >> i) & 1; - error = sysctl_handle_32(oidp, &value, 0, req); + err = SYSCTL_OUT(req, temp, MLX5E_MAX_PRIORITY); + if (err || !req->newptr) + goto done; + err = SYSCTL_IN(req, temp, MLX5E_MAX_PRIORITY); + if (err) + goto done; - /* range check value */ - if (value != 0) - priv->params.rx_priority_flow_control |= (1 << arg2); - else - priv->params.rx_priority_flow_control &= ~(1 << arg2); + priv->params.rx_priority_flow_control = 0; - /* check if update is required */ - if (error == 0 && priv->gone == 0 && - rx_pfc != priv->params.rx_priority_flow_control) { - error = -mlx5e_set_port_pfc(priv); - /* restore previous value */ - if (error != 0) - priv->params.rx_priority_flow_control= rx_pfc; + /* range check input value */ + for (i = 0; i != MLX5E_MAX_PRIORITY; i++) { + if (temp[i] > 1) { + err = ERANGE; + goto done; + } + priv->params.rx_priority_flow_control |= (temp[i] << i); } + + /* check if update is required */ + if (rx_pfc != priv->params.rx_priority_flow_control) + err = -mlx5e_set_port_pfc(priv); +done: + if (err != 0) + priv->params.rx_priority_flow_control= rx_pfc; PRIV_UNLOCK(priv); - return (error); + return (err); } static void mlx5e_setup_pauseframes(struct mlx5e_priv *priv) { - unsigned int x; +#if (__FreeBSD_version < 1100000) char path[96]; +#endif int error; /* enable pauseframes by default */ @@ -3426,25 +3447,6 @@ mlx5e_setup_pauseframes(struct mlx5e_priv *priv) /* try to fetch tunable, if any */ TUNABLE_INT_FETCH(path, &priv->params.rx_pauseframe_control); - - for (x = 0; x != 8; x++) { - - /* compute path for sysctl */ - snprintf(path, sizeof(path), "dev.mce.%d.tx_priority_flow_control_%u", - device_get_unit(priv->mdev->pdev->dev.bsddev), x); - - /* try to fetch tunable, if any */ - if (TUNABLE_INT_FETCH(path, &value) == 0 && value != 0) - priv->params.tx_priority_flow_control |= 1 << x; - - /* compute path for sysctl */ - snprintf(path, sizeof(path), "dev.mce.%d.rx_priority_flow_control_%u", - device_get_unit(priv->mdev->pdev->dev.bsddev), x); - - /* try to fetch tunable, if any */ - if (TUNABLE_INT_FETCH(path, &value) == 0 && value != 0) - priv->params.rx_priority_flow_control |= 1 << x; - } #endif /* register pauseframe SYSCTLs */ @@ -3458,22 +3460,16 @@ mlx5e_setup_pauseframes(struct mlx5e_priv *priv) &priv->params.rx_pauseframe_control, 0, "Set to enable RX pause frames. Clear to disable."); - /* register priority_flow control, PFC, SYSCTLs */ - for (x = 0; x != 8; x++) { - snprintf(path, sizeof(path), "tx_priority_flow_control_%u", x); + /* register priority flow control, PFC, SYSCTLs */ + SYSCTL_ADD_PROC(&priv->sysctl_ctx, SYSCTL_CHILDREN(priv->sysctl_ifnet), + OID_AUTO, "tx_priority_flow_control", CTLTYPE_U8 | CTLFLAG_RWTUN | + CTLFLAG_MPSAFE, priv, 0, &mlx5e_sysctl_tx_priority_flow_control, "CU", + "Set to enable TX ports flow control frames for priorities 0..7. Clear to disable."); - SYSCTL_ADD_PROC(&priv->sysctl_ctx, SYSCTL_CHILDREN(priv->sysctl_ifnet), - OID_AUTO, path, CTLTYPE_UINT | CTLFLAG_RWTUN | - CTLFLAG_MPSAFE, priv, x, &mlx5e_sysctl_tx_priority_flow_control, "IU", - "Set to enable TX ports flow control frames for given priority. Clear to disable."); - - snprintf(path, sizeof(path), "rx_priority_flow_control_%u", x); - - SYSCTL_ADD_PROC(&priv->sysctl_ctx, SYSCTL_CHILDREN(priv->sysctl_ifnet), - OID_AUTO, path, CTLTYPE_UINT | CTLFLAG_RWTUN | - CTLFLAG_MPSAFE, priv, x, &mlx5e_sysctl_rx_priority_flow_control, "IU", - "Set to enable RX ports flow control frames for given priority. Clear to disable."); - } + SYSCTL_ADD_PROC(&priv->sysctl_ctx, SYSCTL_CHILDREN(priv->sysctl_ifnet), + OID_AUTO, "rx_priority_flow_control", CTLTYPE_U8 | CTLFLAG_RWTUN | + CTLFLAG_MPSAFE, priv, 0, &mlx5e_sysctl_rx_priority_flow_control, "CU", + "Set to enable RX ports flow control frames for priorities 0..7. Clear to disable."); PRIV_LOCK(priv); From owner-svn-src-stable@freebsd.org Thu May 16 17:22:12 2019 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id C7C9015A03C7; Thu, 16 May 2019 17:22:12 +0000 (UTC) (envelope-from hselasky@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 6C7228EA32; Thu, 16 May 2019 17:22:12 +0000 (UTC) (envelope-from hselasky@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 4668A23F88; Thu, 16 May 2019 17:22:12 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x4GHMCUh004376; Thu, 16 May 2019 17:22:12 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x4GHMCVZ004375; Thu, 16 May 2019 17:22:12 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201905161722.x4GHMCVZ004375@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Thu, 16 May 2019 17:22:12 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r347811 - stable/11/sys/dev/mlx5/mlx5_en X-SVN-Group: stable-11 X-SVN-Commit-Author: hselasky X-SVN-Commit-Paths: stable/11/sys/dev/mlx5/mlx5_en X-SVN-Commit-Revision: 347811 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 6C7228EA32 X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.98 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.998,0]; NEURAL_HAM_SHORT(-0.99)[-0.985,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US]; NEURAL_HAM_LONG(-1.00)[-1.000,0] X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 16 May 2019 17:22:13 -0000 Author: hselasky Date: Thu May 16 17:22:11 2019 New Revision: 347811 URL: https://svnweb.freebsd.org/changeset/base/347811 Log: MFC r347261: Implement fast close of RX channel in mlx5en(4). Instead of waiting for all jobs to be cancelled, simply close the completion queue to prevent more completion events and let mlx5e_destroy_rq() cleanup the remaining mbufs. Sponsored by: Mellanox Technologies Modified: stable/11/sys/dev/mlx5/mlx5_en/mlx5_en_main.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/dev/mlx5/mlx5_en/mlx5_en_main.c ============================================================================== --- stable/11/sys/dev/mlx5/mlx5_en/mlx5_en_main.c Thu May 16 17:21:27 2019 (r347810) +++ stable/11/sys/dev/mlx5/mlx5_en/mlx5_en_main.c Thu May 16 17:22:11 2019 (r347811) @@ -1033,17 +1033,10 @@ mlx5e_close_rq(struct mlx5e_rq *rq) static void mlx5e_close_rq_wait(struct mlx5e_rq *rq) { - struct mlx5_core_dev *mdev = rq->channel->priv->mdev; - /* wait till RQ is empty */ - while (!mlx5_wq_ll_is_empty(&rq->wq) && - (mdev->state != MLX5_DEVICE_STATE_INTERNAL_ERROR)) { - msleep(4); - rq->cq.mcq.comp(&rq->cq.mcq); - } - - cancel_work_sync(&rq->dim.work); mlx5e_disable_rq(rq); + mlx5e_close_cq(&rq->cq); + cancel_work_sync(&rq->dim.work); mlx5e_destroy_rq(rq); } @@ -1756,7 +1749,6 @@ mlx5e_close_channel_wait(struct mlx5e_channel *c) { mlx5e_close_rq_wait(&c->rq); mlx5e_close_sqs_wait(c); - mlx5e_close_cq(&c->rq.cq); mlx5e_close_tx_cqs(c); /* destroy mutexes */ mlx5e_chan_mtx_destroy(c); From owner-svn-src-stable@freebsd.org Thu May 16 17:22:58 2019 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 1CE8F15A0459; Thu, 16 May 2019 17:22:58 +0000 (UTC) (envelope-from hselasky@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 B45198EBB0; Thu, 16 May 2019 17:22:57 +0000 (UTC) (envelope-from hselasky@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 825B023FA6; Thu, 16 May 2019 17:22:57 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x4GHMvwg004465; Thu, 16 May 2019 17:22:57 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x4GHMvRD004464; Thu, 16 May 2019 17:22:57 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201905161722.x4GHMvRD004464@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Thu, 16 May 2019 17:22:57 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r347812 - stable/11/sys/dev/mlx5/mlx5_en X-SVN-Group: stable-11 X-SVN-Commit-Author: hselasky X-SVN-Commit-Paths: stable/11/sys/dev/mlx5/mlx5_en X-SVN-Commit-Revision: 347812 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: B45198EBB0 X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.98 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.998,0]; NEURAL_HAM_SHORT(-0.99)[-0.986,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US]; NEURAL_HAM_LONG(-1.00)[-1.000,0] X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 16 May 2019 17:22:58 -0000 Author: hselasky Date: Thu May 16 17:22:57 2019 New Revision: 347812 URL: https://svnweb.freebsd.org/changeset/base/347812 Log: MFC r347262: Split mlx5e_update_stats_work() in mlx5en(4). Split the function into the mlx5e_update_stats_locked() core and make mlx5e_update_stats_work() call the _locked helper, similar to many other places in the kernel. This improves the code structure, making the locking clean. Submitted by: kib@ Sponsored by: Mellanox Technologies Modified: stable/11/sys/dev/mlx5/mlx5_en/mlx5_en_main.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/dev/mlx5/mlx5_en/mlx5_en_main.c ============================================================================== --- stable/11/sys/dev/mlx5/mlx5_en/mlx5_en_main.c Thu May 16 17:22:11 2019 (r347811) +++ stable/11/sys/dev/mlx5/mlx5_en/mlx5_en_main.c Thu May 16 17:22:57 2019 (r347812) @@ -475,10 +475,8 @@ free_out: * configuration lock. */ static void -mlx5e_update_stats_work(struct work_struct *work) +mlx5e_update_stats_locked(struct mlx5e_priv *priv) { - struct mlx5e_priv *priv = container_of(work, struct mlx5e_priv, - update_stats_work); struct mlx5_core_dev *mdev = priv->mdev; struct mlx5e_vport_stats *s = &priv->stats.vport; struct mlx5e_sq_stats *sq_stats; @@ -505,12 +503,9 @@ mlx5e_update_stats_work(struct work_struct *work) int i; int j; - PRIV_LOCK(priv); out = mlx5_vzalloc(outlen); if (out == NULL) goto free_out; - if (test_bit(MLX5E_STATE_OPENED, &priv->state) == 0) - goto free_out; /* Collect firts the SW counters and then HW for consistency */ for (i = 0; i < priv->params.num_channels; i++) { @@ -565,78 +560,70 @@ mlx5e_update_stats_work(struct work_struct *work) memset(out, 0, outlen); /* get number of out-of-buffer drops first */ - if (mlx5_vport_query_out_of_rx_buffer(mdev, priv->counter_set_id, - &rx_out_of_buffer)) - goto free_out; + if (test_bit(MLX5E_STATE_OPENED, &priv->state) != 0 && + mlx5_vport_query_out_of_rx_buffer(mdev, priv->counter_set_id, + &rx_out_of_buffer) == 0) { + /* accumulate difference into a 64-bit counter */ + s->rx_out_of_buffer += (u64)(u32)(rx_out_of_buffer - + s->rx_out_of_buffer_prev); + s->rx_out_of_buffer_prev = rx_out_of_buffer; + } - /* accumulate difference into a 64-bit counter */ - s->rx_out_of_buffer += (u64)(u32)(rx_out_of_buffer - s->rx_out_of_buffer_prev); - s->rx_out_of_buffer_prev = rx_out_of_buffer; - /* get port statistics */ - if (mlx5_cmd_exec(mdev, in, sizeof(in), out, outlen)) - goto free_out; - + if (mlx5_cmd_exec(mdev, in, sizeof(in), out, outlen) == 0) { #define MLX5_GET_CTR(out, x) \ MLX5_GET64(query_vport_counter_out, out, x) - s->rx_error_packets = - MLX5_GET_CTR(out, received_errors.packets); - s->rx_error_bytes = - MLX5_GET_CTR(out, received_errors.octets); - s->tx_error_packets = - MLX5_GET_CTR(out, transmit_errors.packets); - s->tx_error_bytes = - MLX5_GET_CTR(out, transmit_errors.octets); + s->rx_error_packets = + MLX5_GET_CTR(out, received_errors.packets); + s->rx_error_bytes = + MLX5_GET_CTR(out, received_errors.octets); + s->tx_error_packets = + MLX5_GET_CTR(out, transmit_errors.packets); + s->tx_error_bytes = + MLX5_GET_CTR(out, transmit_errors.octets); - s->rx_unicast_packets = - MLX5_GET_CTR(out, received_eth_unicast.packets); - s->rx_unicast_bytes = - MLX5_GET_CTR(out, received_eth_unicast.octets); - s->tx_unicast_packets = - MLX5_GET_CTR(out, transmitted_eth_unicast.packets); - s->tx_unicast_bytes = - MLX5_GET_CTR(out, transmitted_eth_unicast.octets); + s->rx_unicast_packets = + MLX5_GET_CTR(out, received_eth_unicast.packets); + s->rx_unicast_bytes = + MLX5_GET_CTR(out, received_eth_unicast.octets); + s->tx_unicast_packets = + MLX5_GET_CTR(out, transmitted_eth_unicast.packets); + s->tx_unicast_bytes = + MLX5_GET_CTR(out, transmitted_eth_unicast.octets); - s->rx_multicast_packets = - MLX5_GET_CTR(out, received_eth_multicast.packets); - s->rx_multicast_bytes = - MLX5_GET_CTR(out, received_eth_multicast.octets); - s->tx_multicast_packets = - MLX5_GET_CTR(out, transmitted_eth_multicast.packets); - s->tx_multicast_bytes = - MLX5_GET_CTR(out, transmitted_eth_multicast.octets); + s->rx_multicast_packets = + MLX5_GET_CTR(out, received_eth_multicast.packets); + s->rx_multicast_bytes = + MLX5_GET_CTR(out, received_eth_multicast.octets); + s->tx_multicast_packets = + MLX5_GET_CTR(out, transmitted_eth_multicast.packets); + s->tx_multicast_bytes = + MLX5_GET_CTR(out, transmitted_eth_multicast.octets); - s->rx_broadcast_packets = - MLX5_GET_CTR(out, received_eth_broadcast.packets); - s->rx_broadcast_bytes = - MLX5_GET_CTR(out, received_eth_broadcast.octets); - s->tx_broadcast_packets = - MLX5_GET_CTR(out, transmitted_eth_broadcast.packets); - s->tx_broadcast_bytes = - MLX5_GET_CTR(out, transmitted_eth_broadcast.octets); + s->rx_broadcast_packets = + MLX5_GET_CTR(out, received_eth_broadcast.packets); + s->rx_broadcast_bytes = + MLX5_GET_CTR(out, received_eth_broadcast.octets); + s->tx_broadcast_packets = + MLX5_GET_CTR(out, transmitted_eth_broadcast.packets); + s->tx_broadcast_bytes = + MLX5_GET_CTR(out, transmitted_eth_broadcast.octets); - s->rx_packets = - s->rx_unicast_packets + - s->rx_multicast_packets + - s->rx_broadcast_packets - - s->rx_out_of_buffer; - s->rx_bytes = - s->rx_unicast_bytes + - s->rx_multicast_bytes + - s->rx_broadcast_bytes; - s->tx_packets = - s->tx_unicast_packets + - s->tx_multicast_packets + - s->tx_broadcast_packets; - s->tx_bytes = - s->tx_unicast_bytes + - s->tx_multicast_bytes + - s->tx_broadcast_bytes; + s->rx_packets = s->rx_unicast_packets + + s->rx_multicast_packets + s->rx_broadcast_packets - + s->rx_out_of_buffer; + s->rx_bytes = s->rx_unicast_bytes + s->rx_multicast_bytes + + s->rx_broadcast_bytes; + s->tx_packets = s->tx_unicast_packets + + s->tx_multicast_packets + s->tx_broadcast_packets; + s->tx_bytes = s->tx_unicast_bytes + s->tx_multicast_bytes + + s->tx_broadcast_bytes; - /* Update calculated offload counters */ - s->tx_csum_offload = s->tx_packets - tx_offload_none; - s->rx_csum_good = s->rx_packets - s->rx_csum_none; + /* Update calculated offload counters */ + s->tx_csum_offload = s->tx_packets - tx_offload_none; + s->rx_csum_good = s->rx_packets - s->rx_csum_none; + } /* Get physical port counters */ mlx5e_update_pport_counters(priv); @@ -685,6 +672,17 @@ free_out: if (error != 0) if_printf(priv->ifp, "Failed reading diagnostics: %d\n", error); } +} + +static void +mlx5e_update_stats_work(struct work_struct *work) +{ + struct mlx5e_priv *priv; + + priv = container_of(work, struct mlx5e_priv, update_stats_work); + PRIV_LOCK(priv); + if (test_bit(MLX5E_STATE_OPENED, &priv->state) != 0) + mlx5e_update_stats_locked(priv); PRIV_UNLOCK(priv); } From owner-svn-src-stable@freebsd.org Thu May 16 17:23:37 2019 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 58FF915A04F7; Thu, 16 May 2019 17:23:37 +0000 (UTC) (envelope-from hselasky@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 F26AD8EDC9; Thu, 16 May 2019 17:23:36 +0000 (UTC) (envelope-from hselasky@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 C1DED23FA8; Thu, 16 May 2019 17:23:36 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x4GHNala004675; Thu, 16 May 2019 17:23:36 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x4GHNaJ7004674; Thu, 16 May 2019 17:23:36 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201905161723.x4GHNaJ7004674@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Thu, 16 May 2019 17:23:36 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r347813 - stable/11/sys/dev/mlx5/mlx5_en X-SVN-Group: stable-11 X-SVN-Commit-Author: hselasky X-SVN-Commit-Paths: stable/11/sys/dev/mlx5/mlx5_en X-SVN-Commit-Revision: 347813 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: F26AD8EDC9 X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.98 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.998,0]; NEURAL_HAM_SHORT(-0.99)[-0.985,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US]; NEURAL_HAM_LONG(-1.00)[-1.000,0] X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 16 May 2019 17:23:37 -0000 Author: hselasky Date: Thu May 16 17:23:36 2019 New Revision: 347813 URL: https://svnweb.freebsd.org/changeset/base/347813 Log: MFC r347263: Disable CQE zipping by default in mlx5en(4). After doing performance measurements, it seems like CQE zipping doesn't have any significant benefit. Moreover, we know that this feature is disabled by default on other operating systems (Linux for example). Submitted by: slavash@ Sponsored by: Mellanox Technologies Modified: stable/11/sys/dev/mlx5/mlx5_en/mlx5_en_main.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/dev/mlx5/mlx5_en/mlx5_en_main.c ============================================================================== --- stable/11/sys/dev/mlx5/mlx5_en/mlx5_en_main.c Thu May 16 17:22:57 2019 (r347812) +++ stable/11/sys/dev/mlx5/mlx5_en/mlx5_en_main.c Thu May 16 17:23:36 2019 (r347813) @@ -3061,7 +3061,12 @@ mlx5e_build_ifp_priv(struct mlx5_core_dev *mdev, priv->params.hw_lro_en = false; priv->params.lro_wqe_sz = MLX5E_PARAMS_DEFAULT_LRO_WQE_SZ; - priv->params.cqe_zipping_en = !!MLX5_CAP_GEN(mdev, cqe_compression); + /* + * CQE zipping is currently defaulted to off. when it won't + * anymore we will consider the HW capability: + * "!!MLX5_CAP_GEN(mdev, cqe_compression)" + */ + priv->params.cqe_zipping_en = false; priv->mdev = mdev; priv->params.num_channels = num_comp_vectors; From owner-svn-src-stable@freebsd.org Thu May 16 17:24:26 2019 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 9FB4C15A05CE; Thu, 16 May 2019 17:24:26 +0000 (UTC) (envelope-from hselasky@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 0B6F58EFDC; Thu, 16 May 2019 17:24:26 +0000 (UTC) (envelope-from hselasky@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 5664623FAA; Thu, 16 May 2019 17:24:22 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x4GHOMhI004830; Thu, 16 May 2019 17:24:22 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x4GHOLIj004828; Thu, 16 May 2019 17:24:21 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201905161724.x4GHOLIj004828@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Thu, 16 May 2019 17:24:21 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r347815 - stable/11/sys/dev/mlx5/mlx5_en X-SVN-Group: stable-11 X-SVN-Commit-Author: hselasky X-SVN-Commit-Paths: stable/11/sys/dev/mlx5/mlx5_en X-SVN-Commit-Revision: 347815 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 0B6F58EFDC X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.98 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.998,0]; NEURAL_HAM_SHORT(-0.99)[-0.986,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US]; NEURAL_HAM_LONG(-1.00)[-1.000,0] X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 16 May 2019 17:24:26 -0000 Author: hselasky Date: Thu May 16 17:24:21 2019 New Revision: 347815 URL: https://svnweb.freebsd.org/changeset/base/347815 Log: MFC r347264: Configure firmware to use RX hash format in mini CQE in mlx5en(4). When using CQE zipping, one can choose between RX hash and Checksum. This will indicate the parameter on which a zipping session should be stopped. While porting the Linux code, Checksum was chosen. However, the value of Checksum is not being used anywhere. For the FreeBSD driver, we prefer to use the RX hash format which will guarantee the RX hash value for all the mini CQEs. While at it, make sure to initialize the Checksum value in the decompressed CQE. Submitted by: slavash@ Sponsored by: Mellanox Technologies Modified: stable/11/sys/dev/mlx5/mlx5_en/mlx5_en_main.c stable/11/sys/dev/mlx5/mlx5_en/mlx5_en_rx.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/dev/mlx5/mlx5_en/mlx5_en_main.c ============================================================================== --- stable/11/sys/dev/mlx5/mlx5_en/mlx5_en_main.c Thu May 16 17:24:11 2019 (r347814) +++ stable/11/sys/dev/mlx5/mlx5_en/mlx5_en_main.c Thu May 16 17:24:21 2019 (r347815) @@ -1850,13 +1850,15 @@ mlx5e_build_rx_cq_param(struct mlx5e_priv *priv, struct net_dim_cq_moder curr; void *cqc = param->cqc; - /* - * TODO The sysctl to control on/off is a bool value for now, which means - * we only support CSUM, once HASH is implemnted we'll need to address that. + * We use MLX5_CQE_FORMAT_HASH because the RX hash mini CQE + * format is more beneficial for FreeBSD use case. + * + * Adding support for MLX5_CQE_FORMAT_CSUM will require changes + * in mlx5e_decompress_cqe. */ if (priv->params.cqe_zipping_en) { - MLX5_SET(cqc, cqc, mini_cqe_res_format, MLX5_CQE_FORMAT_CSUM); + MLX5_SET(cqc, cqc, mini_cqe_res_format, MLX5_CQE_FORMAT_HASH); MLX5_SET(cqc, cqc, cqe_compression_en, 1); } Modified: stable/11/sys/dev/mlx5/mlx5_en/mlx5_en_rx.c ============================================================================== --- stable/11/sys/dev/mlx5/mlx5_en/mlx5_en_rx.c Thu May 16 17:24:11 2019 (r347814) +++ stable/11/sys/dev/mlx5/mlx5_en/mlx5_en_rx.c Thu May 16 17:24:21 2019 (r347815) @@ -340,7 +340,12 @@ mlx5e_decompress_cqe(struct mlx5e_cq *cq, struct mlx5_ */ title->byte_cnt = mini->byte_cnt; title->wqe_counter = cpu_to_be16((wqe_counter + i) & cq->wq.sz_m1); - title->check_sum = mini->checksum; + title->rss_hash_result = mini->rx_hash_result; + /* + * Since we use MLX5_CQE_FORMAT_HASH when creating the RX CQ, + * the value of the checksum should be ignored. + */ + title->check_sum = 0; title->op_own = (title->op_own & 0xf0) | (((cq->wq.cc + i) >> cq->wq.log_sz) & 1); } From owner-svn-src-stable@freebsd.org Thu May 16 17:25:02 2019 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 7AE9715A06B5; Thu, 16 May 2019 17:25:02 +0000 (UTC) (envelope-from hselasky@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 1F81B8F146; Thu, 16 May 2019 17:25:02 +0000 (UTC) (envelope-from hselasky@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 ED4A323FB4; Thu, 16 May 2019 17:25:01 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x4GHP1vE004926; Thu, 16 May 2019 17:25:01 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x4GHP1Zj004925; Thu, 16 May 2019 17:25:01 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201905161725.x4GHP1Zj004925@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Thu, 16 May 2019 17:25:01 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r347816 - stable/11/sys/dev/mlx5/mlx5_core X-SVN-Group: stable-11 X-SVN-Commit-Author: hselasky X-SVN-Commit-Paths: stable/11/sys/dev/mlx5/mlx5_core X-SVN-Commit-Revision: 347816 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 1F81B8F146 X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.98 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.998,0]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; NEURAL_HAM_SHORT(-0.99)[-0.985,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US] X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 16 May 2019 17:25:02 -0000 Author: hselasky Date: Thu May 16 17:25:01 2019 New Revision: 347816 URL: https://svnweb.freebsd.org/changeset/base/347816 Log: MFC r347265: Ticks are integer type in FreeBSD. Sponsored by: Mellanox Technologies Modified: stable/11/sys/dev/mlx5/mlx5_core/mlx5_health.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/dev/mlx5/mlx5_core/mlx5_health.c ============================================================================== --- stable/11/sys/dev/mlx5/mlx5_core/mlx5_health.c Thu May 16 17:24:21 2019 (r347815) +++ stable/11/sys/dev/mlx5/mlx5_core/mlx5_health.c Thu May 16 17:25:01 2019 (r347816) @@ -255,7 +255,7 @@ mlx5_health_allow_reset(struct mlx5_core_dev *dev) #define MLX5_NIC_STATE_POLL_MS 5 void mlx5_enter_error_state(struct mlx5_core_dev *dev, bool force) { - unsigned long end, delay_ms = MLX5_CRDUMP_WAIT_MS; + int end, delay_ms = MLX5_CRDUMP_WAIT_MS; u32 fatal_error; int lock = -EBUSY; @@ -299,7 +299,7 @@ void mlx5_enter_error_state(struct mlx5_core_dev *dev, } while (!time_after(jiffies, end)); if (!sensor_nic_disabled(dev)) { - dev_err(&dev->pdev->dev, "NIC IFC still %d after %lums.\n", + dev_err(&dev->pdev->dev, "NIC IFC still %d after %ums.\n", get_nic_mode(dev), delay_ms); } From owner-svn-src-stable@freebsd.org Thu May 16 17:25:43 2019 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id DAD8C15A0788; Thu, 16 May 2019 17:25:42 +0000 (UTC) (envelope-from hselasky@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 819988F288; Thu, 16 May 2019 17:25:42 +0000 (UTC) (envelope-from hselasky@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 3665023FB5; Thu, 16 May 2019 17:25:42 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x4GHPgDH005011; Thu, 16 May 2019 17:25:42 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x4GHPfWY005010; Thu, 16 May 2019 17:25:41 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201905161725.x4GHPfWY005010@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Thu, 16 May 2019 17:25:41 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r347817 - stable/11/sys/dev/mlx5/mlx5_core X-SVN-Group: stable-11 X-SVN-Commit-Author: hselasky X-SVN-Commit-Paths: stable/11/sys/dev/mlx5/mlx5_core X-SVN-Commit-Revision: 347817 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 819988F288 X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.98 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.998,0]; NEURAL_HAM_SHORT(-0.99)[-0.986,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US]; NEURAL_HAM_LONG(-1.00)[-1.000,0] X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 16 May 2019 17:25:43 -0000 Author: hselasky Date: Thu May 16 17:25:41 2019 New Revision: 347817 URL: https://svnweb.freebsd.org/changeset/base/347817 Log: MFC r347266: Implement get and set nic state as global functions in mlx5core. Sponsored by: Mellanox Technologies Modified: stable/11/sys/dev/mlx5/mlx5_core/mlx5_core.h stable/11/sys/dev/mlx5/mlx5_core/mlx5_health.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/dev/mlx5/mlx5_core/mlx5_core.h ============================================================================== --- stable/11/sys/dev/mlx5/mlx5_core/mlx5_core.h Thu May 16 17:25:01 2019 (r347816) +++ stable/11/sys/dev/mlx5/mlx5_core/mlx5_core.h Thu May 16 17:25:41 2019 (r347817) @@ -108,4 +108,15 @@ extern struct pci_driver mlx5_core_driver; SYSCTL_DECL(_hw_mlx5); +enum { + MLX5_NIC_IFC_FULL = 0, + MLX5_NIC_IFC_DISABLED = 1, + MLX5_NIC_IFC_NO_DRAM_NIC = 2, + MLX5_NIC_IFC_INVALID = 3, + MLX5_NIC_IFC_SW_RESET = 7, +}; + +u8 mlx5_get_nic_state(struct mlx5_core_dev *dev); +void mlx5_set_nic_state(struct mlx5_core_dev *dev, u8 state); + #endif /* __MLX5_CORE_H__ */ Modified: stable/11/sys/dev/mlx5/mlx5_core/mlx5_health.c ============================================================================== --- stable/11/sys/dev/mlx5/mlx5_core/mlx5_health.c Thu May 16 17:25:01 2019 (r347816) +++ stable/11/sys/dev/mlx5/mlx5_core/mlx5_health.c Thu May 16 17:25:41 2019 (r347817) @@ -39,13 +39,6 @@ #define MAX_MISSES 3 enum { - MLX5_NIC_IFC_FULL = 0, - MLX5_NIC_IFC_DISABLED = 1, - MLX5_NIC_IFC_NO_DRAM_NIC = 2, - MLX5_NIC_IFC_SW_RESET = 7, -}; - -enum { MLX5_DROP_NEW_HEALTH_WORK, MLX5_DROP_NEW_RECOVERY_WORK, }; @@ -114,11 +107,21 @@ static int unlock_sem_sw_reset(struct mlx5_core_dev *d return ret; } -static u8 get_nic_mode(struct mlx5_core_dev *dev) +u8 mlx5_get_nic_state(struct mlx5_core_dev *dev) { return (ioread32be(&dev->iseg->cmdq_addr_l_sz) >> 8) & 7; } +void mlx5_set_nic_state(struct mlx5_core_dev *dev, u8 state) +{ + u32 cur_cmdq_addr_l_sz; + + cur_cmdq_addr_l_sz = ioread32be(&dev->iseg->cmdq_addr_l_sz); + iowrite32be((cur_cmdq_addr_l_sz & 0xFFFFF000) | + state << MLX5_NIC_IFC_OFFSET, + &dev->iseg->cmdq_addr_l_sz); +} + static bool sensor_fw_synd_rfr(struct mlx5_core_dev *dev) { struct mlx5_core_health *health = &dev->priv.health; @@ -165,12 +168,12 @@ static bool sensor_pci_no_comm(struct mlx5_core_dev *d static bool sensor_nic_disabled(struct mlx5_core_dev *dev) { - return get_nic_mode(dev) == MLX5_NIC_IFC_DISABLED; + return mlx5_get_nic_state(dev) == MLX5_NIC_IFC_DISABLED; } static bool sensor_nic_sw_reset(struct mlx5_core_dev *dev) { - return get_nic_mode(dev) == MLX5_NIC_IFC_SW_RESET; + return mlx5_get_nic_state(dev) == MLX5_NIC_IFC_SW_RESET; } static u32 check_fatal_sensors(struct mlx5_core_dev *dev) @@ -300,7 +303,7 @@ void mlx5_enter_error_state(struct mlx5_core_dev *dev, if (!sensor_nic_disabled(dev)) { dev_err(&dev->pdev->dev, "NIC IFC still %d after %ums.\n", - get_nic_mode(dev), delay_ms); + mlx5_get_nic_state(dev), delay_ms); } /* Release FW semaphore if you are the lock owner */ @@ -316,7 +319,7 @@ err_state_done: static void mlx5_handle_bad_state(struct mlx5_core_dev *dev) { - u8 nic_mode = get_nic_mode(dev); + u8 nic_mode = mlx5_get_nic_state(dev); if (nic_mode == MLX5_NIC_IFC_SW_RESET) { /* The IFC mode field is 3 bits, so it will read 0x7 in two cases: @@ -362,11 +365,11 @@ static void health_recover(struct work_struct *work) recover = false; } - nic_mode = get_nic_mode(dev); + nic_mode = mlx5_get_nic_state(dev); while (nic_mode != MLX5_NIC_IFC_DISABLED && !time_after(jiffies, end)) { msleep(MLX5_NIC_STATE_POLL_MS); - nic_mode = get_nic_mode(dev); + nic_mode = mlx5_get_nic_state(dev); } if (nic_mode != MLX5_NIC_IFC_DISABLED) { From owner-svn-src-stable@freebsd.org Thu May 16 17:28:32 2019 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 3CD9915A0963; Thu, 16 May 2019 17:28:32 +0000 (UTC) (envelope-from hselasky@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 D1D4E8F476; Thu, 16 May 2019 17:28:31 +0000 (UTC) (envelope-from hselasky@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 B5F2C23FB6; Thu, 16 May 2019 17:28:31 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x4GHSVK0005222; Thu, 16 May 2019 17:28:31 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x4GHSUMN005218; Thu, 16 May 2019 17:28:30 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201905161728.x4GHSUMN005218@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Thu, 16 May 2019 17:28:30 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r347818 - in stable/11/sys/dev/mlx5: . mlx5_core X-SVN-Group: stable-11 X-SVN-Commit-Author: hselasky X-SVN-Commit-Paths: in stable/11/sys/dev/mlx5: . mlx5_core X-SVN-Commit-Revision: 347818 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: D1D4E8F476 X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.98 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.998,0]; NEURAL_HAM_SHORT(-0.99)[-0.986,0]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US] X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 16 May 2019 17:28:32 -0000 Author: hselasky Date: Thu May 16 17:28:30 2019 New Revision: 347818 URL: https://svnweb.freebsd.org/changeset/base/347818 Log: MFC r347268: Add Fast teardown support to mlx5core. Today mlx5 devices support two teardown modes: 1- Regular teardown 2- Force teardown This change introduces the enhanced version of the "Force teardown" that allows SW to perform teardown in a faster way without the need to reclaim all the pages. Fast teardown provides the following advantages: 1- Fix a FW race condition that could cause command timeout 2- Avoid moving to polling mode 3- Close the vport to prevent PCI ACK to be sent without been scattered to memory Linux commit: fcd29ad17c6ff885dfae58f557e9323941e63ba2 Sponsored by: Mellanox Technologies Modified: stable/11/sys/dev/mlx5/mlx5_core/mlx5_core.h stable/11/sys/dev/mlx5/mlx5_core/mlx5_fw.c stable/11/sys/dev/mlx5/mlx5_core/mlx5_main.c stable/11/sys/dev/mlx5/mlx5_ifc.h Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/dev/mlx5/mlx5_core/mlx5_core.h ============================================================================== --- stable/11/sys/dev/mlx5/mlx5_core/mlx5_core.h Thu May 16 17:25:41 2019 (r347817) +++ stable/11/sys/dev/mlx5/mlx5_core/mlx5_core.h Thu May 16 17:28:30 2019 (r347818) @@ -79,6 +79,7 @@ int mlx5_query_qcam_reg(struct mlx5_core_dev *mdev, u3 int mlx5_cmd_init_hca(struct mlx5_core_dev *dev); int mlx5_cmd_teardown_hca(struct mlx5_core_dev *dev); int mlx5_cmd_force_teardown_hca(struct mlx5_core_dev *dev); +int mlx5_cmd_fast_teardown_hca(struct mlx5_core_dev *dev); void mlx5_core_event(struct mlx5_core_dev *dev, enum mlx5_dev_event event, unsigned long param); void mlx5_enter_error_state(struct mlx5_core_dev *dev, bool force); Modified: stable/11/sys/dev/mlx5/mlx5_core/mlx5_fw.c ============================================================================== --- stable/11/sys/dev/mlx5/mlx5_core/mlx5_fw.c Thu May 16 17:25:41 2019 (r347817) +++ stable/11/sys/dev/mlx5/mlx5_core/mlx5_fw.c Thu May 16 17:28:30 2019 (r347818) @@ -249,12 +249,59 @@ int mlx5_cmd_force_teardown_hca(struct mlx5_core_dev * if (ret) return ret; - force_state = MLX5_GET(teardown_hca_out, out, force_state); + force_state = MLX5_GET(teardown_hca_out, out, state); if (force_state == MLX5_TEARDOWN_HCA_OUT_FORCE_STATE_FAIL) { mlx5_core_err(dev, "teardown with force mode failed\n"); return -EIO; } + return 0; +} + +#define MLX5_FAST_TEARDOWN_WAIT_MS 3000 +int mlx5_cmd_fast_teardown_hca(struct mlx5_core_dev *dev) +{ + int end, delay_ms = MLX5_FAST_TEARDOWN_WAIT_MS; + u32 out[MLX5_ST_SZ_DW(teardown_hca_out)] = {}; + u32 in[MLX5_ST_SZ_DW(teardown_hca_in)] = {}; + int state; + int ret; + + if (!MLX5_CAP_GEN(dev, fast_teardown)) { + mlx5_core_dbg(dev, "fast teardown is not supported in the firmware\n"); + return -EOPNOTSUPP; + } + + MLX5_SET(teardown_hca_in, in, opcode, MLX5_CMD_OP_TEARDOWN_HCA); + MLX5_SET(teardown_hca_in, in, profile, + MLX5_TEARDOWN_HCA_IN_PROFILE_PREPARE_FAST_TEARDOWN); + + ret = mlx5_cmd_exec(dev, in, sizeof(in), out, sizeof(out)); + if (ret) + return ret; + + state = MLX5_GET(teardown_hca_out, out, state); + if (state == MLX5_TEARDOWN_HCA_OUT_FORCE_STATE_FAIL) { + mlx5_core_warn(dev, "teardown with fast mode failed\n"); + return -EIO; + } + + mlx5_set_nic_state(dev, MLX5_NIC_IFC_DISABLED); + + /* Loop until device state turns to disable */ + end = jiffies + msecs_to_jiffies(delay_ms); + do { + if (mlx5_get_nic_state(dev) == MLX5_NIC_IFC_DISABLED) + break; + + pause("W", 1); + } while (!time_after(jiffies, end)); + + if (mlx5_get_nic_state(dev) != MLX5_NIC_IFC_DISABLED) { + dev_err(&dev->pdev->dev, "NIC IFC still %d after %ums.\n", + mlx5_get_nic_state(dev), delay_ms); + return -EIO; + } return 0; } Modified: stable/11/sys/dev/mlx5/mlx5_core/mlx5_main.c ============================================================================== --- stable/11/sys/dev/mlx5/mlx5_core/mlx5_main.c Thu May 16 17:25:41 2019 (r347817) +++ stable/11/sys/dev/mlx5/mlx5_core/mlx5_main.c Thu May 16 17:28:30 2019 (r347818) @@ -1397,12 +1397,17 @@ static const struct pci_error_handlers mlx5_err_handle static int mlx5_try_fast_unload(struct mlx5_core_dev *dev) { + bool fast_teardown, force_teardown; int err; - if (!MLX5_CAP_GEN(dev, force_teardown)) { - mlx5_core_dbg(dev, "force teardown is not supported in the firmware\n"); + fast_teardown = MLX5_CAP_GEN(dev, fast_teardown); + force_teardown = MLX5_CAP_GEN(dev, force_teardown); + + mlx5_core_dbg(dev, "force teardown firmware support=%d\n", force_teardown); + mlx5_core_dbg(dev, "fast teardown firmware support=%d\n", fast_teardown); + + if (!fast_teardown && !force_teardown) return -EOPNOTSUPP; - } if (dev->state == MLX5_DEVICE_STATE_INTERNAL_ERROR) { mlx5_core_dbg(dev, "Device in internal error state, giving up\n"); @@ -1415,14 +1420,19 @@ static int mlx5_try_fast_unload(struct mlx5_core_dev * mlx5_drain_health_wq(dev); mlx5_stop_health_poll(dev, false); + err = mlx5_cmd_fast_teardown_hca(dev); + if (!err) + goto done; + err = mlx5_cmd_force_teardown_hca(dev); - if (err) { - mlx5_core_dbg(dev, "Firmware couldn't do fast unload error: %d\n", err); - return err; - } + if (!err) + goto done; + mlx5_core_dbg(dev, "Firmware couldn't do fast unload error: %d\n", err); + mlx5_start_health_poll(dev); + return err; +done: mlx5_enter_error_state(dev, true); - return 0; } Modified: stable/11/sys/dev/mlx5/mlx5_ifc.h ============================================================================== --- stable/11/sys/dev/mlx5/mlx5_ifc.h Thu May 16 17:25:41 2019 (r347817) +++ stable/11/sys/dev/mlx5/mlx5_ifc.h Thu May 16 17:28:30 2019 (r347818) @@ -1054,7 +1054,8 @@ struct mlx5_ifc_cmd_hca_cap_bits { u8 relaxed_ordering_write[1]; u8 reserved_6[0x1]; u8 log_max_mkey[0x6]; - u8 reserved_7[0xc]; + u8 reserved_7[0xb]; + u8 fast_teardown[0x1]; u8 log_max_eq[0x4]; u8 max_indirection[0x8]; @@ -3289,12 +3290,13 @@ struct mlx5_ifc_teardown_hca_out_bits { u8 reserved_1[0x3f]; - u8 force_state[0x1]; + u8 state[0x1]; }; enum { MLX5_TEARDOWN_HCA_IN_PROFILE_GRACEFUL_CLOSE = 0x0, MLX5_TEARDOWN_HCA_IN_PROFILE_FORCE_CLOSE = 0x1, + MLX5_TEARDOWN_HCA_IN_PROFILE_PREPARE_FAST_TEARDOWN = 0x2, }; struct mlx5_ifc_teardown_hca_in_bits { From owner-svn-src-stable@freebsd.org Thu May 16 17:29:05 2019 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id BB5D815A09E4; Thu, 16 May 2019 17:29:05 +0000 (UTC) (envelope-from hselasky@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 5CC488F5A5; Thu, 16 May 2019 17:29:05 +0000 (UTC) (envelope-from hselasky@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 2AAE423FB7; Thu, 16 May 2019 17:29:05 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x4GHT5IS005305; Thu, 16 May 2019 17:29:05 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x4GHT5Kc005304; Thu, 16 May 2019 17:29:05 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201905161729.x4GHT5Kc005304@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Thu, 16 May 2019 17:29:05 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r347819 - stable/11/sys/dev/mlx5/mlx5_core X-SVN-Group: stable-11 X-SVN-Commit-Author: hselasky X-SVN-Commit-Paths: stable/11/sys/dev/mlx5/mlx5_core X-SVN-Commit-Revision: 347819 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 5CC488F5A5 X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.98 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.998,0]; NEURAL_HAM_SHORT(-0.99)[-0.985,0]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US] X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 16 May 2019 17:29:05 -0000 Author: hselasky Date: Thu May 16 17:29:04 2019 New Revision: 347819 URL: https://svnweb.freebsd.org/changeset/base/347819 Log: MFC r347269: Add sysctl(8) to control fast unload support in mlx5core. Sponsored by: Mellanox Technologies Modified: stable/11/sys/dev/mlx5/mlx5_core/mlx5_main.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/dev/mlx5/mlx5_core/mlx5_main.c ============================================================================== --- stable/11/sys/dev/mlx5/mlx5_core/mlx5_main.c Thu May 16 17:28:30 2019 (r347818) +++ stable/11/sys/dev/mlx5/mlx5_core/mlx5_main.c Thu May 16 17:29:04 2019 (r347819) @@ -1,5 +1,5 @@ /*- - * Copyright (c) 2013-2017, Mellanox Technologies, Ltd. All rights reserved. + * Copyright (c) 2013-2019, Mellanox Technologies, Ltd. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -68,6 +68,11 @@ MODULE_PARM_DESC(prof_sel, "profile selector. Valid ra SYSCTL_NODE(_hw, OID_AUTO, mlx5, CTLFLAG_RW, 0, "mlx5 HW controls"); +static int mlx5_fast_unload_enabled = 1; +SYSCTL_INT(_hw_mlx5, OID_AUTO, fast_unload_enabled, CTLFLAG_RWTUN, + &mlx5_fast_unload_enabled, 0, + "Set to enable fast unload. Clear to disable."); + #define NUMA_NO_NODE -1 static LIST_HEAD(intf_list); @@ -1399,6 +1404,11 @@ static int mlx5_try_fast_unload(struct mlx5_core_dev * { bool fast_teardown, force_teardown; int err; + + if (!mlx5_fast_unload_enabled) { + mlx5_core_dbg(dev, "fast unload is disabled by user\n"); + return -EOPNOTSUPP; + } fast_teardown = MLX5_CAP_GEN(dev, fast_teardown); force_teardown = MLX5_CAP_GEN(dev, force_teardown); From owner-svn-src-stable@freebsd.org Thu May 16 17:29:45 2019 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id DD21E15A0A6D; Thu, 16 May 2019 17:29:44 +0000 (UTC) (envelope-from hselasky@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 7F98C8F6C2; Thu, 16 May 2019 17:29:44 +0000 (UTC) (envelope-from hselasky@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 69A4623FB8; Thu, 16 May 2019 17:29:44 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x4GHTiZ1005390; Thu, 16 May 2019 17:29:44 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x4GHThAB005387; Thu, 16 May 2019 17:29:43 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201905161729.x4GHThAB005387@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Thu, 16 May 2019 17:29:43 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r347820 - stable/11/sys/dev/mlx5 X-SVN-Group: stable-11 X-SVN-Commit-Author: hselasky X-SVN-Commit-Paths: stable/11/sys/dev/mlx5 X-SVN-Commit-Revision: 347820 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 7F98C8F6C2 X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.98 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.998,0]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; NEURAL_HAM_SHORT(-0.99)[-0.986,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US] X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 16 May 2019 17:29:45 -0000 Author: hselasky Date: Thu May 16 17:29:43 2019 New Revision: 347820 URL: https://svnweb.freebsd.org/changeset/base/347820 Log: MFC r347270: Expose PCAM, MCAM registers infrastructure in mlx5core. PCAM: Ports capabilities mask register. MCAM: Management capabilities mask register. PCAM and MCAM registers will provide information regarding firmware support for different features, in order to avoid cases where new driver combined with old firmware results in syndromes (for ex. PCIe counters before this patchset). Linux commit: cfdcbceaeffc669b70d904d80a2df9c86c232566 Submitted by: slavash@ Sponsored by: Mellanox Technologies Modified: stable/11/sys/dev/mlx5/device.h stable/11/sys/dev/mlx5/driver.h stable/11/sys/dev/mlx5/mlx5_ifc.h Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/dev/mlx5/device.h ============================================================================== --- stable/11/sys/dev/mlx5/device.h Thu May 16 17:29:04 2019 (r347819) +++ stable/11/sys/dev/mlx5/device.h Thu May 16 17:29:43 2019 (r347820) @@ -927,6 +927,22 @@ enum mlx5_qcam_feature_groups { MLX5_QCAM_FEATURE_ENHANCED_FEATURES = 0x0, }; +enum mlx5_pcam_reg_groups { + MLX5_PCAM_REGS_5000_TO_507F = 0x0, +}; + +enum mlx5_pcam_feature_groups { + MLX5_PCAM_FEATURE_ENHANCED_FEATURES = 0x0, +}; + +enum mlx5_mcam_reg_groups { + MLX5_MCAM_REGS_FIRST_128 = 0x0, +}; + +enum mlx5_mcam_feature_groups { + MLX5_MCAM_FEATURE_ENHANCED_FEATURES = 0x0, +}; + /* GET Dev Caps macros */ #define MLX5_CAP_GEN(mdev, cap) \ MLX5_GET(cmd_hca_cap, mdev->hca_caps_cur[MLX5_CAP_GENERAL], cap) Modified: stable/11/sys/dev/mlx5/driver.h ============================================================================== --- stable/11/sys/dev/mlx5/driver.h Thu May 16 17:29:04 2019 (r347819) +++ stable/11/sys/dev/mlx5/driver.h Thu May 16 17:29:43 2019 (r347820) @@ -147,11 +147,13 @@ enum { MLX5_REG_PELC = 0x500e, MLX5_REG_PVLC = 0x500f, MLX5_REG_PMLP = 0x5002, + MLX5_REG_PCAM = 0x507f, MLX5_REG_NODE_DESC = 0x6001, MLX5_REG_HOST_ENDIANNESS = 0x7004, MLX5_REG_MTMP = 0x900a, MLX5_REG_MCIA = 0x9014, MLX5_REG_MPCNT = 0x9051, + MLX5_REG_MCAM = 0x907f, }; enum dbg_rsc_type { Modified: stable/11/sys/dev/mlx5/mlx5_ifc.h ============================================================================== --- stable/11/sys/dev/mlx5/mlx5_ifc.h Thu May 16 17:29:04 2019 (r347819) +++ stable/11/sys/dev/mlx5/mlx5_ifc.h Thu May 16 17:29:43 2019 (r347820) @@ -1103,7 +1103,9 @@ struct mlx5_ifc_cmd_hca_cap_bits { u8 ets[0x1]; u8 nic_flow_table[0x1]; u8 eswitch_flow_table[0x1]; - u8 reserved_18[0x3]; + u8 reserved_18[0x1]; + u8 mcam_reg[0x1]; + u8 pcam_reg[0x1]; u8 local_ca_ack_delay[0x5]; u8 port_module_event[0x1]; u8 reserved_19[0x5]; @@ -8544,6 +8546,63 @@ struct mlx5_ifc_qcam_reg_bits { struct mlx5_ifc_qcam_qos_feature_cap_mask feature_cap; u8 reserved_at_0[0x80]; } qos_feature_cap_mask; + + u8 reserved_at_1c0[0x80]; +}; + +struct mlx5_ifc_pcam_enhanced_features_bits { + u8 reserved_at_0[0x7e]; + + u8 ppcnt_discard_group[0x1]; + u8 ppcnt_statistical_group[0x1]; +}; + +struct mlx5_ifc_pcam_reg_bits { + u8 reserved_at_0[0x8]; + u8 feature_group[0x8]; + u8 reserved_at_10[0x8]; + u8 access_reg_group[0x8]; + + u8 reserved_at_20[0x20]; + + union { + u8 reserved_at_0[0x80]; + } port_access_reg_cap_mask; + + u8 reserved_at_c0[0x80]; + + union { + struct mlx5_ifc_pcam_enhanced_features_bits enhanced_features; + u8 reserved_at_0[0x80]; + } feature_cap_mask; + + u8 reserved_at_1c0[0xc0]; +}; + +struct mlx5_ifc_mcam_enhanced_features_bits { + u8 reserved_at_0[0x7f]; + + u8 pcie_performance_group[0x1]; +}; + +struct mlx5_ifc_mcam_reg_bits { + u8 reserved_at_0[0x8]; + u8 feature_group[0x8]; + u8 reserved_at_10[0x8]; + u8 access_reg_group[0x8]; + + u8 reserved_at_20[0x20]; + + union { + u8 reserved_at_0[0x80]; + } mng_access_reg_cap_mask; + + u8 reserved_at_c0[0x80]; + + union { + struct mlx5_ifc_mcam_enhanced_features_bits enhanced_features; + u8 reserved_at_0[0x80]; + } mng_feature_cap_mask; u8 reserved_at_1c0[0x80]; }; From owner-svn-src-stable@freebsd.org Thu May 16 17:30:22 2019 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id B79F715A0B11; Thu, 16 May 2019 17:30:21 +0000 (UTC) (envelope-from hselasky@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 5BE088F7D2; Thu, 16 May 2019 17:30:21 +0000 (UTC) (envelope-from hselasky@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 1904E23FBC; Thu, 16 May 2019 17:30:21 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x4GHUKOm005504; Thu, 16 May 2019 17:30:20 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x4GHUKDt005503; Thu, 16 May 2019 17:30:20 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201905161730.x4GHUKDt005503@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Thu, 16 May 2019 17:30:20 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r347821 - stable/11/sys/dev/mlx5/mlx5_core X-SVN-Group: stable-11 X-SVN-Commit-Author: hselasky X-SVN-Commit-Paths: stable/11/sys/dev/mlx5/mlx5_core X-SVN-Commit-Revision: 347821 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 5BE088F7D2 X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.98 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.998,0]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; NEURAL_HAM_SHORT(-0.99)[-0.986,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US] X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 16 May 2019 17:30:22 -0000 Author: hselasky Date: Thu May 16 17:30:20 2019 New Revision: 347821 URL: https://svnweb.freebsd.org/changeset/base/347821 Log: MFC r347271: Implement PCAM, MCAM access register commands in mlx5core. Introduced registers will expose capabilities of new registers and features related to port/management. Driver will query MCAM and PCAM in order to avoid failing on old firmwares with lack of support. Linux commit: c835ad64683bd3e2d1b31ed2cb1ff4366932edb1 Submitted by: slavash@ Sponsored by: Mellanox Technologies Modified: stable/11/sys/dev/mlx5/mlx5_core/mlx5_core.h stable/11/sys/dev/mlx5/mlx5_core/mlx5_port.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/dev/mlx5/mlx5_core/mlx5_core.h ============================================================================== --- stable/11/sys/dev/mlx5/mlx5_core/mlx5_core.h Thu May 16 17:29:43 2019 (r347820) +++ stable/11/sys/dev/mlx5/mlx5_core/mlx5_core.h Thu May 16 17:30:20 2019 (r347821) @@ -76,6 +76,10 @@ int mlx5_query_hca_caps(struct mlx5_core_dev *dev); int mlx5_query_board_id(struct mlx5_core_dev *dev); int mlx5_query_qcam_reg(struct mlx5_core_dev *mdev, u32 *qcam, u8 feature_group, u8 access_reg_group); +int mlx5_query_pcam_reg(struct mlx5_core_dev *dev, u32 *pcam, + u8 feature_group, u8 access_reg_group); +int mlx5_query_mcam_reg(struct mlx5_core_dev *dev, u32 *mcap, + u8 feature_group, u8 access_reg_group); int mlx5_cmd_init_hca(struct mlx5_core_dev *dev); int mlx5_cmd_teardown_hca(struct mlx5_core_dev *dev); int mlx5_cmd_force_teardown_hca(struct mlx5_core_dev *dev); Modified: stable/11/sys/dev/mlx5/mlx5_core/mlx5_port.c ============================================================================== --- stable/11/sys/dev/mlx5/mlx5_core/mlx5_port.c Thu May 16 17:29:43 2019 (r347820) +++ stable/11/sys/dev/mlx5/mlx5_core/mlx5_port.c Thu May 16 17:30:20 2019 (r347821) @@ -79,6 +79,30 @@ int mlx5_query_qcam_reg(struct mlx5_core_dev *mdev, u3 } EXPORT_SYMBOL_GPL(mlx5_query_qcam_reg); +int mlx5_query_pcam_reg(struct mlx5_core_dev *dev, u32 *pcam, u8 feature_group, + u8 access_reg_group) +{ + u32 in[MLX5_ST_SZ_DW(pcam_reg)] = {}; + int sz = MLX5_ST_SZ_BYTES(pcam_reg); + + MLX5_SET(pcam_reg, in, feature_group, feature_group); + MLX5_SET(pcam_reg, in, access_reg_group, access_reg_group); + + return mlx5_core_access_reg(dev, in, sz, pcam, sz, MLX5_REG_PCAM, 0, 0); +} + +int mlx5_query_mcam_reg(struct mlx5_core_dev *dev, u32 *mcam, u8 feature_group, + u8 access_reg_group) +{ + u32 in[MLX5_ST_SZ_DW(mcam_reg)] = {}; + int sz = MLX5_ST_SZ_BYTES(mcam_reg); + + MLX5_SET(mcam_reg, in, feature_group, feature_group); + MLX5_SET(mcam_reg, in, access_reg_group, access_reg_group); + + return mlx5_core_access_reg(dev, in, sz, mcam, sz, MLX5_REG_MCAM, 0, 0); +} + struct mlx5_reg_pcap { u8 rsvd0; u8 port_num; From owner-svn-src-stable@freebsd.org Thu May 16 17:30:57 2019 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id F267C15A0B94; Thu, 16 May 2019 17:30:56 +0000 (UTC) (envelope-from hselasky@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 9541B8F94B; Thu, 16 May 2019 17:30:56 +0000 (UTC) (envelope-from hselasky@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 81D2C23FDC; Thu, 16 May 2019 17:30:56 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x4GHUuHA005588; Thu, 16 May 2019 17:30:56 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x4GHUtXt005585; Thu, 16 May 2019 17:30:55 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201905161730.x4GHUtXt005585@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Thu, 16 May 2019 17:30:55 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r347822 - in stable/11/sys/dev/mlx5: . mlx5_core X-SVN-Group: stable-11 X-SVN-Commit-Author: hselasky X-SVN-Commit-Paths: in stable/11/sys/dev/mlx5: . mlx5_core X-SVN-Commit-Revision: 347822 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 9541B8F94B X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.98 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.998,0]; NEURAL_HAM_SHORT(-0.99)[-0.986,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US]; NEURAL_HAM_LONG(-1.00)[-1.000,0] X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 16 May 2019 17:30:57 -0000 Author: hselasky Date: Thu May 16 17:30:55 2019 New Revision: 347822 URL: https://svnweb.freebsd.org/changeset/base/347822 Log: MFC r347272: Query and cache PCAM, MCAM registers on initialization in mlx5core. On load_one, we now cache our capabilities registers internally, similar to QUERY_HCA_CAP. Capabilities can later be queried using macros introduced in this patch. Linux commit: 71862561f3a62015a11de16d1c306481e8415c08 Submitted by: slavash@ Sponsored by: Mellanox Technologies Modified: stable/11/sys/dev/mlx5/device.h stable/11/sys/dev/mlx5/driver.h stable/11/sys/dev/mlx5/mlx5_core/mlx5_fw.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/dev/mlx5/device.h ============================================================================== --- stable/11/sys/dev/mlx5/device.h Thu May 16 17:30:20 2019 (r347821) +++ stable/11/sys/dev/mlx5/device.h Thu May 16 17:30:55 2019 (r347822) @@ -1048,6 +1048,12 @@ enum mlx5_mcam_feature_groups { MLX5_GET(qos_cap,\ mdev->hca_caps_max[MLX5_CAP_QOS], cap) +#define MLX5_CAP_PCAM_FEATURE(mdev, fld) \ + MLX5_GET(pcam_reg, (mdev)->caps.pcam, feature_cap_mask.enhanced_features.fld) + +#define MLX5_CAP_MCAM_FEATURE(mdev, fld) \ + MLX5_GET(mcam_reg, (mdev)->caps.mcam, mng_feature_cap_mask.enhanced_features.fld) + #define MLX5_CAP_QCAM_REG(mdev, fld) \ MLX5_GET(qcam_reg, (mdev)->caps.qcam, qos_access_reg_cap_mask.reg_cap.fld) Modified: stable/11/sys/dev/mlx5/driver.h ============================================================================== --- stable/11/sys/dev/mlx5/driver.h Thu May 16 17:30:20 2019 (r347821) +++ stable/11/sys/dev/mlx5/driver.h Thu May 16 17:30:55 2019 (r347822) @@ -673,6 +673,8 @@ struct mlx5_core_dev { u32 hca_caps_cur[MLX5_CAP_NUM][MLX5_UN_SZ_DW(hca_cap_union)]; u32 hca_caps_max[MLX5_CAP_NUM][MLX5_UN_SZ_DW(hca_cap_union)]; struct { + u32 pcam[MLX5_ST_SZ_DW(pcam_reg)]; + u32 mcam[MLX5_ST_SZ_DW(mcam_reg)]; u32 qcam[MLX5_ST_SZ_DW(qcam_reg)]; u32 fpga[MLX5_ST_SZ_DW(fpga_cap)]; } caps; Modified: stable/11/sys/dev/mlx5/mlx5_core/mlx5_fw.c ============================================================================== --- stable/11/sys/dev/mlx5/mlx5_core/mlx5_fw.c Thu May 16 17:30:20 2019 (r347821) +++ stable/11/sys/dev/mlx5/mlx5_core/mlx5_fw.c Thu May 16 17:30:55 2019 (r347822) @@ -117,6 +117,20 @@ static int mlx5_get_qcam_reg(struct mlx5_core_dev *dev MLX5_QCAM_REGS_FIRST_128); } +static int mlx5_get_pcam_reg(struct mlx5_core_dev *dev) +{ + return mlx5_query_pcam_reg(dev, dev->caps.pcam, + MLX5_PCAM_FEATURE_ENHANCED_FEATURES, + MLX5_PCAM_REGS_5000_TO_507F); +} + +static int mlx5_get_mcam_reg(struct mlx5_core_dev *dev) +{ + return mlx5_query_mcam_reg(dev, dev->caps.mcam, + MLX5_MCAM_FEATURE_ENHANCED_FEATURES, + MLX5_MCAM_REGS_FIRST_128); +} + int mlx5_query_hca_caps(struct mlx5_core_dev *dev) { int err; From owner-svn-src-stable@freebsd.org Thu May 16 17:31:32 2019 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 97AEC15A0D9F; Thu, 16 May 2019 17:31:32 +0000 (UTC) (envelope-from hselasky@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 38CD48FB0C; Thu, 16 May 2019 17:31:32 +0000 (UTC) (envelope-from hselasky@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 268E323FFE; Thu, 16 May 2019 17:31:32 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x4GHVWKQ006595; Thu, 16 May 2019 17:31:32 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x4GHVWvW006594; Thu, 16 May 2019 17:31:32 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201905161731.x4GHVWvW006594@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Thu, 16 May 2019 17:31:32 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r347823 - stable/11/sys/dev/mlx5/mlx5_core X-SVN-Group: stable-11 X-SVN-Commit-Author: hselasky X-SVN-Commit-Paths: stable/11/sys/dev/mlx5/mlx5_core X-SVN-Commit-Revision: 347823 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 38CD48FB0C X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.98 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.998,0]; NEURAL_HAM_SHORT(-0.99)[-0.985,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US]; NEURAL_HAM_LONG(-1.00)[-1.000,0] X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 16 May 2019 17:31:32 -0000 Author: hselasky Date: Thu May 16 17:31:31 2019 New Revision: 347823 URL: https://svnweb.freebsd.org/changeset/base/347823 Log: MFC r347273: Add reading the mcam_reg in mlx5core. Submitted by: slavash@ Sponsored by: Mellanox Technologies Modified: stable/11/sys/dev/mlx5/mlx5_core/mlx5_fw.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/dev/mlx5/mlx5_core/mlx5_fw.c ============================================================================== --- stable/11/sys/dev/mlx5/mlx5_core/mlx5_fw.c Thu May 16 17:30:55 2019 (r347822) +++ stable/11/sys/dev/mlx5/mlx5_core/mlx5_fw.c Thu May 16 17:31:31 2019 (r347823) @@ -215,6 +215,12 @@ int mlx5_query_hca_caps(struct mlx5_core_dev *dev) return err; } + if (MLX5_CAP_GEN(dev, mcam_reg)) { + err = mlx5_get_mcam_reg(dev); + if (err) + return err; + } + err = mlx5_core_query_special_contexts(dev); if (err) return err; From owner-svn-src-stable@freebsd.org Thu May 16 17:32:09 2019 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 4919715A0E52; Thu, 16 May 2019 17:32:09 +0000 (UTC) (envelope-from hselasky@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 E00B08FCFC; Thu, 16 May 2019 17:32:08 +0000 (UTC) (envelope-from hselasky@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 BBECB2413C; Thu, 16 May 2019 17:32:08 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x4GHW8ks009869; Thu, 16 May 2019 17:32:08 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x4GHW8bw009866; Thu, 16 May 2019 17:32:08 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201905161732.x4GHW8bw009866@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Thu, 16 May 2019 17:32:08 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r347824 - stable/11/sys/dev/mlx5 X-SVN-Group: stable-11 X-SVN-Commit-Author: hselasky X-SVN-Commit-Paths: stable/11/sys/dev/mlx5 X-SVN-Commit-Revision: 347824 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: E00B08FCFC X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.98 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.998,0]; NEURAL_HAM_SHORT(-0.99)[-0.986,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US]; NEURAL_HAM_LONG(-1.00)[-1.000,0] X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 16 May 2019 17:32:09 -0000 Author: hselasky Date: Thu May 16 17:32:08 2019 New Revision: 347824 URL: https://svnweb.freebsd.org/changeset/base/347824 Log: MFC r347274: Add MCC (Management Component Control) register definitions in mlx5core. MCC (Management Component Control) allows to control a firmware component update. MCDA (Management Component Data Access) allows to read and write a firmware component. MCQI (Management Component Query Information) allows to query information about firmware components. Linux commit: 4717628938423fcba0aa8fa889e9fed4eb6a655f Submitted by: slavash@ Sponsored by: Mellanox Technologies Modified: stable/11/sys/dev/mlx5/driver.h stable/11/sys/dev/mlx5/mlx5_ifc.h Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/dev/mlx5/driver.h ============================================================================== --- stable/11/sys/dev/mlx5/driver.h Thu May 16 17:31:31 2019 (r347823) +++ stable/11/sys/dev/mlx5/driver.h Thu May 16 17:32:08 2019 (r347824) @@ -153,6 +153,9 @@ enum { MLX5_REG_MTMP = 0x900a, MLX5_REG_MCIA = 0x9014, MLX5_REG_MPCNT = 0x9051, + MLX5_REG_MCQI = 0x9061, + MLX5_REG_MCC = 0x9062, + MLX5_REG_MCDA = 0x9063, MLX5_REG_MCAM = 0x907f, }; Modified: stable/11/sys/dev/mlx5/mlx5_ifc.h ============================================================================== --- stable/11/sys/dev/mlx5/mlx5_ifc.h Thu May 16 17:31:31 2019 (r347823) +++ stable/11/sys/dev/mlx5/mlx5_ifc.h Thu May 16 17:32:08 2019 (r347824) @@ -9927,6 +9927,85 @@ struct mlx5_ifc_mpcnt_reg_bits { union mlx5_ifc_mpcnt_cntrs_grp_data_layout_bits counter_set; }; +struct mlx5_ifc_mcqi_cap_bits { + u8 supported_info_bitmask[0x20]; + + u8 component_size[0x20]; + + u8 max_component_size[0x20]; + + u8 log_mcda_word_size[0x4]; + u8 reserved_at_64[0xc]; + u8 mcda_max_write_size[0x10]; + + u8 rd_en[0x1]; + u8 reserved_at_81[0x1]; + u8 match_chip_id[0x1]; + u8 match_psid[0x1]; + u8 check_user_timestamp[0x1]; + u8 match_base_guid_mac[0x1]; + u8 reserved_at_86[0x1a]; +}; + +struct mlx5_ifc_mcqi_reg_bits { + u8 read_pending_component[0x1]; + u8 reserved_at_1[0xf]; + u8 component_index[0x10]; + + u8 reserved_at_20[0x20]; + + u8 reserved_at_40[0x1b]; + u8 info_type[0x5]; + + u8 info_size[0x20]; + + u8 offset[0x20]; + + u8 reserved_at_a0[0x10]; + u8 data_size[0x10]; + + u8 data[0][0x20]; +}; + +struct mlx5_ifc_mcc_reg_bits { + u8 reserved_at_0[0x4]; + u8 time_elapsed_since_last_cmd[0xc]; + u8 reserved_at_10[0x8]; + u8 instruction[0x8]; + + u8 reserved_at_20[0x10]; + u8 component_index[0x10]; + + u8 reserved_at_40[0x8]; + u8 update_handle[0x18]; + + u8 handle_owner_type[0x4]; + u8 handle_owner_host_id[0x4]; + u8 reserved_at_68[0x1]; + u8 control_progress[0x7]; + u8 error_code[0x8]; + u8 reserved_at_78[0x4]; + u8 control_state[0x4]; + + u8 component_size[0x20]; + + u8 reserved_at_a0[0x60]; +}; + +struct mlx5_ifc_mcda_reg_bits { + u8 reserved_at_0[0x8]; + u8 update_handle[0x18]; + + u8 offset[0x20]; + + u8 reserved_at_40[0x10]; + u8 size[0x10]; + + u8 reserved_at_60[0x20]; + + u8 data[0][0x20]; +}; + union mlx5_ifc_ports_control_registers_document_bits { struct mlx5_ifc_ib_portcntrs_attribute_grp_data_bits ib_portcntrs_attribute_grp_data; struct mlx5_ifc_bufferx_reg_bits bufferx_reg; From owner-svn-src-stable@freebsd.org Thu May 16 17:32:48 2019 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 453EF15A0F11; Thu, 16 May 2019 17:32:48 +0000 (UTC) (envelope-from hselasky@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 DD1298FFC3; Thu, 16 May 2019 17:32:47 +0000 (UTC) (envelope-from hselasky@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 B2F4A2415B; Thu, 16 May 2019 17:32:47 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x4GHWlgZ010673; Thu, 16 May 2019 17:32:47 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x4GHWljQ010671; Thu, 16 May 2019 17:32:47 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201905161732.x4GHWljQ010671@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Thu, 16 May 2019 17:32:47 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r347825 - stable/11/sys/dev/mlx5 X-SVN-Group: stable-11 X-SVN-Commit-Author: hselasky X-SVN-Commit-Paths: stable/11/sys/dev/mlx5 X-SVN-Commit-Revision: 347825 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: DD1298FFC3 X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.98 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.998,0]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; NEURAL_HAM_SHORT(-0.99)[-0.985,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US] X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 16 May 2019 17:32:48 -0000 Author: hselasky Date: Thu May 16 17:32:47 2019 New Revision: 347825 URL: https://svnweb.freebsd.org/changeset/base/347825 Log: MFC r347275: Enhance MCAM reg to allow query on access reg support in mlx5core. Enhance MCAM to allow the driver to query which access regs are supported. For now, expose the regs needed for FW flashing. Linux commit: 0ab87743cc8c5bcd482daf71961ed5fc45349e01 Submitted by: slavash@ Sponsored by: Mellanox Technologies Modified: stable/11/sys/dev/mlx5/device.h stable/11/sys/dev/mlx5/mlx5_ifc.h Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/dev/mlx5/device.h ============================================================================== --- stable/11/sys/dev/mlx5/device.h Thu May 16 17:32:08 2019 (r347824) +++ stable/11/sys/dev/mlx5/device.h Thu May 16 17:32:47 2019 (r347825) @@ -1054,6 +1054,9 @@ enum mlx5_mcam_feature_groups { #define MLX5_CAP_MCAM_FEATURE(mdev, fld) \ MLX5_GET(mcam_reg, (mdev)->caps.mcam, mng_feature_cap_mask.enhanced_features.fld) +#define MLX5_CAP_MCAM_REG(mdev, reg) \ + MLX5_GET(mcam_reg, (mdev)->caps.mcam, mng_access_reg_cap_mask.access_regs.reg) + #define MLX5_CAP_QCAM_REG(mdev, fld) \ MLX5_GET(qcam_reg, (mdev)->caps.qcam, qos_access_reg_cap_mask.reg_cap.fld) Modified: stable/11/sys/dev/mlx5/mlx5_ifc.h ============================================================================== --- stable/11/sys/dev/mlx5/mlx5_ifc.h Thu May 16 17:32:08 2019 (r347824) +++ stable/11/sys/dev/mlx5/mlx5_ifc.h Thu May 16 17:32:47 2019 (r347825) @@ -8585,6 +8585,18 @@ struct mlx5_ifc_mcam_enhanced_features_bits { u8 pcie_performance_group[0x1]; }; +struct mlx5_ifc_mcam_access_reg_bits { + u8 reserved_at_0[0x1c]; + u8 mcda[0x1]; + u8 mcc[0x1]; + u8 mcqi[0x1]; + u8 reserved_at_1f[0x1]; + + u8 regs_95_to_64[0x20]; + u8 regs_63_to_32[0x20]; + u8 regs_31_to_0[0x20]; +}; + struct mlx5_ifc_mcam_reg_bits { u8 reserved_at_0[0x8]; u8 feature_group[0x8]; @@ -8594,6 +8606,7 @@ struct mlx5_ifc_mcam_reg_bits { u8 reserved_at_20[0x20]; union { + struct mlx5_ifc_mcam_access_reg_bits access_regs; u8 reserved_at_0[0x80]; } mng_access_reg_cap_mask; From owner-svn-src-stable@freebsd.org Thu May 16 17:33:25 2019 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 7FFFC15A1008; Thu, 16 May 2019 17:33:25 +0000 (UTC) (envelope-from hselasky@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 EF09D6811C; Thu, 16 May 2019 17:33:24 +0000 (UTC) (envelope-from hselasky@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 C0A192415C; Thu, 16 May 2019 17:33:24 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x4GHXOgT010781; Thu, 16 May 2019 17:33:24 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x4GHXOXU010780; Thu, 16 May 2019 17:33:24 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201905161733.x4GHXOXU010780@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Thu, 16 May 2019 17:33:24 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r347826 - stable/11/sys/dev/mlx5/mlx5_core X-SVN-Group: stable-11 X-SVN-Commit-Author: hselasky X-SVN-Commit-Paths: stable/11/sys/dev/mlx5/mlx5_core X-SVN-Commit-Revision: 347826 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: EF09D6811C X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.98 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.998,0]; NEURAL_HAM_SHORT(-0.99)[-0.986,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US]; NEURAL_HAM_LONG(-1.00)[-1.000,0] X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 16 May 2019 17:33:25 -0000 Author: hselasky Date: Thu May 16 17:33:24 2019 New Revision: 347826 URL: https://svnweb.freebsd.org/changeset/base/347826 Log: MFC r347276: Add helper functions to set/query MCC/MCDA/MCQI registers in mlx5core. To be used by the mlx5 callbacks exposed to the mlxfw module. Linux commit: d2ad488b0073bd1a2c3f5d2ea50a7eb632103e5d Submitted by: slavash@ Sponsored by: Mellanox Technologies Modified: stable/11/sys/dev/mlx5/mlx5_core/mlx5_fw.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/dev/mlx5/mlx5_core/mlx5_fw.c ============================================================================== --- stable/11/sys/dev/mlx5/mlx5_core/mlx5_fw.c Thu May 16 17:32:47 2019 (r347825) +++ stable/11/sys/dev/mlx5/mlx5_core/mlx5_fw.c Thu May 16 17:33:24 2019 (r347826) @@ -341,3 +341,117 @@ int mlx5_core_set_dc_cnak_trace(struct mlx5_core_dev * return mlx5_cmd_exec(dev, &in, sizeof(in), &out, sizeof(out)); } + +enum mlxsw_reg_mcc_instruction { + MLX5_REG_MCC_INSTRUCTION_LOCK_UPDATE_HANDLE = 0x01, + MLX5_REG_MCC_INSTRUCTION_RELEASE_UPDATE_HANDLE = 0x02, + MLX5_REG_MCC_INSTRUCTION_UPDATE_COMPONENT = 0x03, + MLX5_REG_MCC_INSTRUCTION_VERIFY_COMPONENT = 0x04, + MLX5_REG_MCC_INSTRUCTION_ACTIVATE = 0x06, + MLX5_REG_MCC_INSTRUCTION_CANCEL = 0x08, +}; + +static int mlx5_reg_mcc_set(struct mlx5_core_dev *dev, + enum mlxsw_reg_mcc_instruction instr, + u16 component_index, u32 update_handle, + u32 component_size) +{ + u32 out[MLX5_ST_SZ_DW(mcc_reg)]; + u32 in[MLX5_ST_SZ_DW(mcc_reg)]; + + memset(in, 0, sizeof(in)); + + MLX5_SET(mcc_reg, in, instruction, instr); + MLX5_SET(mcc_reg, in, component_index, component_index); + MLX5_SET(mcc_reg, in, update_handle, update_handle); + MLX5_SET(mcc_reg, in, component_size, component_size); + + return mlx5_core_access_reg(dev, in, sizeof(in), out, + sizeof(out), MLX5_REG_MCC, 0, 1); +} + +static int mlx5_reg_mcc_query(struct mlx5_core_dev *dev, + u32 *update_handle, u8 *error_code, + u8 *control_state) +{ + u32 out[MLX5_ST_SZ_DW(mcc_reg)]; + u32 in[MLX5_ST_SZ_DW(mcc_reg)]; + int err; + + memset(in, 0, sizeof(in)); + memset(out, 0, sizeof(out)); + MLX5_SET(mcc_reg, in, update_handle, *update_handle); + + err = mlx5_core_access_reg(dev, in, sizeof(in), out, + sizeof(out), MLX5_REG_MCC, 0, 0); + if (err) + goto out; + + *update_handle = MLX5_GET(mcc_reg, out, update_handle); + *error_code = MLX5_GET(mcc_reg, out, error_code); + *control_state = MLX5_GET(mcc_reg, out, control_state); + +out: + return err; +} + +static int mlx5_reg_mcda_set(struct mlx5_core_dev *dev, + u32 update_handle, + u32 offset, u16 size, + u8 *data) +{ + int err, in_size = MLX5_ST_SZ_BYTES(mcda_reg) + size; + u32 out[MLX5_ST_SZ_DW(mcda_reg)]; + int i, j, dw_size = size >> 2; + __be32 data_element; + u32 *in; + + in = kzalloc(in_size, GFP_KERNEL); + if (!in) + return -ENOMEM; + + MLX5_SET(mcda_reg, in, update_handle, update_handle); + MLX5_SET(mcda_reg, in, offset, offset); + MLX5_SET(mcda_reg, in, size, size); + + for (i = 0; i < dw_size; i++) { + j = i * 4; + data_element = htonl(*(u32 *)&data[j]); + memcpy(MLX5_ADDR_OF(mcda_reg, in, data) + j, &data_element, 4); + } + + err = mlx5_core_access_reg(dev, in, in_size, out, + sizeof(out), MLX5_REG_MCDA, 0, 1); + kfree(in); + return err; +} + +static int mlx5_reg_mcqi_query(struct mlx5_core_dev *dev, + u16 component_index, + u32 *max_component_size, + u8 *log_mcda_word_size, + u16 *mcda_max_write_size) +{ + u32 out[MLX5_ST_SZ_DW(mcqi_reg) + MLX5_ST_SZ_DW(mcqi_cap)]; + int offset = MLX5_ST_SZ_DW(mcqi_reg); + u32 in[MLX5_ST_SZ_DW(mcqi_reg)]; + int err; + + memset(in, 0, sizeof(in)); + memset(out, 0, sizeof(out)); + + MLX5_SET(mcqi_reg, in, component_index, component_index); + MLX5_SET(mcqi_reg, in, data_size, MLX5_ST_SZ_BYTES(mcqi_cap)); + + err = mlx5_core_access_reg(dev, in, sizeof(in), out, + sizeof(out), MLX5_REG_MCQI, 0, 0); + if (err) + goto out; + + *max_component_size = MLX5_GET(mcqi_cap, out + offset, max_component_size); + *log_mcda_word_size = MLX5_GET(mcqi_cap, out + offset, log_mcda_word_size); + *mcda_max_write_size = MLX5_GET(mcqi_cap, out + offset, mcda_max_write_size); + +out: + return err; +} From owner-svn-src-stable@freebsd.org Thu May 16 17:34:10 2019 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 844FE15A10E0; Thu, 16 May 2019 17:34:10 +0000 (UTC) (envelope-from hselasky@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 24C4C682D8; Thu, 16 May 2019 17:34:10 +0000 (UTC) (envelope-from hselasky@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 0A81C2415E; Thu, 16 May 2019 17:34:10 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x4GHY9jY010877; Thu, 16 May 2019 17:34:09 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x4GHY9N6010876; Thu, 16 May 2019 17:34:09 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201905161734.x4GHY9N6010876@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Thu, 16 May 2019 17:34:09 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r347827 - stable/11/sys/dev/mlx5/mlx5_en X-SVN-Group: stable-11 X-SVN-Commit-Author: hselasky X-SVN-Commit-Paths: stable/11/sys/dev/mlx5/mlx5_en X-SVN-Commit-Revision: 347827 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 24C4C682D8 X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.98 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.998,0]; NEURAL_HAM_SHORT(-0.99)[-0.985,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US]; NEURAL_HAM_LONG(-1.00)[-1.000,0] X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 16 May 2019 17:34:10 -0000 Author: hselasky Date: Thu May 16 17:34:09 2019 New Revision: 347827 URL: https://svnweb.freebsd.org/changeset/base/347827 Log: MFC r347277: Avoid leaking send queue mbufs during error recovery in mlx5en(4). Sponsored by: Mellanox Technologies Modified: stable/11/sys/dev/mlx5/mlx5_en/mlx5_en_main.c stable/11/sys/dev/mlx5/mlx5_en/mlx5_en_tx.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/dev/mlx5/mlx5_en/mlx5_en_main.c ============================================================================== --- stable/11/sys/dev/mlx5/mlx5_en/mlx5_en_main.c Thu May 16 17:33:24 2019 (r347826) +++ stable/11/sys/dev/mlx5/mlx5_en/mlx5_en_main.c Thu May 16 17:34:09 2019 (r347827) @@ -1044,8 +1044,13 @@ mlx5e_free_sq_db(struct mlx5e_sq *sq) int wq_sz = mlx5_wq_cyc_get_size(&sq->wq); int x; - for (x = 0; x != wq_sz; x++) + for (x = 0; x != wq_sz; x++) { + if (sq->mbuf[x].mbuf != NULL) { + bus_dmamap_unload(sq->dma_tag, sq->mbuf[x].dma_map); + m_freem(sq->mbuf[x].mbuf); + } bus_dmamap_destroy(sq->dma_tag, sq->mbuf[x].dma_map); + } free(sq->mbuf, M_MLX5EN); } Modified: stable/11/sys/dev/mlx5/mlx5_en/mlx5_en_tx.c ============================================================================== --- stable/11/sys/dev/mlx5/mlx5_en/mlx5_en_tx.c Thu May 16 17:33:24 2019 (r347826) +++ stable/11/sys/dev/mlx5/mlx5_en/mlx5_en_tx.c Thu May 16 17:34:09 2019 (r347827) @@ -496,7 +496,7 @@ mlx5e_poll_tx_cq(struct mlx5e_sq *sq, int budget) for (x = 0; x != sq->cev_factor; x++) { ci = sqcc & sq->wq.sz_m1; mb = sq->mbuf[ci].mbuf; - sq->mbuf[ci].mbuf = NULL; /* Safety clear */ + sq->mbuf[ci].mbuf = NULL; if (mb == NULL) { if (sq->mbuf[ci].num_bytes == 0) { From owner-svn-src-stable@freebsd.org Thu May 16 17:34:56 2019 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id E578615A11DF; Thu, 16 May 2019 17:34:55 +0000 (UTC) (envelope-from hselasky@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 7898D6857B; Thu, 16 May 2019 17:34:55 +0000 (UTC) (envelope-from hselasky@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 4596324160; Thu, 16 May 2019 17:34:55 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x4GHYtOA011010; Thu, 16 May 2019 17:34:55 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x4GHYtBL011009; Thu, 16 May 2019 17:34:55 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201905161734.x4GHYtBL011009@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Thu, 16 May 2019 17:34:55 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r347829 - stable/11/sys/ofed/drivers/infiniband/ulp/ipoib X-SVN-Group: stable-11 X-SVN-Commit-Author: hselasky X-SVN-Commit-Paths: stable/11/sys/ofed/drivers/infiniband/ulp/ipoib X-SVN-Commit-Revision: 347829 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 7898D6857B X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.98 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.998,0]; NEURAL_HAM_SHORT(-0.99)[-0.985,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US]; NEURAL_HAM_LONG(-1.00)[-1.000,0] X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 16 May 2019 17:34:56 -0000 Author: hselasky Date: Thu May 16 17:34:54 2019 New Revision: 347829 URL: https://svnweb.freebsd.org/changeset/base/347829 Log: MFC r347278: Fix endless loop in ipoib_poll(). ib_req_notify_cq may return negative value which will indicate a failure. In the case of uncorrectable error, we will end up in an endless loop. Fix that, by going to another loop with poll_more only if there is anything left to poll. Submitted by: slavash@ Sponsored by: Mellanox Technologies Modified: stable/11/sys/ofed/drivers/infiniband/ulp/ipoib/ipoib_ib.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/ofed/drivers/infiniband/ulp/ipoib/ipoib_ib.c ============================================================================== --- stable/11/sys/ofed/drivers/infiniband/ulp/ipoib/ipoib_ib.c Thu May 16 17:34:36 2019 (r347828) +++ stable/11/sys/ofed/drivers/infiniband/ulp/ipoib/ipoib_ib.c Thu May 16 17:34:54 2019 (r347829) @@ -407,7 +407,7 @@ poll_more: spin_unlock(&priv->drain_lock); if (ib_req_notify_cq(priv->recv_cq, - IB_CQ_NEXT_COMP | IB_CQ_REPORT_MISSED_EVENTS)) + IB_CQ_NEXT_COMP | IB_CQ_REPORT_MISSED_EVENTS) > 0) goto poll_more; } From owner-svn-src-stable@freebsd.org Thu May 16 17:35:41 2019 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id CF53C15A130D; Thu, 16 May 2019 17:35:40 +0000 (UTC) (envelope-from hselasky@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 74A3E69A7A; Thu, 16 May 2019 17:35:40 +0000 (UTC) (envelope-from hselasky@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 43CD924161; Thu, 16 May 2019 17:35:40 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x4GHZexI011109; Thu, 16 May 2019 17:35:40 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x4GHZeRL011108; Thu, 16 May 2019 17:35:40 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201905161735.x4GHZeRL011108@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Thu, 16 May 2019 17:35:40 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r347830 - stable/11/sys/dev/mlx5/mlx5_en X-SVN-Group: stable-11 X-SVN-Commit-Author: hselasky X-SVN-Commit-Paths: stable/11/sys/dev/mlx5/mlx5_en X-SVN-Commit-Revision: 347830 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 74A3E69A7A X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.98 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.998,0]; NEURAL_HAM_SHORT(-0.99)[-0.986,0]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US] X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 16 May 2019 17:35:41 -0000 Author: hselasky Date: Thu May 16 17:35:39 2019 New Revision: 347830 URL: https://svnweb.freebsd.org/changeset/base/347830 Log: MFC r347279: Fix netstat counters mapping in mlx5en(4). The current mapping of driver counters to netstat counters is wrong. For example, a single jabber packet, will cause the Ierrs counter to count three times. The work for mapping the hardware and software counters to their right place in netstat counters were already done in Linux, take that as is to the FreeBSD driver. Submitted by: slavash@ Sponsored by: Mellanox Technologies Modified: stable/11/sys/dev/mlx5/mlx5_en/mlx5_en_main.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/dev/mlx5/mlx5_en/mlx5_en_main.c ============================================================================== --- stable/11/sys/dev/mlx5/mlx5_en/mlx5_en_main.c Thu May 16 17:34:54 2019 (r347829) +++ stable/11/sys/dev/mlx5/mlx5_en/mlx5_en_main.c Thu May 16 17:35:39 2019 (r347830) @@ -637,22 +637,14 @@ mlx5e_update_stats_locked(struct mlx5e_priv *priv) #if (__FreeBSD_version < 1100000) /* no get_counters interface in fbsd 10 */ ifp->if_ipackets = s->rx_packets; - ifp->if_ierrors = s->rx_error_packets + - priv->stats.pport.alignment_err + - priv->stats.pport.check_seq_err + - priv->stats.pport.crc_align_errors + - priv->stats.pport.in_range_len_errors + - priv->stats.pport.jabbers + + ifp->if_ierrors = priv->stats.pport.in_range_len_errors + priv->stats.pport.out_of_range_len + - priv->stats.pport.oversize_pkts + - priv->stats.pport.symbol_err + priv->stats.pport.too_long_errors + - priv->stats.pport.undersize_pkts + - priv->stats.pport.unsupported_op_rx; - ifp->if_iqdrops = s->rx_out_of_buffer + - priv->stats.pport.drop_events; + priv->stats.pport.check_seq_err + + priv->stats.pport.alignment_err; + ifp->if_iqdrops = s->rx_out_of_buffer; ifp->if_opackets = s->tx_packets; - ifp->if_oerrors = s->tx_error_packets; + ifp->if_oerrors = priv->stats.port_stats_debug.out_discards; ifp->if_snd.ifq_drops = s->tx_queue_dropped; ifp->if_ibytes = s->rx_bytes; ifp->if_obytes = s->tx_bytes; @@ -2665,28 +2657,20 @@ mlx5e_get_counter(struct ifnet *ifp, ift_counter cnt) retval = priv->stats.vport.rx_packets; break; case IFCOUNTER_IERRORS: - retval = priv->stats.vport.rx_error_packets + - priv->stats.pport.alignment_err + - priv->stats.pport.check_seq_err + - priv->stats.pport.crc_align_errors + - priv->stats.pport.in_range_len_errors + - priv->stats.pport.jabbers + + retval = priv->stats.pport.in_range_len_errors + priv->stats.pport.out_of_range_len + - priv->stats.pport.oversize_pkts + - priv->stats.pport.symbol_err + priv->stats.pport.too_long_errors + - priv->stats.pport.undersize_pkts + - priv->stats.pport.unsupported_op_rx; + priv->stats.pport.check_seq_err + + priv->stats.pport.alignment_err; break; case IFCOUNTER_IQDROPS: - retval = priv->stats.vport.rx_out_of_buffer + - priv->stats.pport.drop_events; + retval = priv->stats.vport.rx_out_of_buffer; break; case IFCOUNTER_OPACKETS: retval = priv->stats.vport.tx_packets; break; case IFCOUNTER_OERRORS: - retval = priv->stats.vport.tx_error_packets; + retval = priv->stats.port_stats_debug.out_discards; break; case IFCOUNTER_IBYTES: retval = priv->stats.vport.rx_bytes; From owner-svn-src-stable@freebsd.org Thu May 16 17:36:20 2019 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 0DA8815A13E0; Thu, 16 May 2019 17:36:20 +0000 (UTC) (envelope-from hselasky@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 A47CE69BFA; Thu, 16 May 2019 17:36:19 +0000 (UTC) (envelope-from hselasky@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 716C82416B; Thu, 16 May 2019 17:36:19 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x4GHaJFk011199; Thu, 16 May 2019 17:36:19 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x4GHaJd5011198; Thu, 16 May 2019 17:36:19 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201905161736.x4GHaJd5011198@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Thu, 16 May 2019 17:36:19 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r347831 - stable/11/usr.sbin/mlx5tool X-SVN-Group: stable-11 X-SVN-Commit-Author: hselasky X-SVN-Commit-Paths: stable/11/usr.sbin/mlx5tool X-SVN-Commit-Revision: 347831 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: A47CE69BFA X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.98 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.998,0]; NEURAL_HAM_SHORT(-0.99)[-0.985,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US]; NEURAL_HAM_LONG(-1.00)[-1.000,0] X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 16 May 2019 17:36:20 -0000 Author: hselasky Date: Thu May 16 17:36:18 2019 New Revision: 347831 URL: https://svnweb.freebsd.org/changeset/base/347831 Log: MFC r347280: Fix style. Submitted by: kib@ Sponsored by: Mellanox Technologies Modified: stable/11/usr.sbin/mlx5tool/mlx5tool.c Directory Properties: stable/11/ (props changed) Modified: stable/11/usr.sbin/mlx5tool/mlx5tool.c ============================================================================== --- stable/11/usr.sbin/mlx5tool/mlx5tool.c Thu May 16 17:35:39 2019 (r347830) +++ stable/11/usr.sbin/mlx5tool/mlx5tool.c Thu May 16 17:36:18 2019 (r347831) @@ -184,7 +184,7 @@ main(int argc, char *argv[]) act = ACTION_DUMP_GET; break; case 'e': - act= ACTION_DUMP_FORCE; + act = ACTION_DUMP_FORCE; break; case 'o': dumpname = optarg; From owner-svn-src-stable@freebsd.org Thu May 16 17:36:53 2019 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 13D5315A1499; Thu, 16 May 2019 17:36:53 +0000 (UTC) (envelope-from hselasky@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 ADFA969D84; Thu, 16 May 2019 17:36:52 +0000 (UTC) (envelope-from hselasky@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 94EC22416C; Thu, 16 May 2019 17:36:52 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x4GHaq7d011281; Thu, 16 May 2019 17:36:52 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x4GHaq6l011280; Thu, 16 May 2019 17:36:52 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201905161736.x4GHaq6l011280@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Thu, 16 May 2019 17:36:52 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r347832 - stable/11/usr.sbin/mlx5tool X-SVN-Group: stable-11 X-SVN-Commit-Author: hselasky X-SVN-Commit-Paths: stable/11/usr.sbin/mlx5tool X-SVN-Commit-Revision: 347832 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: ADFA969D84 X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.98 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.998,0]; NEURAL_HAM_SHORT(-0.99)[-0.985,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US]; NEURAL_HAM_LONG(-1.00)[-1.000,0] X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 16 May 2019 17:36:53 -0000 Author: hselasky Date: Thu May 16 17:36:52 2019 New Revision: 347832 URL: https://svnweb.freebsd.org/changeset/base/347832 Log: MFC r347281: Fix typo. Submitted by: kib@ Sponsored by: Mellanox Technologies Modified: stable/11/usr.sbin/mlx5tool/mlx5tool.8 Directory Properties: stable/11/ (props changed) Modified: stable/11/usr.sbin/mlx5tool/mlx5tool.8 ============================================================================== --- stable/11/usr.sbin/mlx5tool/mlx5tool.8 Thu May 16 17:36:18 2019 (r347831) +++ stable/11/usr.sbin/mlx5tool/mlx5tool.8 Thu May 16 17:36:52 2019 (r347832) @@ -25,7 +25,7 @@ .\" .\" $FreeBSD$ .\" -.Dd March 8, 2018 +.Dd May 7, 2019 .Dt mlx5tool 8 .Os .Sh NAME @@ -78,7 +78,7 @@ command for the specified device. Clear the stored firmware dump, preparing the kernel buffer for the next dump. .It Fl w -Fetche the stored firmware dump and writes it into the file specified +Fetches the stored firmware dump and writes it into the file specified by the .Fl o option argument. From owner-svn-src-stable@freebsd.org Thu May 16 17:37:35 2019 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 0435C15A1558; Thu, 16 May 2019 17:37:35 +0000 (UTC) (envelope-from hselasky@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 920F569F32; Thu, 16 May 2019 17:37:34 +0000 (UTC) (envelope-from hselasky@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 7D7E42416D; Thu, 16 May 2019 17:37:34 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x4GHbYLl011369; Thu, 16 May 2019 17:37:34 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x4GHbY9F011368; Thu, 16 May 2019 17:37:34 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201905161737.x4GHbY9F011368@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Thu, 16 May 2019 17:37:34 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r347833 - stable/11/sys/dev/mlx5/mlx5_core X-SVN-Group: stable-11 X-SVN-Commit-Author: hselasky X-SVN-Commit-Paths: stable/11/sys/dev/mlx5/mlx5_core X-SVN-Commit-Revision: 347833 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 920F569F32 X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.98 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.998,0]; NEURAL_HAM_SHORT(-0.99)[-0.985,0]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US] X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 16 May 2019 17:37:35 -0000 Author: hselasky Date: Thu May 16 17:37:34 2019 New Revision: 347833 URL: https://svnweb.freebsd.org/changeset/base/347833 Log: MFC r347282: Change implicit and probably erronous EPERM to EIO on command status error in mlx5core. Submitted by: kib@ Sponsored by: Mellanox Technologies Modified: stable/11/sys/dev/mlx5/mlx5_core/mlx5_cmd.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/dev/mlx5/mlx5_core/mlx5_cmd.c ============================================================================== --- stable/11/sys/dev/mlx5/mlx5_core/mlx5_cmd.c Thu May 16 17:36:52 2019 (r347832) +++ stable/11/sys/dev/mlx5/mlx5_core/mlx5_cmd.c Thu May 16 17:37:34 2019 (r347833) @@ -1235,7 +1235,7 @@ EXPORT_SYMBOL(mlx5_cmd_comp_handler); static int status_to_err(u8 status) { - return status ? -1 : 0; /* TBD more meaningful codes */ + return status ? -EIO : 0; /* TBD more meaningful codes */ } static struct mlx5_cmd_msg *alloc_msg(struct mlx5_core_dev *dev, int in_size, From owner-svn-src-stable@freebsd.org Thu May 16 17:38:12 2019 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 0FBE915A1617; Thu, 16 May 2019 17:38:12 +0000 (UTC) (envelope-from hselasky@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 A49E46A09B; Thu, 16 May 2019 17:38:11 +0000 (UTC) (envelope-from hselasky@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 8D11B2416E; Thu, 16 May 2019 17:38:11 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x4GHcBGX011457; Thu, 16 May 2019 17:38:11 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x4GHcBIh011456; Thu, 16 May 2019 17:38:11 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201905161738.x4GHcBIh011456@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Thu, 16 May 2019 17:38:11 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r347834 - stable/11/sys/dev/mlx5/mlx5_core X-SVN-Group: stable-11 X-SVN-Commit-Author: hselasky X-SVN-Commit-Paths: stable/11/sys/dev/mlx5/mlx5_core X-SVN-Commit-Revision: 347834 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: A49E46A09B X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.98 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.998,0]; NEURAL_HAM_SHORT(-0.99)[-0.985,0]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US] X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 16 May 2019 17:38:12 -0000 Author: hselasky Date: Thu May 16 17:38:11 2019 New Revision: 347834 URL: https://svnweb.freebsd.org/changeset/base/347834 Log: MFC r347283: Remove redundant line of code in mlx5core. Sponsored by: Mellanox Technologies Modified: stable/11/sys/dev/mlx5/mlx5_core/mlx5_cmd.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/dev/mlx5/mlx5_core/mlx5_cmd.c ============================================================================== --- stable/11/sys/dev/mlx5/mlx5_core/mlx5_cmd.c Thu May 16 17:37:34 2019 (r347833) +++ stable/11/sys/dev/mlx5/mlx5_core/mlx5_cmd.c Thu May 16 17:38:11 2019 (r347834) @@ -1215,7 +1215,7 @@ void mlx5_cmd_comp_handler(struct mlx5_core_dev *dev, ent->ret = verify_signature(ent); else ent->ret = 0; - ent->status = ent->lay->status_own >> 1; + if (triggered) ent->status = MLX5_DRIVER_STATUS_ABORTED; else From owner-svn-src-stable@freebsd.org Thu May 16 17:39:00 2019 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 59BD515A16F6; Thu, 16 May 2019 17:39:00 +0000 (UTC) (envelope-from hselasky@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 F1A0A6A245; Thu, 16 May 2019 17:38:59 +0000 (UTC) (envelope-from hselasky@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 A717B2416F; Thu, 16 May 2019 17:38:59 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x4GHcxC6011544; Thu, 16 May 2019 17:38:59 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x4GHcxNc011543; Thu, 16 May 2019 17:38:59 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201905161738.x4GHcxNc011543@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Thu, 16 May 2019 17:38:59 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r347835 - stable/11/sys/dev/mlx5/mlx5_core X-SVN-Group: stable-11 X-SVN-Commit-Author: hselasky X-SVN-Commit-Paths: stable/11/sys/dev/mlx5/mlx5_core X-SVN-Commit-Revision: 347835 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: F1A0A6A245 X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.98 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.998,0]; NEURAL_HAM_SHORT(-0.99)[-0.985,0]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US] X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 16 May 2019 17:39:00 -0000 Author: hselasky Date: Thu May 16 17:38:59 2019 New Revision: 347835 URL: https://svnweb.freebsd.org/changeset/base/347835 Log: MFC r347284: Convert remaining module parameters into SYSCTLs in mlx5core. Sponsored by: Mellanox Technologies Modified: stable/11/sys/dev/mlx5/mlx5_core/mlx5_main.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/dev/mlx5/mlx5_core/mlx5_main.c ============================================================================== --- stable/11/sys/dev/mlx5/mlx5_core/mlx5_main.c Thu May 16 17:38:11 2019 (r347834) +++ stable/11/sys/dev/mlx5/mlx5_core/mlx5_main.c Thu May 16 17:38:59 2019 (r347835) @@ -25,8 +25,6 @@ * $FreeBSD$ */ -#define LINUXKPI_PARAM_PREFIX mlx5_ - #include #include #include @@ -57,17 +55,19 @@ MODULE_DEPEND(mlx5, linuxkpi, 1, 1, 1); #endif MODULE_VERSION(mlx5, 1); +SYSCTL_NODE(_hw, OID_AUTO, mlx5, CTLFLAG_RW, 0, "mlx5 hardware controls"); + int mlx5_core_debug_mask; -module_param_named(debug_mask, mlx5_core_debug_mask, int, 0644); -MODULE_PARM_DESC(debug_mask, "debug mask: 1 = dump cmd data, 2 = dump cmd exec time, 3 = both. Default=0"); +SYSCTL_INT(_hw_mlx5, OID_AUTO, debug_mask, CTLFLAG_RWTUN, + &mlx5_core_debug_mask, 0, + "debug mask: 1 = dump cmd data, 2 = dump cmd exec time, 3 = both. Default=0"); #define MLX5_DEFAULT_PROF 2 -static int prof_sel = MLX5_DEFAULT_PROF; -module_param_named(prof_sel, prof_sel, int, 0444); -MODULE_PARM_DESC(prof_sel, "profile selector. Valid range 0 - 2"); +static int mlx5_prof_sel = MLX5_DEFAULT_PROF; +SYSCTL_INT(_hw_mlx5, OID_AUTO, prof_sel, CTLFLAG_RWTUN, + &mlx5_prof_sel, 0, + "profile selector. Valid range 0 - 2"); -SYSCTL_NODE(_hw, OID_AUTO, mlx5, CTLFLAG_RW, 0, "mlx5 HW controls"); - static int mlx5_fast_unload_enabled = 1; SYSCTL_INT(_hw_mlx5, OID_AUTO, fast_unload_enabled, CTLFLAG_RWTUN, &mlx5_fast_unload_enabled, 0, @@ -1217,11 +1217,11 @@ static int init_one(struct pci_dev *pdev, if (id) priv->pci_dev_data = id->driver_data; - if (prof_sel < 0 || prof_sel >= ARRAY_SIZE(profiles)) { + if (mlx5_prof_sel < 0 || mlx5_prof_sel >= ARRAY_SIZE(profiles)) { device_printf(bsddev, "WARN: selected profile out of range, selecting default (%d)\n", MLX5_DEFAULT_PROF); - prof_sel = MLX5_DEFAULT_PROF; + mlx5_prof_sel = MLX5_DEFAULT_PROF; } - dev->profile = &profiles[prof_sel]; + dev->profile = &profiles[mlx5_prof_sel]; dev->pdev = pdev; dev->event = mlx5_core_event; From owner-svn-src-stable@freebsd.org Thu May 16 17:48:38 2019 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id DC4A615A1B78; Thu, 16 May 2019 17:48:37 +0000 (UTC) (envelope-from hselasky@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 835CA6AA8F; Thu, 16 May 2019 17:48:37 +0000 (UTC) (envelope-from hselasky@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 57B642432D; Thu, 16 May 2019 17:48:37 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x4GHmbIX016672; Thu, 16 May 2019 17:48:37 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x4GHmaIj016667; Thu, 16 May 2019 17:48:36 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201905161748.x4GHmaIj016667@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Thu, 16 May 2019 17:48:36 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r347838 - in stable/11: share/man/man4 sys/conf sys/dev/mlxfw sys/modules sys/modules/mlxfw X-SVN-Group: stable-11 X-SVN-Commit-Author: hselasky X-SVN-Commit-Paths: in stable/11: share/man/man4 sys/conf sys/dev/mlxfw sys/modules sys/modules/mlxfw X-SVN-Commit-Revision: 347838 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 835CA6AA8F X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.98 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.998,0]; NEURAL_HAM_SHORT(-0.99)[-0.986,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US]; NEURAL_HAM_LONG(-1.00)[-1.000,0] X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 16 May 2019 17:48:38 -0000 Author: hselasky Date: Thu May 16 17:48:36 2019 New Revision: 347838 URL: https://svnweb.freebsd.org/changeset/base/347838 Log: MFC r347285 and r347327: Initial version of Mellanox in-kernel firmware upgrade support. Submitted by: slavash@ Sponsored by: Mellanox Technologies Added: stable/11/sys/dev/mlxfw/ - copied from r347285, head/sys/dev/mlxfw/ stable/11/sys/modules/mlxfw/ - copied from r347285, head/sys/modules/mlxfw/ Modified: stable/11/share/man/man4/mlx5en.4 stable/11/sys/conf/NOTES stable/11/sys/conf/files stable/11/sys/conf/kern.pre.mk stable/11/sys/modules/Makefile Directory Properties: stable/11/ (props changed) Modified: stable/11/share/man/man4/mlx5en.4 ============================================================================== --- stable/11/share/man/man4/mlx5en.4 Thu May 16 17:44:17 2019 (r347837) +++ stable/11/share/man/man4/mlx5en.4 Thu May 16 17:48:36 2019 (r347838) @@ -24,7 +24,7 @@ .\" .\" $FreeBSD$ .\" -.Dd December 3, 2015 +.Dd May 8, 2019 .Dt MLX5EN 4 .Os .Sh NAME @@ -36,6 +36,9 @@ place the following lines in your kernel configuration file: .Bd -ragged -offset indent .Cd "options COMPAT_LINUXKPI" +.Cd "device xz" +.Cd "device mlxfw" +.Cd "device firmware" .Cd "device mlx5" .Cd "device mlx5en" .Ed Modified: stable/11/sys/conf/NOTES ============================================================================== --- stable/11/sys/conf/NOTES Thu May 16 17:44:17 2019 (r347837) +++ stable/11/sys/conf/NOTES Thu May 16 17:48:36 2019 (r347838) @@ -1983,6 +1983,7 @@ device xmphy # XaQti XMAC II # 88E8062, 88E8035, 88E8036, 88E8038, 88E8050, 88E8052, 88E8053, # 88E8055, 88E8056 and D-Link 560T/550SX. # lmc: Support for the LMC/SBE wide-area network interface cards. +# mlxfw: Mellanox firmware update module. # mlx5: Mellanox ConnectX-4 and ConnectX-4 LX IB and Eth shared code module. # mlx5en:Mellanox ConnectX-4 and ConnectX-4 LX PCIe Ethernet adapters. # my: Myson Fast Ethernet (MTD80X, MTD89X) @@ -2102,6 +2103,7 @@ device gem # Apple GMAC/Sun ERI/Sun GEM device hme # Sun HME (Happy Meal Ethernet) device jme # JMicron JMC250 Gigabit/JMC260 Fast Ethernet device lge # Level 1 LXT1001 gigabit Ethernet +device mlxfw # Mellanox firmware update module device mlx5 # Shared code module between IB and Ethernet device mlx5en # Mellanox ConnectX-4 and ConnectX-4 LX device msk # Marvell/SysKonnect Yukon II Gigabit Ethernet Modified: stable/11/sys/conf/files ============================================================================== --- stable/11/sys/conf/files Thu May 16 17:44:17 2019 (r347837) +++ stable/11/sys/conf/files Thu May 16 17:48:36 2019 (r347838) @@ -2390,6 +2390,12 @@ dev/mii/ukphy_subr.c optional miibus | mii dev/mii/vscphy.c optional miibus | vscphy dev/mii/xmphy.c optional miibus | xmphy dev/mk48txx/mk48txx.c optional mk48txx +dev/mlxfw/mlxfw_fsm.c optional mlxfw \ + compile-with "${MLXFW_C}" +dev/mlxfw/mlxfw_mfa2.c optional mlxfw \ + compile-with "${MLXFW_C}" +dev/mlxfw/mlxfw_mfa2_tlv_multi.c optional mlxfw \ + compile-with "${MLXFW_C}" dev/mlx/mlx.c optional mlx dev/mlx/mlx_disk.c optional mlx dev/mlx/mlx_pci.c optional mlx pci Modified: stable/11/sys/conf/kern.pre.mk ============================================================================== --- stable/11/sys/conf/kern.pre.mk Thu May 16 17:44:17 2019 (r347837) +++ stable/11/sys/conf/kern.pre.mk Thu May 16 17:48:36 2019 (r347838) @@ -183,6 +183,12 @@ OFEDCFLAGS= ${CFLAGS:N-I*} -DCONFIG_INFINIBAND_USER_ME OFED_C_NOIMP= ${CC} -c -o ${.TARGET} ${OFEDCFLAGS} ${WERROR} ${PROF} OFED_C= ${OFED_C_NOIMP} ${.IMPSRC} +# mlxfw C flags. +MLXFW_C= ${OFED_C_NOIMP} \ + -I$S/contrib/xz-embedded/freebsd \ + -I$S/contrib/xz-embedded/linux/lib/xz \ + ${.IMPSRC} + GEN_CFILES= $S/$M/$M/genassym.c ${MFILES:T:S/.m$/.c/} SYSTEM_CFILES= config.c env.c hints.c vnode_if.c SYSTEM_DEP= Makefile ${SYSTEM_OBJS} Modified: stable/11/sys/modules/Makefile ============================================================================== --- stable/11/sys/modules/Makefile Thu May 16 17:44:17 2019 (r347837) +++ stable/11/sys/modules/Makefile Thu May 16 17:48:36 2019 (r347838) @@ -246,6 +246,7 @@ SUBDIR= \ mfi \ mii \ mlx \ + mlxfw \ ${_mlx4} \ ${_mlx4ib} \ ${_mlx4en} \ From owner-svn-src-stable@freebsd.org Thu May 16 17:49:30 2019 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id C5EB615A1BED; Thu, 16 May 2019 17:49:30 +0000 (UTC) (envelope-from hselasky@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 6CDF96ABBD; Thu, 16 May 2019 17:49:30 +0000 (UTC) (envelope-from hselasky@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 460872432E; Thu, 16 May 2019 17:49:30 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x4GHnU2w016776; Thu, 16 May 2019 17:49:30 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x4GHnTDE016773; Thu, 16 May 2019 17:49:29 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201905161749.x4GHnTDE016773@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Thu, 16 May 2019 17:49:29 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r347839 - stable/11/sys/dev/mlx5/mlx5_core X-SVN-Group: stable-11 X-SVN-Commit-Author: hselasky X-SVN-Commit-Paths: stable/11/sys/dev/mlx5/mlx5_core X-SVN-Commit-Revision: 347839 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 6CDF96ABBD X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.98 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.998,0]; NEURAL_HAM_SHORT(-0.99)[-0.986,0]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US] X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 16 May 2019 17:49:31 -0000 Author: hselasky Date: Thu May 16 17:49:29 2019 New Revision: 347839 URL: https://svnweb.freebsd.org/changeset/base/347839 Log: MFC r347286: Add mlxfw callbacks in mlx5core. Add mlx5 implementation for the ones defined by the mlxfw shared module to be used while flashing the device firmware. The callbacks do their job through the MCQI, MCC and MCDA registers. Linux commit: 62bd22cf326dc4ac5be673c11cef4602dc1f5e47 Submitted by: slavash@ Sponsored by: Mellanox Technologies Modified: stable/11/sys/dev/mlx5/mlx5_core/mlx5_core.h stable/11/sys/dev/mlx5/mlx5_core/mlx5_fw.c stable/11/sys/dev/mlx5/mlx5_core/mlx5_main.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/dev/mlx5/mlx5_core/mlx5_core.h ============================================================================== --- stable/11/sys/dev/mlx5/mlx5_core/mlx5_core.h Thu May 16 17:48:36 2019 (r347838) +++ stable/11/sys/dev/mlx5/mlx5_core/mlx5_core.h Thu May 16 17:49:29 2019 (r347839) @@ -32,6 +32,8 @@ #include #include +#include + #define DRIVER_NAME "mlx5_core" #ifndef DRIVER_VERSION #define DRIVER_VERSION "3.5.0" @@ -92,6 +94,8 @@ void mlx5_recover_device(struct mlx5_core_dev *dev); int mlx5_register_device(struct mlx5_core_dev *dev); void mlx5_unregister_device(struct mlx5_core_dev *dev); + +int mlx5_firmware_flash(struct mlx5_core_dev *dev, const struct firmware *fw); void mlx5e_init(void); void mlx5e_cleanup(void); Modified: stable/11/sys/dev/mlx5/mlx5_core/mlx5_fw.c ============================================================================== --- stable/11/sys/dev/mlx5/mlx5_core/mlx5_fw.c Thu May 16 17:48:36 2019 (r347838) +++ stable/11/sys/dev/mlx5/mlx5_core/mlx5_fw.c Thu May 16 17:49:29 2019 (r347839) @@ -455,3 +455,156 @@ static int mlx5_reg_mcqi_query(struct mlx5_core_dev *d out: return err; } + +struct mlx5_mlxfw_dev { + struct mlxfw_dev mlxfw_dev; + struct mlx5_core_dev *mlx5_core_dev; +}; + +static int mlx5_component_query(struct mlxfw_dev *mlxfw_dev, + u16 component_index, u32 *p_max_size, + u8 *p_align_bits, u16 *p_max_write_size) +{ + struct mlx5_mlxfw_dev *mlx5_mlxfw_dev = + container_of(mlxfw_dev, struct mlx5_mlxfw_dev, mlxfw_dev); + struct mlx5_core_dev *dev = mlx5_mlxfw_dev->mlx5_core_dev; + + return mlx5_reg_mcqi_query(dev, component_index, p_max_size, + p_align_bits, p_max_write_size); +} + +static int mlx5_fsm_lock(struct mlxfw_dev *mlxfw_dev, u32 *fwhandle) +{ + struct mlx5_mlxfw_dev *mlx5_mlxfw_dev = + container_of(mlxfw_dev, struct mlx5_mlxfw_dev, mlxfw_dev); + struct mlx5_core_dev *dev = mlx5_mlxfw_dev->mlx5_core_dev; + u8 control_state, error_code; + int err; + + *fwhandle = 0; + err = mlx5_reg_mcc_query(dev, fwhandle, &error_code, &control_state); + if (err) + return err; + + if (control_state != MLXFW_FSM_STATE_IDLE) + return -EBUSY; + + return mlx5_reg_mcc_set(dev, MLX5_REG_MCC_INSTRUCTION_LOCK_UPDATE_HANDLE, + 0, *fwhandle, 0); +} + +static int mlx5_fsm_component_update(struct mlxfw_dev *mlxfw_dev, u32 fwhandle, + u16 component_index, u32 component_size) +{ + struct mlx5_mlxfw_dev *mlx5_mlxfw_dev = + container_of(mlxfw_dev, struct mlx5_mlxfw_dev, mlxfw_dev); + struct mlx5_core_dev *dev = mlx5_mlxfw_dev->mlx5_core_dev; + + return mlx5_reg_mcc_set(dev, MLX5_REG_MCC_INSTRUCTION_UPDATE_COMPONENT, + component_index, fwhandle, component_size); +} + +static int mlx5_fsm_block_download(struct mlxfw_dev *mlxfw_dev, u32 fwhandle, + u8 *data, u16 size, u32 offset) +{ + struct mlx5_mlxfw_dev *mlx5_mlxfw_dev = + container_of(mlxfw_dev, struct mlx5_mlxfw_dev, mlxfw_dev); + struct mlx5_core_dev *dev = mlx5_mlxfw_dev->mlx5_core_dev; + + return mlx5_reg_mcda_set(dev, fwhandle, offset, size, data); +} + +static int mlx5_fsm_component_verify(struct mlxfw_dev *mlxfw_dev, u32 fwhandle, + u16 component_index) +{ + struct mlx5_mlxfw_dev *mlx5_mlxfw_dev = + container_of(mlxfw_dev, struct mlx5_mlxfw_dev, mlxfw_dev); + struct mlx5_core_dev *dev = mlx5_mlxfw_dev->mlx5_core_dev; + + return mlx5_reg_mcc_set(dev, MLX5_REG_MCC_INSTRUCTION_VERIFY_COMPONENT, + component_index, fwhandle, 0); +} + +static int mlx5_fsm_activate(struct mlxfw_dev *mlxfw_dev, u32 fwhandle) +{ + struct mlx5_mlxfw_dev *mlx5_mlxfw_dev = + container_of(mlxfw_dev, struct mlx5_mlxfw_dev, mlxfw_dev); + struct mlx5_core_dev *dev = mlx5_mlxfw_dev->mlx5_core_dev; + + return mlx5_reg_mcc_set(dev, MLX5_REG_MCC_INSTRUCTION_ACTIVATE, 0, + fwhandle, 0); +} + +static int mlx5_fsm_query_state(struct mlxfw_dev *mlxfw_dev, u32 fwhandle, + enum mlxfw_fsm_state *fsm_state, + enum mlxfw_fsm_state_err *fsm_state_err) +{ + struct mlx5_mlxfw_dev *mlx5_mlxfw_dev = + container_of(mlxfw_dev, struct mlx5_mlxfw_dev, mlxfw_dev); + struct mlx5_core_dev *dev = mlx5_mlxfw_dev->mlx5_core_dev; + u8 control_state, error_code; + int err; + + err = mlx5_reg_mcc_query(dev, &fwhandle, &error_code, &control_state); + if (err) + return err; + + *fsm_state = control_state; + *fsm_state_err = min_t(enum mlxfw_fsm_state_err, error_code, + MLXFW_FSM_STATE_ERR_MAX); + return 0; +} + +static void mlx5_fsm_cancel(struct mlxfw_dev *mlxfw_dev, u32 fwhandle) +{ + struct mlx5_mlxfw_dev *mlx5_mlxfw_dev = + container_of(mlxfw_dev, struct mlx5_mlxfw_dev, mlxfw_dev); + struct mlx5_core_dev *dev = mlx5_mlxfw_dev->mlx5_core_dev; + + mlx5_reg_mcc_set(dev, MLX5_REG_MCC_INSTRUCTION_CANCEL, 0, fwhandle, 0); +} + +static void mlx5_fsm_release(struct mlxfw_dev *mlxfw_dev, u32 fwhandle) +{ + struct mlx5_mlxfw_dev *mlx5_mlxfw_dev = + container_of(mlxfw_dev, struct mlx5_mlxfw_dev, mlxfw_dev); + struct mlx5_core_dev *dev = mlx5_mlxfw_dev->mlx5_core_dev; + + mlx5_reg_mcc_set(dev, MLX5_REG_MCC_INSTRUCTION_RELEASE_UPDATE_HANDLE, 0, + fwhandle, 0); +} + +static const struct mlxfw_dev_ops mlx5_mlxfw_dev_ops = { + .component_query = mlx5_component_query, + .fsm_lock = mlx5_fsm_lock, + .fsm_component_update = mlx5_fsm_component_update, + .fsm_block_download = mlx5_fsm_block_download, + .fsm_component_verify = mlx5_fsm_component_verify, + .fsm_activate = mlx5_fsm_activate, + .fsm_query_state = mlx5_fsm_query_state, + .fsm_cancel = mlx5_fsm_cancel, + .fsm_release = mlx5_fsm_release +}; + +int mlx5_firmware_flash(struct mlx5_core_dev *dev, + const struct firmware *firmware) +{ + struct mlx5_mlxfw_dev mlx5_mlxfw_dev = { + .mlxfw_dev = { + .ops = &mlx5_mlxfw_dev_ops, + .psid = dev->board_id, + .psid_size = strlen(dev->board_id), + }, + .mlx5_core_dev = dev + }; + + if (!MLX5_CAP_GEN(dev, mcam_reg) || + !MLX5_CAP_MCAM_REG(dev, mcqi) || + !MLX5_CAP_MCAM_REG(dev, mcc) || + !MLX5_CAP_MCAM_REG(dev, mcda)) { + pr_info("%s flashing isn't supported by the running FW\n", __func__); + return -EOPNOTSUPP; + } + + return mlxfw_firmware_flash(&mlx5_mlxfw_dev.mlxfw_dev, firmware); +} Modified: stable/11/sys/dev/mlx5/mlx5_core/mlx5_main.c ============================================================================== --- stable/11/sys/dev/mlx5/mlx5_core/mlx5_main.c Thu May 16 17:48:36 2019 (r347838) +++ stable/11/sys/dev/mlx5/mlx5_core/mlx5_main.c Thu May 16 17:49:29 2019 (r347839) @@ -50,9 +50,8 @@ static const char mlx5_version[] = "Mellanox Core driv MODULE_AUTHOR("Eli Cohen "); MODULE_DESCRIPTION("Mellanox Connect-IB, ConnectX-4 core driver"); MODULE_LICENSE("Dual BSD/GPL"); -#if (__FreeBSD_version >= 1100000) MODULE_DEPEND(mlx5, linuxkpi, 1, 1, 1); -#endif +MODULE_DEPEND(mlx5, mlxfw, 1, 1, 1); MODULE_VERSION(mlx5, 1); SYSCTL_NODE(_hw, OID_AUTO, mlx5, CTLFLAG_RW, 0, "mlx5 hardware controls"); From owner-svn-src-stable@freebsd.org Thu May 16 17:50:18 2019 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id BF7B015A1C88; Thu, 16 May 2019 17:50:17 +0000 (UTC) (envelope-from hselasky@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 486C46AD08; Thu, 16 May 2019 17:50:17 +0000 (UTC) (envelope-from hselasky@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 2005824332; Thu, 16 May 2019 17:50:17 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x4GHoGCL016911; Thu, 16 May 2019 17:50:16 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x4GHoGDG016907; Thu, 16 May 2019 17:50:16 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201905161750.x4GHoGDG016907@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Thu, 16 May 2019 17:50:16 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r347840 - in stable/11: share/man/man4 sys/dev/mlx5 sys/dev/mlx5/mlx5_core usr.sbin/mlx5tool X-SVN-Group: stable-11 X-SVN-Commit-Author: hselasky X-SVN-Commit-Paths: in stable/11: share/man/man4 sys/dev/mlx5 sys/dev/mlx5/mlx5_core usr.sbin/mlx5tool X-SVN-Commit-Revision: 347840 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 486C46AD08 X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.98 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.998,0]; NEURAL_HAM_SHORT(-0.99)[-0.986,0]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US] X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 16 May 2019 17:50:18 -0000 Author: hselasky Date: Thu May 16 17:50:15 2019 New Revision: 347840 URL: https://svnweb.freebsd.org/changeset/base/347840 Log: MFC r347287: Rename mlx5_fwdump_addr to more neutral mlx5_tool_addr in mlx5core. Submitted by: kib@ Sponsored by: Mellanox Technologies Modified: stable/11/share/man/man4/mlx5io.4 stable/11/sys/dev/mlx5/mlx5_core/mlx5_fwdump.c stable/11/sys/dev/mlx5/mlx5io.h stable/11/usr.sbin/mlx5tool/mlx5tool.c Directory Properties: stable/11/ (props changed) Modified: stable/11/share/man/man4/mlx5io.4 ============================================================================== --- stable/11/share/man/man4/mlx5io.4 Thu May 16 17:49:29 2019 (r347839) +++ stable/11/share/man/man4/mlx5io.4 Thu May 16 17:50:15 2019 (r347840) @@ -25,7 +25,7 @@ .\" .\" $FreeBSD$ .\" -.Dd February 20, 2018 +.Dd May 7, 2019 .Dt mlx5io 4 .Os .Sh NAME @@ -55,10 +55,10 @@ far, or existing dump cleared with the .Dv MLX5_FWDUMP_RESET command for the specified device. The argument for the command should point to the -.Vt struct mlx5_fwdump_addr +.Vt struct mlx5_tool_addr structure, containing the PCIe bus address of the device. .Bd -literal -struct mlx5_fwdump_addr { +struct mlx5_tool_addr { uint32_t domain; uint8_t bus; uint8_t slot; @@ -69,7 +69,7 @@ struct mlx5_fwdump_addr { Clear the stored firmware dump, preparing the kernel buffer for the next dump. The argument for the command should point to the -.Vt struct mlx5_fwdump_addr +.Vt struct mlx5_tool_addr structure, containing the PCIe bus address of the device. .It Dv MLX5_FWDUMP_GET Fetch the stored firmware dump into the user memory. @@ -88,7 +88,7 @@ in the field. .Bd -literal struct mlx5_fwdump_get { - struct mlx5_fwdump_addr devaddr; + struct mlx5_tool_addr devaddr; struct mlx5_fwdump_reg *buf; size_t reg_cnt; size_t reg_filled; /* out */ Modified: stable/11/sys/dev/mlx5/mlx5_core/mlx5_fwdump.c ============================================================================== --- stable/11/sys/dev/mlx5/mlx5_core/mlx5_fwdump.c Thu May 16 17:49:29 2019 (r347839) +++ stable/11/sys/dev/mlx5/mlx5_core/mlx5_fwdump.c Thu May 16 17:50:15 2019 (r347840) @@ -170,7 +170,7 @@ mlx5_fwdump_clean(struct mlx5_core_dev *mdev) } static int -mlx5_dbsf_to_core(const struct mlx5_fwdump_addr *devaddr, +mlx5_dbsf_to_core(const struct mlx5_tool_addr *devaddr, struct mlx5_core_dev **mdev) { device_t dev; @@ -231,7 +231,7 @@ mlx5_fwdump_ioctl(struct cdev *dev, u_long cmd, caddr_ { struct mlx5_core_dev *mdev; struct mlx5_fwdump_get *fwg; - struct mlx5_fwdump_addr *devaddr; + struct mlx5_tool_addr *devaddr; struct mlx5_dump_data *dd; int error; @@ -254,7 +254,7 @@ mlx5_fwdump_ioctl(struct cdev *dev, u_long cmd, caddr_ error = EBADF; break; } - devaddr = (struct mlx5_fwdump_addr *)data; + devaddr = (struct mlx5_tool_addr *)data; error = mlx5_dbsf_to_core(devaddr, &mdev); if (error != 0) break; @@ -269,7 +269,7 @@ mlx5_fwdump_ioctl(struct cdev *dev, u_long cmd, caddr_ error = EBADF; break; } - devaddr = (struct mlx5_fwdump_addr *)data; + devaddr = (struct mlx5_tool_addr *)data; error = mlx5_dbsf_to_core(devaddr, &mdev); if (error != 0) break; Modified: stable/11/sys/dev/mlx5/mlx5io.h ============================================================================== --- stable/11/sys/dev/mlx5/mlx5io.h Thu May 16 17:49:29 2019 (r347839) +++ stable/11/sys/dev/mlx5/mlx5io.h Thu May 16 17:50:15 2019 (r347840) @@ -35,7 +35,7 @@ struct mlx5_fwdump_reg { uint32_t val; }; -struct mlx5_fwdump_addr { +struct mlx5_tool_addr { uint32_t domain; uint8_t bus; uint8_t slot; @@ -43,15 +43,15 @@ struct mlx5_fwdump_addr { }; struct mlx5_fwdump_get { - struct mlx5_fwdump_addr devaddr; + struct mlx5_tool_addr devaddr; struct mlx5_fwdump_reg *buf; size_t reg_cnt; size_t reg_filled; /* out */ }; #define MLX5_FWDUMP_GET _IOWR('m', 1, struct mlx5_fwdump_get) -#define MLX5_FWDUMP_RESET _IOW('m', 2, struct mlx5_fwdump_addr) -#define MLX5_FWDUMP_FORCE _IOW('m', 3, struct mlx5_fwdump_addr) +#define MLX5_FWDUMP_RESET _IOW('m', 2, struct mlx5_tool_addr) +#define MLX5_FWDUMP_FORCE _IOW('m', 3, struct mlx5_tool_addr) #ifndef _KERNEL #define MLX5_DEV_PATH _PATH_DEV"mlx5ctl" Modified: stable/11/usr.sbin/mlx5tool/mlx5tool.c ============================================================================== --- stable/11/usr.sbin/mlx5tool/mlx5tool.c Thu May 16 17:49:29 2019 (r347839) +++ stable/11/usr.sbin/mlx5tool/mlx5tool.c Thu May 16 17:50:15 2019 (r347840) @@ -41,7 +41,7 @@ __FBSDID("$FreeBSD$"); /* stolen from pciconf.c: parsesel() */ static int -parse_pci_addr(const char *addrstr, struct mlx5_fwdump_addr *addr) +parse_pci_addr(const char *addrstr, struct mlx5_tool_addr *addr) { char *eppos; unsigned long selarr[4]; @@ -73,7 +73,7 @@ parse_pci_addr(const char *addrstr, struct mlx5_fwdump } static int -mlx5tool_save_dump(int ctldev, const struct mlx5_fwdump_addr *addr, +mlx5tool_save_dump(int ctldev, const struct mlx5_tool_addr *addr, const char *dumpname) { struct mlx5_fwdump_get fdg; @@ -123,7 +123,7 @@ out: } static int -mlx5tool_dump_reset(int ctldev, const struct mlx5_fwdump_addr *addr) +mlx5tool_dump_reset(int ctldev, const struct mlx5_tool_addr *addr) { if (ioctl(ctldev, MLX5_FWDUMP_RESET, addr) == -1) { @@ -134,7 +134,7 @@ mlx5tool_dump_reset(int ctldev, const struct mlx5_fwdu } static int -mlx5tool_dump_force(int ctldev, const struct mlx5_fwdump_addr *addr) +mlx5tool_dump_force(int ctldev, const struct mlx5_tool_addr *addr) { if (ioctl(ctldev, MLX5_FWDUMP_FORCE, addr) == -1) { @@ -166,7 +166,7 @@ enum mlx5_action { int main(int argc, char *argv[]) { - struct mlx5_fwdump_addr addr; + struct mlx5_tool_addr addr; char *dumpname; char *addrstr; int c, ctldev, res; From owner-svn-src-stable@freebsd.org Thu May 16 17:50:54 2019 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 4462015A1CDC; Thu, 16 May 2019 17:50:54 +0000 (UTC) (envelope-from hselasky@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 DBCBF6AE62; Thu, 16 May 2019 17:50:53 +0000 (UTC) (envelope-from hselasky@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 B6E4324346; Thu, 16 May 2019 17:50:53 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x4GHoroZ020203; Thu, 16 May 2019 17:50:53 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x4GHorvH020200; Thu, 16 May 2019 17:50:53 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201905161750.x4GHorvH020200@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Thu, 16 May 2019 17:50:53 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r347841 - in stable/11: sys/dev/mlx5 sys/dev/mlx5/mlx5_core usr.sbin/mlx5tool X-SVN-Group: stable-11 X-SVN-Commit-Author: hselasky X-SVN-Commit-Paths: in stable/11: sys/dev/mlx5 sys/dev/mlx5/mlx5_core usr.sbin/mlx5tool X-SVN-Commit-Revision: 347841 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: DBCBF6AE62 X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.98 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.998,0]; NEURAL_HAM_SHORT(-0.99)[-0.986,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US]; NEURAL_HAM_LONG(-1.00)[-1.000,0] X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 16 May 2019 17:50:54 -0000 Author: hselasky Date: Thu May 16 17:50:52 2019 New Revision: 347841 URL: https://svnweb.freebsd.org/changeset/base/347841 Log: MFC r347288: Implement userspace firmware update for ConnectX-4/5/6. Submitted by: kib@ Sponsored by: Mellanox Technologies Modified: stable/11/sys/dev/mlx5/mlx5_core/mlx5_fwdump.c stable/11/sys/dev/mlx5/mlx5io.h stable/11/usr.sbin/mlx5tool/mlx5tool.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/dev/mlx5/mlx5_core/mlx5_fwdump.c ============================================================================== --- stable/11/sys/dev/mlx5/mlx5_core/mlx5_fwdump.c Thu May 16 17:50:15 2019 (r347840) +++ stable/11/sys/dev/mlx5/mlx5_core/mlx5_fwdump.c Thu May 16 17:50:52 2019 (r347841) @@ -233,6 +233,8 @@ mlx5_fwdump_ioctl(struct cdev *dev, u_long cmd, caddr_ struct mlx5_fwdump_get *fwg; struct mlx5_tool_addr *devaddr; struct mlx5_dump_data *dd; + struct mlx5_fw_update *fu; + struct firmware fake_fw; int error; error = 0; @@ -274,6 +276,36 @@ mlx5_fwdump_ioctl(struct cdev *dev, u_long cmd, caddr_ if (error != 0) break; mlx5_fwdump(mdev); + break; + case MLX5_FW_UPDATE: + if ((fflag & FWRITE) == 0) { + error = EBADF; + break; + } + fu = (struct mlx5_fw_update *)data; + if (fu->img_fw_data_len > 10 * 1024 * 1024) { + error = EINVAL; + break; + } + devaddr = &fu->devaddr; + error = mlx5_dbsf_to_core(devaddr, &mdev); + if (error != 0) + break; + bzero(&fake_fw, sizeof(fake_fw)); + fake_fw.name = "umlx_fw_up"; + fake_fw.datasize = fu->img_fw_data_len; + fake_fw.version = 1; + fake_fw.data = (void *)kmem_malloc(fu->img_fw_data_len, + M_WAITOK); + if (fake_fw.data == NULL) { + error = ENOMEM; + break; + } + error = copyin(fu->img_fw_data, __DECONST(void *, fake_fw.data), + fu->img_fw_data_len); + if (error == 0) + error = -mlx5_firmware_flash(mdev, &fake_fw); + kmem_free((vm_offset_t)fake_fw.data, fu->img_fw_data_len); break; default: error = ENOTTY; Modified: stable/11/sys/dev/mlx5/mlx5io.h ============================================================================== --- stable/11/sys/dev/mlx5/mlx5io.h Thu May 16 17:50:15 2019 (r347840) +++ stable/11/sys/dev/mlx5/mlx5io.h Thu May 16 17:50:52 2019 (r347841) @@ -49,9 +49,16 @@ struct mlx5_fwdump_get { size_t reg_filled; /* out */ }; +struct mlx5_fw_update { + struct mlx5_tool_addr devaddr; + void *img_fw_data; + size_t img_fw_data_len; +}; + #define MLX5_FWDUMP_GET _IOWR('m', 1, struct mlx5_fwdump_get) #define MLX5_FWDUMP_RESET _IOW('m', 2, struct mlx5_tool_addr) #define MLX5_FWDUMP_FORCE _IOW('m', 3, struct mlx5_tool_addr) +#define MLX5_FW_UPDATE _IOW('m', 4, struct mlx5_fw_update) #ifndef _KERNEL #define MLX5_DEV_PATH _PATH_DEV"mlx5ctl" Modified: stable/11/usr.sbin/mlx5tool/mlx5tool.c ============================================================================== --- stable/11/usr.sbin/mlx5tool/mlx5tool.c Thu May 16 17:50:15 2019 (r347840) +++ stable/11/usr.sbin/mlx5tool/mlx5tool.c Thu May 16 17:50:52 2019 (r347841) @@ -28,6 +28,8 @@ __FBSDID("$FreeBSD$"); #include #include +#include +#include #include #include #include @@ -144,15 +146,60 @@ mlx5tool_dump_force(int ctldev, const struct mlx5_tool return (0); } +static int +mlx5tool_fw_update(int ctldev, const struct mlx5_tool_addr *addr, + const char *img_fw_path) +{ + struct stat st; + struct mlx5_fw_update fwup; + int error, fd, res; + + res = 0; + fd = open(img_fw_path, O_RDONLY); + if (fd == -1) { + warn("Unable to open %s", img_fw_path); + res = 1; + goto close_fd; + } + error = fstat(fd, &st); + if (error != 0) { + warn("Unable to stat %s", img_fw_path); + res = 1; + goto close_fd; + } + memset(&fwup, 0, sizeof(fwup)); + memcpy(&fwup.devaddr, addr, sizeof(fwup.devaddr)); + fwup.img_fw_data = mmap(NULL, st.st_size, PROT_READ, MAP_PRIVATE, + fd, 0); + if (fwup.img_fw_data == MAP_FAILED) { + warn("Unable to mmap %s", img_fw_path); + res = 1; + goto close_fd; + } + fwup.img_fw_data_len = st.st_size; + + error = ioctl(ctldev, MLX5_FW_UPDATE, &fwup); + if (error == -1) { + warn("MLX5_FW_UPDATE"); + } + + munmap(fwup.img_fw_data, st.st_size); +close_fd: + close(fd); + return (res); +} + static void usage(void) { fprintf(stderr, - "Usage: mlx5tool -d pci [-w -o dump.file | -r | -e]\n"); + "Usage: mlx5tool -d pci [-w -o dump.file | -r |" + " -e | -f fw.mfa2]\n"); fprintf(stderr, "\t-w - write firmware dump to the specified file\n"); fprintf(stderr, "\t-r - reset dump\n"); fprintf(stderr, "\t-e - force dump\n"); + fprintf(stderr, "\t-f fw.img - flash firmware from fw.img\n"); exit(1); } @@ -160,6 +207,7 @@ enum mlx5_action { ACTION_DUMP_GET, ACTION_DUMP_RESET, ACTION_DUMP_FORCE, + ACTION_FW_UPDATE, ACTION_NONE, }; @@ -169,13 +217,15 @@ main(int argc, char *argv[]) struct mlx5_tool_addr addr; char *dumpname; char *addrstr; + char *img_fw_path; int c, ctldev, res; enum mlx5_action act; act = ACTION_NONE; addrstr = NULL; dumpname = NULL; - while ((c = getopt(argc, argv, "d:eho:rw")) != -1) { + img_fw_path = NULL; + while ((c = getopt(argc, argv, "d:ef:ho:rw")) != -1) { switch (c) { case 'd': addrstr = optarg; @@ -192,12 +242,18 @@ main(int argc, char *argv[]) case 'r': act = ACTION_DUMP_RESET; break; + case 'f': + act = ACTION_FW_UPDATE; + img_fw_path = optarg; + break; case 'h': default: usage(); } } - if (act == ACTION_NONE || (dumpname != NULL && act != ACTION_DUMP_GET)) + if (act == ACTION_NONE || (dumpname != NULL && + act != ACTION_DUMP_GET) || (img_fw_path != NULL && + act != ACTION_FW_UPDATE)) usage(); if (parse_pci_addr(addrstr, &addr) != 0) exit(1); @@ -214,6 +270,9 @@ main(int argc, char *argv[]) break; case ACTION_DUMP_FORCE: res = mlx5tool_dump_force(ctldev, &addr); + break; + case ACTION_FW_UPDATE: + res = mlx5tool_fw_update(ctldev, &addr, img_fw_path); break; default: res = 0; From owner-svn-src-stable@freebsd.org Thu May 16 17:51:31 2019 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id C23E515A1D52; Thu, 16 May 2019 17:51:31 +0000 (UTC) (envelope-from hselasky@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 66F636AFFE; Thu, 16 May 2019 17:51:31 +0000 (UTC) (envelope-from hselasky@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 3795C24495; Thu, 16 May 2019 17:51:31 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x4GHpV2Q022064; Thu, 16 May 2019 17:51:31 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x4GHpUEr022062; Thu, 16 May 2019 17:51:30 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201905161751.x4GHpUEr022062@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Thu, 16 May 2019 17:51:30 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r347842 - in stable/11: share/man/man4 usr.sbin/mlx5tool X-SVN-Group: stable-11 X-SVN-Commit-Author: hselasky X-SVN-Commit-Paths: in stable/11: share/man/man4 usr.sbin/mlx5tool X-SVN-Commit-Revision: 347842 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 66F636AFFE X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.98 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.998,0]; NEURAL_HAM_SHORT(-0.99)[-0.986,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US]; NEURAL_HAM_LONG(-1.00)[-1.000,0] X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 16 May 2019 17:51:32 -0000 Author: hselasky Date: Thu May 16 17:51:30 2019 New Revision: 347842 URL: https://svnweb.freebsd.org/changeset/base/347842 Log: MFC r347289: Document userspace firmware flash in mlx5tool(8) and mlx5io(4). Submitted by: kib@ Sponsored by: Mellanox Technologies Modified: stable/11/share/man/man4/mlx5io.4 stable/11/usr.sbin/mlx5tool/mlx5tool.8 Directory Properties: stable/11/ (props changed) Modified: stable/11/share/man/man4/mlx5io.4 ============================================================================== --- stable/11/share/man/man4/mlx5io.4 Thu May 16 17:50:52 2019 (r347841) +++ stable/11/share/man/man4/mlx5io.4 Thu May 16 17:51:30 2019 (r347842) @@ -1,5 +1,5 @@ .\" -.\" Copyright (c) 2018 Mellanox Technologies +.\" Copyright (c) 2018, 2019 Mellanox Technologies .\" All rights reserved. .\" .\" Redistribution and use in source and binary forms, with or without @@ -121,6 +121,27 @@ struct mlx5_fwdump_reg { uint32_t val; }; .Ed +.It Dv MLX5_FW_UPDATE +Requests firmware update (flash) on the adapter specified by the +.Dv devaddr +using the firmware image in +.Dv MFA2 +format. +The argument for the ioctl command is the +.Vt struct mlx5_fw_update +with the following definition. +.Bd -literal +struct mlx5_fw_update { + struct mlx5_tool_addr devaddr; + void *img_fw_data; + size_t img_fw_data_len; +}; +.Ed +Image address in memory is passed in +.Dv img_fw_data , +the length of the image is specified in +.Dv img_fw_data_len +field. .El .Sh FILES The Modified: stable/11/usr.sbin/mlx5tool/mlx5tool.8 ============================================================================== --- stable/11/usr.sbin/mlx5tool/mlx5tool.8 Thu May 16 17:50:52 2019 (r347841) +++ stable/11/usr.sbin/mlx5tool/mlx5tool.8 Thu May 16 17:51:30 2019 (r347842) @@ -1,5 +1,5 @@ .\" -.\" Copyright (c) 2018 Mellanox Technologies +.\" Copyright (c) 2018, 2019 Mellanox Technologies .\" All rights reserved. .\" .\" Redistribution and use in source and binary forms, with or without @@ -37,11 +37,14 @@ .Fl e .Nm .Fl d Ar domain:bus:slot:func -.Fl r +.Fl rn .Nm .Fl d Ar domain:bus:slot:func .Fl o Ar file .Fl w +.Nm +.Fl d Ar domain:bus:slot:func +.Fl f Ar file.mfa2 .Sh DESCRIPTION The .Nm @@ -82,6 +85,12 @@ Fetches the stored firmware dump and writes it into th by the .Fl o option argument. +.It Fl f +Flashes the firmware image +.Fa file.mfa2 +to the specified adapter. +Image must be in MFA2 pack format and contain a component suitable +for the adapter hardware. .El .Sh FILES The From owner-svn-src-stable@freebsd.org Thu May 16 17:57:10 2019 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id D05D315A2053; Thu, 16 May 2019 17:57:10 +0000 (UTC) (envelope-from hselasky@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 731D96B4FF; Thu, 16 May 2019 17:57:10 +0000 (UTC) (envelope-from hselasky@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 48460244EC; Thu, 16 May 2019 17:57:10 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x4GHvAXf022418; Thu, 16 May 2019 17:57:10 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x4GHvAV6022417; Thu, 16 May 2019 17:57:10 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201905161757.x4GHvAV6022417@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Thu, 16 May 2019 17:57:10 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r347844 - stable/11/sys/dev/mlx5/mlx5_core X-SVN-Group: stable-11 X-SVN-Commit-Author: hselasky X-SVN-Commit-Paths: stable/11/sys/dev/mlx5/mlx5_core X-SVN-Commit-Revision: 347844 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 731D96B4FF X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.97 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.998,0]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; NEURAL_HAM_SHORT(-0.97)[-0.974,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US] X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 16 May 2019 17:57:11 -0000 Author: hselasky Date: Thu May 16 17:57:09 2019 New Revision: 347844 URL: https://svnweb.freebsd.org/changeset/base/347844 Log: Fix minor compile issue after MFC r347288. This is a direct commit. Sponsored by: Mellanox Technologies Modified: stable/11/sys/dev/mlx5/mlx5_core/mlx5_fwdump.c Modified: stable/11/sys/dev/mlx5/mlx5_core/mlx5_fwdump.c ============================================================================== --- stable/11/sys/dev/mlx5/mlx5_core/mlx5_fwdump.c Thu May 16 17:53:36 2019 (r347843) +++ stable/11/sys/dev/mlx5/mlx5_core/mlx5_fwdump.c Thu May 16 17:57:09 2019 (r347844) @@ -295,7 +295,7 @@ mlx5_fwdump_ioctl(struct cdev *dev, u_long cmd, caddr_ fake_fw.name = "umlx_fw_up"; fake_fw.datasize = fu->img_fw_data_len; fake_fw.version = 1; - fake_fw.data = (void *)kmem_malloc(fu->img_fw_data_len, + fake_fw.data = (void *)kmem_malloc(kmem_arena, fu->img_fw_data_len, M_WAITOK); if (fake_fw.data == NULL) { error = ENOMEM; @@ -305,7 +305,7 @@ mlx5_fwdump_ioctl(struct cdev *dev, u_long cmd, caddr_ fu->img_fw_data_len); if (error == 0) error = -mlx5_firmware_flash(mdev, &fake_fw); - kmem_free((vm_offset_t)fake_fw.data, fu->img_fw_data_len); + kmem_free(kmem_arena, (vm_offset_t)fake_fw.data, fu->img_fw_data_len); break; default: error = ENOTTY; From owner-svn-src-stable@freebsd.org Thu May 16 17:57:56 2019 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 6D78715A20C7; Thu, 16 May 2019 17:57:56 +0000 (UTC) (envelope-from hselasky@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 14C716B635; Thu, 16 May 2019 17:57:56 +0000 (UTC) (envelope-from hselasky@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 D5E74244EE; Thu, 16 May 2019 17:57:55 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x4GHvtFh022508; Thu, 16 May 2019 17:57:55 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x4GHvtvA022507; Thu, 16 May 2019 17:57:55 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201905161757.x4GHvtvA022507@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Thu, 16 May 2019 17:57:55 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r347845 - stable/11/sys/dev/mlx5/mlx5_core X-SVN-Group: stable-11 X-SVN-Commit-Author: hselasky X-SVN-Commit-Paths: stable/11/sys/dev/mlx5/mlx5_core X-SVN-Commit-Revision: 347845 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 14C716B635 X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.97 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.998,0]; NEURAL_HAM_SHORT(-0.97)[-0.974,0]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US] X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 16 May 2019 17:57:56 -0000 Author: hselasky Date: Thu May 16 17:57:55 2019 New Revision: 347845 URL: https://svnweb.freebsd.org/changeset/base/347845 Log: MFC r347290: Fix for double bus master disable in mlx5core. mlx5_pci_disable_device is calling pci_disable_device which disables bus master. No need to explicitly call pci_clear_master. Submitted by: slavash@ Sponsored by: Mellanox Technologies Modified: stable/11/sys/dev/mlx5/mlx5_core/mlx5_main.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/dev/mlx5/mlx5_core/mlx5_main.c ============================================================================== --- stable/11/sys/dev/mlx5/mlx5_core/mlx5_main.c Thu May 16 17:57:09 2019 (r347844) +++ stable/11/sys/dev/mlx5/mlx5_core/mlx5_main.c Thu May 16 17:57:55 2019 (r347845) @@ -866,7 +866,6 @@ static int mlx5_pci_init(struct mlx5_core_dev *dev, st return 0; err_clr_master: - pci_clear_master(dev->pdev); release_bar(dev->pdev); err_disable: mlx5_pci_disable_device(dev); @@ -877,7 +876,6 @@ err_dbg: static void mlx5_pci_close(struct mlx5_core_dev *dev, struct mlx5_priv *priv) { iounmap(dev->iseg); - pci_clear_master(dev->pdev); release_bar(dev->pdev); mlx5_pci_disable_device(dev); } From owner-svn-src-stable@freebsd.org Thu May 16 17:59:03 2019 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 4DE0515A2195; Thu, 16 May 2019 17:59:03 +0000 (UTC) (envelope-from hselasky@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 E80E96B78B; Thu, 16 May 2019 17:59:02 +0000 (UTC) (envelope-from hselasky@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 C0702244EF; Thu, 16 May 2019 17:59:02 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x4GHx2PY022623; Thu, 16 May 2019 17:59:02 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x4GHx2uf022622; Thu, 16 May 2019 17:59:02 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201905161759.x4GHx2uf022622@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Thu, 16 May 2019 17:59:02 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r347846 - stable/11/sys/ofed/drivers/infiniband/ulp/ipoib X-SVN-Group: stable-11 X-SVN-Commit-Author: hselasky X-SVN-Commit-Paths: stable/11/sys/ofed/drivers/infiniband/ulp/ipoib X-SVN-Commit-Revision: 347846 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: E80E96B78B X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.97 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.998,0]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; NEURAL_HAM_SHORT(-0.97)[-0.974,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US] X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 16 May 2019 17:59:03 -0000 Author: hselasky Date: Thu May 16 17:59:02 2019 New Revision: 347846 URL: https://svnweb.freebsd.org/changeset/base/347846 Log: MFC r347291: Handle IB_EVENT_DEVICE_FATAL event in ipoib. Perform flush if IB_EVENT_DEVICE_FATAL was received. Submitted by: slavash@ Sponsored by: Mellanox Technologies Modified: stable/11/sys/ofed/drivers/infiniband/ulp/ipoib/ipoib_verbs.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/ofed/drivers/infiniband/ulp/ipoib/ipoib_verbs.c ============================================================================== --- stable/11/sys/ofed/drivers/infiniband/ulp/ipoib/ipoib_verbs.c Thu May 16 17:57:55 2019 (r347845) +++ stable/11/sys/ofed/drivers/infiniband/ulp/ipoib/ipoib_verbs.c Thu May 16 17:59:02 2019 (r347846) @@ -280,7 +280,8 @@ void ipoib_event(struct ib_event_handler *handler, queue_work(ipoib_workqueue, &priv->flush_light); } else if (record->event == IB_EVENT_PORT_ERR || record->event == IB_EVENT_PORT_ACTIVE || - record->event == IB_EVENT_LID_CHANGE) { + record->event == IB_EVENT_LID_CHANGE || + record->event == IB_EVENT_DEVICE_FATAL) { queue_work(ipoib_workqueue, &priv->flush_normal); } else if (record->event == IB_EVENT_PKEY_CHANGE) { queue_work(ipoib_workqueue, &priv->flush_heavy); From owner-svn-src-stable@freebsd.org Thu May 16 17:59:44 2019 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id C508D15A220D; Thu, 16 May 2019 17:59:44 +0000 (UTC) (envelope-from hselasky@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 6C87B6B8C6; Thu, 16 May 2019 17:59:44 +0000 (UTC) (envelope-from hselasky@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 460CF244F0; Thu, 16 May 2019 17:59:44 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x4GHxiq9022707; Thu, 16 May 2019 17:59:44 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x4GHxiiG022706; Thu, 16 May 2019 17:59:44 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201905161759.x4GHxiiG022706@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Thu, 16 May 2019 17:59:44 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r347847 - stable/11/sys/dev/mlx5/mlx5_core X-SVN-Group: stable-11 X-SVN-Commit-Author: hselasky X-SVN-Commit-Paths: stable/11/sys/dev/mlx5/mlx5_core X-SVN-Commit-Revision: 347847 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 6C87B6B8C6 X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.97 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.998,0]; NEURAL_HAM_SHORT(-0.97)[-0.974,0]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US] X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 16 May 2019 17:59:44 -0000 Author: hselasky Date: Thu May 16 17:59:43 2019 New Revision: 347847 URL: https://svnweb.freebsd.org/changeset/base/347847 Log: MFC r347292: Add mlx5_firmware_update() in mlx5core. Add support for upgrading firmware on mlx5 module load. Submitted by: slavash@ Sponsored by: Mellanox Technologies Modified: stable/11/sys/dev/mlx5/mlx5_core/mlx5_main.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/dev/mlx5/mlx5_core/mlx5_main.c ============================================================================== --- stable/11/sys/dev/mlx5/mlx5_core/mlx5_main.c Thu May 16 17:59:02 2019 (r347846) +++ stable/11/sys/dev/mlx5/mlx5_core/mlx5_main.c Thu May 16 17:59:43 2019 (r347847) @@ -52,6 +52,7 @@ MODULE_DESCRIPTION("Mellanox Connect-IB, ConnectX-4 co MODULE_LICENSE("Dual BSD/GPL"); MODULE_DEPEND(mlx5, linuxkpi, 1, 1, 1); MODULE_DEPEND(mlx5, mlxfw, 1, 1, 1); +MODULE_DEPEND(mlx5, firmware, 1, 1, 1); MODULE_VERSION(mlx5, 1); SYSCTL_NODE(_hw, OID_AUTO, mlx5, CTLFLAG_RW, 0, "mlx5 hardware controls"); @@ -820,6 +821,23 @@ void *mlx5_get_protocol_dev(struct mlx5_core_dev *mdev } EXPORT_SYMBOL(mlx5_get_protocol_dev); +static int +mlx5_firmware_update(struct mlx5_core_dev *dev) +{ + const struct firmware *fw; + int err; + + fw = firmware_get("mlx5fw_mfa"); + if (fw) { + err = mlx5_firmware_flash(dev, fw); + firmware_put(fw, FIRMWARE_UNLOAD); + } + else + return (-ENOENT); + + return err; +} + static int mlx5_pci_init(struct mlx5_core_dev *dev, struct mlx5_priv *priv) { struct pci_dev *pdev = dev->pdev; @@ -1256,6 +1274,8 @@ static int init_one(struct pci_dev *pdev, } mlx5_fwdump_prep(dev); + + mlx5_firmware_update(dev); pci_save_state(bsddev); return 0; From owner-svn-src-stable@freebsd.org Thu May 16 18:00:18 2019 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id D15CC15A22B4; Thu, 16 May 2019 18:00:18 +0000 (UTC) (envelope-from brooks@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 736A26BA16; Thu, 16 May 2019 18:00:18 +0000 (UTC) (envelope-from brooks@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 4E3BB244F6; Thu, 16 May 2019 18:00:18 +0000 (UTC) (envelope-from brooks@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x4GI0Ioi022854; Thu, 16 May 2019 18:00:18 GMT (envelope-from brooks@FreeBSD.org) Received: (from brooks@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x4GI0HAr022852; Thu, 16 May 2019 18:00:17 GMT (envelope-from brooks@FreeBSD.org) Message-Id: <201905161800.x4GI0HAr022852@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: brooks set sender to brooks@FreeBSD.org using -f From: Brooks Davis Date: Thu, 16 May 2019 18:00:17 +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: r347848 - in stable/12/sys/dev: ae dme X-SVN-Group: stable-12 X-SVN-Commit-Author: brooks X-SVN-Commit-Paths: in stable/12/sys/dev: ae dme X-SVN-Commit-Revision: 347848 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 736A26BA16 X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.97 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.998,0]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; NEURAL_HAM_SHORT(-0.97)[-0.974,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US] X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 16 May 2019 18:00:19 -0000 Author: brooks Date: Thu May 16 18:00:17 2019 New Revision: 347848 URL: https://svnweb.freebsd.org/changeset/base/347848 Log: MFC r347365, r347703 r347365: Update dme(4) to reflect that it will not be removed due to FCP-101. dme(4) is the built-in NIC on a couple non-expandable mips platforms and thus should remain. The FCP has been updated to reflect this fact. Discussed with: imp r347703: FCP-101: ae(4) is sufficently popular to be moved to the keep list. Modified: stable/12/sys/dev/ae/if_ae.c stable/12/sys/dev/dme/if_dme.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/dev/ae/if_ae.c ============================================================================== --- stable/12/sys/dev/ae/if_ae.c Thu May 16 17:59:43 2019 (r347847) +++ stable/12/sys/dev/ae/if_ae.c Thu May 16 18:00:17 2019 (r347848) @@ -396,8 +396,6 @@ ae_attach(device_t dev) goto fail; } - gone_by_fcp101_dev(dev); - fail: if (error != 0) ae_detach(dev); Modified: stable/12/sys/dev/dme/if_dme.c ============================================================================== --- stable/12/sys/dev/dme/if_dme.c Thu May 16 17:59:43 2019 (r347847) +++ stable/12/sys/dev/dme/if_dme.c Thu May 16 18:00:17 2019 (r347848) @@ -916,8 +916,6 @@ dme_attach(device_t dev) goto fail; } - gone_by_fcp101_dev(dev); - fail: if (error != 0) dme_detach(dev); From owner-svn-src-stable@freebsd.org Thu May 16 18:00:38 2019 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id ECF4115A2332; Thu, 16 May 2019 18:00:37 +0000 (UTC) (envelope-from hselasky@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 92D696BB18; Thu, 16 May 2019 18:00:37 +0000 (UTC) (envelope-from hselasky@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 6CDE0244FA; Thu, 16 May 2019 18:00:37 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x4GI0boM022918; Thu, 16 May 2019 18:00:37 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x4GI0bKH022917; Thu, 16 May 2019 18:00:37 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201905161800.x4GI0bKH022917@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Thu, 16 May 2019 18:00:37 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r347849 - stable/11/sys/dev/mlx5/mlx5_en X-SVN-Group: stable-11 X-SVN-Commit-Author: hselasky X-SVN-Commit-Paths: stable/11/sys/dev/mlx5/mlx5_en X-SVN-Commit-Revision: 347849 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 92D696BB18 X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.97 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.998,0]; NEURAL_HAM_SHORT(-0.97)[-0.974,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US]; NEURAL_HAM_LONG(-1.00)[-1.000,0] X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 16 May 2019 18:00:38 -0000 Author: hselasky Date: Thu May 16 18:00:37 2019 New Revision: 347849 URL: https://svnweb.freebsd.org/changeset/base/347849 Log: MFC r347293: Use software counters for rx_packets and rx_bytes in mlx5en(4). The physical- and virtual- port counters might not reflect the amount of data received after address filtering. Use the software counters instead for rx_packets and rx_bytes to know exactly how much data was received. Sponsored by: Mellanox Technologies Modified: stable/11/sys/dev/mlx5/mlx5_en/mlx5_en_main.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/dev/mlx5/mlx5_en/mlx5_en_main.c ============================================================================== --- stable/11/sys/dev/mlx5/mlx5_en/mlx5_en_main.c Thu May 16 18:00:17 2019 (r347848) +++ stable/11/sys/dev/mlx5/mlx5_en/mlx5_en_main.c Thu May 16 18:00:37 2019 (r347849) @@ -499,6 +499,8 @@ mlx5e_update_stats_locked(struct mlx5e_priv *priv) u64 sw_lro_flushed = 0; u64 rx_csum_none = 0; u64 rx_wqe_err = 0; + u64 rx_packets = 0; + u64 rx_bytes = 0; u32 rx_out_of_buffer = 0; int i; int j; @@ -522,6 +524,8 @@ mlx5e_update_stats_locked(struct mlx5e_priv *priv) lro_bytes += rq_stats->lro_bytes; rx_csum_none += rq_stats->csum_none; rx_wqe_err += rq_stats->wqe_err; + rx_packets += rq_stats->packets; + rx_bytes += rq_stats->bytes; for (j = 0; j < priv->num_tc; j++) { sq_stats = &pch->sq[j].stats; @@ -548,6 +552,8 @@ mlx5e_update_stats_locked(struct mlx5e_priv *priv) s->sw_lro_flushed = sw_lro_flushed; s->rx_csum_none = rx_csum_none; s->rx_wqe_err = rx_wqe_err; + s->rx_packets = rx_packets; + s->rx_bytes = rx_bytes; /* HW counters */ memset(in, 0, sizeof(in)); @@ -610,11 +616,6 @@ mlx5e_update_stats_locked(struct mlx5e_priv *priv) s->tx_broadcast_bytes = MLX5_GET_CTR(out, transmitted_eth_broadcast.octets); - s->rx_packets = s->rx_unicast_packets + - s->rx_multicast_packets + s->rx_broadcast_packets - - s->rx_out_of_buffer; - s->rx_bytes = s->rx_unicast_bytes + s->rx_multicast_bytes + - s->rx_broadcast_bytes; s->tx_packets = s->tx_unicast_packets + s->tx_multicast_packets + s->tx_broadcast_packets; s->tx_bytes = s->tx_unicast_bytes + s->tx_multicast_bytes + From owner-svn-src-stable@freebsd.org Thu May 16 18:01:25 2019 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 2629315A23C9; Thu, 16 May 2019 18:01:25 +0000 (UTC) (envelope-from hselasky@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 BFF806BD14; Thu, 16 May 2019 18:01:24 +0000 (UTC) (envelope-from hselasky@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 9881624533; Thu, 16 May 2019 18:01:24 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x4GI1Ov2025991; Thu, 16 May 2019 18:01:24 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x4GI1NiP025986; Thu, 16 May 2019 18:01:23 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201905161801.x4GI1NiP025986@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Thu, 16 May 2019 18:01:23 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r347850 - in stable/11/sys/dev/mlx5: . mlx5_core mlx5_en X-SVN-Group: stable-11 X-SVN-Commit-Author: hselasky X-SVN-Commit-Paths: in stable/11/sys/dev/mlx5: . mlx5_core mlx5_en X-SVN-Commit-Revision: 347850 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: BFF806BD14 X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.97 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.998,0]; NEURAL_HAM_SHORT(-0.98)[-0.975,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US]; NEURAL_HAM_LONG(-1.00)[-1.000,0] X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 16 May 2019 18:01:25 -0000 Author: hselasky Date: Thu May 16 18:01:23 2019 New Revision: 347850 URL: https://svnweb.freebsd.org/changeset/base/347850 Log: MFC r347294: Add vnic steering drop statistics in mlx5en(4). Sponsored by: Mellanox Technologies Modified: stable/11/sys/dev/mlx5/mlx5_core/mlx5_cmd.c stable/11/sys/dev/mlx5/mlx5_en/en.h stable/11/sys/dev/mlx5/mlx5_en/mlx5_en_main.c stable/11/sys/dev/mlx5/mlx5_ifc.h Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/dev/mlx5/mlx5_core/mlx5_cmd.c ============================================================================== --- stable/11/sys/dev/mlx5/mlx5_core/mlx5_cmd.c Thu May 16 18:00:37 2019 (r347849) +++ stable/11/sys/dev/mlx5/mlx5_core/mlx5_cmd.c Thu May 16 18:01:23 2019 (r347850) @@ -412,6 +412,7 @@ static int mlx5_internal_err_ret_value(struct mlx5_cor case MLX5_CMD_OP_MODIFY_HCA_VPORT_CONTEXT: case MLX5_CMD_OP_QUERY_HCA_VPORT_GID: case MLX5_CMD_OP_QUERY_HCA_VPORT_PKEY: + case MLX5_CMD_OP_QUERY_VNIC_ENV: case MLX5_CMD_OP_QUERY_VPORT_COUNTER: case MLX5_CMD_OP_ALLOC_Q_COUNTER: case MLX5_CMD_OP_QUERY_Q_COUNTER: @@ -537,6 +538,7 @@ const char *mlx5_command_str(int command) MLX5_COMMAND_STR_CASE(MODIFY_HCA_VPORT_CONTEXT); MLX5_COMMAND_STR_CASE(QUERY_HCA_VPORT_GID); MLX5_COMMAND_STR_CASE(QUERY_HCA_VPORT_PKEY); + MLX5_COMMAND_STR_CASE(QUERY_VNIC_ENV); MLX5_COMMAND_STR_CASE(QUERY_VPORT_COUNTER); MLX5_COMMAND_STR_CASE(SET_WOL_ROL); MLX5_COMMAND_STR_CASE(QUERY_WOL_ROL); Modified: stable/11/sys/dev/mlx5/mlx5_en/en.h ============================================================================== --- stable/11/sys/dev/mlx5/mlx5_en/en.h Thu May 16 18:00:37 2019 (r347849) +++ stable/11/sys/dev/mlx5/mlx5_en/en.h Thu May 16 18:01:23 2019 (r347850) @@ -185,7 +185,8 @@ typedef void (mlx5e_cq_comp_t)(struct mlx5_core_cq *); m(+1, u64 tx_queue_dropped, "tx_queue_dropped", "Transmit queue dropped") \ m(+1, u64 tx_defragged, "tx_defragged", "Transmit queue defragged") \ m(+1, u64 rx_wqe_err, "rx_wqe_err", "Receive WQE errors") \ - m(+1, u64 tx_jumbo_packets, "tx_jumbo_packets", "TX packets greater than 1518 octets") + m(+1, u64 tx_jumbo_packets, "tx_jumbo_packets", "TX packets greater than 1518 octets") \ + m(+1, u64 rx_steer_missed_packets, "rx_steer_missed_packets", "RX packets dropped by steering rule(s)") #define MLX5E_VPORT_STATS_NUM (0 MLX5E_VPORT_STATS(MLX5E_STATS_COUNT)) Modified: stable/11/sys/dev/mlx5/mlx5_en/mlx5_en_main.c ============================================================================== --- stable/11/sys/dev/mlx5/mlx5_en/mlx5_en_main.c Thu May 16 18:00:37 2019 (r347849) +++ stable/11/sys/dev/mlx5/mlx5_en/mlx5_en_main.c Thu May 16 18:01:23 2019 (r347850) @@ -468,6 +468,28 @@ free_out: kvfree(out); } +static void +mlx5e_grp_vnic_env_update_stats(struct mlx5e_priv *priv) +{ + u32 out[MLX5_ST_SZ_DW(query_vnic_env_out)] = {}; + u32 in[MLX5_ST_SZ_DW(query_vnic_env_in)] = {}; + + if (!MLX5_CAP_GEN(priv->mdev, nic_receive_steering_discard)) + return; + + MLX5_SET(query_vnic_env_in, in, opcode, + MLX5_CMD_OP_QUERY_VNIC_ENV); + MLX5_SET(query_vnic_env_in, in, op_mod, 0); + MLX5_SET(query_vnic_env_in, in, other_vport, 0); + + if (mlx5_cmd_exec(priv->mdev, in, sizeof(in), out, sizeof(out)) != 0) + return; + + priv->stats.vport.rx_steer_missed_packets = + MLX5_GET64(query_vnic_env_out, out, + vport_env.nic_receive_steering_discard); +} + /* * This function is called regularly to collect all statistics * counters from the firmware. The values can be viewed through the @@ -554,6 +576,8 @@ mlx5e_update_stats_locked(struct mlx5e_priv *priv) s->rx_wqe_err = rx_wqe_err; s->rx_packets = rx_packets; s->rx_bytes = rx_bytes; + + mlx5e_grp_vnic_env_update_stats(priv); /* HW counters */ memset(in, 0, sizeof(in)); Modified: stable/11/sys/dev/mlx5/mlx5_ifc.h ============================================================================== --- stable/11/sys/dev/mlx5/mlx5_ifc.h Thu May 16 18:00:37 2019 (r347849) +++ stable/11/sys/dev/mlx5/mlx5_ifc.h Thu May 16 18:01:23 2019 (r347850) @@ -151,6 +151,7 @@ enum { MLX5_CMD_OP_MODIFY_HCA_VPORT_CONTEXT = 0x763, MLX5_CMD_OP_QUERY_HCA_VPORT_GID = 0x764, MLX5_CMD_OP_QUERY_HCA_VPORT_PKEY = 0x765, + MLX5_CMD_OP_QUERY_VNIC_ENV = 0x76f, MLX5_CMD_OP_QUERY_VPORT_COUNTER = 0x770, MLX5_CMD_OP_ALLOC_Q_COUNTER = 0x771, MLX5_CMD_OP_DEALLOC_Q_COUNTER = 0x772, @@ -1222,7 +1223,9 @@ struct mlx5_ifc_cmd_hca_cap_bits { u8 reserved_44[0xb]; u8 log_max_xrcd[0x5]; - u8 reserved_45[0x10]; + u8 nic_receive_steering_discard[0x1]; + u8 reserved_45[0x7]; + u8 log_max_flow_counter_bulk[0x8]; u8 max_flow_counter[0x10]; u8 reserved_46[0x3]; @@ -2190,6 +2193,24 @@ struct mlx5_ifc_xrc_srqc_bits { u8 reserved_9[0x80]; }; +struct mlx5_ifc_vnic_diagnostic_statistics_bits { + u8 counter_error_queues[0x20]; + + u8 total_error_queues[0x20]; + + u8 send_queue_priority_update_flow[0x20]; + + u8 reserved_at_60[0x20]; + + u8 nic_receive_steering_discard[0x40]; + + u8 receive_discard_vport_down[0x40]; + + u8 transmit_discard_vport_down[0x40]; + + u8 reserved_at_140[0xec0]; +}; + struct mlx5_ifc_traffic_counter_bits { u8 packets[0x40]; @@ -3964,6 +3985,35 @@ struct mlx5_ifc_query_vport_state_in_bits { u8 vport_number[0x10]; u8 reserved_3[0x20]; +}; + +struct mlx5_ifc_query_vnic_env_out_bits { + u8 status[0x8]; + u8 reserved_at_8[0x18]; + + u8 syndrome[0x20]; + + u8 reserved_at_40[0x40]; + + struct mlx5_ifc_vnic_diagnostic_statistics_bits vport_env; +}; + +enum { + MLX5_QUERY_VNIC_ENV_IN_OP_MOD_VPORT_DIAG_STATISTICS = 0x0, +}; + +struct mlx5_ifc_query_vnic_env_in_bits { + u8 opcode[0x10]; + u8 reserved_at_10[0x10]; + + u8 reserved_at_20[0x10]; + u8 op_mod[0x10]; + + u8 other_vport[0x1]; + u8 reserved_at_41[0xf]; + u8 vport_number[0x10]; + + u8 reserved_at_60[0x20]; }; struct mlx5_ifc_query_vport_counter_out_bits { From owner-svn-src-stable@freebsd.org Thu May 16 18:02:10 2019 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 33B9215A25E1; Thu, 16 May 2019 18:02:10 +0000 (UTC) (envelope-from hselasky@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 CFCB36BEE4; Thu, 16 May 2019 18:02:09 +0000 (UTC) (envelope-from hselasky@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 A92D02456C; Thu, 16 May 2019 18:02:09 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x4GI29f5026092; Thu, 16 May 2019 18:02:09 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x4GI29Ms026091; Thu, 16 May 2019 18:02:09 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201905161802.x4GI29Ms026091@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Thu, 16 May 2019 18:02:09 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r347851 - stable/11/sys/dev/mlx5/mlx5_en X-SVN-Group: stable-11 X-SVN-Commit-Author: hselasky X-SVN-Commit-Paths: stable/11/sys/dev/mlx5/mlx5_en X-SVN-Commit-Revision: 347851 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: CFCB36BEE4 X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.97 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.998,0]; NEURAL_HAM_SHORT(-0.97)[-0.974,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US]; NEURAL_HAM_LONG(-1.00)[-1.000,0] X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 16 May 2019 18:02:10 -0000 Author: hselasky Date: Thu May 16 18:02:09 2019 New Revision: 347851 URL: https://svnweb.freebsd.org/changeset/base/347851 Log: MFC r347295: Let rx_out_of_buffer be a 32-bit counter in mlx5en(4). This fixes counting issues when the firmware resets the counter during allocation of the counter set where the counter belongs. Sponsored by: Mellanox Technologies Modified: stable/11/sys/dev/mlx5/mlx5_en/en.h stable/11/sys/dev/mlx5/mlx5_en/mlx5_en_main.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/dev/mlx5/mlx5_en/en.h ============================================================================== --- stable/11/sys/dev/mlx5/mlx5_en/en.h Thu May 16 18:01:23 2019 (r347850) +++ stable/11/sys/dev/mlx5/mlx5_en/en.h Thu May 16 18:02:09 2019 (r347851) @@ -194,7 +194,6 @@ struct mlx5e_vport_stats { struct sysctl_ctx_list ctx; u64 arg [0]; MLX5E_VPORT_STATS(MLX5E_STATS_VAR) - u32 rx_out_of_buffer_prev; }; #define MLX5E_PPORT_IEEE802_3_STATS(m) \ Modified: stable/11/sys/dev/mlx5/mlx5_en/mlx5_en_main.c ============================================================================== --- stable/11/sys/dev/mlx5/mlx5_en/mlx5_en_main.c Thu May 16 18:01:23 2019 (r347850) +++ stable/11/sys/dev/mlx5/mlx5_en/mlx5_en_main.c Thu May 16 18:02:09 2019 (r347851) @@ -593,10 +593,7 @@ mlx5e_update_stats_locked(struct mlx5e_priv *priv) if (test_bit(MLX5E_STATE_OPENED, &priv->state) != 0 && mlx5_vport_query_out_of_rx_buffer(mdev, priv->counter_set_id, &rx_out_of_buffer) == 0) { - /* accumulate difference into a 64-bit counter */ - s->rx_out_of_buffer += (u64)(u32)(rx_out_of_buffer - - s->rx_out_of_buffer_prev); - s->rx_out_of_buffer_prev = rx_out_of_buffer; + s->rx_out_of_buffer = rx_out_of_buffer; } /* get port statistics */ From owner-svn-src-stable@freebsd.org Thu May 16 18:05:17 2019 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 7435315A2775; Thu, 16 May 2019 18:05:17 +0000 (UTC) (envelope-from hselasky@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 1739B6C389; Thu, 16 May 2019 18:05:17 +0000 (UTC) (envelope-from hselasky@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 E757C246B5; Thu, 16 May 2019 18:05:16 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x4GI5Gdb028012; Thu, 16 May 2019 18:05:16 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x4GI5Gex028011; Thu, 16 May 2019 18:05:16 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201905161805.x4GI5Gex028011@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Thu, 16 May 2019 18:05:16 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r347853 - stable/11/sys/dev/mlx5/mlx5_core X-SVN-Group: stable-11 X-SVN-Commit-Author: hselasky X-SVN-Commit-Paths: stable/11/sys/dev/mlx5/mlx5_core X-SVN-Commit-Revision: 347853 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 1739B6C389 X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.97 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_SHORT(-0.97)[-0.974,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US]; NEURAL_HAM_MEDIUM(-1.00)[-0.998,0]; NEURAL_HAM_LONG(-1.00)[-1.000,0] X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 16 May 2019 18:05:17 -0000 Author: hselasky Date: Thu May 16 18:05:16 2019 New Revision: 347853 URL: https://svnweb.freebsd.org/changeset/base/347853 Log: MFC r347297: Control automatic update of firmware on driver load with a tunable in mlx5core. Submitted by: kib@ Sponsored by: Mellanox Technologies Modified: stable/11/sys/dev/mlx5/mlx5_core/mlx5_main.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/dev/mlx5/mlx5_core/mlx5_main.c ============================================================================== --- stable/11/sys/dev/mlx5/mlx5_core/mlx5_main.c Thu May 16 18:03:08 2019 (r347852) +++ stable/11/sys/dev/mlx5/mlx5_core/mlx5_main.c Thu May 16 18:05:16 2019 (r347853) @@ -821,12 +821,19 @@ void *mlx5_get_protocol_dev(struct mlx5_core_dev *mdev } EXPORT_SYMBOL(mlx5_get_protocol_dev); +static int mlx5_auto_fw_update; +SYSCTL_INT(_hw_mlx5, OID_AUTO, auto_fw_update, CTLFLAG_RDTUN | CTLFLAG_NOFETCH, + &mlx5_auto_fw_update, 0, + "Allow automatic firmware update on driver start"); static int mlx5_firmware_update(struct mlx5_core_dev *dev) { const struct firmware *fw; int err; + TUNABLE_INT_FETCH("hw.mlx5.auto_fw_update", &mlx5_auto_fw_update); + if (!mlx5_auto_fw_update) + return (0); fw = firmware_get("mlx5fw_mfa"); if (fw) { err = mlx5_firmware_flash(dev, fw); From owner-svn-src-stable@freebsd.org Thu May 16 18:06:11 2019 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 7116F15A27DD; Thu, 16 May 2019 18:06:11 +0000 (UTC) (envelope-from hselasky@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 125F46C4CB; Thu, 16 May 2019 18:06:11 +0000 (UTC) (envelope-from hselasky@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 E0F15246B6; Thu, 16 May 2019 18:06:10 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x4GI6ANZ028123; Thu, 16 May 2019 18:06:10 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x4GI6A7X028122; Thu, 16 May 2019 18:06:10 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201905161806.x4GI6A7X028122@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Thu, 16 May 2019 18:06:10 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r347854 - stable/11/sys/dev/mlx5 X-SVN-Group: stable-11 X-SVN-Commit-Author: hselasky X-SVN-Commit-Paths: stable/11/sys/dev/mlx5 X-SVN-Commit-Revision: 347854 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 125F46C4CB X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.97 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.998,0]; NEURAL_HAM_SHORT(-0.97)[-0.974,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US]; NEURAL_HAM_LONG(-1.00)[-1.000,0] X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 16 May 2019 18:06:11 -0000 Author: hselasky Date: Thu May 16 18:06:10 2019 New Revision: 347854 URL: https://svnweb.freebsd.org/changeset/base/347854 Log: MFC r347298: Remove unused speed enums in mlx5core. Submitted by: slavash@ Sponsored by: Mellanox Technologies Modified: stable/11/sys/dev/mlx5/driver.h Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/dev/mlx5/driver.h ============================================================================== --- stable/11/sys/dev/mlx5/driver.h Thu May 16 18:05:16 2019 (r347853) +++ stable/11/sys/dev/mlx5/driver.h Thu May 16 18:06:10 2019 (r347854) @@ -205,36 +205,6 @@ enum mlx5_port_status { MLX5_PORT_DOWN = 1 << 1, }; -enum mlx5_link_mode { - MLX5_1000BASE_CX_SGMII = 0, - MLX5_1000BASE_KX = 1, - MLX5_10GBASE_CX4 = 2, - MLX5_10GBASE_KX4 = 3, - MLX5_10GBASE_KR = 4, - MLX5_20GBASE_KR2 = 5, - MLX5_40GBASE_CR4 = 6, - MLX5_40GBASE_KR4 = 7, - MLX5_56GBASE_R4 = 8, - MLX5_10GBASE_CR = 12, - MLX5_10GBASE_SR = 13, - MLX5_10GBASE_ER = 14, - MLX5_40GBASE_SR4 = 15, - MLX5_40GBASE_LR4 = 16, - MLX5_100GBASE_CR4 = 20, - MLX5_100GBASE_SR4 = 21, - MLX5_100GBASE_KR4 = 22, - MLX5_100GBASE_LR4 = 23, - MLX5_100BASE_TX = 24, - MLX5_1000BASE_T = 25, - MLX5_10GBASE_T = 26, - MLX5_25GBASE_CR = 27, - MLX5_25GBASE_KR = 28, - MLX5_25GBASE_SR = 29, - MLX5_50GBASE_CR2 = 30, - MLX5_50GBASE_KR2 = 31, - MLX5_LINK_MODES_NUMBER, -}; - enum { MLX5_VSC_SPACE_SUPPORTED = 0x1, MLX5_VSC_SPACE_OFFSET = 0x4, From owner-svn-src-stable@freebsd.org Thu May 16 18:06:58 2019 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 0817915A289F; Thu, 16 May 2019 18:06:58 +0000 (UTC) (envelope-from hselasky@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 AC0446C615; Thu, 16 May 2019 18:06:57 +0000 (UTC) (envelope-from hselasky@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 87064246B8; Thu, 16 May 2019 18:06:57 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x4GI6vRd028215; Thu, 16 May 2019 18:06:57 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x4GI6uet028210; Thu, 16 May 2019 18:06:56 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201905161806.x4GI6uet028210@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Thu, 16 May 2019 18:06:56 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r347855 - in stable/11/sys/dev/mlx5: . mlx5_core mlx5_en mlx5_ib X-SVN-Group: stable-11 X-SVN-Commit-Author: hselasky X-SVN-Commit-Paths: in stable/11/sys/dev/mlx5: . mlx5_core mlx5_en mlx5_ib X-SVN-Commit-Revision: 347855 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: AC0446C615 X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.98 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.998,0]; NEURAL_HAM_SHORT(-0.98)[-0.978,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US]; NEURAL_HAM_LONG(-1.00)[-1.000,0] X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 16 May 2019 18:06:58 -0000 Author: hselasky Date: Thu May 16 18:06:56 2019 New Revision: 347855 URL: https://svnweb.freebsd.org/changeset/base/347855 Log: MFC r347299: Add support for 200Gb ethernet speeds to mlx5core. Submitted by: slavash@ Sponsored by: Mellanox Technologies Modified: stable/11/sys/dev/mlx5/mlx5_core/mlx5_fw.c stable/11/sys/dev/mlx5/mlx5_core/mlx5_port.c stable/11/sys/dev/mlx5/mlx5_en/mlx5_en_main.c stable/11/sys/dev/mlx5/mlx5_ib/mlx5_ib_main.c stable/11/sys/dev/mlx5/mlx5_ifc.h stable/11/sys/dev/mlx5/port.h Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/dev/mlx5/mlx5_core/mlx5_fw.c ============================================================================== --- stable/11/sys/dev/mlx5/mlx5_core/mlx5_fw.c Thu May 16 18:06:10 2019 (r347854) +++ stable/11/sys/dev/mlx5/mlx5_core/mlx5_fw.c Thu May 16 18:06:56 2019 (r347855) @@ -221,6 +221,12 @@ int mlx5_query_hca_caps(struct mlx5_core_dev *dev) return err; } + if (MLX5_CAP_GEN(dev, pcam_reg)) { + err = mlx5_get_pcam_reg(dev); + if (err) + return err; + } + err = mlx5_core_query_special_contexts(dev); if (err) return err; Modified: stable/11/sys/dev/mlx5/mlx5_core/mlx5_port.c ============================================================================== --- stable/11/sys/dev/mlx5/mlx5_core/mlx5_port.c Thu May 16 18:06:10 2019 (r347854) +++ stable/11/sys/dev/mlx5/mlx5_core/mlx5_port.c Thu May 16 18:06:56 2019 (r347855) @@ -260,7 +260,7 @@ int mlx5_query_port_eth_proto_oper(struct mlx5_core_de EXPORT_SYMBOL(mlx5_query_port_eth_proto_oper); int mlx5_set_port_proto(struct mlx5_core_dev *dev, u32 proto_admin, - int proto_mask) + int proto_mask, bool ext) { u32 in[MLX5_ST_SZ_DW(ptys_reg)] = {0}; u32 out[MLX5_ST_SZ_DW(ptys_reg)] = {0}; @@ -268,10 +268,14 @@ int mlx5_set_port_proto(struct mlx5_core_dev *dev, u32 MLX5_SET(ptys_reg, in, local_port, 1); MLX5_SET(ptys_reg, in, proto_mask, proto_mask); - if (proto_mask == MLX5_PTYS_EN) - MLX5_SET(ptys_reg, in, eth_proto_admin, proto_admin); - else + if (proto_mask == MLX5_PTYS_EN) { + if (ext) + MLX5_SET(ptys_reg, in, ext_eth_proto_admin, proto_admin); + else + MLX5_SET(ptys_reg, in, eth_proto_admin, proto_admin); + } else { MLX5_SET(ptys_reg, in, ib_proto_admin, proto_admin); + } err = mlx5_core_access_reg(dev, in, sizeof(in), out, sizeof(out), MLX5_REG_PTYS, 0, 1); Modified: stable/11/sys/dev/mlx5/mlx5_en/mlx5_en_main.c ============================================================================== --- stable/11/sys/dev/mlx5/mlx5_en/mlx5_en_main.c Thu May 16 18:06:10 2019 (r347854) +++ stable/11/sys/dev/mlx5/mlx5_en/mlx5_en_main.c Thu May 16 18:06:56 2019 (r347855) @@ -47,117 +47,355 @@ struct mlx5e_channel_param { struct mlx5e_cq_param tx_cq; }; -static const struct { +struct media { u32 subtype; u64 baudrate; -} mlx5e_mode_table[MLX5E_LINK_MODES_NUMBER] = { +}; - [MLX5E_1000BASE_CX_SGMII] = { +static const struct media mlx5e_mode_table[MLX5E_LINK_SPEEDS_NUMBER][MLX5E_LINK_MODES_NUMBER] = { + + [MLX5E_1000BASE_CX_SGMII][MLX5E_SGMII] = { .subtype = IFM_1000_CX_SGMII, .baudrate = IF_Mbps(1000ULL), }, - [MLX5E_1000BASE_KX] = { + [MLX5E_1000BASE_KX][MLX5E_KX] = { .subtype = IFM_1000_KX, .baudrate = IF_Mbps(1000ULL), }, - [MLX5E_10GBASE_CX4] = { + [MLX5E_10GBASE_CX4][MLX5E_CX4] = { .subtype = IFM_10G_CX4, .baudrate = IF_Gbps(10ULL), }, - [MLX5E_10GBASE_KX4] = { + [MLX5E_10GBASE_KX4][MLX5E_KX4] = { .subtype = IFM_10G_KX4, .baudrate = IF_Gbps(10ULL), }, - [MLX5E_10GBASE_KR] = { + [MLX5E_10GBASE_KR][MLX5E_KR] = { .subtype = IFM_10G_KR, .baudrate = IF_Gbps(10ULL), }, - [MLX5E_20GBASE_KR2] = { + [MLX5E_20GBASE_KR2][MLX5E_KR2] = { .subtype = IFM_20G_KR2, .baudrate = IF_Gbps(20ULL), }, - [MLX5E_40GBASE_CR4] = { + [MLX5E_40GBASE_CR4][MLX5E_CR4] = { .subtype = IFM_40G_CR4, .baudrate = IF_Gbps(40ULL), }, - [MLX5E_40GBASE_KR4] = { + [MLX5E_40GBASE_KR4][MLX5E_KR4] = { .subtype = IFM_40G_KR4, .baudrate = IF_Gbps(40ULL), }, - [MLX5E_56GBASE_R4] = { + [MLX5E_56GBASE_R4][MLX5E_R] = { .subtype = IFM_56G_R4, .baudrate = IF_Gbps(56ULL), }, - [MLX5E_10GBASE_CR] = { + [MLX5E_10GBASE_CR][MLX5E_CR1] = { .subtype = IFM_10G_CR1, .baudrate = IF_Gbps(10ULL), }, - [MLX5E_10GBASE_SR] = { + [MLX5E_10GBASE_SR][MLX5E_SR] = { .subtype = IFM_10G_SR, .baudrate = IF_Gbps(10ULL), }, - [MLX5E_10GBASE_ER] = { + [MLX5E_10GBASE_ER_LR][MLX5E_ER] = { .subtype = IFM_10G_ER, .baudrate = IF_Gbps(10ULL), }, - [MLX5E_40GBASE_SR4] = { + [MLX5E_10GBASE_ER_LR][MLX5E_LR] = { + .subtype = IFM_10G_LR, + .baudrate = IF_Gbps(10ULL), + }, + [MLX5E_40GBASE_SR4][MLX5E_SR4] = { .subtype = IFM_40G_SR4, .baudrate = IF_Gbps(40ULL), }, - [MLX5E_40GBASE_LR4] = { + [MLX5E_40GBASE_LR4_ER4][MLX5E_LR4] = { .subtype = IFM_40G_LR4, .baudrate = IF_Gbps(40ULL), }, - [MLX5E_100GBASE_CR4] = { + [MLX5E_40GBASE_LR4_ER4][MLX5E_ER4] = { + .subtype = IFM_40G_ER4, + .baudrate = IF_Gbps(40ULL), + }, + [MLX5E_100GBASE_CR4][MLX5E_CR4] = { .subtype = IFM_100G_CR4, .baudrate = IF_Gbps(100ULL), }, - [MLX5E_100GBASE_SR4] = { + [MLX5E_100GBASE_SR4][MLX5E_SR4] = { .subtype = IFM_100G_SR4, .baudrate = IF_Gbps(100ULL), }, - [MLX5E_100GBASE_KR4] = { + [MLX5E_100GBASE_KR4][MLX5E_KR4] = { .subtype = IFM_100G_KR4, .baudrate = IF_Gbps(100ULL), }, - [MLX5E_100GBASE_LR4] = { + [MLX5E_100GBASE_LR4][MLX5E_LR4] = { .subtype = IFM_100G_LR4, .baudrate = IF_Gbps(100ULL), }, - [MLX5E_100BASE_TX] = { + [MLX5E_100BASE_TX][MLX5E_TX] = { .subtype = IFM_100_TX, .baudrate = IF_Mbps(100ULL), }, - [MLX5E_1000BASE_T] = { + [MLX5E_1000BASE_T][MLX5E_T] = { .subtype = IFM_1000_T, .baudrate = IF_Mbps(1000ULL), }, - [MLX5E_10GBASE_T] = { + [MLX5E_10GBASE_T][MLX5E_T] = { .subtype = IFM_10G_T, .baudrate = IF_Gbps(10ULL), }, - [MLX5E_25GBASE_CR] = { + [MLX5E_25GBASE_CR][MLX5E_CR] = { .subtype = IFM_25G_CR, .baudrate = IF_Gbps(25ULL), }, - [MLX5E_25GBASE_KR] = { + [MLX5E_25GBASE_KR][MLX5E_KR] = { .subtype = IFM_25G_KR, .baudrate = IF_Gbps(25ULL), }, - [MLX5E_25GBASE_SR] = { + [MLX5E_25GBASE_SR][MLX5E_SR] = { .subtype = IFM_25G_SR, .baudrate = IF_Gbps(25ULL), }, - [MLX5E_50GBASE_CR2] = { + [MLX5E_50GBASE_CR2][MLX5E_CR2] = { .subtype = IFM_50G_CR2, .baudrate = IF_Gbps(50ULL), }, - [MLX5E_50GBASE_KR2] = { + [MLX5E_50GBASE_KR2][MLX5E_KR2] = { .subtype = IFM_50G_KR2, .baudrate = IF_Gbps(50ULL), }, }; +static const struct media mlx5e_ext_mode_table[MLX5E_EXT_LINK_SPEEDS_NUMBER][MLX5E_LINK_MODES_NUMBER] = { + [MLX5E_SGMII_100M][MLX5E_SGMII] = { + .subtype = IFM_100_SGMII, + .baudrate = IF_Mbps(100), + }, + [MLX5E_1000BASE_X_SGMII][MLX5E_KX] = { + .subtype = IFM_1000_KX, + .baudrate = IF_Mbps(1000), + }, + [MLX5E_1000BASE_X_SGMII][MLX5E_CX_SGMII] = { + .subtype = IFM_1000_CX_SGMII, + .baudrate = IF_Mbps(1000), + }, + [MLX5E_1000BASE_X_SGMII][MLX5E_CX] = { + .subtype = IFM_1000_CX, + .baudrate = IF_Mbps(1000), + }, + [MLX5E_1000BASE_X_SGMII][MLX5E_LX] = { + .subtype = IFM_1000_LX, + .baudrate = IF_Mbps(1000), + }, + [MLX5E_1000BASE_X_SGMII][MLX5E_SX] = { + .subtype = IFM_1000_SX, + .baudrate = IF_Mbps(1000), + }, + [MLX5E_1000BASE_X_SGMII][MLX5E_T] = { + .subtype = IFM_1000_T, + .baudrate = IF_Mbps(1000), + }, + [MLX5E_5GBASE_R][MLX5E_T] = { + .subtype = IFM_5000_T, + .baudrate = IF_Mbps(5000), + }, + [MLX5E_5GBASE_R][MLX5E_KR] = { + .subtype = IFM_5000_KR, + .baudrate = IF_Mbps(5000), + }, + [MLX5E_5GBASE_R][MLX5E_KR1] = { + .subtype = IFM_5000_KR1, + .baudrate = IF_Mbps(5000), + }, + [MLX5E_5GBASE_R][MLX5E_KR_S] = { + .subtype = IFM_5000_KR_S, + .baudrate = IF_Mbps(5000), + }, + [MLX5E_10GBASE_XFI_XAUI_1][MLX5E_ER] = { + .subtype = IFM_10G_ER, + .baudrate = IF_Gbps(10ULL), + }, + [MLX5E_10GBASE_XFI_XAUI_1][MLX5E_KR] = { + .subtype = IFM_10G_KR, + .baudrate = IF_Gbps(10ULL), + }, + [MLX5E_10GBASE_XFI_XAUI_1][MLX5E_LR] = { + .subtype = IFM_10G_LR, + .baudrate = IF_Gbps(10ULL), + }, + [MLX5E_10GBASE_XFI_XAUI_1][MLX5E_SR] = { + .subtype = IFM_10G_SR, + .baudrate = IF_Gbps(10ULL), + }, + [MLX5E_10GBASE_XFI_XAUI_1][MLX5E_T] = { + .subtype = IFM_10G_T, + .baudrate = IF_Gbps(10ULL), + }, + [MLX5E_10GBASE_XFI_XAUI_1][MLX5E_AOC] = { + .subtype = IFM_10G_AOC, + .baudrate = IF_Gbps(10ULL), + }, + [MLX5E_10GBASE_XFI_XAUI_1][MLX5E_CR1] = { + .subtype = IFM_10G_CR1, + .baudrate = IF_Gbps(10ULL), + }, + [MLX5E_40GBASE_XLAUI_4_XLPPI_4][MLX5E_CR4] = { + .subtype = IFM_40G_CR4, + .baudrate = IF_Gbps(40ULL), + }, + [MLX5E_40GBASE_XLAUI_4_XLPPI_4][MLX5E_KR4] = { + .subtype = IFM_40G_KR4, + .baudrate = IF_Gbps(40ULL), + }, + [MLX5E_40GBASE_XLAUI_4_XLPPI_4][MLX5E_LR4] = { + .subtype = IFM_40G_LR4, + .baudrate = IF_Gbps(40ULL), + }, + [MLX5E_40GBASE_XLAUI_4_XLPPI_4][MLX5E_SR4] = { + .subtype = IFM_40G_SR4, + .baudrate = IF_Gbps(40ULL), + }, + [MLX5E_40GBASE_XLAUI_4_XLPPI_4][MLX5E_ER4] = { + .subtype = IFM_40G_ER4, + .baudrate = IF_Gbps(40ULL), + }, + + [MLX5E_25GAUI_1_25GBASE_CR_KR][MLX5E_CR] = { + .subtype = IFM_25G_CR, + .baudrate = IF_Gbps(25ULL), + }, + [MLX5E_25GAUI_1_25GBASE_CR_KR][MLX5E_KR] = { + .subtype = IFM_25G_KR, + .baudrate = IF_Gbps(25ULL), + }, + [MLX5E_25GAUI_1_25GBASE_CR_KR][MLX5E_SR] = { + .subtype = IFM_25G_SR, + .baudrate = IF_Gbps(25ULL), + }, + [MLX5E_25GAUI_1_25GBASE_CR_KR][MLX5E_ACC] = { + .subtype = IFM_25G_ACC, + .baudrate = IF_Gbps(25ULL), + }, + [MLX5E_25GAUI_1_25GBASE_CR_KR][MLX5E_AOC] = { + .subtype = IFM_25G_AOC, + .baudrate = IF_Gbps(25ULL), + }, + [MLX5E_25GAUI_1_25GBASE_CR_KR][MLX5E_CR1] = { + .subtype = IFM_25G_CR1, + .baudrate = IF_Gbps(25ULL), + }, + [MLX5E_25GAUI_1_25GBASE_CR_KR][MLX5E_CR_S] = { + .subtype = IFM_25G_CR_S, + .baudrate = IF_Gbps(25ULL), + }, + [MLX5E_25GAUI_1_25GBASE_CR_KR][MLX5E_KR1] = { + .subtype = IFM_5000_KR1, + .baudrate = IF_Gbps(25ULL), + }, + [MLX5E_25GAUI_1_25GBASE_CR_KR][MLX5E_KR_S] = { + .subtype = IFM_25G_KR_S, + .baudrate = IF_Gbps(25ULL), + }, + [MLX5E_25GAUI_1_25GBASE_CR_KR][MLX5E_LR] = { + .subtype = IFM_25G_LR, + .baudrate = IF_Gbps(25ULL), + }, + [MLX5E_25GAUI_1_25GBASE_CR_KR][MLX5E_T] = { + .subtype = IFM_25G_T, + .baudrate = IF_Gbps(25ULL), + }, + [MLX5E_50GAUI_2_LAUI_2_50GBASE_CR2_KR2][MLX5E_CR2] = { + .subtype = IFM_50G_CR2, + .baudrate = IF_Gbps(50ULL), + }, + [MLX5E_50GAUI_2_LAUI_2_50GBASE_CR2_KR2][MLX5E_KR2] = { + .subtype = IFM_50G_KR2, + .baudrate = IF_Gbps(50ULL), + }, + [MLX5E_50GAUI_2_LAUI_2_50GBASE_CR2_KR2][MLX5E_SR2] = { + .subtype = IFM_50G_SR2, + .baudrate = IF_Gbps(50ULL), + }, + [MLX5E_50GAUI_2_LAUI_2_50GBASE_CR2_KR2][MLX5E_LR2] = { + .subtype = IFM_50G_LR2, + .baudrate = IF_Gbps(50ULL), + }, + [MLX5E_50GAUI_1_LAUI_1_50GBASE_CR_KR][MLX5E_LR] = { + .subtype = IFM_50G_LR, + .baudrate = IF_Gbps(50ULL), + }, + [MLX5E_50GAUI_1_LAUI_1_50GBASE_CR_KR][MLX5E_SR] = { + .subtype = IFM_50G_SR, + .baudrate = IF_Gbps(50ULL), + }, + [MLX5E_50GAUI_1_LAUI_1_50GBASE_CR_KR][MLX5E_CP] = { + .subtype = IFM_50G_CP, + .baudrate = IF_Gbps(50ULL), + }, + [MLX5E_50GAUI_1_LAUI_1_50GBASE_CR_KR][MLX5E_FR] = { + .subtype = IFM_50G_FR, + .baudrate = IF_Gbps(50ULL), + }, + [MLX5E_50GAUI_1_LAUI_1_50GBASE_CR_KR][MLX5E_KR_PAM4] = { + .subtype = IFM_50G_KR_PAM4, + .baudrate = IF_Gbps(50ULL), + }, + [MLX5E_CAUI_4_100GBASE_CR4_KR4][MLX5E_CR4] = { + .subtype = IFM_100G_CR4, + .baudrate = IF_Gbps(100ULL), + }, + [MLX5E_CAUI_4_100GBASE_CR4_KR4][MLX5E_KR4] = { + .subtype = IFM_100G_KR4, + .baudrate = IF_Gbps(100ULL), + }, + [MLX5E_CAUI_4_100GBASE_CR4_KR4][MLX5E_LR4] = { + .subtype = IFM_100G_LR4, + .baudrate = IF_Gbps(100ULL), + }, + [MLX5E_CAUI_4_100GBASE_CR4_KR4][MLX5E_SR4] = { + .subtype = IFM_100G_SR4, + .baudrate = IF_Gbps(100ULL), + }, + [MLX5E_100GAUI_2_100GBASE_CR2_KR2][MLX5E_SR2] = { + .subtype = IFM_100G_SR2, + .baudrate = IF_Gbps(100ULL), + }, + [MLX5E_100GAUI_2_100GBASE_CR2_KR2][MLX5E_CP2] = { + .subtype = IFM_100G_CP2, + .baudrate = IF_Gbps(100ULL), + }, + [MLX5E_100GAUI_2_100GBASE_CR2_KR2][MLX5E_KR2_PAM4] = { + .subtype = IFM_100G_KR2_PAM4, + .baudrate = IF_Gbps(100ULL), + }, + [MLX5E_200GAUI_4_200GBASE_CR4_KR4][MLX5E_DR4] = { + .subtype = IFM_200G_DR4, + .baudrate = IF_Gbps(200ULL), + }, + [MLX5E_200GAUI_4_200GBASE_CR4_KR4][MLX5E_LR4] = { + .subtype = IFM_200G_LR4, + .baudrate = IF_Gbps(200ULL), + }, + [MLX5E_200GAUI_4_200GBASE_CR4_KR4][MLX5E_SR4] = { + .subtype = IFM_200G_SR4, + .baudrate = IF_Gbps(200ULL), + }, + [MLX5E_200GAUI_4_200GBASE_CR4_KR4][MLX5E_FR4] = { + .subtype = IFM_200G_FR4, + .baudrate = IF_Gbps(200ULL), + }, + [MLX5E_200GAUI_4_200GBASE_CR4_KR4][MLX5E_CR4_PAM4] = { + .subtype = IFM_200G_CR4_PAM4, + .baudrate = IF_Gbps(200ULL), + }, + [MLX5E_200GAUI_4_200GBASE_CR4_KR4][MLX5E_KR4_PAM4] = { + .subtype = IFM_200G_KR4_PAM4, + .baudrate = IF_Gbps(200ULL), + }, +}; + MALLOC_DEFINE(M_MLX5EN, "MLX5EN", "MLX5 Ethernet"); static void @@ -169,7 +407,9 @@ mlx5e_update_carrier(struct mlx5e_priv *priv) int error; u8 port_state; u8 is_er_type; - u8 i; + u8 i, j; + bool ext; + struct media media_entry = {}; port_state = mlx5_query_vport_state(mdev, MLX5_QUERY_VPORT_STATE_IN_OP_MOD_VNIC_VPORT, 0); @@ -183,49 +423,58 @@ mlx5e_update_carrier(struct mlx5e_priv *priv) return; } - error = mlx5_query_port_ptys(mdev, out, sizeof(out), MLX5_PTYS_EN, 1); + error = mlx5_query_port_ptys(mdev, out, sizeof(out), + MLX5_PTYS_EN, 1); if (error) { priv->media_active_last = IFM_ETHER; priv->ifp->if_baudrate = 1; - if_printf(priv->ifp, "%s: query port ptys failed: 0x%x\n", - __func__, error); + if_printf(priv->ifp, "%s: query port ptys failed: " + "0x%x\n", __func__, error); return; } - eth_proto_oper = MLX5_GET(ptys_reg, out, eth_proto_oper); - for (i = 0; i != MLX5E_LINK_MODES_NUMBER; i++) { - if (mlx5e_mode_table[i].baudrate == 0) - continue; - if (MLX5E_PROT_MASK(i) & eth_proto_oper) { - u32 subtype = mlx5e_mode_table[i].subtype; + ext = MLX5_CAP_PCAM_FEATURE(mdev, ptys_extended_ethernet); + eth_proto_oper = MLX5_GET_ETH_PROTO(ptys_reg, out, ext, + eth_proto_oper); - priv->ifp->if_baudrate = - mlx5e_mode_table[i].baudrate; + i = ilog2(eth_proto_oper); - switch (subtype) { - case IFM_10G_ER: - error = mlx5_query_pddr_range_info(mdev, 1, &is_er_type); - if (error != 0) { - if_printf(priv->ifp, "%s: query port pddr failed: %d\n", - __func__, error); - } - if (error != 0 || is_er_type == 0) - subtype = IFM_10G_LR; - break; - case IFM_40G_LR4: - error = mlx5_query_pddr_range_info(mdev, 1, &is_er_type); - if (error != 0) { - if_printf(priv->ifp, "%s: query port pddr failed: %d\n", - __func__, error); - } - if (error == 0 && is_er_type != 0) - subtype = IFM_40G_ER4; - break; - } - priv->media_active_last = subtype | IFM_ETHER | IFM_FDX; + for (j = 0; j != MLX5E_LINK_MODES_NUMBER; j++) { + media_entry = ext ? mlx5e_ext_mode_table[i][j] : + mlx5e_mode_table[i][j]; + if (media_entry.baudrate != 0) break; + } + + if (media_entry.subtype == 0) { + if_printf(priv->ifp, "%s: Could not find operational " + "media subtype\n", __func__); + return; + } + + switch (media_entry.subtype) { + case IFM_10G_ER: + error = mlx5_query_pddr_range_info(mdev, 1, &is_er_type); + if (error != 0) { + if_printf(priv->ifp, "%s: query port pddr failed: %d\n", + __func__, error); } + if (error != 0 || is_er_type == 0) + media_entry.subtype = IFM_10G_LR; + break; + case IFM_40G_LR4: + error = mlx5_query_pddr_range_info(mdev, 1, &is_er_type); + if (error != 0) { + if_printf(priv->ifp, "%s: query port pddr failed: %d\n", + __func__, error); + } + if (error == 0 && is_er_type != 0) + media_entry.subtype = IFM_40G_ER4; + break; } + priv->media_active_last = media_entry.subtype | IFM_ETHER | IFM_FDX; + priv->ifp->if_baudrate = media_entry.baudrate; + if_link_state_change(priv->ifp, LINK_STATE_UP); } @@ -242,10 +491,13 @@ mlx5e_media_status(struct ifnet *dev, struct ifmediare } static u32 -mlx5e_find_link_mode(u32 subtype) +mlx5e_find_link_mode(u32 subtype, bool ext) { u32 i; + u32 j; u32 link_mode = 0; + u32 speeds_num = 0; + struct media media_entry = {}; switch (subtype) { case IFM_10G_LR: @@ -256,11 +508,19 @@ mlx5e_find_link_mode(u32 subtype) break; } - for (i = 0; i < MLX5E_LINK_MODES_NUMBER; ++i) { - if (mlx5e_mode_table[i].baudrate == 0) - continue; - if (mlx5e_mode_table[i].subtype == subtype) - link_mode |= MLX5E_PROT_MASK(i); + speeds_num = ext ? MLX5E_EXT_LINK_SPEEDS_NUMBER : + MLX5E_LINK_SPEEDS_NUMBER; + + for (i = 0; i != speeds_num; i++) { + for (j = 0; j < MLX5E_LINK_MODES_NUMBER ; ++j) { + media_entry = ext ? mlx5e_ext_mode_table[i][j] : + mlx5e_mode_table[i][j]; + if (media_entry.baudrate == 0) + continue; + if (media_entry.subtype == subtype) { + link_mode |= MLX5E_PROT_MASK(i); + } + } } return (link_mode); @@ -286,7 +546,8 @@ mlx5e_set_port_pfc(struct mlx5e_priv *priv) } else if (priv->params.rx_pauseframe_control || priv->params.tx_pauseframe_control) { if_printf(priv->ifp, - "Global pauseframes must be disabled before enabling PFC.\n"); + "Global pauseframes must be disabled before " + "enabling PFC.\n"); error = -EINVAL; } else { error = mlx5e_set_port_pause_and_pfc(priv); @@ -301,9 +562,11 @@ mlx5e_media_change(struct ifnet *dev) struct mlx5_core_dev *mdev = priv->mdev; u32 eth_proto_cap; u32 link_mode; + u32 out[MLX5_ST_SZ_DW(ptys_reg)]; int was_opened; int locked; int error; + bool ext; locked = PRIV_LOCKED(priv); if (!locked) @@ -313,14 +576,21 @@ mlx5e_media_change(struct ifnet *dev) error = EINVAL; goto done; } - link_mode = mlx5e_find_link_mode(IFM_SUBTYPE(priv->media.ifm_media)); - /* query supported capabilities */ - error = mlx5_query_port_proto_cap(mdev, ð_proto_cap, MLX5_PTYS_EN); + error = mlx5_query_port_ptys(mdev, out, sizeof(out), + MLX5_PTYS_EN, 1); if (error != 0) { if_printf(dev, "Query port media capability failed\n"); goto done; } + + ext = MLX5_CAP_PCAM_FEATURE(mdev, ptys_extended_ethernet); + link_mode = mlx5e_find_link_mode(IFM_SUBTYPE(priv->media.ifm_media), ext); + + /* query supported capabilities */ + eth_proto_cap = MLX5_GET_ETH_PROTO(ptys_reg, out, ext, + eth_proto_capability); + /* check for autoselect */ if (IFM_SUBTYPE(priv->media.ifm_media) == IFM_AUTO) { link_mode = eth_proto_cap; @@ -357,7 +627,7 @@ mlx5e_media_change(struct ifnet *dev) /* reconfigure the hardware */ mlx5_set_port_status(mdev, MLX5_PORT_DOWN); - mlx5_set_port_proto(mdev, link_mode, MLX5_PTYS_EN); + mlx5_set_port_proto(mdev, link_mode, MLX5_PTYS_EN, ext); error = -mlx5e_set_port_pause_and_pfc(priv); if (was_opened) mlx5_set_port_status(mdev, MLX5_PORT_UP); @@ -3507,12 +3777,17 @@ mlx5e_create_ifp(struct mlx5_core_dev *mdev) struct ifnet *ifp; struct mlx5e_priv *priv; u8 dev_addr[ETHER_ADDR_LEN] __aligned(4); + u8 connector_type; struct sysctl_oid_list *child; int ncv = mdev->priv.eq_table.num_comp_vectors; char unit[16]; int err; - int i; + int i,j; u32 eth_proto_cap; + u32 out[MLX5_ST_SZ_DW(ptys_reg)]; + bool ext = 0; + u32 speeds_num; + struct media media_entry = {}; if (mlx5e_check_required_hca_cap(mdev)) { mlx5_core_dbg(mdev, "mlx5e_check_required_hca_cap() failed\n"); @@ -3652,28 +3927,41 @@ mlx5e_create_ifp(struct mlx5_core_dev *mdev) /* setup default pauseframes configuration */ mlx5e_setup_pauseframes(priv); - err = mlx5_query_port_proto_cap(mdev, ð_proto_cap, MLX5_PTYS_EN); - if (err) { + /* Setup supported medias */ + //TODO: If we failed to query ptys is it ok to proceed?? + if (!mlx5_query_port_ptys(mdev, out, sizeof(out), MLX5_PTYS_EN, 1)) { + ext = MLX5_CAP_PCAM_FEATURE(mdev, + ptys_extended_ethernet); + eth_proto_cap = MLX5_GET_ETH_PROTO(ptys_reg, out, ext, + eth_proto_capability); + if (MLX5_CAP_PCAM_FEATURE(mdev, ptys_connector_type)) + connector_type = MLX5_GET(ptys_reg, out, + connector_type); + } else { eth_proto_cap = 0; - if_printf(ifp, "%s: Query port media capability failed, %d\n", - __func__, err); + if_printf(ifp, "%s: Query port media capability failed," + " %d\n", __func__, err); } - /* Setup supported medias */ ifmedia_init(&priv->media, IFM_IMASK | IFM_ETH_FMASK, mlx5e_media_change, mlx5e_media_status); - for (i = 0; i < MLX5E_LINK_MODES_NUMBER; ++i) { - if (mlx5e_mode_table[i].baudrate == 0) - continue; - if (MLX5E_PROT_MASK(i) & eth_proto_cap) { - ifmedia_add(&priv->media, - mlx5e_mode_table[i].subtype | - IFM_ETHER, 0, NULL); - ifmedia_add(&priv->media, - mlx5e_mode_table[i].subtype | - IFM_ETHER | IFM_FDX | - IFM_ETH_RXPAUSE | IFM_ETH_TXPAUSE, 0, NULL); + speeds_num = ext ? MLX5E_EXT_LINK_SPEEDS_NUMBER : MLX5E_LINK_SPEEDS_NUMBER; + for (i = 0; i != speeds_num; i++) { + for (j = 0; j < MLX5E_LINK_MODES_NUMBER ; ++j) { + media_entry = ext ? mlx5e_ext_mode_table[i][j] : + mlx5e_mode_table[i][j]; + if (media_entry.baudrate == 0) + continue; + if (MLX5E_PROT_MASK(i) & eth_proto_cap) { + ifmedia_add(&priv->media, + media_entry.subtype | + IFM_ETHER, 0, NULL); + ifmedia_add(&priv->media, + media_entry.subtype | + IFM_ETHER | IFM_FDX | + IFM_ETH_RXPAUSE | IFM_ETH_TXPAUSE, 0, NULL); + } } } Modified: stable/11/sys/dev/mlx5/mlx5_ib/mlx5_ib_main.c ============================================================================== --- stable/11/sys/dev/mlx5/mlx5_ib/mlx5_ib_main.c Thu May 16 18:06:10 2019 (r347854) +++ stable/11/sys/dev/mlx5/mlx5_ib/mlx5_ib_main.c Thu May 16 18:06:56 2019 (r347855) @@ -180,7 +180,7 @@ static int translate_eth_proto_oper(u32 eth_proto_oper case MLX5E_PROT_MASK(MLX5E_10GBASE_KR): case MLX5E_PROT_MASK(MLX5E_10GBASE_CR): case MLX5E_PROT_MASK(MLX5E_10GBASE_SR): - case MLX5E_PROT_MASK(MLX5E_10GBASE_ER): + case MLX5E_PROT_MASK(MLX5E_10GBASE_ER_LR): *active_width = IB_WIDTH_1X; *active_speed = IB_SPEED_QDR; break; @@ -193,7 +193,7 @@ static int translate_eth_proto_oper(u32 eth_proto_oper case MLX5E_PROT_MASK(MLX5E_40GBASE_CR4): case MLX5E_PROT_MASK(MLX5E_40GBASE_KR4): case MLX5E_PROT_MASK(MLX5E_40GBASE_SR4): - case MLX5E_PROT_MASK(MLX5E_40GBASE_LR4): + case MLX5E_PROT_MASK(MLX5E_40GBASE_LR4_ER4): *active_width = IB_WIDTH_4X; *active_speed = IB_SPEED_QDR; break; Modified: stable/11/sys/dev/mlx5/mlx5_ifc.h ============================================================================== --- stable/11/sys/dev/mlx5/mlx5_ifc.h Thu May 16 18:06:10 2019 (r347854) +++ stable/11/sys/dev/mlx5/mlx5_ifc.h Thu May 16 18:06:56 2019 (r347855) @@ -7881,28 +7881,29 @@ struct mlx5_ifc_ptys_reg_bits { u8 reserved_3[0xc]; u8 data_rate_oper[0x10]; - u8 fc_proto_capability[0x20]; + u8 ext_eth_proto_capability[0x20]; u8 eth_proto_capability[0x20]; u8 ib_link_width_capability[0x10]; u8 ib_proto_capability[0x10]; - u8 fc_proto_admin[0x20]; + u8 ext_eth_proto_admin[0x20]; u8 eth_proto_admin[0x20]; u8 ib_link_width_admin[0x10]; u8 ib_proto_admin[0x10]; - u8 fc_proto_oper[0x20]; + u8 ext_eth_proto_oper[0x20]; u8 eth_proto_oper[0x20]; u8 ib_link_width_oper[0x10]; u8 ib_proto_oper[0x10]; - u8 reserved_4[0x20]; + u8 reserved_4[0x1c]; + u8 connector_type[0x4]; u8 eth_proto_lp_advertise[0x20]; @@ -8601,8 +8602,17 @@ struct mlx5_ifc_qcam_reg_bits { }; struct mlx5_ifc_pcam_enhanced_features_bits { - u8 reserved_at_0[0x7e]; - + u8 reserved_at_0[0x6d]; + u8 rx_icrc_encapsulated_counter[0x1]; + u8 reserved_at_6e[0x4]; + u8 ptys_extended_ethernet[0x1]; + u8 reserved_at_73[0x3]; + u8 pfcc_mask[0x1]; + u8 reserved_at_77[0x3]; + u8 per_lane_error_counters[0x1]; + u8 rx_buffer_fullness_counters[0x1]; + u8 ptys_connector_type[0x1]; + u8 reserved_at_7d[0x1]; u8 ppcnt_discard_group[0x1]; u8 ppcnt_statistical_group[0x1]; }; Modified: stable/11/sys/dev/mlx5/port.h ============================================================================== --- stable/11/sys/dev/mlx5/port.h Thu May 16 18:06:10 2019 (r347854) +++ stable/11/sys/dev/mlx5/port.h Thu May 16 18:06:56 2019 (r347855) @@ -58,7 +58,7 @@ enum mlx5_an_status { #define MLX5_I2C_ADDR_HIGH 0x51 #define MLX5_EEPROM_PAGE_LENGTH 256 -enum mlx5e_link_mode { +enum mlx5e_link_speed { MLX5E_1000BASE_CX_SGMII = 0, MLX5E_1000BASE_KX = 1, MLX5E_10GBASE_CX4 = 2, @@ -70,9 +70,9 @@ enum mlx5e_link_mode { MLX5E_56GBASE_R4 = 8, MLX5E_10GBASE_CR = 12, MLX5E_10GBASE_SR = 13, - MLX5E_10GBASE_ER = 14, + MLX5E_10GBASE_ER_LR = 14, MLX5E_40GBASE_SR4 = 15, - MLX5E_40GBASE_LR4 = 16, + MLX5E_40GBASE_LR4_ER4 = 16, MLX5E_50GBASE_SR2 = 18, MLX5E_100GBASE_CR4 = 20, MLX5E_100GBASE_SR4 = 21, @@ -86,6 +86,78 @@ enum mlx5e_link_mode { MLX5E_25GBASE_SR = 29, MLX5E_50GBASE_CR2 = 30, MLX5E_50GBASE_KR2 = 31, + MLX5E_LINK_SPEEDS_NUMBER, +}; + +enum mlx5e_ext_link_speed { + MLX5E_SGMII_100M = 0, + MLX5E_1000BASE_X_SGMII = 1, + MLX5E_5GBASE_R = 3, + MLX5E_10GBASE_XFI_XAUI_1 = 4, + MLX5E_40GBASE_XLAUI_4_XLPPI_4 = 5, + MLX5E_25GAUI_1_25GBASE_CR_KR = 6, + MLX5E_50GAUI_2_LAUI_2_50GBASE_CR2_KR2 = 7, + MLX5E_50GAUI_1_LAUI_1_50GBASE_CR_KR = 8, + MLX5E_CAUI_4_100GBASE_CR4_KR4 = 9, + MLX5E_100GAUI_2_100GBASE_CR2_KR2 = 10, + MLX5E_200GAUI_4_200GBASE_CR4_KR4 = 12, + MLX5E_400GAUI_8 = 15, + MLX5E_EXT_LINK_SPEEDS_NUMBER, +}; + +enum mlx5e_link_mode { + MLX5E_ACC, + MLX5E_AOC, + MLX5E_AUI, + MLX5E_AUI_AC, + MLX5E_AUI2, + MLX5E_AUI2_AC, + MLX5E_AUI4, + MLX5E_AUI4_AC, + MLX5E_CAUI2, + MLX5E_CAUI2_AC, + MLX5E_CAUI4, + MLX5E_CAUI4_AC, + MLX5E_CP, + MLX5E_CP2, + MLX5E_CR, + MLX5E_CR_S, + MLX5E_CR1, + MLX5E_CR2, + MLX5E_CR4, + MLX5E_CR_PAM4, + MLX5E_CR4_PAM4, + MLX5E_CX4, + MLX5E_CX, + MLX5E_CX_SGMII, + MLX5E_DR, + MLX5E_DR4, + MLX5E_ER, + MLX5E_ER4, + MLX5E_FR, + MLX5E_FR4, + MLX5E_KR, + MLX5E_KR1, + MLX5E_KR_PAM4, + MLX5E_KR_S, + MLX5E_KR2, + MLX5E_KR2_PAM4, + MLX5E_KR4, + MLX5E_KR4_PAM4, + MLX5E_KX, + MLX5E_KX4, + MLX5E_LR, + MLX5E_LR2, + MLX5E_LR4, + MLX5E_LX, + MLX5E_R, + MLX5E_SGMII, + MLX5E_SR, + MLX5E_SR2, + MLX5E_SR4, + MLX5E_SX, + MLX5E_T, + MLX5E_TX, MLX5E_LINK_MODES_NUMBER, }; @@ -113,6 +185,10 @@ enum mlx5_qpts_trust_state { #define PORT_MODULE_EVENT_MODULE_STATUS_MASK 0xF #define PORT_MODULE_EVENT_ERROR_TYPE_MASK 0xF +#define MLX5_GET_ETH_PROTO(reg, out, ext, field) \ + ((ext) ? MLX5_GET(reg, out, ext_##field) : \ + MLX5_GET(reg, out, field)) + int mlx5_set_port_caps(struct mlx5_core_dev *dev, u8 port_num, u32 caps); int mlx5_query_port_ptys(struct mlx5_core_dev *dev, u32 *ptys, int ptys_size, int proto_mask, u8 local_port); @@ -127,7 +203,7 @@ int mlx5_query_port_proto_admin(struct mlx5_core_dev * int mlx5_query_port_eth_proto_oper(struct mlx5_core_dev *dev, u32 *proto_oper, u8 local_port); int mlx5_set_port_proto(struct mlx5_core_dev *dev, u32 proto_admin, - int proto_mask); + int proto_mask, bool ext); int mlx5_set_port_status(struct mlx5_core_dev *dev, enum mlx5_port_status status); int mlx5_query_port_status(struct mlx5_core_dev *dev, u8 *status); From owner-svn-src-stable@freebsd.org Thu May 16 18:07:53 2019 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 779CF15A2962; Thu, 16 May 2019 18:07:53 +0000 (UTC) (envelope-from hselasky@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 1C5636C779; Thu, 16 May 2019 18:07:53 +0000 (UTC) (envelope-from hselasky@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 EBDD1246B9; Thu, 16 May 2019 18:07:52 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x4GI7qfE028312; Thu, 16 May 2019 18:07:52 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x4GI7qNK028311; Thu, 16 May 2019 18:07:52 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201905161807.x4GI7qNK028311@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Thu, 16 May 2019 18:07:52 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r347856 - stable/11/sys/dev/mlx5/mlx5_en X-SVN-Group: stable-11 X-SVN-Commit-Author: hselasky X-SVN-Commit-Paths: stable/11/sys/dev/mlx5/mlx5_en X-SVN-Commit-Revision: 347856 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 1C5636C779 X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.97 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.998,0]; NEURAL_HAM_SHORT(-0.97)[-0.974,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US]; NEURAL_HAM_LONG(-1.00)[-1.000,0] X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 16 May 2019 18:07:53 -0000 Author: hselasky Date: Thu May 16 18:07:52 2019 New Revision: 347856 URL: https://svnweb.freebsd.org/changeset/base/347856 Log: MFC r347300: Do not add IFM_10G_LR and IFM_40G_ER4 to supported media types by default in mlx5en(4). IFM_10G_LR and IFM_40G_ER4 media should be added only if the device has the needed capability bit set for it. Submitted by: slavash@ Sponsored by: Mellanox Technologies Modified: stable/11/sys/dev/mlx5/mlx5_en/mlx5_en_main.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/dev/mlx5/mlx5_en/mlx5_en_main.c ============================================================================== --- stable/11/sys/dev/mlx5/mlx5_en/mlx5_en_main.c Thu May 16 18:06:56 2019 (r347855) +++ stable/11/sys/dev/mlx5/mlx5_en/mlx5_en_main.c Thu May 16 18:07:52 2019 (r347856) @@ -3965,17 +3965,6 @@ mlx5e_create_ifp(struct mlx5_core_dev *mdev) } } - /* Additional supported medias */ - ifmedia_add(&priv->media, IFM_10G_LR | IFM_ETHER, 0, NULL); - ifmedia_add(&priv->media, IFM_10G_LR | - IFM_ETHER | IFM_FDX | - IFM_ETH_RXPAUSE | IFM_ETH_TXPAUSE, 0, NULL); - - ifmedia_add(&priv->media, IFM_40G_ER4 | IFM_ETHER, 0, NULL); - ifmedia_add(&priv->media, IFM_40G_ER4 | - IFM_ETHER | IFM_FDX | - IFM_ETH_RXPAUSE | IFM_ETH_TXPAUSE, 0, NULL); - ifmedia_add(&priv->media, IFM_ETHER | IFM_AUTO, 0, NULL); ifmedia_add(&priv->media, IFM_ETHER | IFM_AUTO | IFM_FDX | IFM_ETH_RXPAUSE | IFM_ETH_TXPAUSE, 0, NULL); From owner-svn-src-stable@freebsd.org Thu May 16 18:08:35 2019 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 3DC6715A29DB; Thu, 16 May 2019 18:08:35 +0000 (UTC) (envelope-from hselasky@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 D8F256C8B7; Thu, 16 May 2019 18:08:34 +0000 (UTC) (envelope-from hselasky@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 B211F246BA; Thu, 16 May 2019 18:08:34 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x4GI8YXb028401; Thu, 16 May 2019 18:08:34 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x4GI8YRx028399; Thu, 16 May 2019 18:08:34 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201905161808.x4GI8YRx028399@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Thu, 16 May 2019 18:08:34 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r347857 - in stable/11/sys/ofed: drivers/infiniband/core include/rdma X-SVN-Group: stable-11 X-SVN-Commit-Author: hselasky X-SVN-Commit-Paths: in stable/11/sys/ofed: drivers/infiniband/core include/rdma X-SVN-Commit-Revision: 347857 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: D8F256C8B7 X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.97 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.998,0]; NEURAL_HAM_SHORT(-0.98)[-0.975,0]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US] X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 16 May 2019 18:08:35 -0000 Author: hselasky Date: Thu May 16 18:08:33 2019 New Revision: 347857 URL: https://svnweb.freebsd.org/changeset/base/347857 Log: MFC r347301: Add new rates to ibcore. Add the new rates that were added to the Infiniband specification as part of HDR and 2x support. Submitted by: slavash@ Sponsored by: Mellanox Technologies Modified: stable/11/sys/ofed/drivers/infiniband/core/ib_verbs.c stable/11/sys/ofed/include/rdma/ib_verbs.h Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/ofed/drivers/infiniband/core/ib_verbs.c ============================================================================== --- stable/11/sys/ofed/drivers/infiniband/core/ib_verbs.c Thu May 16 18:07:52 2019 (r347856) +++ stable/11/sys/ofed/drivers/infiniband/core/ib_verbs.c Thu May 16 18:08:33 2019 (r347857) @@ -136,6 +136,10 @@ __attribute_const__ int ib_rate_to_mult(enum ib_rate r case IB_RATE_60_GBPS: return 24; case IB_RATE_80_GBPS: return 32; case IB_RATE_120_GBPS: return 48; + case IB_RATE_28_GBPS: return 11; + case IB_RATE_50_GBPS: return 20; + case IB_RATE_400_GBPS: return 160; + case IB_RATE_600_GBPS: return 240; default: return -1; } } @@ -153,6 +157,18 @@ __attribute_const__ enum ib_rate mult_to_ib_rate(int m case 24: return IB_RATE_60_GBPS; case 32: return IB_RATE_80_GBPS; case 48: return IB_RATE_120_GBPS; + case 6: return IB_RATE_14_GBPS; + case 22: return IB_RATE_56_GBPS; + case 45: return IB_RATE_112_GBPS; + case 67: return IB_RATE_168_GBPS; + case 10: return IB_RATE_25_GBPS; + case 40: return IB_RATE_100_GBPS; + case 80: return IB_RATE_200_GBPS; + case 120: return IB_RATE_300_GBPS; + case 11: return IB_RATE_28_GBPS; + case 20: return IB_RATE_50_GBPS; + case 160: return IB_RATE_400_GBPS; + case 240: return IB_RATE_600_GBPS; default: return IB_RATE_PORT_CURRENT; } } @@ -178,6 +194,10 @@ __attribute_const__ int ib_rate_to_mbps(enum ib_rate r case IB_RATE_100_GBPS: return 103125; case IB_RATE_200_GBPS: return 206250; case IB_RATE_300_GBPS: return 309375; + case IB_RATE_28_GBPS: return 28125; + case IB_RATE_50_GBPS: return 53125; + case IB_RATE_400_GBPS: return 425000; + case IB_RATE_600_GBPS: return 637500; default: return -1; } } Modified: stable/11/sys/ofed/include/rdma/ib_verbs.h ============================================================================== --- stable/11/sys/ofed/include/rdma/ib_verbs.h Thu May 16 18:07:52 2019 (r347856) +++ stable/11/sys/ofed/include/rdma/ib_verbs.h Thu May 16 18:08:33 2019 (r347857) @@ -396,6 +396,7 @@ enum ib_port_cap_flags { enum ib_port_width { IB_WIDTH_1X = 1, + IB_WIDTH_2X = 16, IB_WIDTH_4X = 2, IB_WIDTH_8X = 4, IB_WIDTH_12X = 8 @@ -405,6 +406,7 @@ static inline int ib_width_enum_to_int(enum ib_port_wi { switch (width) { case IB_WIDTH_1X: return 1; + case IB_WIDTH_2X: return 2; case IB_WIDTH_4X: return 4; case IB_WIDTH_8X: return 8; case IB_WIDTH_12X: return 12; @@ -670,7 +672,11 @@ enum ib_rate { IB_RATE_25_GBPS = 15, IB_RATE_100_GBPS = 16, IB_RATE_200_GBPS = 17, - IB_RATE_300_GBPS = 18 + IB_RATE_300_GBPS = 18, + IB_RATE_28_GBPS = 19, + IB_RATE_50_GBPS = 20, + IB_RATE_400_GBPS = 21, + IB_RATE_600_GBPS = 22, }; /** From owner-svn-src-stable@freebsd.org Thu May 16 18:09:36 2019 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 3EA9715A2A9C; Thu, 16 May 2019 18:09:36 +0000 (UTC) (envelope-from hselasky@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 D8A746CA13; Thu, 16 May 2019 18:09:35 +0000 (UTC) (envelope-from hselasky@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 B3689246BB; Thu, 16 May 2019 18:09:35 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x4GI9ZCo028540; Thu, 16 May 2019 18:09:35 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x4GI9ZxH028538; Thu, 16 May 2019 18:09:35 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201905161809.x4GI9ZxH028538@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Thu, 16 May 2019 18:09:35 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r347858 - in stable/11/contrib/ofed/libibverbs: . examples X-SVN-Group: stable-11 X-SVN-Commit-Author: hselasky X-SVN-Commit-Paths: in stable/11/contrib/ofed/libibverbs: . examples X-SVN-Commit-Revision: 347858 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: D8A746CA13 X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.97 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.998,0]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; NEURAL_HAM_SHORT(-0.98)[-0.975,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US] X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 16 May 2019 18:09:36 -0000 Author: hselasky Date: Thu May 16 18:09:34 2019 New Revision: 347858 URL: https://svnweb.freebsd.org/changeset/base/347858 Log: MFC r347302: Add support for 200Gbit speeds to libibverbs. Submitted by: slavash@ Sponsored by: Mellanox Technologies Modified: stable/11/contrib/ofed/libibverbs/examples/devinfo.c stable/11/contrib/ofed/libibverbs/verbs.c stable/11/contrib/ofed/libibverbs/verbs.h Directory Properties: stable/11/ (props changed) Modified: stable/11/contrib/ofed/libibverbs/examples/devinfo.c ============================================================================== --- stable/11/contrib/ofed/libibverbs/examples/devinfo.c Thu May 16 18:08:33 2019 (r347857) +++ stable/11/contrib/ofed/libibverbs/examples/devinfo.c Thu May 16 18:09:34 2019 (r347858) @@ -128,6 +128,7 @@ static const char *width_str(uint8_t width) case 2: return "4"; case 4: return "8"; case 8: return "12"; + case 16: return "2"; default: return "invalid width"; } } @@ -143,6 +144,7 @@ static const char *speed_str(uint8_t speed) case 16: return "14.0 Gbps"; case 32: return "25.0 Gbps"; + case 64: return "50.0 Gbps"; default: return "invalid speed"; } } Modified: stable/11/contrib/ofed/libibverbs/verbs.c ============================================================================== --- stable/11/contrib/ofed/libibverbs/verbs.c Thu May 16 18:08:33 2019 (r347857) +++ stable/11/contrib/ofed/libibverbs/verbs.c Thu May 16 18:09:34 2019 (r347858) @@ -111,6 +111,10 @@ int __attribute__((const)) ibv_rate_to_mult(enum ibv_r case IBV_RATE_60_GBPS: return 24; case IBV_RATE_80_GBPS: return 32; case IBV_RATE_120_GBPS: return 48; + case IBV_RATE_28_GBPS: return 11; + case IBV_RATE_50_GBPS: return 20; + case IBV_RATE_400_GBPS: return 160; + case IBV_RATE_600_GBPS: return 240; default: return -1; } } @@ -127,6 +131,10 @@ enum ibv_rate __attribute__((const)) mult_to_ibv_rate( case 24: return IBV_RATE_60_GBPS; case 32: return IBV_RATE_80_GBPS; case 48: return IBV_RATE_120_GBPS; + case 11: return IBV_RATE_28_GBPS; + case 20: return IBV_RATE_50_GBPS; + case 160: return IBV_RATE_400_GBPS; + case 240: return IBV_RATE_600_GBPS; default: return IBV_RATE_MAX; } } @@ -151,6 +159,10 @@ int __attribute__((const)) ibv_rate_to_mbps(enum ibv_ case IBV_RATE_100_GBPS: return 103125; case IBV_RATE_200_GBPS: return 206250; case IBV_RATE_300_GBPS: return 309375; + case IBV_RATE_28_GBPS: return 28125; + case IBV_RATE_50_GBPS: return 53125; + case IBV_RATE_400_GBPS: return 425000; + case IBV_RATE_600_GBPS: return 637500; default: return -1; } } @@ -175,6 +187,10 @@ enum ibv_rate __attribute__((const)) mbps_to_ibv_rate( case 103125: return IBV_RATE_100_GBPS; case 206250: return IBV_RATE_200_GBPS; case 309375: return IBV_RATE_300_GBPS; + case 28125: return IBV_RATE_28_GBPS; + case 53125: return IBV_RATE_50_GBPS; + case 425000: return IBV_RATE_400_GBPS; + case 637500: return IBV_RATE_600_GBPS; default: return IBV_RATE_MAX; } } Modified: stable/11/contrib/ofed/libibverbs/verbs.h ============================================================================== --- stable/11/contrib/ofed/libibverbs/verbs.h Thu May 16 18:08:33 2019 (r347857) +++ stable/11/contrib/ofed/libibverbs/verbs.h Thu May 16 18:09:34 2019 (r347858) @@ -590,7 +590,11 @@ enum ibv_rate { IBV_RATE_25_GBPS = 15, IBV_RATE_100_GBPS = 16, IBV_RATE_200_GBPS = 17, - IBV_RATE_300_GBPS = 18 + IBV_RATE_300_GBPS = 18, + IBV_RATE_28_GBPS = 19, + IBV_RATE_50_GBPS = 20, + IBV_RATE_400_GBPS = 21, + IBV_RATE_600_GBPS = 22, }; /** From owner-svn-src-stable@freebsd.org Thu May 16 18:10:11 2019 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 9041F15A2B29; Thu, 16 May 2019 18:10:11 +0000 (UTC) (envelope-from hselasky@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 3494C6CB36; Thu, 16 May 2019 18:10:11 +0000 (UTC) (envelope-from hselasky@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 0FC1F246BF; Thu, 16 May 2019 18:10:11 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x4GIAAv1028664; Thu, 16 May 2019 18:10:10 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x4GIAAsb028662; Thu, 16 May 2019 18:10:10 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201905161810.x4GIAAsb028662@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Thu, 16 May 2019 18:10:10 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r347859 - stable/11/sys/dev/mlx5/mlx5_ib X-SVN-Group: stable-11 X-SVN-Commit-Author: hselasky X-SVN-Commit-Paths: stable/11/sys/dev/mlx5/mlx5_ib X-SVN-Commit-Revision: 347859 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 3494C6CB36 X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.97 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.998,0]; NEURAL_HAM_SHORT(-0.98)[-0.975,0]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US] X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 16 May 2019 18:10:11 -0000 Author: hselasky Date: Thu May 16 18:10:10 2019 New Revision: 347859 URL: https://svnweb.freebsd.org/changeset/base/347859 Log: MFC r347303: Add support for new rates to mlx5ib. Submitted by: slavash@ Sponsored by: Mellanox Technologies Modified: stable/11/sys/dev/mlx5/mlx5_ib/mlx5_ib_main.c stable/11/sys/dev/mlx5/mlx5_ib/mlx5_ib_qp.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/dev/mlx5/mlx5_ib/mlx5_ib_main.c ============================================================================== --- stable/11/sys/dev/mlx5/mlx5_ib/mlx5_ib_main.c Thu May 16 18:09:34 2019 (r347858) +++ stable/11/sys/dev/mlx5/mlx5_ib/mlx5_ib_main.c Thu May 16 18:10:10 2019 (r347859) @@ -223,14 +223,70 @@ static int translate_eth_proto_oper(u32 eth_proto_oper return 0; } +static int translate_eth_ext_proto_oper(u32 eth_proto_oper, u8 *active_speed, + u8 *active_width) +{ + switch (eth_proto_oper) { + case MLX5E_PROT_MASK(MLX5E_SGMII_100M): + case MLX5E_PROT_MASK(MLX5E_1000BASE_X_SGMII): + *active_width = IB_WIDTH_1X; + *active_speed = IB_SPEED_SDR; + break; + case MLX5E_PROT_MASK(MLX5E_5GBASE_R): + *active_width = IB_WIDTH_1X; + *active_speed = IB_SPEED_DDR; + break; + case MLX5E_PROT_MASK(MLX5E_10GBASE_XFI_XAUI_1): + *active_width = IB_WIDTH_1X; + *active_speed = IB_SPEED_QDR; + break; + case MLX5E_PROT_MASK(MLX5E_40GBASE_XLAUI_4_XLPPI_4): + *active_width = IB_WIDTH_4X; + *active_speed = IB_SPEED_QDR; + break; + case MLX5E_PROT_MASK(MLX5E_25GAUI_1_25GBASE_CR_KR): + *active_width = IB_WIDTH_1X; + *active_speed = IB_SPEED_EDR; + break; + case MLX5E_PROT_MASK(MLX5E_50GAUI_2_LAUI_2_50GBASE_CR2_KR2): + *active_width = IB_WIDTH_2X; + *active_speed = IB_SPEED_EDR; + break; + case MLX5E_PROT_MASK(MLX5E_50GAUI_1_LAUI_1_50GBASE_CR_KR): + *active_width = IB_WIDTH_1X; + *active_speed = IB_SPEED_HDR; + break; + case MLX5E_PROT_MASK(MLX5E_CAUI_4_100GBASE_CR4_KR4): + *active_width = IB_WIDTH_4X; + *active_speed = IB_SPEED_EDR; + break; + case MLX5E_PROT_MASK(MLX5E_100GAUI_2_100GBASE_CR2_KR2): + *active_width = IB_WIDTH_2X; + *active_speed = IB_SPEED_HDR; + break; + case MLX5E_PROT_MASK(MLX5E_200GAUI_4_200GBASE_CR4_KR4): + *active_width = IB_WIDTH_4X; + *active_speed = IB_SPEED_HDR; + break; + default: + *active_width = IB_WIDTH_4X; + *active_speed = IB_SPEED_QDR; + return -EINVAL; + } + + return 0; +} + static int mlx5_query_port_roce(struct ib_device *device, u8 port_num, struct ib_port_attr *props) { struct mlx5_ib_dev *dev = to_mdev(device); + u32 out[MLX5_ST_SZ_DW(ptys_reg)] = {}; struct net_device *ndev; enum ib_mtu ndev_ib_mtu; u16 qkey_viol_cntr; u32 eth_prot_oper; + bool ext; int err; memset(props, 0, sizeof(*props)); @@ -238,13 +294,21 @@ static int mlx5_query_port_roce(struct ib_device *devi /* Possible bad flows are checked before filling out props so in case * of an error it will still be zeroed out. */ - err = mlx5_query_port_eth_proto_oper(dev->mdev, ð_prot_oper, port_num); + err = mlx5_query_port_ptys(dev->mdev, out, sizeof(out), MLX5_PTYS_EN, + port_num); if (err) return err; - translate_eth_proto_oper(eth_prot_oper, &props->active_speed, - &props->active_width); + ext = MLX5_CAP_PCAM_FEATURE(dev->mdev, ptys_extended_ethernet); + eth_prot_oper = MLX5_GET_ETH_PROTO(ptys_reg, out, ext, eth_proto_oper); + if (ext) + translate_eth_ext_proto_oper(eth_prot_oper, &props->active_speed, + &props->active_width); + else + translate_eth_proto_oper(eth_prot_oper, &props->active_speed, + &props->active_width); + props->port_cap_flags |= IB_PORT_CM_SUP; props->port_cap_flags |= IB_PORT_IP_BASED_GIDS; @@ -772,9 +836,7 @@ static int translate_active_width(struct ib_device *ib if (active_width & MLX5_IB_WIDTH_1X) { *ib_width = IB_WIDTH_1X; } else if (active_width & MLX5_IB_WIDTH_2X) { - mlx5_ib_dbg(dev, "active_width %d is not supported by IB spec\n", - (int)active_width); - err = -EINVAL; + *ib_width = IB_WIDTH_2X; } else if (active_width & MLX5_IB_WIDTH_4X) { *ib_width = IB_WIDTH_4X; } else if (active_width & MLX5_IB_WIDTH_8X) { Modified: stable/11/sys/dev/mlx5/mlx5_ib/mlx5_ib_qp.c ============================================================================== --- stable/11/sys/dev/mlx5/mlx5_ib/mlx5_ib_qp.c Thu May 16 18:09:34 2019 (r347858) +++ stable/11/sys/dev/mlx5/mlx5_ib/mlx5_ib_qp.c Thu May 16 18:10:10 2019 (r347859) @@ -2125,7 +2125,7 @@ static int ib_rate_to_mlx5(struct mlx5_ib_dev *dev, u8 { if (rate == IB_RATE_PORT_CURRENT) { return 0; - } else if (rate < IB_RATE_2_5_GBPS || rate > IB_RATE_300_GBPS) { + } else if (rate < IB_RATE_2_5_GBPS || rate > IB_RATE_600_GBPS) { return -EINVAL; } else { while (rate != IB_RATE_2_5_GBPS && From owner-svn-src-stable@freebsd.org Thu May 16 18:11:26 2019 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 41D0B15A2BE3; Thu, 16 May 2019 18:11:26 +0000 (UTC) (envelope-from hselasky@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 CBFB16CD31; Thu, 16 May 2019 18:11:25 +0000 (UTC) (envelope-from hselasky@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 9895B24700; Thu, 16 May 2019 18:11:25 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x4GIBPYb032709; Thu, 16 May 2019 18:11:25 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x4GIBPRP032708; Thu, 16 May 2019 18:11:25 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201905161811.x4GIBPRP032708@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Thu, 16 May 2019 18:11:25 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r347860 - stable/11/sys/dev/mlx5/mlx5_ib X-SVN-Group: stable-11 X-SVN-Commit-Author: hselasky X-SVN-Commit-Paths: stable/11/sys/dev/mlx5/mlx5_ib X-SVN-Commit-Revision: 347860 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: CBFB16CD31 X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.97 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.998,0]; NEURAL_HAM_SHORT(-0.97)[-0.974,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US]; NEURAL_HAM_LONG(-1.00)[-1.000,0] X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 16 May 2019 18:11:26 -0000 Author: hselasky Date: Thu May 16 18:11:25 2019 New Revision: 347860 URL: https://svnweb.freebsd.org/changeset/base/347860 Log: MFC r347304: Always return success for RoCE modify port in mlx5ib. CM layer calls ib_modify_port() regardless of the link layer. For the Ethernet ports, qkey violation and Port capabilities are meaningless. Therefore, always return success for ib_modify_port calls on the Ethernet ports. Linux Commit: ec2558796d25e6024071b6bcb8e11392538d57bf Submitted by: slavash@ Sponsored by: Mellanox Technologies Modified: stable/11/sys/dev/mlx5/mlx5_ib/mlx5_ib_main.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/dev/mlx5/mlx5_ib/mlx5_ib_main.c ============================================================================== --- stable/11/sys/dev/mlx5/mlx5_ib/mlx5_ib_main.c Thu May 16 18:10:10 2019 (r347859) +++ stable/11/sys/dev/mlx5/mlx5_ib/mlx5_ib_main.c Thu May 16 18:11:25 2019 (r347860) @@ -1078,6 +1078,14 @@ static int mlx5_ib_modify_port(struct ib_device *ibdev u32 tmp; int err; + /* + * CM layer calls ib_modify_port() regardless of the link + * layer. For Ethernet ports, qkey violation and Port + * capabilities are meaningless. + */ + if (mlx5_ib_port_link_layer(ibdev, port) == IB_LINK_LAYER_ETHERNET) + return 0; + mutex_lock(&dev->cap_mask_mutex); err = mlx5_ib_query_port(ibdev, port, &attr); From owner-svn-src-stable@freebsd.org Thu May 16 18:12:15 2019 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 9CB7615A2DED; Thu, 16 May 2019 18:12:15 +0000 (UTC) (envelope-from hselasky@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 438706D022; Thu, 16 May 2019 18:12:15 +0000 (UTC) (envelope-from hselasky@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 1E2F824748; Thu, 16 May 2019 18:12:15 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x4GICExQ033618; Thu, 16 May 2019 18:12:14 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x4GICEdx033616; Thu, 16 May 2019 18:12:14 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201905161812.x4GICEdx033616@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Thu, 16 May 2019 18:12:14 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r347861 - in stable/11/sys/dev/mlx5: . mlx5_core mlx5_en X-SVN-Group: stable-11 X-SVN-Commit-Author: hselasky X-SVN-Commit-Paths: in stable/11/sys/dev/mlx5: . mlx5_core mlx5_en X-SVN-Commit-Revision: 347861 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 438706D022 X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.97 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.998,0]; NEURAL_HAM_SHORT(-0.98)[-0.975,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US]; NEURAL_HAM_LONG(-1.00)[-1.000,0] X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 16 May 2019 18:12:15 -0000 Author: hselasky Date: Thu May 16 18:12:14 2019 New Revision: 347861 URL: https://svnweb.freebsd.org/changeset/base/347861 Log: MFC r347305: Move workqueue from mlx5en(4) to mlx5core. This avoids creating more workqueues in mlx5core to do simple firmware command polling tasks. Sponsored by: Mellanox Technologies Modified: stable/11/sys/dev/mlx5/driver.h stable/11/sys/dev/mlx5/mlx5_core/mlx5_health.c stable/11/sys/dev/mlx5/mlx5_en/mlx5_en_main.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/dev/mlx5/driver.h ============================================================================== --- stable/11/sys/dev/mlx5/driver.h Thu May 16 18:11:25 2019 (r347860) +++ stable/11/sys/dev/mlx5/driver.h Thu May 16 18:12:14 2019 (r347861) @@ -1,5 +1,5 @@ /*- - * Copyright (c) 2013-2017, Mellanox Technologies, Ltd. All rights reserved. + * Copyright (c) 2013-2019, Mellanox Technologies, Ltd. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -503,6 +503,7 @@ struct mlx5_core_health { u32 prev; int miss_counter; u32 fatal_error; + struct workqueue_struct *wq_watchdog; /* wq spinlock to synchronize draining */ spinlock_t wq_lock; struct workqueue_struct *wq; Modified: stable/11/sys/dev/mlx5/mlx5_core/mlx5_health.c ============================================================================== --- stable/11/sys/dev/mlx5/mlx5_core/mlx5_health.c Thu May 16 18:11:25 2019 (r347860) +++ stable/11/sys/dev/mlx5/mlx5_core/mlx5_health.c Thu May 16 18:12:14 2019 (r347861) @@ -604,26 +604,27 @@ void mlx5_health_cleanup(struct mlx5_core_dev *dev) struct mlx5_core_health *health = &dev->priv.health; destroy_workqueue(health->wq); + destroy_workqueue(health->wq_watchdog); } -#define HEALTH_NAME "mlx5_health" int mlx5_health_init(struct mlx5_core_dev *dev) { struct mlx5_core_health *health; - char *name; - int len; + char name[64]; health = &dev->priv.health; - len = strlen(HEALTH_NAME) + strlen(dev_name(&dev->pdev->dev)); - name = kmalloc(len + 1, GFP_KERNEL); - if (!name) - return -ENOMEM; - snprintf(name, len, "%s:%s", HEALTH_NAME, dev_name(&dev->pdev->dev)); + snprintf(name, sizeof(name), "%s-rec", dev_name(&dev->pdev->dev)); health->wq = create_singlethread_workqueue(name); - kfree(name); if (!health->wq) return -ENOMEM; + + snprintf(name, sizeof(name), "%s-wdg", dev_name(&dev->pdev->dev)); + health->wq_watchdog = create_singlethread_workqueue(name); + if (!health->wq_watchdog) { + destroy_workqueue(health->wq); + return -ENOMEM; + } spin_lock_init(&health->wq_lock); INIT_WORK(&health->work, health_care); Modified: stable/11/sys/dev/mlx5/mlx5_en/mlx5_en_main.c ============================================================================== --- stable/11/sys/dev/mlx5/mlx5_en/mlx5_en_main.c Thu May 16 18:11:25 2019 (r347860) +++ stable/11/sys/dev/mlx5/mlx5_en/mlx5_en_main.c Thu May 16 18:12:14 2019 (r347861) @@ -3875,13 +3875,8 @@ mlx5e_create_ifp(struct mlx5_core_dev *mdev) goto err_free_sysctl; } - snprintf(unit, sizeof(unit), "mce%u_wq", - device_get_unit(mdev->pdev->dev.bsddev)); - priv->wq = alloc_workqueue(unit, 0, 1); - if (priv->wq == NULL) { - if_printf(ifp, "%s: alloc_workqueue failed\n", __func__); - goto err_free_sysctl; - } + /* reuse mlx5core's watchdog workqueue */ + priv->wq = mdev->priv.health.wq_watchdog; err = mlx5_alloc_map_uar(mdev, &priv->cq_uar); if (err) { @@ -4013,7 +4008,7 @@ err_unmap_free_uar: mlx5_unmap_free_uar(mdev, &priv->cq_uar); err_free_wq: - destroy_workqueue(priv->wq); + flush_workqueue(priv->wq); err_free_sysctl: sysctl_ctx_free(&priv->sysctl_ctx); @@ -4069,7 +4064,7 @@ mlx5e_destroy_ifp(struct mlx5_core_dev *mdev, void *vp mlx5_core_dealloc_pd(priv->mdev, priv->pdn); mlx5_unmap_free_uar(priv->mdev, &priv->cq_uar); mlx5e_disable_async_events(priv); - destroy_workqueue(priv->wq); + flush_workqueue(priv->wq); mlx5e_priv_mtx_destroy(priv); free(priv, M_MLX5EN); } From owner-svn-src-stable@freebsd.org Thu May 16 18:13:04 2019 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 9A7E815A2E75; Thu, 16 May 2019 18:13:04 +0000 (UTC) (envelope-from hselasky@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 3A5226D18F; Thu, 16 May 2019 18:13:04 +0000 (UTC) (envelope-from hselasky@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 EBD0124862; Thu, 16 May 2019 18:13:03 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x4GID3dE033714; Thu, 16 May 2019 18:13:03 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x4GID2t9033708; Thu, 16 May 2019 18:13:02 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201905161813.x4GID2t9033708@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Thu, 16 May 2019 18:13:02 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r347862 - in stable/11/sys/dev/mlx5: . mlx5_core X-SVN-Group: stable-11 X-SVN-Commit-Author: hselasky X-SVN-Commit-Paths: in stable/11/sys/dev/mlx5: . mlx5_core X-SVN-Commit-Revision: 347862 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 3A5226D18F X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.97 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.998,0]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; NEURAL_HAM_SHORT(-0.98)[-0.977,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US] X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 16 May 2019 18:13:04 -0000 Author: hselasky Date: Thu May 16 18:13:02 2019 New Revision: 347862 URL: https://svnweb.freebsd.org/changeset/base/347862 Log: MFC r347306: Implement reading PCI power status in mlx5core. Implement a watchdog as part of the healtcare subsystem which reads the PCI power status during startup and upon the PCI power status change event and store it into the core device structure. This value is then exported to user-space via a read-only SYSCTL. A dmesg print has been added to inform the admin about the PCI power status. Sponsored by: Mellanox Technologies Modified: stable/11/sys/dev/mlx5/device.h stable/11/sys/dev/mlx5/driver.h stable/11/sys/dev/mlx5/mlx5_core/mlx5_eq.c stable/11/sys/dev/mlx5/mlx5_core/mlx5_health.c stable/11/sys/dev/mlx5/mlx5_core/mlx5_main.c stable/11/sys/dev/mlx5/mlx5_ifc.h Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/dev/mlx5/device.h ============================================================================== --- stable/11/sys/dev/mlx5/device.h Thu May 16 18:12:14 2019 (r347861) +++ stable/11/sys/dev/mlx5/device.h Thu May 16 18:13:02 2019 (r347862) @@ -1213,6 +1213,7 @@ static inline int mlx5_get_cqe_format(const struct mlx enum { MLX5_GEN_EVENT_SUBTYPE_DELAY_DROP_TIMEOUT = 0x1, + MLX5_GEN_EVENT_SUBTYPE_PCI_POWER_CHANGE_EVENT = 0x5, }; /* 8 regular priorities + 1 for multicast */ Modified: stable/11/sys/dev/mlx5/driver.h ============================================================================== --- stable/11/sys/dev/mlx5/driver.h Thu May 16 18:12:14 2019 (r347861) +++ stable/11/sys/dev/mlx5/driver.h Thu May 16 18:13:02 2019 (r347862) @@ -504,6 +504,7 @@ struct mlx5_core_health { int miss_counter; u32 fatal_error; struct workqueue_struct *wq_watchdog; + struct work_struct work_watchdog; /* wq spinlock to synchronize draining */ spinlock_t wq_lock; struct workqueue_struct *wq; @@ -679,6 +680,8 @@ struct mlx5_core_dev { struct sysctl_ctx_list sysctl_ctx; int msix_eqvec; + int pwr_status; + int pwr_value; struct { struct mlx5_rsvd_gids reserved_gids; @@ -929,6 +932,7 @@ void mlx5_stop_health_poll(struct mlx5_core_dev *dev, void mlx5_drain_health_wq(struct mlx5_core_dev *dev); void mlx5_drain_health_recovery(struct mlx5_core_dev *dev); void mlx5_trigger_health_work(struct mlx5_core_dev *dev); +void mlx5_trigger_health_watchdog(struct mlx5_core_dev *dev); #define mlx5_buf_alloc_node(dev, size, direct, buf, node) \ mlx5_buf_alloc(dev, size, direct, buf) @@ -1063,6 +1067,8 @@ int mlx5_vsc_write(struct mlx5_core_dev *mdev, u32 add int mlx5_vsc_read(struct mlx5_core_dev *mdev, u32 addr, u32 *data); int mlx5_vsc_lock_addr_space(struct mlx5_core_dev *mdev, u32 addr); int mlx5_vsc_unlock_addr_space(struct mlx5_core_dev *mdev, u32 addr); +int mlx5_pci_read_power_status(struct mlx5_core_dev *mdev, + u16 *p_power, u8 *p_status); static inline u32 mlx5_mkey_to_idx(u32 mkey) { Modified: stable/11/sys/dev/mlx5/mlx5_core/mlx5_eq.c ============================================================================== --- stable/11/sys/dev/mlx5/mlx5_core/mlx5_eq.c Thu May 16 18:12:14 2019 (r347861) +++ stable/11/sys/dev/mlx5/mlx5_core/mlx5_eq.c Thu May 16 18:13:02 2019 (r347862) @@ -561,6 +561,11 @@ int mlx5_start_eqs(struct mlx5_core_dev *dev) if (MLX5_CAP_GEN(dev, temp_warn_event)) async_event_mask |= (1ull << MLX5_EVENT_TYPE_TEMP_WARN_EVENT); + if (MLX5_CAP_GEN(dev, general_notification_event)) { + async_event_mask |= (1ull << + MLX5_EVENT_TYPE_CODING_GENERAL_NOTIFICATION_EVENT); + } + err = mlx5_create_map_eq(dev, &table->cmd_eq, MLX5_EQ_VEC_CMD, MLX5_NUM_CMD_EQE, 1ull << MLX5_EVENT_TYPE_CMD, "mlx5_cmd_eq", &dev->priv.uuari.uars[0]); @@ -716,14 +721,17 @@ static void mlx5_port_general_notification_event(struc struct mlx5_eqe *eqe) { u8 port = (eqe->data.port.port >> 4) & 0xf; - u32 rqn = 0; - struct mlx5_eqe_general_notification_event *general_event = NULL; + u32 rqn; + struct mlx5_eqe_general_notification_event *general_event; switch (eqe->sub_type) { case MLX5_GEN_EVENT_SUBTYPE_DELAY_DROP_TIMEOUT: general_event = &eqe->data.general_notifications; rqn = be32_to_cpu(general_event->rq_user_index_delay_drop) & 0xffffff; + break; + case MLX5_GEN_EVENT_SUBTYPE_PCI_POWER_CHANGE_EVENT: + mlx5_trigger_health_watchdog(dev); break; default: mlx5_core_warn(dev, Modified: stable/11/sys/dev/mlx5/mlx5_core/mlx5_health.c ============================================================================== --- stable/11/sys/dev/mlx5/mlx5_core/mlx5_health.c Thu May 16 18:12:14 2019 (r347861) +++ stable/11/sys/dev/mlx5/mlx5_core/mlx5_health.c Thu May 16 18:13:02 2019 (r347862) @@ -41,6 +41,7 @@ enum { MLX5_DROP_NEW_HEALTH_WORK, MLX5_DROP_NEW_RECOVERY_WORK, + MLX5_DROP_NEW_WATCHDOG_WORK, }; enum { @@ -506,6 +507,66 @@ static void print_health_info(struct mlx5_core_dev *de printf("mlx5_core: INFO: ""raw fw_ver 0x%08x\n", fw); } +static void health_watchdog(struct work_struct *work) +{ + struct mlx5_core_dev *dev; + u16 power; + u8 status; + int err; + + dev = container_of(work, struct mlx5_core_dev, priv.health.work_watchdog); + + if (!MLX5_CAP_GEN(dev, mcam_reg) || + !MLX5_CAP_MCAM_FEATURE(dev, pcie_status_and_power)) + return; + + err = mlx5_pci_read_power_status(dev, &power, &status); + if (err < 0) { + mlx5_core_warn(dev, "Failed reading power status: %d\n", err); + return; + } + + dev->pwr_value = power; + + if (dev->pwr_status != status) { + device_t bsddev = dev->pdev->dev.bsddev; + + switch (status) { + case 0: + dev->pwr_status = status; + device_printf(bsddev, "PCI power is not published by the PCIe slot.\n"); + break; + case 1: + dev->pwr_status = status; + device_printf(bsddev, "PCIe slot advertised sufficient power (%uW).\n", power); + break; + case 2: + dev->pwr_status = status; + device_printf(bsddev, "WARN: Detected insufficient power on the PCIe slot (%uW).\n", power); + break; + default: + dev->pwr_status = 0; + device_printf(bsddev, "WARN: Unknown power state detected(%d).\n", status); + break; + } + } +} + +void +mlx5_trigger_health_watchdog(struct mlx5_core_dev *dev) +{ + struct mlx5_core_health *health = &dev->priv.health; + unsigned long flags; + + spin_lock_irqsave(&health->wq_lock, flags); + if (!test_bit(MLX5_DROP_NEW_WATCHDOG_WORK, &health->flags)) + queue_work(health->wq_watchdog, &health->work_watchdog); + else + dev_err(&dev->pdev->dev, + "scheduling watchdog is not permitted at this stage\n"); + spin_unlock_irqrestore(&health->wq_lock, flags); +} + static void poll_health(unsigned long data) { struct mlx5_core_dev *dev = (struct mlx5_core_dev *)data; @@ -516,9 +577,6 @@ static void poll_health(unsigned long data) if (dev->state != MLX5_DEVICE_STATE_UP) return; - if (dev->state == MLX5_DEVICE_STATE_INTERNAL_ERROR) - goto out; - count = ioread32be(health->health_counter); if (count == health->prev) ++health->miss_counter; @@ -540,7 +598,6 @@ static void poll_health(unsigned long data) mlx5_trigger_health_work(dev); } -out: mod_timer(&health->timer, get_next_poll_jiffies()); } @@ -552,12 +609,16 @@ void mlx5_start_health_poll(struct mlx5_core_dev *dev) health->fatal_error = MLX5_SENSOR_NO_ERR; clear_bit(MLX5_DROP_NEW_HEALTH_WORK, &health->flags); clear_bit(MLX5_DROP_NEW_RECOVERY_WORK, &health->flags); + clear_bit(MLX5_DROP_NEW_WATCHDOG_WORK, &health->flags); health->health = &dev->iseg->health; health->health_counter = &dev->iseg->health_counter; setup_timer(&health->timer, poll_health, (unsigned long)dev); mod_timer(&health->timer, round_jiffies(jiffies + MLX5_HEALTH_POLL_INTERVAL)); + + /* do initial PCI power state readout */ + mlx5_trigger_health_watchdog(dev); } void mlx5_stop_health_poll(struct mlx5_core_dev *dev, bool disable_health) @@ -569,6 +630,7 @@ void mlx5_stop_health_poll(struct mlx5_core_dev *dev, spin_lock_irqsave(&health->wq_lock, flags); set_bit(MLX5_DROP_NEW_HEALTH_WORK, &health->flags); set_bit(MLX5_DROP_NEW_RECOVERY_WORK, &health->flags); + set_bit(MLX5_DROP_NEW_WATCHDOG_WORK, &health->flags); spin_unlock_irqrestore(&health->wq_lock, flags); } @@ -583,9 +645,11 @@ void mlx5_drain_health_wq(struct mlx5_core_dev *dev) spin_lock_irqsave(&health->wq_lock, flags); set_bit(MLX5_DROP_NEW_HEALTH_WORK, &health->flags); set_bit(MLX5_DROP_NEW_RECOVERY_WORK, &health->flags); + set_bit(MLX5_DROP_NEW_WATCHDOG_WORK, &health->flags); spin_unlock_irqrestore(&health->wq_lock, flags); cancel_delayed_work_sync(&health->recover_work); cancel_work_sync(&health->work); + cancel_work_sync(&health->work_watchdog); } void mlx5_drain_health_recovery(struct mlx5_core_dev *dev) @@ -628,6 +692,7 @@ int mlx5_health_init(struct mlx5_core_dev *dev) spin_lock_init(&health->wq_lock); INIT_WORK(&health->work, health_care); + INIT_WORK(&health->work_watchdog, health_watchdog); INIT_DELAYED_WORK(&health->recover_work, health_recover); return 0; Modified: stable/11/sys/dev/mlx5/mlx5_core/mlx5_main.c ============================================================================== --- stable/11/sys/dev/mlx5/mlx5_core/mlx5_main.c Thu May 16 18:12:14 2019 (r347861) +++ stable/11/sys/dev/mlx5/mlx5_core/mlx5_main.c Thu May 16 18:13:02 2019 (r347862) @@ -197,6 +197,21 @@ static int set_dma_caps(struct pci_dev *pdev) return err; } +int mlx5_pci_read_power_status(struct mlx5_core_dev *dev, + u16 *p_power, u8 *p_status) +{ + u32 in[MLX5_ST_SZ_DW(mpein_reg)] = {}; + u32 out[MLX5_ST_SZ_DW(mpein_reg)] = {}; + int err; + + err = mlx5_core_access_reg(dev, in, sizeof(in), out, sizeof(out), + MLX5_ACCESS_REG_SUMMARY_CTRL_ID_MPEIN, 0, 0); + + *p_status = MLX5_GET(mpein_reg, out, pwr_status); + *p_power = MLX5_GET(mpein_reg, out, pci_power); + return err; +} + static int mlx5_pci_enable_device(struct mlx5_core_dev *dev) { struct pci_dev *pdev = dev->pdev; @@ -1255,6 +1270,14 @@ static int init_one(struct pci_dev *pdev, SYSCTL_CHILDREN(device_get_sysctl_tree(bsddev)), OID_AUTO, "msix_eqvec", CTLFLAG_RDTUN, &dev->msix_eqvec, 0, "Maximum number of MSIX event queue vectors, if set"); + SYSCTL_ADD_INT(&dev->sysctl_ctx, + SYSCTL_CHILDREN(device_get_sysctl_tree(bsddev)), + OID_AUTO, "power_status", CTLFLAG_RD, &dev->pwr_status, 0, + "0:Invalid 1:Sufficient 2:Insufficient"); + SYSCTL_ADD_INT(&dev->sysctl_ctx, + SYSCTL_CHILDREN(device_get_sysctl_tree(bsddev)), + OID_AUTO, "power_value", CTLFLAG_RD, &dev->pwr_value, 0, + "Current power value in Watts"); INIT_LIST_HEAD(&priv->ctx_list); spin_lock_init(&priv->ctx_lock); Modified: stable/11/sys/dev/mlx5/mlx5_ifc.h ============================================================================== --- stable/11/sys/dev/mlx5/mlx5_ifc.h Thu May 16 18:12:14 2019 (r347861) +++ stable/11/sys/dev/mlx5/mlx5_ifc.h Thu May 16 18:13:02 2019 (r347862) @@ -8640,8 +8640,9 @@ struct mlx5_ifc_pcam_reg_bits { }; struct mlx5_ifc_mcam_enhanced_features_bits { - u8 reserved_at_0[0x7f]; - + u8 reserved_at_0[0x6e]; + u8 pcie_status_and_power[0x1]; + u8 reserved_at_111[0x10]; u8 pcie_performance_group[0x1]; }; @@ -9998,6 +9999,91 @@ struct mlx5_ifc_mpcnt_reg_bits { u8 reserved_2[0x1f]; union mlx5_ifc_mpcnt_cntrs_grp_data_layout_bits counter_set; +}; + +enum { + MLX5_ACCESS_REG_SUMMARY_CTRL_ID_MPEIN = 0x9050, + MLX5_MPEIN_PWR_STATUS_INVALID = 0, + MLX5_MPEIN_PWR_STATUS_SUFFICIENT = 1, + MLX5_MPEIN_PWR_STATUS_INSUFFICIENT = 2, +}; + +struct mlx5_ifc_mpein_reg_bits { + u8 reserved_at_0[0x2]; + u8 depth[0x6]; + u8 pcie_index[0x8]; + u8 node[0x8]; + u8 reserved_at_18[0x8]; + + u8 capability_mask[0x20]; + + u8 reserved_at_40[0x8]; + u8 link_width_enabled[0x8]; + u8 link_speed_enabled[0x10]; + + u8 lane0_physical_position[0x8]; + u8 link_width_active[0x8]; + u8 link_speed_active[0x10]; + + u8 num_of_pfs[0x10]; + u8 num_of_vfs[0x10]; + + u8 bdf0[0x10]; + u8 reserved_at_b0[0x10]; + + u8 max_read_request_size[0x4]; + u8 max_payload_size[0x4]; + u8 reserved_at_c8[0x5]; + u8 pwr_status[0x3]; + u8 port_type[0x4]; + u8 reserved_at_d4[0xb]; + u8 lane_reversal[0x1]; + + u8 reserved_at_e0[0x14]; + u8 pci_power[0xc]; + + u8 reserved_at_100[0x20]; + + u8 device_status[0x10]; + u8 port_state[0x8]; + u8 reserved_at_138[0x8]; + + u8 reserved_at_140[0x10]; + u8 receiver_detect_result[0x10]; + + u8 reserved_at_160[0x20]; +}; + +struct mlx5_ifc_mpein_reg_ext_bits { + u8 reserved_at_0[0x2]; + u8 depth[0x6]; + u8 pcie_index[0x8]; + u8 node[0x8]; + u8 reserved_at_18[0x8]; + + u8 reserved_at_20[0x20]; + + u8 reserved_at_40[0x8]; + u8 link_width_enabled[0x8]; + u8 link_speed_enabled[0x10]; + + u8 lane0_physical_position[0x8]; + u8 link_width_active[0x8]; + u8 link_speed_active[0x10]; + + u8 num_of_pfs[0x10]; + u8 num_of_vfs[0x10]; + + u8 bdf0[0x10]; + u8 reserved_at_b0[0x10]; + + u8 max_read_request_size[0x4]; + u8 max_payload_size[0x4]; + u8 reserved_at_c8[0x5]; + u8 pwr_status[0x3]; + u8 port_type[0x4]; + u8 reserved_at_d4[0xb]; + u8 lane_reversal[0x1]; }; struct mlx5_ifc_mcqi_cap_bits { From owner-svn-src-stable@freebsd.org Thu May 16 18:13:48 2019 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 3D68715A2F25; Thu, 16 May 2019 18:13:48 +0000 (UTC) (envelope-from hselasky@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 D133C6D2D8; Thu, 16 May 2019 18:13:47 +0000 (UTC) (envelope-from hselasky@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 ABC1F24863; Thu, 16 May 2019 18:13:47 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x4GIDlwP033803; Thu, 16 May 2019 18:13:47 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x4GIDld1033802; Thu, 16 May 2019 18:13:47 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201905161813.x4GIDld1033802@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Thu, 16 May 2019 18:13:47 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r347863 - in stable/11/sys/dev/mlx5: . mlx5_core X-SVN-Group: stable-11 X-SVN-Commit-Author: hselasky X-SVN-Commit-Paths: in stable/11/sys/dev/mlx5: . mlx5_core X-SVN-Commit-Revision: 347863 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: D133C6D2D8 X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.97 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.998,0]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; NEURAL_HAM_SHORT(-0.98)[-0.977,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US] X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 16 May 2019 18:13:48 -0000 Author: hselasky Date: Thu May 16 18:13:47 2019 New Revision: 347863 URL: https://svnweb.freebsd.org/changeset/base/347863 Log: MFC r347307: Update performance counter bits in mlx5core. Sponsored by: Mellanox Technologies Modified: stable/11/sys/dev/mlx5/mlx5_core/mlx5_diagnostics.c stable/11/sys/dev/mlx5/mlx5_ifc.h Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/dev/mlx5/mlx5_core/mlx5_diagnostics.c ============================================================================== --- stable/11/sys/dev/mlx5/mlx5_core/mlx5_diagnostics.c Thu May 16 18:13:02 2019 (r347862) +++ stable/11/sys/dev/mlx5/mlx5_core/mlx5_diagnostics.c Thu May 16 18:13:47 2019 (r347863) @@ -231,13 +231,13 @@ int mlx5_core_get_diagnostics_full(struct mlx5_core_de MLX5_REG_MPCNT, 0, 0); if (err == 0) { void *pcounters = MLX5_ADDR_OF(mpcnt_reg, out, - counter_set.pcie_performance_counters_data_layout); + counter_set.pcie_perf_counters); pdiag->counter.rx_pci_errors = - MLX5_GET(pcie_performance_counters_data_layout, + MLX5_GET(pcie_perf_counters, pcounters, rx_errors); pdiag->counter.tx_pci_errors = - MLX5_GET(pcie_performance_counters_data_layout, + MLX5_GET(pcie_perf_counters, pcounters, tx_errors); } MLX5_SET(mpcnt_reg, in, grp, @@ -247,13 +247,13 @@ int mlx5_core_get_diagnostics_full(struct mlx5_core_de MLX5_REG_MPCNT, 0, 0); if (err == 0) { void *pcounters = MLX5_ADDR_OF(mpcnt_reg, out, - counter_set.pcie_timers_and_states_data_layout); + counter_set.pcie_timers_states); pdiag->counter.tx_pci_non_fatal_errors = - MLX5_GET(pcie_timers_and_states_data_layout, + MLX5_GET(pcie_timers_states, pcounters, non_fatal_err_msg_sent); pdiag->counter.tx_pci_fatal_errors = - MLX5_GET(pcie_timers_and_states_data_layout, + MLX5_GET(pcie_timers_states, pcounters, fatal_err_msg_sent); } kvfree(in); Modified: stable/11/sys/dev/mlx5/mlx5_ifc.h ============================================================================== --- stable/11/sys/dev/mlx5/mlx5_ifc.h Thu May 16 18:13:02 2019 (r347862) +++ stable/11/sys/dev/mlx5/mlx5_ifc.h Thu May 16 18:13:47 2019 (r347863) @@ -9868,11 +9868,89 @@ struct mlx5_ifc_ppcnt_reg_bits { union mlx5_ifc_eth_cntrs_grp_data_layout_auto_bits counter_set; }; -struct mlx5_ifc_pcie_performance_counters_data_layout_bits { +struct mlx5_ifc_pcie_lanes_counters_bits { u8 life_time_counter_high[0x20]; u8 life_time_counter_low[0x20]; + u8 error_counter_lane0[0x20]; + + u8 error_counter_lane1[0x20]; + + u8 error_counter_lane2[0x20]; + + u8 error_counter_lane3[0x20]; + + u8 error_counter_lane4[0x20]; + + u8 error_counter_lane5[0x20]; + + u8 error_counter_lane6[0x20]; + + u8 error_counter_lane7[0x20]; + + u8 error_counter_lane8[0x20]; + + u8 error_counter_lane9[0x20]; + + u8 error_counter_lane10[0x20]; + + u8 error_counter_lane11[0x20]; + + u8 error_counter_lane12[0x20]; + + u8 error_counter_lane13[0x20]; + + u8 error_counter_lane14[0x20]; + + u8 error_counter_lane15[0x20]; + + u8 reserved_at_240[0x580]; +}; + +struct mlx5_ifc_pcie_lanes_counters_ext_bits { + u8 reserved_at_0[0x40]; + + u8 error_counter_lane0[0x20]; + + u8 error_counter_lane1[0x20]; + + u8 error_counter_lane2[0x20]; + + u8 error_counter_lane3[0x20]; + + u8 error_counter_lane4[0x20]; + + u8 error_counter_lane5[0x20]; + + u8 error_counter_lane6[0x20]; + + u8 error_counter_lane7[0x20]; + + u8 error_counter_lane8[0x20]; + + u8 error_counter_lane9[0x20]; + + u8 error_counter_lane10[0x20]; + + u8 error_counter_lane11[0x20]; + + u8 error_counter_lane12[0x20]; + + u8 error_counter_lane13[0x20]; + + u8 error_counter_lane14[0x20]; + + u8 error_counter_lane15[0x20]; + + u8 reserved_at_240[0x580]; +}; + +struct mlx5_ifc_pcie_perf_counters_bits { + u8 life_time_counter_high[0x20]; + + u8 life_time_counter_low[0x20]; + u8 rx_errors[0x20]; u8 tx_errors[0x20]; @@ -9889,10 +9967,46 @@ struct mlx5_ifc_pcie_performance_counters_data_layout_ u8 crc_error_tlp[0x20]; - u8 reserved_0[0x680]; + u8 tx_overflow_buffer_pkt[0x40]; + + u8 outbound_stalled_reads[0x20]; + + u8 outbound_stalled_writes[0x20]; + + u8 outbound_stalled_reads_events[0x20]; + + u8 outbound_stalled_writes_events[0x20]; + + u8 tx_overflow_buffer_marked_pkt[0x40]; + + u8 reserved_at_240[0x580]; }; -struct mlx5_ifc_pcie_timers_and_states_data_layout_bits { +struct mlx5_ifc_pcie_perf_counters_ext_bits { + u8 reserved_at_0[0x40]; + + u8 rx_errors[0x20]; + + u8 tx_errors[0x20]; + + u8 reserved_at_80[0xc0]; + + u8 tx_overflow_buffer_pkt[0x40]; + + u8 outbound_stalled_reads[0x20]; + + u8 outbound_stalled_writes[0x20]; + + u8 outbound_stalled_reads_events[0x20]; + + u8 outbound_stalled_writes_events[0x20]; + + u8 tx_overflow_buffer_marked_pkt[0x40]; + + u8 reserved_at_240[0x580]; +}; + +struct mlx5_ifc_pcie_timers_states_bits { u8 life_time_counter_high[0x20]; u8 life_time_counter_low[0x20]; @@ -9939,66 +10053,97 @@ struct mlx5_ifc_pcie_timers_and_states_data_layout_bit u8 fatal_err_msg_sent[0x20]; - u8 reserved_0[0x4e0]; + u8 reserved_at_2e0[0x4e0]; }; -struct mlx5_ifc_pcie_lanes_counters_data_layout_bits { - u8 life_time_counter_high[0x20]; +struct mlx5_ifc_pcie_timers_states_ext_bits { + u8 reserved_at_0[0x40]; - u8 life_time_counter_low[0x20]; + u8 time_to_boot_image_start[0x20]; - u8 error_counter_lane0[0x20]; + u8 time_to_link_image[0x20]; - u8 error_counter_lane1[0x20]; + u8 calibration_time[0x20]; - u8 error_counter_lane2[0x20]; + u8 time_to_first_perst[0x20]; - u8 error_counter_lane3[0x20]; + u8 time_to_detect_state[0x20]; - u8 error_counter_lane4[0x20]; + u8 time_to_l0[0x20]; - u8 error_counter_lane5[0x20]; + u8 time_to_crs_en[0x20]; - u8 error_counter_lane6[0x20]; + u8 time_to_plastic_image_start[0x20]; - u8 error_counter_lane7[0x20]; + u8 time_to_iron_image_start[0x20]; - u8 error_counter_lane8[0x20]; + u8 perst_handler[0x20]; - u8 error_counter_lane9[0x20]; + u8 times_in_l1[0x20]; - u8 error_counter_lane10[0x20]; + u8 times_in_l23[0x20]; - u8 error_counter_lane11[0x20]; + u8 dl_down[0x20]; - u8 error_counter_lane12[0x20]; + u8 config_cycle1usec[0x20]; - u8 error_counter_lane13[0x20]; + u8 config_cycle2to7usec[0x20]; - u8 error_counter_lane14[0x20]; + u8 config_cycle8to15usec[0x20]; - u8 error_counter_lane15[0x20]; + u8 config_cycle16to63usec[0x20]; - u8 reserved_0[0x580]; + u8 config_cycle64usec[0x20]; + + u8 correctable_err_msg_sent[0x20]; + + u8 non_fatal_err_msg_sent[0x20]; + + u8 fatal_err_msg_sent[0x20]; + + u8 reserved_at_2e0[0x4e0]; }; -union mlx5_ifc_mpcnt_cntrs_grp_data_layout_bits { - struct mlx5_ifc_pcie_performance_counters_data_layout_bits pcie_performance_counters_data_layout; - struct mlx5_ifc_pcie_timers_and_states_data_layout_bits pcie_timers_and_states_data_layout; - struct mlx5_ifc_pcie_lanes_counters_data_layout_bits pcie_lanes_counters_data_layout; - u8 reserved_0[0xf8]; +union mlx5_ifc_mpcnt_reg_counter_set_auto_bits { + struct mlx5_ifc_pcie_perf_counters_bits pcie_perf_counters; + struct mlx5_ifc_pcie_lanes_counters_bits pcie_lanes_counters; + struct mlx5_ifc_pcie_timers_states_bits pcie_timers_states; + u8 reserved_at_0[0x7c0]; }; +union mlx5_ifc_mpcnt_reg_counter_set_auto_ext_bits { + struct mlx5_ifc_pcie_perf_counters_ext_bits pcie_perf_counters_ext; + struct mlx5_ifc_pcie_lanes_counters_ext_bits pcie_lanes_counters_ext; + struct mlx5_ifc_pcie_timers_states_ext_bits pcie_timers_states_ext; + u8 reserved_at_0[0x7c0]; +}; + struct mlx5_ifc_mpcnt_reg_bits { - u8 reserved_0[0x8]; + u8 reserved_at_0[0x2]; + u8 depth[0x6]; u8 pcie_index[0x8]; - u8 reserved_1[0xa]; + u8 node[0x8]; + u8 reserved_at_18[0x2]; u8 grp[0x6]; u8 clr[0x1]; - u8 reserved_2[0x1f]; + u8 reserved_at_21[0x1f]; - union mlx5_ifc_mpcnt_cntrs_grp_data_layout_bits counter_set; + union mlx5_ifc_mpcnt_reg_counter_set_auto_bits counter_set; +}; + +struct mlx5_ifc_mpcnt_reg_ext_bits { + u8 reserved_at_0[0x2]; + u8 depth[0x6]; + u8 pcie_index[0x8]; + u8 node[0x8]; + u8 reserved_at_18[0x2]; + u8 grp[0x6]; + + u8 clr[0x1]; + u8 reserved_at_21[0x1f]; + + union mlx5_ifc_mpcnt_reg_counter_set_auto_ext_bits counter_set; }; enum { From owner-svn-src-stable@freebsd.org Thu May 16 18:16:09 2019 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 984C015A3242; Thu, 16 May 2019 18:16:09 +0000 (UTC) (envelope-from hselasky@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 461DA6D5BF; Thu, 16 May 2019 18:16:09 +0000 (UTC) (envelope-from hselasky@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 F329824865; Thu, 16 May 2019 18:16:08 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x4GIG8Vf033987; Thu, 16 May 2019 18:16:08 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x4GIG8eY033986; Thu, 16 May 2019 18:16:08 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201905161816.x4GIG8eY033986@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Thu, 16 May 2019 18:16:08 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r347864 - stable/11/sys/dev/mlx5/mlx5_en X-SVN-Group: stable-11 X-SVN-Commit-Author: hselasky X-SVN-Commit-Paths: stable/11/sys/dev/mlx5/mlx5_en X-SVN-Commit-Revision: 347864 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 461DA6D5BF X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.98 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.998,0]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; NEURAL_HAM_SHORT(-0.98)[-0.979,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US] X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 16 May 2019 18:16:10 -0000 Author: hselasky Date: Thu May 16 18:16:08 2019 New Revision: 347864 URL: https://svnweb.freebsd.org/changeset/base/347864 Log: MFC r347308: Extend the counters framework in mlx5en(4). Allow more macro arguments and split the variable type and name into separate arguments. This allows simple and powerful copy and extraction of values from IFC based structures into SYSCTLs with the use of a single macro. Sponsored by: Mellanox Technologies Modified: stable/11/sys/dev/mlx5/mlx5_en/en.h Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/dev/mlx5/mlx5_en/en.h ============================================================================== --- stable/11/sys/dev/mlx5/mlx5_en/en.h Thu May 16 18:13:47 2019 (r347863) +++ stable/11/sys/dev/mlx5/mlx5_en/en.h Thu May 16 18:16:08 2019 (r347864) @@ -1,5 +1,5 @@ /*- - * Copyright (c) 2015-2018 Mellanox Technologies. All rights reserved. + * Copyright (c) 2015-2019 Mellanox Technologies. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -145,48 +145,48 @@ struct mlx5e_cq; typedef void (mlx5e_cq_comp_t)(struct mlx5_core_cq *); -#define MLX5E_STATS_COUNT(a,b,c,d) a -#define MLX5E_STATS_VAR(a,b,c,d) b; -#define MLX5E_STATS_DESC(a,b,c,d) c, d, +#define MLX5E_STATS_COUNT(a, ...) a +#define MLX5E_STATS_VAR(a, b, c, ...) b c; +#define MLX5E_STATS_DESC(a, b, c, d, e, ...) d, e, #define MLX5E_VPORT_STATS(m) \ /* HW counters */ \ - m(+1, u64 rx_packets, "rx_packets", "Received packets") \ - m(+1, u64 rx_bytes, "rx_bytes", "Received bytes") \ - m(+1, u64 tx_packets, "tx_packets", "Transmitted packets") \ - m(+1, u64 tx_bytes, "tx_bytes", "Transmitted bytes") \ - m(+1, u64 rx_error_packets, "rx_error_packets", "Received error packets") \ - m(+1, u64 rx_error_bytes, "rx_error_bytes", "Received error bytes") \ - m(+1, u64 tx_error_packets, "tx_error_packets", "Transmitted error packets") \ - m(+1, u64 tx_error_bytes, "tx_error_bytes", "Transmitted error bytes") \ - m(+1, u64 rx_unicast_packets, "rx_unicast_packets", "Received unicast packets") \ - m(+1, u64 rx_unicast_bytes, "rx_unicast_bytes", "Received unicast bytes") \ - m(+1, u64 tx_unicast_packets, "tx_unicast_packets", "Transmitted unicast packets") \ - m(+1, u64 tx_unicast_bytes, "tx_unicast_bytes", "Transmitted unicast bytes") \ - m(+1, u64 rx_multicast_packets, "rx_multicast_packets", "Received multicast packets") \ - m(+1, u64 rx_multicast_bytes, "rx_multicast_bytes", "Received multicast bytes") \ - m(+1, u64 tx_multicast_packets, "tx_multicast_packets", "Transmitted multicast packets") \ - m(+1, u64 tx_multicast_bytes, "tx_multicast_bytes", "Transmitted multicast bytes") \ - m(+1, u64 rx_broadcast_packets, "rx_broadcast_packets", "Received broadcast packets") \ - m(+1, u64 rx_broadcast_bytes, "rx_broadcast_bytes", "Received broadcast bytes") \ - m(+1, u64 tx_broadcast_packets, "tx_broadcast_packets", "Transmitted broadcast packets") \ - m(+1, u64 tx_broadcast_bytes, "tx_broadcast_bytes", "Transmitted broadcast bytes") \ - m(+1, u64 rx_out_of_buffer, "rx_out_of_buffer", "Receive out of buffer, no recv wqes events") \ + m(+1, u64, rx_packets, "rx_packets", "Received packets") \ + m(+1, u64, rx_bytes, "rx_bytes", "Received bytes") \ + m(+1, u64, tx_packets, "tx_packets", "Transmitted packets") \ + m(+1, u64, tx_bytes, "tx_bytes", "Transmitted bytes") \ + m(+1, u64, rx_error_packets, "rx_error_packets", "Received error packets") \ + m(+1, u64, rx_error_bytes, "rx_error_bytes", "Received error bytes") \ + m(+1, u64, tx_error_packets, "tx_error_packets", "Transmitted error packets") \ + m(+1, u64, tx_error_bytes, "tx_error_bytes", "Transmitted error bytes") \ + m(+1, u64, rx_unicast_packets, "rx_unicast_packets", "Received unicast packets") \ + m(+1, u64, rx_unicast_bytes, "rx_unicast_bytes", "Received unicast bytes") \ + m(+1, u64, tx_unicast_packets, "tx_unicast_packets", "Transmitted unicast packets") \ + m(+1, u64, tx_unicast_bytes, "tx_unicast_bytes", "Transmitted unicast bytes") \ + m(+1, u64, rx_multicast_packets, "rx_multicast_packets", "Received multicast packets") \ + m(+1, u64, rx_multicast_bytes, "rx_multicast_bytes", "Received multicast bytes") \ + m(+1, u64, tx_multicast_packets, "tx_multicast_packets", "Transmitted multicast packets") \ + m(+1, u64, tx_multicast_bytes, "tx_multicast_bytes", "Transmitted multicast bytes") \ + m(+1, u64, rx_broadcast_packets, "rx_broadcast_packets", "Received broadcast packets") \ + m(+1, u64, rx_broadcast_bytes, "rx_broadcast_bytes", "Received broadcast bytes") \ + m(+1, u64, tx_broadcast_packets, "tx_broadcast_packets", "Transmitted broadcast packets") \ + m(+1, u64, tx_broadcast_bytes, "tx_broadcast_bytes", "Transmitted broadcast bytes") \ + m(+1, u64, rx_out_of_buffer, "rx_out_of_buffer", "Receive out of buffer, no recv wqes events") \ /* SW counters */ \ - m(+1, u64 tso_packets, "tso_packets", "Transmitted TSO packets") \ - m(+1, u64 tso_bytes, "tso_bytes", "Transmitted TSO bytes") \ - m(+1, u64 lro_packets, "lro_packets", "Received LRO packets") \ - m(+1, u64 lro_bytes, "lro_bytes", "Received LRO bytes") \ - m(+1, u64 sw_lro_queued, "sw_lro_queued", "Packets queued for SW LRO") \ - m(+1, u64 sw_lro_flushed, "sw_lro_flushed", "Packets flushed from SW LRO") \ - m(+1, u64 rx_csum_good, "rx_csum_good", "Received checksum valid packets") \ - m(+1, u64 rx_csum_none, "rx_csum_none", "Received no checksum packets") \ - m(+1, u64 tx_csum_offload, "tx_csum_offload", "Transmit checksum offload packets") \ - m(+1, u64 tx_queue_dropped, "tx_queue_dropped", "Transmit queue dropped") \ - m(+1, u64 tx_defragged, "tx_defragged", "Transmit queue defragged") \ - m(+1, u64 rx_wqe_err, "rx_wqe_err", "Receive WQE errors") \ - m(+1, u64 tx_jumbo_packets, "tx_jumbo_packets", "TX packets greater than 1518 octets") \ - m(+1, u64 rx_steer_missed_packets, "rx_steer_missed_packets", "RX packets dropped by steering rule(s)") + m(+1, u64, tso_packets, "tso_packets", "Transmitted TSO packets") \ + m(+1, u64, tso_bytes, "tso_bytes", "Transmitted TSO bytes") \ + m(+1, u64, lro_packets, "lro_packets", "Received LRO packets") \ + m(+1, u64, lro_bytes, "lro_bytes", "Received LRO bytes") \ + m(+1, u64, sw_lro_queued, "sw_lro_queued", "Packets queued for SW LRO") \ + m(+1, u64, sw_lro_flushed, "sw_lro_flushed", "Packets flushed from SW LRO") \ + m(+1, u64, rx_csum_good, "rx_csum_good", "Received checksum valid packets") \ + m(+1, u64, rx_csum_none, "rx_csum_none", "Received no checksum packets") \ + m(+1, u64, tx_csum_offload, "tx_csum_offload", "Transmit checksum offload packets") \ + m(+1, u64, tx_queue_dropped, "tx_queue_dropped", "Transmit queue dropped") \ + m(+1, u64, tx_defragged, "tx_defragged", "Transmit queue defragged") \ + m(+1, u64, rx_wqe_err, "rx_wqe_err", "Receive WQE errors") \ + m(+1, u64, tx_jumbo_packets, "tx_jumbo_packets", "TX packets greater than 1518 octets") \ + m(+1, u64, rx_steer_missed_packets, "rx_steer_missed_packets", "RX packets dropped by steering rule(s)") #define MLX5E_VPORT_STATS_NUM (0 MLX5E_VPORT_STATS(MLX5E_STATS_COUNT)) @@ -197,128 +197,129 @@ struct mlx5e_vport_stats { }; #define MLX5E_PPORT_IEEE802_3_STATS(m) \ - m(+1, u64 frames_tx, "frames_tx", "Frames transmitted") \ - m(+1, u64 frames_rx, "frames_rx", "Frames received") \ - m(+1, u64 check_seq_err, "check_seq_err", "Sequence errors") \ - m(+1, u64 alignment_err, "alignment_err", "Alignment errors") \ - m(+1, u64 octets_tx, "octets_tx", "Bytes transmitted") \ - m(+1, u64 octets_received, "octets_received", "Bytes received") \ - m(+1, u64 multicast_xmitted, "multicast_xmitted", "Multicast transmitted") \ - m(+1, u64 broadcast_xmitted, "broadcast_xmitted", "Broadcast transmitted") \ - m(+1, u64 multicast_rx, "multicast_rx", "Multicast received") \ - m(+1, u64 broadcast_rx, "broadcast_rx", "Broadcast received") \ - m(+1, u64 in_range_len_errors, "in_range_len_errors", "In range length errors") \ - m(+1, u64 out_of_range_len, "out_of_range_len", "Out of range length errors") \ - m(+1, u64 too_long_errors, "too_long_errors", "Too long errors") \ - m(+1, u64 symbol_err, "symbol_err", "Symbol errors") \ - m(+1, u64 mac_control_tx, "mac_control_tx", "MAC control transmitted") \ - m(+1, u64 mac_control_rx, "mac_control_rx", "MAC control received") \ - m(+1, u64 unsupported_op_rx, "unsupported_op_rx", "Unsupported operation received") \ - m(+1, u64 pause_ctrl_rx, "pause_ctrl_rx", "Pause control received") \ - m(+1, u64 pause_ctrl_tx, "pause_ctrl_tx", "Pause control transmitted") + m(+1, u64, frames_tx, "frames_tx", "Frames transmitted") \ + m(+1, u64, frames_rx, "frames_rx", "Frames received") \ + m(+1, u64, check_seq_err, "check_seq_err", "Sequence errors") \ + m(+1, u64, alignment_err, "alignment_err", "Alignment errors") \ + m(+1, u64, octets_tx, "octets_tx", "Bytes transmitted") \ + m(+1, u64, octets_received, "octets_received", "Bytes received") \ + m(+1, u64, multicast_xmitted, "multicast_xmitted", "Multicast transmitted") \ + m(+1, u64, broadcast_xmitted, "broadcast_xmitted", "Broadcast transmitted") \ + m(+1, u64, multicast_rx, "multicast_rx", "Multicast received") \ + m(+1, u64, broadcast_rx, "broadcast_rx", "Broadcast received") \ + m(+1, u64, in_range_len_errors, "in_range_len_errors", "In range length errors") \ + m(+1, u64, out_of_range_len, "out_of_range_len", "Out of range length errors") \ + m(+1, u64, too_long_errors, "too_long_errors", "Too long errors") \ + m(+1, u64, symbol_err, "symbol_err", "Symbol errors") \ + m(+1, u64, mac_control_tx, "mac_control_tx", "MAC control transmitted") \ + m(+1, u64, mac_control_rx, "mac_control_rx", "MAC control received") \ + m(+1, u64, unsupported_op_rx, "unsupported_op_rx", "Unsupported operation received") \ + m(+1, u64, pause_ctrl_rx, "pause_ctrl_rx", "Pause control received") \ + m(+1, u64, pause_ctrl_tx, "pause_ctrl_tx", "Pause control transmitted") #define MLX5E_PPORT_RFC2819_STATS(m) \ - m(+1, u64 drop_events, "drop_events", "Dropped events") \ - m(+1, u64 octets, "octets", "Octets") \ - m(+1, u64 pkts, "pkts", "Packets") \ - m(+1, u64 broadcast_pkts, "broadcast_pkts", "Broadcast packets") \ - m(+1, u64 multicast_pkts, "multicast_pkts", "Multicast packets") \ - m(+1, u64 crc_align_errors, "crc_align_errors", "CRC alignment errors") \ - m(+1, u64 undersize_pkts, "undersize_pkts", "Undersized packets") \ - m(+1, u64 oversize_pkts, "oversize_pkts", "Oversized packets") \ - m(+1, u64 fragments, "fragments", "Fragments") \ - m(+1, u64 jabbers, "jabbers", "Jabbers") \ - m(+1, u64 collisions, "collisions", "Collisions") + m(+1, u64, drop_events, "drop_events", "Dropped events") \ + m(+1, u64, octets, "octets", "Octets") \ + m(+1, u64, pkts, "pkts", "Packets") \ + m(+1, u64, broadcast_pkts, "broadcast_pkts", "Broadcast packets") \ + m(+1, u64, multicast_pkts, "multicast_pkts", "Multicast packets") \ + m(+1, u64, crc_align_errors, "crc_align_errors", "CRC alignment errors") \ + m(+1, u64, undersize_pkts, "undersize_pkts", "Undersized packets") \ + m(+1, u64, oversize_pkts, "oversize_pkts", "Oversized packets") \ + m(+1, u64, fragments, "fragments", "Fragments") \ + m(+1, u64, jabbers, "jabbers", "Jabbers") \ + m(+1, u64, collisions, "collisions", "Collisions") #define MLX5E_PPORT_RFC2819_STATS_DEBUG(m) \ - m(+1, u64 p64octets, "p64octets", "Bytes") \ - m(+1, u64 p65to127octets, "p65to127octets", "Bytes") \ - m(+1, u64 p128to255octets, "p128to255octets", "Bytes") \ - m(+1, u64 p256to511octets, "p256to511octets", "Bytes") \ - m(+1, u64 p512to1023octets, "p512to1023octets", "Bytes") \ - m(+1, u64 p1024to1518octets, "p1024to1518octets", "Bytes") \ - m(+1, u64 p1519to2047octets, "p1519to2047octets", "Bytes") \ - m(+1, u64 p2048to4095octets, "p2048to4095octets", "Bytes") \ - m(+1, u64 p4096to8191octets, "p4096to8191octets", "Bytes") \ - m(+1, u64 p8192to10239octets, "p8192to10239octets", "Bytes") + m(+1, u64, p64octets, "p64octets", "Bytes") \ + m(+1, u64, p65to127octets, "p65to127octets", "Bytes") \ + m(+1, u64, p128to255octets, "p128to255octets", "Bytes") \ + m(+1, u64, p256to511octets, "p256to511octets", "Bytes") \ + m(+1, u64, p512to1023octets, "p512to1023octets", "Bytes") \ + m(+1, u64, p1024to1518octets, "p1024to1518octets", "Bytes") \ + m(+1, u64, p1519to2047octets, "p1519to2047octets", "Bytes") \ + m(+1, u64, p2048to4095octets, "p2048to4095octets", "Bytes") \ + m(+1, u64, p4096to8191octets, "p4096to8191octets", "Bytes") \ + m(+1, u64, p8192to10239octets, "p8192to10239octets", "Bytes") #define MLX5E_PPORT_RFC2863_STATS_DEBUG(m) \ - m(+1, u64 in_octets, "in_octets", "In octets") \ - m(+1, u64 in_ucast_pkts, "in_ucast_pkts", "In unicast packets") \ - m(+1, u64 in_discards, "in_discards", "In discards") \ - m(+1, u64 in_errors, "in_errors", "In errors") \ - m(+1, u64 in_unknown_protos, "in_unknown_protos", "In unknown protocols") \ - m(+1, u64 out_octets, "out_octets", "Out octets") \ - m(+1, u64 out_ucast_pkts, "out_ucast_pkts", "Out unicast packets") \ - m(+1, u64 out_discards, "out_discards", "Out discards") \ - m(+1, u64 out_errors, "out_errors", "Out errors") \ - m(+1, u64 in_multicast_pkts, "in_multicast_pkts", "In multicast packets") \ - m(+1, u64 in_broadcast_pkts, "in_broadcast_pkts", "In broadcast packets") \ - m(+1, u64 out_multicast_pkts, "out_multicast_pkts", "Out multicast packets") \ - m(+1, u64 out_broadcast_pkts, "out_broadcast_pkts", "Out broadcast packets") + m(+1, u64, in_octets, "in_octets", "In octets") \ + m(+1, u64, in_ucast_pkts, "in_ucast_pkts", "In unicast packets") \ + m(+1, u64, in_discards, "in_discards", "In discards") \ + m(+1, u64, in_errors, "in_errors", "In errors") \ + m(+1, u64, in_unknown_protos, "in_unknown_protos", "In unknown protocols") \ + m(+1, u64, out_octets, "out_octets", "Out octets") \ + m(+1, u64, out_ucast_pkts, "out_ucast_pkts", "Out unicast packets") \ + m(+1, u64, out_discards, "out_discards", "Out discards") \ + m(+1, u64, out_errors, "out_errors", "Out errors") \ + m(+1, u64, in_multicast_pkts, "in_multicast_pkts", "In multicast packets") \ + m(+1, u64, in_broadcast_pkts, "in_broadcast_pkts", "In broadcast packets") \ + m(+1, u64, out_multicast_pkts, "out_multicast_pkts", "Out multicast packets") \ + m(+1, u64, out_broadcast_pkts, "out_broadcast_pkts", "Out broadcast packets") #define MLX5E_PPORT_ETHERNET_EXTENDED_STATS_DEBUG(m) \ - m(+1, u64 port_transmit_wait_high, "port_transmit_wait_high", "Port transmit wait high") \ - m(+1, u64 ecn_marked, "ecn_marked", "ECN marked") \ - m(+1, u64 no_buffer_discard_mc, "no_buffer_discard_mc", "No buffer discard mc") \ - m(+1, u64 rx_ebp, "rx_ebp", "RX EBP") \ - m(+1, u64 tx_ebp, "tx_ebp", "TX EBP") \ - m(+1, u64 rx_buffer_almost_full, "rx_buffer_almost_full", "RX buffer almost full") \ - m(+1, u64 rx_buffer_full, "rx_buffer_full", "RX buffer full") \ - m(+1, u64 rx_icrc_encapsulated, "rx_icrc_encapsulated", "RX ICRC encapsulated") \ - m(+1, u64 ex_reserved_0, "ex_reserved_0", "Reserved") \ - m(+1, u64 ex_reserved_1, "ex_reserved_1", "Reserved") \ - m(+1, u64 tx_stat_p64octets, "tx_stat_p64octets", "Bytes") \ - m(+1, u64 tx_stat_p65to127octets, "tx_stat_p65to127octets", "Bytes") \ - m(+1, u64 tx_stat_p128to255octets, "tx_stat_p128to255octets", "Bytes") \ - m(+1, u64 tx_stat_p256to511octets, "tx_stat_p256to511octets", "Bytes") \ - m(+1, u64 tx_stat_p512to1023octets, "tx_stat_p512to1023octets", "Bytes") \ - m(+1, u64 tx_stat_p1024to1518octets, "tx_stat_p1024to1518octets", "Bytes") \ - m(+1, u64 tx_stat_p1519to2047octets, "tx_stat_p1519to2047octets", "Bytes") \ - m(+1, u64 tx_stat_p2048to4095octets, "tx_stat_p2048to4095octets", "Bytes") \ - m(+1, u64 tx_stat_p4096to8191octets, "tx_stat_p4096to8191octets", "Bytes") \ - m(+1, u64 tx_stat_p8192to10239octets, "tx_stat_p8192to10239octets", "Bytes") + m(+1, u64, port_transmit_wait_high, "port_transmit_wait_high", "Port transmit wait high") \ + m(+1, u64, ecn_marked, "ecn_marked", "ECN marked") \ + m(+1, u64, no_buffer_discard_mc, "no_buffer_discard_mc", "No buffer discard mc") \ + m(+1, u64, rx_ebp, "rx_ebp", "RX EBP") \ + m(+1, u64, tx_ebp, "tx_ebp", "TX EBP") \ + m(+1, u64, rx_buffer_almost_full, "rx_buffer_almost_full", "RX buffer almost full") \ + m(+1, u64, rx_buffer_full, "rx_buffer_full", "RX buffer full") \ + m(+1, u64, rx_icrc_encapsulated, "rx_icrc_encapsulated", "RX ICRC encapsulated") \ + m(+1, u64, ex_reserved_0, "ex_reserved_0", "Reserved") \ + m(+1, u64, ex_reserved_1, "ex_reserved_1", "Reserved") \ + m(+1, u64, tx_stat_p64octets, "tx_stat_p64octets", "Bytes") \ + m(+1, u64, tx_stat_p65to127octets, "tx_stat_p65to127octets", "Bytes") \ + m(+1, u64, tx_stat_p128to255octets, "tx_stat_p128to255octets", "Bytes") \ + m(+1, u64, tx_stat_p256to511octets, "tx_stat_p256to511octets", "Bytes") \ + m(+1, u64, tx_stat_p512to1023octets, "tx_stat_p512to1023octets", "Bytes") \ + m(+1, u64, tx_stat_p1024to1518octets, "tx_stat_p1024to1518octets", "Bytes") \ + m(+1, u64, tx_stat_p1519to2047octets, "tx_stat_p1519to2047octets", "Bytes") \ + m(+1, u64, tx_stat_p2048to4095octets, "tx_stat_p2048to4095octets", "Bytes") \ + m(+1, u64, tx_stat_p4096to8191octets, "tx_stat_p4096to8191octets", "Bytes") \ + m(+1, u64, tx_stat_p8192to10239octets, "tx_stat_p8192to10239octets", "Bytes") -#define MLX5E_PPORT_PHYSICAL_LAYER_STATS_DEBUG(m) \ - m(+1, u64 time_since_last_clear, "time_since_last_clear", \ - "Time since the last counters clear event (msec)") \ - m(+1, u64 symbol_errors, "symbol_errors", "Symbol errors") \ - m(+1, u64 sync_headers_errors, "sync_headers_errors", "Sync header error counter") \ - m(+1, u64 bip_errors_lane0, "edpl_bip_errors_lane0", \ - "Indicates the number of PRBS errors on lane 0") \ - m(+1, u64 bip_errors_lane1, "edpl_bip_errors_lane1", \ - "Indicates the number of PRBS errors on lane 1") \ - m(+1, u64 bip_errors_lane2, "edpl_bip_errors_lane2", \ - "Indicates the number of PRBS errors on lane 2") \ - m(+1, u64 bip_errors_lane3, "edpl_bip_errors_lane3", \ - "Indicates the number of PRBS errors on lane 3") \ - m(+1, u64 fc_corrected_blocks_lane0, "fc_corrected_blocks_lane0", \ - "FEC correctable block counter lane 0") \ - m(+1, u64 fc_corrected_blocks_lane1, "fc_corrected_blocks_lane1", \ - "FEC correctable block counter lane 1") \ - m(+1, u64 fc_corrected_blocks_lane2, "fc_corrected_blocks_lane2", \ - "FEC correctable block counter lane 2") \ - m(+1, u64 fc_corrected_blocks_lane3, "fc_corrected_blocks_lane3", \ - "FEC correctable block counter lane 3") \ - m(+1, u64 rs_corrected_blocks, "rs_corrected_blocks", \ - "FEC correcable block counter") \ - m(+1, u64 rs_uncorrectable_blocks, "rs_uncorrectable_blocks", \ - "FEC uncorrecable block counter") \ - m(+1, u64 rs_no_errors_blocks, "rs_no_errors_blocks", \ - "The number of RS-FEC blocks received that had no errors") \ - m(+1, u64 rs_single_error_blocks, "rs_single_error_blocks", \ - "The number of corrected RS-FEC blocks received that had" \ - "exactly 1 error symbol") \ - m(+1, u64 rs_corrected_symbols_total, "rs_corrected_symbols_total", \ - "Port FEC corrected symbol counter") \ - m(+1, u64 rs_corrected_symbols_lane0, "rs_corrected_symbols_lane0", \ - "FEC corrected symbol counter lane 0") \ - m(+1, u64 rs_corrected_symbols_lane1, "rs_corrected_symbols_lane1", \ - "FEC corrected symbol counter lane 1") \ - m(+1, u64 rs_corrected_symbols_lane2, "rs_corrected_symbols_lane2", \ - "FEC corrected symbol counter lane 2") \ - m(+1, u64 rs_corrected_symbols_lane3, "rs_corrected_symbols_lane3", \ - "FEC corrected symbol counter lane 3") +#define MLX5E_PPORT_PHYSICAL_LAYER_STATS_DEBUG(m) \ + m(+1, u64, time_since_last_clear, "time_since_last_clear", \ + "Time since the last counters clear event (msec)") \ + m(+1, u64, symbol_errors, "symbol_errors", "Symbol errors") \ + m(+1, u64, sync_headers_errors, "sync_headers_errors", \ + "Sync header error counter") \ + m(+1, u64, bip_errors_lane0, "edpl_bip_errors_lane0", \ + "Indicates the number of PRBS errors on lane 0") \ + m(+1, u64, bip_errors_lane1, "edpl_bip_errors_lane1", \ + "Indicates the number of PRBS errors on lane 1") \ + m(+1, u64, bip_errors_lane2, "edpl_bip_errors_lane2", \ + "Indicates the number of PRBS errors on lane 2") \ + m(+1, u64, bip_errors_lane3, "edpl_bip_errors_lane3", \ + "Indicates the number of PRBS errors on lane 3") \ + m(+1, u64, fc_corrected_blocks_lane0, "fc_corrected_blocks_lane0", \ + "FEC correctable block counter lane 0") \ + m(+1, u64, fc_corrected_blocks_lane1, "fc_corrected_blocks_lane1", \ + "FEC correctable block counter lane 1") \ + m(+1, u64, fc_corrected_blocks_lane2, "fc_corrected_blocks_lane2", \ + "FEC correctable block counter lane 2") \ + m(+1, u64, fc_corrected_blocks_lane3, "fc_corrected_blocks_lane3", \ + "FEC correctable block counter lane 3") \ + m(+1, u64, rs_corrected_blocks, "rs_corrected_blocks", \ + "FEC correcable block counter") \ + m(+1, u64, rs_uncorrectable_blocks, "rs_uncorrectable_blocks", \ + "FEC uncorrecable block counter") \ + m(+1, u64, rs_no_errors_blocks, "rs_no_errors_blocks", \ + "The number of RS-FEC blocks received that had no errors") \ + m(+1, u64, rs_single_error_blocks, "rs_single_error_blocks", \ + "The number of corrected RS-FEC blocks received that had" \ + "exactly 1 error symbol") \ + m(+1, u64, rs_corrected_symbols_total, "rs_corrected_symbols_total", \ + "Port FEC corrected symbol counter") \ + m(+1, u64, rs_corrected_symbols_lane0, "rs_corrected_symbols_lane0", \ + "FEC corrected symbol counter lane 0") \ + m(+1, u64, rs_corrected_symbols_lane1, "rs_corrected_symbols_lane1", \ + "FEC corrected symbol counter lane 1") \ + m(+1, u64, rs_corrected_symbols_lane2, "rs_corrected_symbols_lane2", \ + "FEC corrected symbol counter lane 2") \ + m(+1, u64, rs_corrected_symbols_lane3, "rs_corrected_symbols_lane3", \ + "FEC corrected symbol counter lane 3") /* Per priority statistics for PFC */ #define MLX5E_PPORT_PER_PRIO_STATS_SUB(m,n,p) \ @@ -347,7 +348,7 @@ struct mlx5e_vport_stats { "device_stall_critical_watermark", "Device stall critical watermark") #define MLX5E_PPORT_PER_PRIO_STATS_PREFIX(m,p,c,t,f,s,d) \ - m(c, t pri_##p##_##f, "prio" #p "_" s, "Priority " #p " - " d) + m(c, t, pri_##p##_##f, "prio" #p "_" s, "Priority " #p " - " d) #define MLX5E_PPORT_PER_PRIO_STATS_NUM_PRIO 8 @@ -409,14 +410,14 @@ struct mlx5e_port_stats_debug { }; #define MLX5E_RQ_STATS(m) \ - m(+1, u64 packets, "packets", "Received packets") \ - m(+1, u64 bytes, "bytes", "Received bytes") \ - m(+1, u64 csum_none, "csum_none", "Received packets") \ - m(+1, u64 lro_packets, "lro_packets", "Received LRO packets") \ - m(+1, u64 lro_bytes, "lro_bytes", "Received LRO bytes") \ - m(+1, u64 sw_lro_queued, "sw_lro_queued", "Packets queued for SW LRO") \ - m(+1, u64 sw_lro_flushed, "sw_lro_flushed", "Packets flushed from SW LRO") \ - m(+1, u64 wqe_err, "wqe_err", "Received packets") + m(+1, u64, packets, "packets", "Received packets") \ + m(+1, u64, bytes, "bytes", "Received bytes") \ + m(+1, u64, csum_none, "csum_none", "Received packets") \ + m(+1, u64, lro_packets, "lro_packets", "Received LRO packets") \ + m(+1, u64, lro_bytes, "lro_bytes", "Received LRO bytes") \ + m(+1, u64, sw_lro_queued, "sw_lro_queued", "Packets queued for SW LRO") \ + m(+1, u64, sw_lro_flushed, "sw_lro_flushed", "Packets flushed from SW LRO") \ + m(+1, u64, wqe_err, "wqe_err", "Received packets") #define MLX5E_RQ_STATS_NUM (0 MLX5E_RQ_STATS(MLX5E_STATS_COUNT)) @@ -427,14 +428,14 @@ struct mlx5e_rq_stats { }; #define MLX5E_SQ_STATS(m) \ - m(+1, u64 packets, "packets", "Transmitted packets") \ - m(+1, u64 bytes, "bytes", "Transmitted bytes") \ - m(+1, u64 tso_packets, "tso_packets", "Transmitted packets") \ - m(+1, u64 tso_bytes, "tso_bytes", "Transmitted bytes") \ - m(+1, u64 csum_offload_none, "csum_offload_none", "Transmitted packets") \ - m(+1, u64 defragged, "defragged", "Transmitted packets") \ - m(+1, u64 dropped, "dropped", "Transmitted packets") \ - m(+1, u64 nop, "nop", "Transmitted packets") + m(+1, u64, packets, "packets", "Transmitted packets") \ + m(+1, u64, bytes, "bytes", "Transmitted bytes") \ + m(+1, u64, tso_packets, "tso_packets", "Transmitted packets") \ + m(+1, u64, tso_bytes, "tso_bytes", "Transmitted bytes") \ + m(+1, u64, csum_offload_none, "csum_offload_none", "Transmitted packets") \ + m(+1, u64, defragged, "defragged", "Transmitted packets") \ + m(+1, u64, dropped, "dropped", "Transmitted packets") \ + m(+1, u64, nop, "nop", "Transmitted packets") #define MLX5E_SQ_STATS_NUM (0 MLX5E_SQ_STATS(MLX5E_STATS_COUNT)) @@ -492,32 +493,31 @@ struct mlx5e_params { }; #define MLX5E_PARAMS(m) \ - m(+1, u64 tx_queue_size_max, "tx_queue_size_max", "Max send queue size") \ - m(+1, u64 rx_queue_size_max, "rx_queue_size_max", "Max receive queue size") \ - m(+1, u64 tx_queue_size, "tx_queue_size", "Default send queue size") \ - m(+1, u64 rx_queue_size, "rx_queue_size", "Default receive queue size") \ - m(+1, u64 channels, "channels", "Default number of channels") \ - m(+1, u64 channels_rsss, "channels_rsss", "Default channels receive side scaling stride") \ - m(+1, u64 coalesce_usecs_max, "coalesce_usecs_max", "Maximum usecs for joining packets") \ - m(+1, u64 coalesce_pkts_max, "coalesce_pkts_max", "Maximum packets to join") \ - m(+1, u64 rx_coalesce_usecs, "rx_coalesce_usecs", "Limit in usec for joining rx packets") \ - m(+1, u64 rx_coalesce_pkts, "rx_coalesce_pkts", "Maximum number of rx packets to join") \ - m(+1, u64 rx_coalesce_mode, "rx_coalesce_mode", "0: EQE fixed mode 1: CQE fixed mode 2: EQE auto mode 3: CQE auto mode") \ - m(+1, u64 tx_coalesce_usecs, "tx_coalesce_usecs", "Limit in usec for joining tx packets") \ - m(+1, u64 tx_coalesce_pkts, "tx_coalesce_pkts", "Maximum number of tx packets to join") \ - m(+1, u64 tx_coalesce_mode, "tx_coalesce_mode", "0: EQE mode 1: CQE mode") \ - m(+1, u64 tx_completion_fact, "tx_completion_fact", "1..MAX: Completion event ratio") \ - m(+1, u64 tx_completion_fact_max, "tx_completion_fact_max", "Maximum completion event ratio") \ - m(+1, u64 hw_lro, "hw_lro", "set to enable hw_lro") \ - m(+1, u64 cqe_zipping, "cqe_zipping", "0 : CQE zipping disabled") \ - m(+1, u64 modify_tx_dma, "modify_tx_dma", "0: Enable TX 1: Disable TX") \ - m(+1, u64 modify_rx_dma, "modify_rx_dma", "0: Enable RX 1: Disable RX") \ - m(+1, u64 diag_pci_enable, "diag_pci_enable", "0: Disabled 1: Enabled") \ - m(+1, u64 diag_general_enable, "diag_general_enable", "0: Disabled 1: Enabled") \ - m(+1, u64 hw_mtu, "hw_mtu", "Current hardware MTU value") \ - m(+1, u64 mc_local_lb, "mc_local_lb", "0: Local multicast loopback enabled 1: Disabled") \ - m(+1, u64 uc_local_lb, "uc_local_lb", "0: Local unicast loopback enabled 1: Disabled") - + m(+1, u64, tx_queue_size_max, "tx_queue_size_max", "Max send queue size") \ + m(+1, u64, rx_queue_size_max, "rx_queue_size_max", "Max receive queue size") \ + m(+1, u64, tx_queue_size, "tx_queue_size", "Default send queue size") \ + m(+1, u64, rx_queue_size, "rx_queue_size", "Default receive queue size") \ + m(+1, u64, channels, "channels", "Default number of channels") \ + m(+1, u64, channels_rsss, "channels_rsss", "Default channels receive side scaling stride") \ + m(+1, u64, coalesce_usecs_max, "coalesce_usecs_max", "Maximum usecs for joining packets") \ + m(+1, u64, coalesce_pkts_max, "coalesce_pkts_max", "Maximum packets to join") \ + m(+1, u64, rx_coalesce_usecs, "rx_coalesce_usecs", "Limit in usec for joining rx packets") \ + m(+1, u64, rx_coalesce_pkts, "rx_coalesce_pkts", "Maximum number of rx packets to join") \ + m(+1, u64, rx_coalesce_mode, "rx_coalesce_mode", "0: EQE fixed mode 1: CQE fixed mode 2: EQE auto mode 3: CQE auto mode") \ + m(+1, u64, tx_coalesce_usecs, "tx_coalesce_usecs", "Limit in usec for joining tx packets") \ + m(+1, u64, tx_coalesce_pkts, "tx_coalesce_pkts", "Maximum number of tx packets to join") \ + m(+1, u64, tx_coalesce_mode, "tx_coalesce_mode", "0: EQE mode 1: CQE mode") \ + m(+1, u64, tx_completion_fact, "tx_completion_fact", "1..MAX: Completion event ratio") \ + m(+1, u64, tx_completion_fact_max, "tx_completion_fact_max", "Maximum completion event ratio") \ + m(+1, u64, hw_lro, "hw_lro", "set to enable hw_lro") \ + m(+1, u64, cqe_zipping, "cqe_zipping", "0 : CQE zipping disabled") \ + m(+1, u64, modify_tx_dma, "modify_tx_dma", "0: Enable TX 1: Disable TX") \ + m(+1, u64, modify_rx_dma, "modify_rx_dma", "0: Enable RX 1: Disable RX") \ + m(+1, u64, diag_pci_enable, "diag_pci_enable", "0: Disabled 1: Enabled") \ + m(+1, u64, diag_general_enable, "diag_general_enable", "0: Disabled 1: Enabled") \ + m(+1, u64, hw_mtu, "hw_mtu", "Current hardware MTU value") \ + m(+1, u64, mc_local_lb, "mc_local_lb", "0: Local multicast loopback enabled 1: Disabled") \ + m(+1, u64, uc_local_lb, "uc_local_lb", "0: Local unicast loopback enabled 1: Disabled") #define MLX5E_PARAMS_NUM (0 MLX5E_PARAMS(MLX5E_STATS_COUNT)) From owner-svn-src-stable@freebsd.org Thu May 16 18:16:58 2019 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id B2FB115A32BF; Thu, 16 May 2019 18:16:58 +0000 (UTC) (envelope-from hselasky@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 5763E6D6F6; Thu, 16 May 2019 18:16:58 +0000 (UTC) (envelope-from hselasky@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 2FA5024866; Thu, 16 May 2019 18:16:58 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x4GIGwqr034077; Thu, 16 May 2019 18:16:58 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x4GIGvpU034076; Thu, 16 May 2019 18:16:57 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201905161816.x4GIGvpU034076@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Thu, 16 May 2019 18:16:57 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r347865 - stable/11/sys/dev/mlx5/mlx5_en X-SVN-Group: stable-11 X-SVN-Commit-Author: hselasky X-SVN-Commit-Paths: stable/11/sys/dev/mlx5/mlx5_en X-SVN-Commit-Revision: 347865 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 5763E6D6F6 X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.97 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.998,0]; NEURAL_HAM_SHORT(-0.98)[-0.977,0]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US] X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 16 May 2019 18:16:58 -0000 Author: hselasky Date: Thu May 16 18:16:57 2019 New Revision: 347865 URL: https://svnweb.freebsd.org/changeset/base/347865 Log: MFC r347309: Add support for extended PCIe counters in mlx5en(4). Sponsored by: Mellanox Technologies Modified: stable/11/sys/dev/mlx5/mlx5_en/en.h stable/11/sys/dev/mlx5/mlx5_en/mlx5_en_main.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/dev/mlx5/mlx5_en/en.h ============================================================================== --- stable/11/sys/dev/mlx5/mlx5_en/en.h Thu May 16 18:16:08 2019 (r347864) +++ stable/11/sys/dev/mlx5/mlx5_en/en.h Thu May 16 18:16:57 2019 (r347865) @@ -362,6 +362,151 @@ struct mlx5e_vport_stats { MLX5E_PPORT_PER_PRIO_STATS_SUB(MLX5E_PPORT_PER_PRIO_STATS_PREFIX,m,6) \ MLX5E_PPORT_PER_PRIO_STATS_SUB(MLX5E_PPORT_PER_PRIO_STATS_PREFIX,m,7) +#define MLX5E_PCIE_PERFORMANCE_COUNTERS_64(m) \ + m(+1, u64, life_time_counter_high, "life_time_counter", \ + "Life time counter.", pcie_perf_counters) \ + m(+1, u64, tx_overflow_buffer_pkt, "tx_overflow_buffer_pkt", \ + "The number of packets dropped due to lack of PCIe buffers " \ + "in receive path from NIC port toward the hosts.", \ + pcie_perf_counters) \ + m(+1, u64, tx_overflow_buffer_marked_pkt, \ + "tx_overflow_buffer_marked_pkt", \ + "The number of packets marked due to lack of PCIe buffers " \ + "in receive path from NIC port toward the hosts.", \ + pcie_perf_counters) + +#define MLX5E_PCIE_PERFORMANCE_COUNTERS_32(m) \ + m(+1, u64, rx_errors, "rx_errors", \ + "Number of transitions to recovery due to Framing " \ + "errors and CRC errors.", pcie_perf_counters) \ + m(+1, u64, tx_errors, "tx_errors", "Number of transitions " \ + "to recovery due to EIEOS and TS errors.", pcie_perf_counters) \ + m(+1, u64, l0_to_recovery_eieos, "l0_to_recovery_eieos", "Number of " \ + "transitions to recovery due to getting EIEOS.", pcie_perf_counters)\ + m(+1, u64, l0_to_recovery_ts, "l0_to_recovery_ts", "Number of " \ + "transitions to recovery due to getting TS.", pcie_perf_counters) \ + m(+1, u64, l0_to_recovery_framing, "l0_to_recovery_framing", "Number "\ + "of transitions to recovery due to identifying framing " \ + "errors at gen3/4.", pcie_perf_counters) \ + m(+1, u64, l0_to_recovery_retrain, "l0_to_recovery_retrain", \ + "Number of transitions to recovery due to link retrain request " \ + "from data link.", pcie_perf_counters) \ + m(+1, u64, crc_error_dllp, "crc_error_dllp", "Number of transitions " \ + "to recovery due to identifying CRC DLLP errors.", \ + pcie_perf_counters) \ + m(+1, u64, crc_error_tlp, "crc_error_tlp", "Number of transitions to "\ + "recovery due to identifying CRC TLP errors.", pcie_perf_counters) \ + m(+1, u64, outbound_stalled_reads, "outbound_stalled_reads", \ + "The percentage of time within the last second that the NIC had " \ + "outbound non-posted read requests but could not perform the " \ + "operation due to insufficient non-posted credits.", \ + pcie_perf_counters) \ + m(+1, u64, outbound_stalled_writes, "outbound_stalled_writes", \ + "The percentage of time within the last second that the NIC had " \ + "outbound posted writes requests but could not perform the " \ + "operation due to insufficient posted credits.", \ + pcie_perf_counters) \ + m(+1, u64, outbound_stalled_reads_events, \ + "outbound_stalled_reads_events", "The number of events where " \ + "outbound_stalled_reads was above a threshold.", \ + pcie_perf_counters) \ + m(+1, u64, outbound_stalled_writes_events, \ + "outbound_stalled_writes_events", \ + "The number of events where outbound_stalled_writes was above " \ + "a threshold.", pcie_perf_counters) + +#define MLX5E_PCIE_TIMERS_AND_STATES_COUNTERS_32(m) \ + m(+1, u64, time_to_boot_image_start, "time_to_boot_image_start", \ + "Time from start until FW boot image starts running in usec.", \ + pcie_timers_states) \ + m(+1, u64, time_to_link_image, "time_to_link_image", \ + "Time from start until FW pci_link image starts running in usec.", \ + pcie_timers_states) \ + m(+1, u64, calibration_time, "calibration_time", \ + "Time it took FW to do calibration in usec.", \ + pcie_timers_states) \ + m(+1, u64, time_to_first_perst, "time_to_first_perst", \ + "Time form start until FW handle first perst. in usec.", \ + pcie_timers_states) \ + m(+1, u64, time_to_detect_state, "time_to_detect_state", \ + "Time from start until first transition to LTSSM.Detect_Q in usec", \ + pcie_timers_states) \ + m(+1, u64, time_to_l0, "time_to_l0", \ + "Time from start until first transition to LTSSM.L0 in usec", \ + pcie_timers_states) \ + m(+1, u64, time_to_crs_en, "time_to_crs_en", \ + "Time from start until crs is enabled in usec", \ + pcie_timers_states) \ + m(+1, u64, time_to_plastic_image_start, "time_to_plastic_image_start",\ + "Time form start until FW plastic image starts running in usec.", \ + pcie_timers_states) \ + m(+1, u64, time_to_iron_image_start, "time_to_iron_image_start", \ + "Time form start until FW iron image starts running in usec.", \ + pcie_timers_states) \ + m(+1, u64, perst_handler, "perst_handler", \ + "Number of persts arrived.", pcie_timers_states) \ + m(+1, u64, times_in_l1, "times_in_l1", \ + "Number of times LTSSM entered L1 flow.", pcie_timers_states) \ + m(+1, u64, times_in_l23, "times_in_l23", \ + "Number of times LTSSM entered L23 flow.", pcie_timers_states) \ + m(+1, u64, dl_down, "dl_down", \ + "Number of moves for DL_active to DL_down.", pcie_timers_states) \ + m(+1, u64, config_cycle1usec, "config_cycle1usec", \ + "Number of configuration requests that firmware " \ + "handled in less than 1 usec.", pcie_timers_states) \ + m(+1, u64, config_cycle2to7usec, "config_cycle2to7usec", \ + "Number of configuration requests that firmware " \ + "handled within 2 to 7 usec.", pcie_timers_states) \ + m(+1, u64, config_cycle8to15usec, "config_cycle8to15usec", \ + "Number of configuration requests that firmware " \ + "handled within 8 to 15 usec.", pcie_timers_states) \ + m(+1, u64, config_cycle16to63usec, "config_cycle16to63usec", \ + "Number of configuration requests that firmware " \ + "handled within 16 to 63 usec.", pcie_timers_states) \ + m(+1, u64, config_cycle64usec, "config_cycle64usec", \ + "Number of configuration requests that firmware " \ + "handled took more than 64 usec.", pcie_timers_states) \ + m(+1, u64, correctable_err_msg_sent, "correctable_err_msg_sent", \ + "Number of correctable error messages sent.", pcie_timers_states) \ + m(+1, u64, non_fatal_err_msg_sent, "non_fatal_err_msg_sent", \ + "Number of non-Fatal error msg sent.", pcie_timers_states) \ + m(+1, u64, fatal_err_msg_sent, "fatal_err_msg_sent", \ + "Number of fatal error msg sent.", pcie_timers_states) + +#define MLX5E_PCIE_LANE_COUNTERS_32(m) \ + m(+1, u64, error_counter_lane0, "error_counter_lane0", \ + "Error counter for PCI lane 0", pcie_lanes_counters) \ + m(+1, u64, error_counter_lane1, "error_counter_lane1", \ + "Error counter for PCI lane 1", pcie_lanes_counters) \ + m(+1, u64, error_counter_lane2, "error_counter_lane2", \ + "Error counter for PCI lane 2", pcie_lanes_counters) \ + m(+1, u64, error_counter_lane3, "error_counter_lane3", \ + "Error counter for PCI lane 3", pcie_lanes_counters) \ + m(+1, u64, error_counter_lane4, "error_counter_lane4", \ + "Error counter for PCI lane 4", pcie_lanes_counters) \ + m(+1, u64, error_counter_lane5, "error_counter_lane5", \ + "Error counter for PCI lane 5", pcie_lanes_counters) \ + m(+1, u64, error_counter_lane6, "error_counter_lane6", \ + "Error counter for PCI lane 6", pcie_lanes_counters) \ + m(+1, u64, error_counter_lane7, "error_counter_lane7", \ + "Error counter for PCI lane 7", pcie_lanes_counters) \ + m(+1, u64, error_counter_lane8, "error_counter_lane8", \ + "Error counter for PCI lane 8", pcie_lanes_counters) \ + m(+1, u64, error_counter_lane9, "error_counter_lane9", \ + "Error counter for PCI lane 9", pcie_lanes_counters) \ + m(+1, u64, error_counter_lane10, "error_counter_lane10", \ + "Error counter for PCI lane 10", pcie_lanes_counters) \ + m(+1, u64, error_counter_lane11, "error_counter_lane11", \ + "Error counter for PCI lane 11", pcie_lanes_counters) \ + m(+1, u64, error_counter_lane12, "error_counter_lane12", \ + "Error counter for PCI lane 12", pcie_lanes_counters) \ + m(+1, u64, error_counter_lane13, "error_counter_lane13", \ + "Error counter for PCI lane 13", pcie_lanes_counters) \ + m(+1, u64, error_counter_lane14, "error_counter_lane14", \ + "Error counter for PCI lane 14", pcie_lanes_counters) \ + m(+1, u64, error_counter_lane15, "error_counter_lane15", \ + "Error counter for PCI lane 15", pcie_lanes_counters) + /* * Make sure to update mlx5e_update_pport_counters() * when adding a new MLX5E_PPORT_STATS block @@ -375,7 +520,11 @@ struct mlx5e_vport_stats { MLX5E_PPORT_RFC2819_STATS_DEBUG(m) \ MLX5E_PPORT_RFC2863_STATS_DEBUG(m) \ MLX5E_PPORT_PHYSICAL_LAYER_STATS_DEBUG(m) \ - MLX5E_PPORT_ETHERNET_EXTENDED_STATS_DEBUG(m) + MLX5E_PPORT_ETHERNET_EXTENDED_STATS_DEBUG(m) \ + MLX5E_PCIE_PERFORMANCE_COUNTERS_64(m) \ + MLX5E_PCIE_PERFORMANCE_COUNTERS_32(m) \ + MLX5E_PCIE_TIMERS_AND_STATES_COUNTERS_32(m) \ + MLX5E_PCIE_LANE_COUNTERS_32(m) #define MLX5E_PPORT_IEEE802_3_STATS_NUM \ (0 MLX5E_PPORT_IEEE802_3_STATS(MLX5E_STATS_COUNT)) Modified: stable/11/sys/dev/mlx5/mlx5_en/mlx5_en_main.c ============================================================================== --- stable/11/sys/dev/mlx5/mlx5_en/mlx5_en_main.c Thu May 16 18:16:08 2019 (r347864) +++ stable/11/sys/dev/mlx5/mlx5_en/mlx5_en_main.c Thu May 16 18:16:57 2019 (r347865) @@ -650,6 +650,56 @@ mlx5e_update_carrier_work(struct work_struct *work) PRIV_UNLOCK(priv); } +#define MLX5E_PCIE_PERF_GET_64(a,b,c,d,e,f) \ + s_debug->c = MLX5_GET64(mpcnt_reg, out, counter_set.f.c); + +#define MLX5E_PCIE_PERF_GET_32(a,b,c,d,e,f) \ + s_debug->c = MLX5_GET(mpcnt_reg, out, counter_set.f.c); + +static void +mlx5e_update_pcie_counters(struct mlx5e_priv *priv) +{ + struct mlx5_core_dev *mdev = priv->mdev; + struct mlx5e_port_stats_debug *s_debug = &priv->stats.port_stats_debug; + const unsigned sz = MLX5_ST_SZ_BYTES(mpcnt_reg); + void *out; + void *in; + int err; + + /* allocate firmware request structures */ + in = mlx5_vzalloc(sz); + out = mlx5_vzalloc(sz); + if (in == NULL || out == NULL) + goto free_out; + + MLX5_SET(mpcnt_reg, in, grp, MLX5_PCIE_PERFORMANCE_COUNTERS_GROUP); + err = mlx5_core_access_reg(mdev, in, sz, out, sz, MLX5_REG_MPCNT, 0, 0); + if (err != 0) + goto free_out; + + MLX5E_PCIE_PERFORMANCE_COUNTERS_64(MLX5E_PCIE_PERF_GET_64) + MLX5E_PCIE_PERFORMANCE_COUNTERS_32(MLX5E_PCIE_PERF_GET_32) + + MLX5_SET(mpcnt_reg, in, grp, MLX5_PCIE_TIMERS_AND_STATES_COUNTERS_GROUP); + err = mlx5_core_access_reg(mdev, in, sz, out, sz, MLX5_REG_MPCNT, 0, 0); + if (err != 0) + goto free_out; + + MLX5E_PCIE_TIMERS_AND_STATES_COUNTERS_32(MLX5E_PCIE_PERF_GET_32) + + MLX5_SET(mpcnt_reg, in, grp, MLX5_PCIE_LANE_COUNTERS_GROUP); + err = mlx5_core_access_reg(mdev, in, sz, out, sz, MLX5_REG_MPCNT, 0, 0); + if (err != 0) + goto free_out; + + MLX5E_PCIE_LANE_COUNTERS_32(MLX5E_PCIE_PERF_GET_32) + +free_out: + /* free firmware request structures */ + kvfree(in); + kvfree(out); +} + /* * This function reads the physical port counters from the firmware * using a pre-defined layout defined by various MLX5E_PPORT_XXX() @@ -696,6 +746,7 @@ mlx5e_update_pport_counters(struct mlx5e_priv *priv) mlx5_core_access_reg(mdev, in, sz, out, sz, MLX5_REG_PPCNT, 0, 0); for (x = 0; x != MLX5E_PPORT_RFC2819_STATS_NUM; x++, y++) s->arg[y] = be64toh(ptr[x]); + for (y = 0; x != MLX5E_PPORT_RFC2819_STATS_NUM + MLX5E_PPORT_RFC2819_STATS_DEBUG_NUM; x++, y++) s_debug->arg[y] = be64toh(ptr[x]); @@ -717,6 +768,9 @@ mlx5e_update_pport_counters(struct mlx5e_priv *priv) mlx5_core_access_reg(mdev, in, sz, out, sz, MLX5_REG_PPCNT, 0, 0); for (x = 0; x != MLX5E_PPORT_ETHERNET_EXTENDED_STATS_DEBUG_NUM; x++, y++) s_debug->arg[y] = be64toh(ptr[x]); + + /* read PCIE counters */ + mlx5e_update_pcie_counters(priv); /* read per-priority counters */ MLX5_SET(ppcnt_reg, in, grp, MLX5_PER_PRIORITY_COUNTERS_GROUP); From owner-svn-src-stable@freebsd.org Thu May 16 18:17:40 2019 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 1C30615A333A; Thu, 16 May 2019 18:17:40 +0000 (UTC) (envelope-from hselasky@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 B57766D859; Thu, 16 May 2019 18:17:39 +0000 (UTC) (envelope-from hselasky@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 8ECD524867; Thu, 16 May 2019 18:17:39 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x4GIHdGx034166; Thu, 16 May 2019 18:17:39 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x4GIHdaB034164; Thu, 16 May 2019 18:17:39 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201905161817.x4GIHdaB034164@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Thu, 16 May 2019 18:17:39 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r347866 - stable/11/sys/dev/mlx5/mlx5_en X-SVN-Group: stable-11 X-SVN-Commit-Author: hselasky X-SVN-Commit-Paths: stable/11/sys/dev/mlx5/mlx5_en X-SVN-Commit-Revision: 347866 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: B57766D859 X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.97 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.998,0]; NEURAL_HAM_SHORT(-0.98)[-0.975,0]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US] X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 16 May 2019 18:17:40 -0000 Author: hselasky Date: Thu May 16 18:17:38 2019 New Revision: 347866 URL: https://svnweb.freebsd.org/changeset/base/347866 Log: MFC r347310: Expose per-lane counters before correction mechanism in mlx5en(4). Sponsored by: Mellanox Technologies Modified: stable/11/sys/dev/mlx5/mlx5_en/en.h stable/11/sys/dev/mlx5/mlx5_en/mlx5_en_main.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/dev/mlx5/mlx5_en/en.h ============================================================================== --- stable/11/sys/dev/mlx5/mlx5_en/en.h Thu May 16 18:16:57 2019 (r347865) +++ stable/11/sys/dev/mlx5/mlx5_en/en.h Thu May 16 18:17:38 2019 (r347866) @@ -279,6 +279,24 @@ struct mlx5e_vport_stats { m(+1, u64, tx_stat_p4096to8191octets, "tx_stat_p4096to8191octets", "Bytes") \ m(+1, u64, tx_stat_p8192to10239octets, "tx_stat_p8192to10239octets", "Bytes") +#define MLX5E_PPORT_STATISTICAL_DEBUG(m) \ + m(+1, u64, phy_time_since_last_clear, "phy_time_since_last_clear", \ + "Time since last clear in milliseconds") \ + m(+1, u64, phy_received_bits, "phy_received_bits", \ + "Total amount of traffic received in bits before error correction") \ + m(+1, u64, phy_symbol_errors, "phy_symbol_errors", \ + "Total number of symbol errors before error correction") \ + m(+1, u64, phy_corrected_bits, "phy_corrected_bits", \ + "Total number of corrected bits ") \ + m(+1, u64, phy_corrected_bits_lane0, "phy_corrected_bits_lane0", \ + "Total number of corrected bits for lane 0") \ + m(+1, u64, phy_corrected_bits_lane1, "phy_corrected_bits_lane1", \ + "Total number of corrected bits for lane 1") \ + m(+1, u64, phy_corrected_bits_lane2, "phy_corrected_bits_lane2", \ + "Total number of corrected bits for lane 2") \ + m(+1, u64, phy_corrected_bits_lane3, "phy_corrected_bits_lane3", \ + "Total number of corrected bits for lane 3") + #define MLX5E_PPORT_PHYSICAL_LAYER_STATS_DEBUG(m) \ m(+1, u64, time_since_last_clear, "time_since_last_clear", \ "Time since the last counters clear event (msec)") \ @@ -521,6 +539,7 @@ struct mlx5e_vport_stats { MLX5E_PPORT_RFC2863_STATS_DEBUG(m) \ MLX5E_PPORT_PHYSICAL_LAYER_STATS_DEBUG(m) \ MLX5E_PPORT_ETHERNET_EXTENDED_STATS_DEBUG(m) \ + MLX5E_PPORT_STATISTICAL_DEBUG(m) \ MLX5E_PCIE_PERFORMANCE_COUNTERS_64(m) \ MLX5E_PCIE_PERFORMANCE_COUNTERS_32(m) \ MLX5E_PCIE_TIMERS_AND_STATES_COUNTERS_32(m) \ @@ -543,6 +562,8 @@ struct mlx5e_vport_stats { (0 MLX5E_PPORT_PHYSICAL_LAYER_STATS_DEBUG(MLX5E_STATS_COUNT)) #define MLX5E_PPORT_ETHERNET_EXTENDED_STATS_DEBUG_NUM \ (0 MLX5E_PPORT_ETHERNET_EXTENDED_STATS_DEBUG(MLX5E_STATS_COUNT)) +#define MLX5E_PPORT_STATISTICAL_DEBUG_NUM \ + (0 MLX5E_PPORT_STATISTICAL_DEBUG(MLX5E_STATS_COUNT)) #define MLX5E_PORT_STATS_DEBUG_NUM \ (0 MLX5E_PORT_STATS_DEBUG(MLX5E_STATS_COUNT)) Modified: stable/11/sys/dev/mlx5/mlx5_en/mlx5_en_main.c ============================================================================== --- stable/11/sys/dev/mlx5/mlx5_en/mlx5_en_main.c Thu May 16 18:16:57 2019 (r347865) +++ stable/11/sys/dev/mlx5/mlx5_en/mlx5_en_main.c Thu May 16 18:17:38 2019 (r347866) @@ -769,6 +769,18 @@ mlx5e_update_pport_counters(struct mlx5e_priv *priv) for (x = 0; x != MLX5E_PPORT_ETHERNET_EXTENDED_STATS_DEBUG_NUM; x++, y++) s_debug->arg[y] = be64toh(ptr[x]); + /* read Extended Statistical Group */ + if (MLX5_CAP_GEN(mdev, pcam_reg) && + MLX5_CAP_PCAM_FEATURE(mdev, ppcnt_statistical_group) && + MLX5_CAP_PCAM_FEATURE(mdev, per_lane_error_counters)) { + /* read Extended Statistical counter group using predefined counter layout */ + MLX5_SET(ppcnt_reg, in, grp, MLX5_PHYSICAL_LAYER_STATISTICAL_GROUP); + mlx5_core_access_reg(mdev, in, sz, out, sz, MLX5_REG_PPCNT, 0, 0); + + for (x = 0; x != MLX5E_PPORT_STATISTICAL_DEBUG_NUM; x++, y++) + s_debug->arg[y] = be64toh(ptr[x]); + } + /* read PCIE counters */ mlx5e_update_pcie_counters(priv); From owner-svn-src-stable@freebsd.org Thu May 16 18:18:23 2019 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 3B39715A3411; Thu, 16 May 2019 18:18:23 +0000 (UTC) (envelope-from hselasky@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 D2D9A6D9E0; Thu, 16 May 2019 18:18:22 +0000 (UTC) (envelope-from hselasky@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 AE87E24868; Thu, 16 May 2019 18:18:22 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x4GIIMYd034255; Thu, 16 May 2019 18:18:22 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x4GIIM1I034254; Thu, 16 May 2019 18:18:22 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201905161818.x4GIIM1I034254@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Thu, 16 May 2019 18:18:22 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r347867 - stable/11/contrib/ofed/libmlx5 X-SVN-Group: stable-11 X-SVN-Commit-Author: hselasky X-SVN-Commit-Paths: stable/11/contrib/ofed/libmlx5 X-SVN-Commit-Revision: 347867 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: D2D9A6D9E0 X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.97 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.998,0]; NEURAL_HAM_SHORT(-0.97)[-0.974,0]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US] X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 16 May 2019 18:18:23 -0000 Author: hselasky Date: Thu May 16 18:18:22 2019 New Revision: 347867 URL: https://svnweb.freebsd.org/changeset/base/347867 Log: MFC r347311: Add ConnectX-6 DX HCA ID to libmlx5. In addition, add "ConnectX family mlx5Gen Virtual Function" device ID. Every new HCA VF will be identified with this device ID. Submitted by: slavash@ Sponsored by: Mellanox Technologies Modified: stable/11/contrib/ofed/libmlx5/mlx5.c Directory Properties: stable/11/ (props changed) Modified: stable/11/contrib/ofed/libmlx5/mlx5.c ============================================================================== --- stable/11/contrib/ofed/libmlx5/mlx5.c Thu May 16 18:17:38 2019 (r347866) +++ stable/11/contrib/ofed/libmlx5/mlx5.c Thu May 16 18:18:22 2019 (r347867) @@ -79,6 +79,8 @@ static struct { HCA(MELLANOX, 4122), /* ConnectX-5 Ex VF */ HCA(MELLANOX, 4123), /* ConnectX-6 */ HCA(MELLANOX, 4124), /* ConnectX-6 VF */ + HCA(MELLANOX, 4125), /* ConnectX-6 DX */ + HCA(MELLANOX, 4126), /* ConnectX family mlx5Gen Virtual Function */ HCA(MELLANOX, 41682), /* BlueField integrated ConnectX-5 network controller */ HCA(MELLANOX, 41683), /* BlueField integrated ConnectX-5 network controller VF */ }; From owner-svn-src-stable@freebsd.org Thu May 16 18:19:10 2019 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 4070A15A34BD; Thu, 16 May 2019 18:19:10 +0000 (UTC) (envelope-from hselasky@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 D8A886DB36; Thu, 16 May 2019 18:19:09 +0000 (UTC) (envelope-from hselasky@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 B2FE224869; Thu, 16 May 2019 18:19:09 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x4GIJ9p6034351; Thu, 16 May 2019 18:19:09 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x4GIJ86P034345; Thu, 16 May 2019 18:19:08 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201905161819.x4GIJ86P034345@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Thu, 16 May 2019 18:19:08 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r347868 - in stable/11/sys/dev/mlx5: . mlx5_core X-SVN-Group: stable-11 X-SVN-Commit-Author: hselasky X-SVN-Commit-Paths: in stable/11/sys/dev/mlx5: . mlx5_core X-SVN-Commit-Revision: 347868 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: D8A886DB36 X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.97 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.998,0]; NEURAL_HAM_SHORT(-0.98)[-0.975,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US]; NEURAL_HAM_LONG(-1.00)[-1.000,0] X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 16 May 2019 18:19:10 -0000 Author: hselasky Date: Thu May 16 18:19:08 2019 New Revision: 347868 URL: https://svnweb.freebsd.org/changeset/base/347868 Log: MFC r347312: Add Firmware Reset Level, MFRL, register accessors in mlx5core. Submitted by: kib@ Sponsored by: Mellanox Technologies Modified: stable/11/sys/dev/mlx5/device.h stable/11/sys/dev/mlx5/driver.h stable/11/sys/dev/mlx5/mlx5_core/mlx5_core.h stable/11/sys/dev/mlx5/mlx5_core/mlx5_port.c stable/11/sys/dev/mlx5/mlx5_ifc.h Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/dev/mlx5/device.h ============================================================================== --- stable/11/sys/dev/mlx5/device.h Thu May 16 18:18:22 2019 (r347867) +++ stable/11/sys/dev/mlx5/device.h Thu May 16 18:19:08 2019 (r347868) @@ -1216,6 +1216,11 @@ enum { MLX5_GEN_EVENT_SUBTYPE_PCI_POWER_CHANGE_EVENT = 0x5, }; +enum { + MLX5_FRL_LEVEL3 = 0x8, + MLX5_FRL_LEVEL6 = 0x40, +}; + /* 8 regular priorities + 1 for multicast */ #define MLX5_NUM_BYPASS_FTS 9 Modified: stable/11/sys/dev/mlx5/driver.h ============================================================================== --- stable/11/sys/dev/mlx5/driver.h Thu May 16 18:18:22 2019 (r347867) +++ stable/11/sys/dev/mlx5/driver.h Thu May 16 18:19:08 2019 (r347868) @@ -152,6 +152,7 @@ enum { MLX5_REG_HOST_ENDIANNESS = 0x7004, MLX5_REG_MTMP = 0x900a, MLX5_REG_MCIA = 0x9014, + MLX5_REG_MFRL = 0x9028, MLX5_REG_MPCNT = 0x9051, MLX5_REG_MCQI = 0x9061, MLX5_REG_MCC = 0x9062, Modified: stable/11/sys/dev/mlx5/mlx5_core/mlx5_core.h ============================================================================== --- stable/11/sys/dev/mlx5/mlx5_core/mlx5_core.h Thu May 16 18:18:22 2019 (r347867) +++ stable/11/sys/dev/mlx5/mlx5_core/mlx5_core.h Thu May 16 18:19:08 2019 (r347868) @@ -82,6 +82,8 @@ int mlx5_query_pcam_reg(struct mlx5_core_dev *dev, u32 u8 feature_group, u8 access_reg_group); int mlx5_query_mcam_reg(struct mlx5_core_dev *dev, u32 *mcap, u8 feature_group, u8 access_reg_group); +int mlx5_query_mfrl_reg(struct mlx5_core_dev *mdev, u8 *reset_level); +int mlx5_set_mfrl_reg(struct mlx5_core_dev *mdev, u8 reset_level); int mlx5_cmd_init_hca(struct mlx5_core_dev *dev); int mlx5_cmd_teardown_hca(struct mlx5_core_dev *dev); int mlx5_cmd_force_teardown_hca(struct mlx5_core_dev *dev); Modified: stable/11/sys/dev/mlx5/mlx5_core/mlx5_port.c ============================================================================== --- stable/11/sys/dev/mlx5/mlx5_core/mlx5_port.c Thu May 16 18:18:22 2019 (r347867) +++ stable/11/sys/dev/mlx5/mlx5_core/mlx5_port.c Thu May 16 18:19:08 2019 (r347868) @@ -1210,3 +1210,29 @@ int mlx5_query_pddr_range_info(struct mlx5_core_dev *m return (0); } EXPORT_SYMBOL_GPL(mlx5_query_pddr_range_info); + +int +mlx5_query_mfrl_reg(struct mlx5_core_dev *mdev, u8 *reset_level) +{ + u32 mfrl[MLX5_ST_SZ_DW(mfrl_reg)] = {}; + int sz = MLX5_ST_SZ_BYTES(mfrl_reg); + int err; + + err = mlx5_core_access_reg(mdev, mfrl, sz, mfrl, sz, MLX5_REG_MFRL, + 0, 0); + if (err == 0) + *reset_level = MLX5_GET(mfrl_reg, mfrl, reset_level); + return (err); +} + +int +mlx5_set_mfrl_reg(struct mlx5_core_dev *mdev, u8 reset_level) +{ + u32 mfrl[MLX5_ST_SZ_DW(mfrl_reg)] = {}; + int sz = MLX5_ST_SZ_BYTES(mfrl_reg); + + MLX5_SET(mfrl_reg, mfrl, reset_level, reset_level); + + return (mlx5_core_access_reg(mdev, mfrl, sz, mfrl, sz, MLX5_REG_MFRL, + 0, 1)); +} Modified: stable/11/sys/dev/mlx5/mlx5_ifc.h ============================================================================== --- stable/11/sys/dev/mlx5/mlx5_ifc.h Thu May 16 18:18:22 2019 (r347867) +++ stable/11/sys/dev/mlx5/mlx5_ifc.h Thu May 16 18:19:08 2019 (r347868) @@ -10409,4 +10409,9 @@ struct mlx5_ifc_qpts_reg_bits { u8 trust_state[0x3]; }; +struct mlx5_ifc_mfrl_reg_bits { + u8 reserved_at_0[0x38]; + u8 reset_level[0x8]; +}; + #endif /* MLX5_IFC_H */ From owner-svn-src-stable@freebsd.org Thu May 16 18:20:16 2019 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id E21ED15A35F9; Thu, 16 May 2019 18:20:15 +0000 (UTC) (envelope-from hselasky@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 8686B6DD77; Thu, 16 May 2019 18:20:15 +0000 (UTC) (envelope-from hselasky@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 62B142486E; Thu, 16 May 2019 18:20:15 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x4GIKFB6034633; Thu, 16 May 2019 18:20:15 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x4GIKEf8034627; Thu, 16 May 2019 18:20:14 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201905161820.x4GIKEf8034627@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Thu, 16 May 2019 18:20:14 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r347869 - in stable/11: share/man/man4 sys/dev/mlx5 sys/dev/mlx5/mlx5_core usr.sbin/mlx5tool X-SVN-Group: stable-11 X-SVN-Commit-Author: hselasky X-SVN-Commit-Paths: in stable/11: share/man/man4 sys/dev/mlx5 sys/dev/mlx5/mlx5_core usr.sbin/mlx5tool X-SVN-Commit-Revision: 347869 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 8686B6DD77 X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.97 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.998,0]; NEURAL_HAM_SHORT(-0.98)[-0.975,0]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US] X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 16 May 2019 18:20:16 -0000 Author: hselasky Date: Thu May 16 18:20:14 2019 New Revision: 347869 URL: https://svnweb.freebsd.org/changeset/base/347869 Log: MFC r347313: Implement firmware reset from userspace in mlx5tool(8). Submitted by: kib@ Sponsored by: Mellanox Technologies Modified: stable/11/share/man/man4/mlx5io.4 stable/11/sys/dev/mlx5/mlx5_core/mlx5_fwdump.c stable/11/sys/dev/mlx5/mlx5io.h stable/11/usr.sbin/mlx5tool/mlx5tool.8 stable/11/usr.sbin/mlx5tool/mlx5tool.c Directory Properties: stable/11/ (props changed) Modified: stable/11/share/man/man4/mlx5io.4 ============================================================================== --- stable/11/share/man/man4/mlx5io.4 Thu May 16 18:19:08 2019 (r347868) +++ stable/11/share/man/man4/mlx5io.4 Thu May 16 18:20:14 2019 (r347869) @@ -142,6 +142,11 @@ Image address in memory is passed in the length of the image is specified in .Dv img_fw_data_len field. +.It Dv MLX5_FW_RESET +Requests PCIe link-level reset on the device. +The address of the device is specified by the +.Vt struct mlx5_tool_addr +structure, which should be passed as an argument. .El .Sh FILES The Modified: stable/11/sys/dev/mlx5/mlx5_core/mlx5_fwdump.c ============================================================================== --- stable/11/sys/dev/mlx5/mlx5_core/mlx5_fwdump.c Thu May 16 18:19:08 2019 (r347868) +++ stable/11/sys/dev/mlx5/mlx5_core/mlx5_fwdump.c Thu May 16 18:20:14 2019 (r347869) @@ -226,6 +226,24 @@ out: } static int +mlx5_fw_reset(struct mlx5_core_dev *mdev) +{ + device_t dev, bus; + int error; + + error = -mlx5_set_mfrl_reg(mdev, MLX5_FRL_LEVEL3); + if (error == 0) { + dev = mdev->pdev->dev.bsddev; + mtx_lock(&Giant); + bus = device_get_parent(dev); + error = BUS_RESET_CHILD(device_get_parent(bus), bus, + DEVF_RESET_DETACH); + mtx_unlock(&Giant); + } + return (error); +} + +static int mlx5_fwdump_ioctl(struct cdev *dev, u_long cmd, caddr_t data, int fflag, struct thread *td) { @@ -306,6 +324,17 @@ mlx5_fwdump_ioctl(struct cdev *dev, u_long cmd, caddr_ if (error == 0) error = -mlx5_firmware_flash(mdev, &fake_fw); kmem_free(kmem_arena, (vm_offset_t)fake_fw.data, fu->img_fw_data_len); + break; + case MLX5_FW_RESET: + if ((fflag & FWRITE) == 0) { + error = EBADF; + break; + } + devaddr = (struct mlx5_tool_addr *)data; + error = mlx5_dbsf_to_core(devaddr, &mdev); + if (error != 0) + break; + error = mlx5_fw_reset(mdev); break; default: error = ENOTTY; Modified: stable/11/sys/dev/mlx5/mlx5io.h ============================================================================== --- stable/11/sys/dev/mlx5/mlx5io.h Thu May 16 18:19:08 2019 (r347868) +++ stable/11/sys/dev/mlx5/mlx5io.h Thu May 16 18:20:14 2019 (r347869) @@ -59,6 +59,7 @@ struct mlx5_fw_update { #define MLX5_FWDUMP_RESET _IOW('m', 2, struct mlx5_tool_addr) #define MLX5_FWDUMP_FORCE _IOW('m', 3, struct mlx5_tool_addr) #define MLX5_FW_UPDATE _IOW('m', 4, struct mlx5_fw_update) +#define MLX5_FW_RESET _IOW('m', 5, struct mlx5_tool_addr) #ifndef _KERNEL #define MLX5_DEV_PATH _PATH_DEV"mlx5ctl" Modified: stable/11/usr.sbin/mlx5tool/mlx5tool.8 ============================================================================== --- stable/11/usr.sbin/mlx5tool/mlx5tool.8 Thu May 16 18:19:08 2019 (r347868) +++ stable/11/usr.sbin/mlx5tool/mlx5tool.8 Thu May 16 18:20:14 2019 (r347869) @@ -45,6 +45,9 @@ .Nm .Fl d Ar domain:bus:slot:func .Fl f Ar file.mfa2 +.Nm +.Fl d Ar domain:bus:slot:func +.Fl z .Sh DESCRIPTION The .Nm @@ -91,6 +94,14 @@ Flashes the firmware image to the specified adapter. Image must be in MFA2 pack format and contain a component suitable for the adapter hardware. +.Pp +Typically, PCIe link-level reset is required to activate the +newly flashed image, which can be performed by the system reboot +or using the +.Fl z +option. +.It Fl z +Performs PCIe link-level reset on the specified device. .El .Sh FILES The Modified: stable/11/usr.sbin/mlx5tool/mlx5tool.c ============================================================================== --- stable/11/usr.sbin/mlx5tool/mlx5tool.c Thu May 16 18:19:08 2019 (r347868) +++ stable/11/usr.sbin/mlx5tool/mlx5tool.c Thu May 16 18:20:14 2019 (r347869) @@ -189,17 +189,29 @@ close_fd: return (res); } +static int +mlx5tool_fw_reset(int ctldev, const struct mlx5_tool_addr *addr) +{ + + if (ioctl(ctldev, MLX5_FW_RESET, addr) == -1) { + warn("MLX5_FW_RESET"); + return (1); + } + return (0); +} + static void usage(void) { fprintf(stderr, "Usage: mlx5tool -d pci [-w -o dump.file | -r |" - " -e | -f fw.mfa2]\n"); + " -e | -f fw.mfa2 | -z]\n"); fprintf(stderr, "\t-w - write firmware dump to the specified file\n"); fprintf(stderr, "\t-r - reset dump\n"); fprintf(stderr, "\t-e - force dump\n"); fprintf(stderr, "\t-f fw.img - flash firmware from fw.img\n"); + fprintf(stderr, "\t-z - initiate firmware reset\n"); exit(1); } @@ -208,6 +220,7 @@ enum mlx5_action { ACTION_DUMP_RESET, ACTION_DUMP_FORCE, ACTION_FW_UPDATE, + ACTION_FW_RESET, ACTION_NONE, }; @@ -225,7 +238,7 @@ main(int argc, char *argv[]) addrstr = NULL; dumpname = NULL; img_fw_path = NULL; - while ((c = getopt(argc, argv, "d:ef:ho:rw")) != -1) { + while ((c = getopt(argc, argv, "d:ef:ho:rwz")) != -1) { switch (c) { case 'd': addrstr = optarg; @@ -246,6 +259,9 @@ main(int argc, char *argv[]) act = ACTION_FW_UPDATE; img_fw_path = optarg; break; + case 'z': + act = ACTION_FW_RESET; + break; case 'h': default: usage(); @@ -273,6 +289,9 @@ main(int argc, char *argv[]) break; case ACTION_FW_UPDATE: res = mlx5tool_fw_update(ctldev, &addr, img_fw_path); + break; + case ACTION_FW_RESET: + res = mlx5tool_fw_reset(ctldev, &addr); break; default: res = 0; From owner-svn-src-stable@freebsd.org Thu May 16 18:20:48 2019 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 00F2215A36B2; Thu, 16 May 2019 18:20:48 +0000 (UTC) (envelope-from hselasky@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 9C3F36DEF0; Thu, 16 May 2019 18:20:47 +0000 (UTC) (envelope-from hselasky@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 768382487F; Thu, 16 May 2019 18:20:47 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x4GIKlrW034713; Thu, 16 May 2019 18:20:47 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x4GIKl4K034712; Thu, 16 May 2019 18:20:47 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201905161820.x4GIKl4K034712@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Thu, 16 May 2019 18:20:47 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r347870 - stable/11/usr.sbin/mlx5tool X-SVN-Group: stable-11 X-SVN-Commit-Author: hselasky X-SVN-Commit-Paths: stable/11/usr.sbin/mlx5tool X-SVN-Commit-Revision: 347870 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 9C3F36DEF0 X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.97 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.998,0]; NEURAL_HAM_SHORT(-0.97)[-0.974,0]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US] X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 16 May 2019 18:20:48 -0000 Author: hselasky Date: Thu May 16 18:20:47 2019 New Revision: 347870 URL: https://svnweb.freebsd.org/changeset/base/347870 Log: MFC r347314: Ensure that only one command is specified at a time in mlx5tool(8). Submitted by: kib@ Sponsored by: Mellanox Technologies Modified: stable/11/usr.sbin/mlx5tool/mlx5tool.c Directory Properties: stable/11/ (props changed) Modified: stable/11/usr.sbin/mlx5tool/mlx5tool.c ============================================================================== --- stable/11/usr.sbin/mlx5tool/mlx5tool.c Thu May 16 18:20:14 2019 (r347869) +++ stable/11/usr.sbin/mlx5tool/mlx5tool.c Thu May 16 18:20:47 2019 (r347870) @@ -244,22 +244,32 @@ main(int argc, char *argv[]) addrstr = optarg; break; case 'w': + if (act != ACTION_NONE) + usage(); act = ACTION_DUMP_GET; break; case 'e': + if (act != ACTION_NONE) + usage(); act = ACTION_DUMP_FORCE; break; case 'o': dumpname = optarg; break; case 'r': + if (act != ACTION_NONE) + usage(); act = ACTION_DUMP_RESET; break; case 'f': + if (act != ACTION_NONE) + usage(); act = ACTION_FW_UPDATE; img_fw_path = optarg; break; case 'z': + if (act != ACTION_NONE) + usage(); act = ACTION_FW_RESET; break; case 'h': From owner-svn-src-stable@freebsd.org Thu May 16 18:22:03 2019 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 697D615A38ED; Thu, 16 May 2019 18:22:03 +0000 (UTC) (envelope-from hselasky@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 0F2546E15A; Thu, 16 May 2019 18:22:03 +0000 (UTC) (envelope-from hselasky@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 DDF9B248DE; Thu, 16 May 2019 18:22:02 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x4GIM2il038928; Thu, 16 May 2019 18:22:02 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x4GIM2Sx038925; Thu, 16 May 2019 18:22:02 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201905161822.x4GIM2Sx038925@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Thu, 16 May 2019 18:22:02 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r347871 - stable/11/sys/dev/mlx5/mlx5_core X-SVN-Group: stable-11 X-SVN-Commit-Author: hselasky X-SVN-Commit-Paths: stable/11/sys/dev/mlx5/mlx5_core X-SVN-Commit-Revision: 347871 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 0F2546E15A X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.97 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.998,0]; NEURAL_HAM_SHORT(-0.98)[-0.975,0]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US] X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 16 May 2019 18:22:03 -0000 Author: hselasky Date: Thu May 16 18:22:02 2019 New Revision: 347871 URL: https://svnweb.freebsd.org/changeset/base/347871 Log: MFC r347315: Rename functions from mlx5_fwdump to mlx5_ctl in mlx5core. Submitted by: kib@ Sponsored by: Mellanox Technologies Modified: stable/11/sys/dev/mlx5/mlx5_core/mlx5_core.h stable/11/sys/dev/mlx5/mlx5_core/mlx5_fwdump.c stable/11/sys/dev/mlx5/mlx5_core/mlx5_main.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/dev/mlx5/mlx5_core/mlx5_core.h ============================================================================== --- stable/11/sys/dev/mlx5/mlx5_core/mlx5_core.h Thu May 16 18:20:47 2019 (r347870) +++ stable/11/sys/dev/mlx5/mlx5_core/mlx5_core.h Thu May 16 18:22:02 2019 (r347871) @@ -104,8 +104,8 @@ void mlx5e_cleanup(void); int mlx5_rename_eq(struct mlx5_core_dev *dev, int eq_ix, char *name); -int mlx5_fwdump_init(void); -void mlx5_fwdump_fini(void); +int mlx5_ctl_init(void); +void mlx5_ctl_fini(void); void mlx5_fwdump_prep(struct mlx5_core_dev *mdev); void mlx5_fwdump(struct mlx5_core_dev *mdev); void mlx5_fwdump_clean(struct mlx5_core_dev *mdev); Modified: stable/11/sys/dev/mlx5/mlx5_core/mlx5_fwdump.c ============================================================================== --- stable/11/sys/dev/mlx5/mlx5_core/mlx5_fwdump.c Thu May 16 18:20:47 2019 (r347870) +++ stable/11/sys/dev/mlx5/mlx5_core/mlx5_fwdump.c Thu May 16 18:22:02 2019 (r347871) @@ -244,7 +244,7 @@ mlx5_fw_reset(struct mlx5_core_dev *mdev) } static int -mlx5_fwdump_ioctl(struct cdev *dev, u_long cmd, caddr_t data, int fflag, +mlx5_ctl_ioctl(struct cdev *dev, u_long cmd, caddr_t data, int fflag, struct thread *td) { struct mlx5_core_dev *mdev; @@ -343,34 +343,34 @@ mlx5_fwdump_ioctl(struct cdev *dev, u_long cmd, caddr_ return (error); } -static struct cdevsw mlx5_fwdump_devsw = { +static struct cdevsw mlx5_ctl_devsw = { .d_version = D_VERSION, - .d_ioctl = mlx5_fwdump_ioctl, + .d_ioctl = mlx5_ctl_ioctl, }; -static struct cdev *mlx5_fwdump_dev; +static struct cdev *mlx5_ctl_dev; int -mlx5_fwdump_init(void) +mlx5_ctl_init(void) { struct make_dev_args mda; int error; make_dev_args_init(&mda); mda.mda_flags = MAKEDEV_WAITOK | MAKEDEV_CHECKNAME; - mda.mda_devsw = &mlx5_fwdump_devsw; + mda.mda_devsw = &mlx5_ctl_devsw; mda.mda_uid = UID_ROOT; mda.mda_gid = GID_OPERATOR; mda.mda_mode = 0640; - error = make_dev_s(&mda, &mlx5_fwdump_dev, "mlx5ctl"); + error = make_dev_s(&mda, &mlx5_ctl_dev, "mlx5ctl"); return (-error); } void -mlx5_fwdump_fini(void) +mlx5_ctl_fini(void) { - if (mlx5_fwdump_dev != NULL) - destroy_dev(mlx5_fwdump_dev); + if (mlx5_ctl_dev != NULL) + destroy_dev(mlx5_ctl_dev); } Modified: stable/11/sys/dev/mlx5/mlx5_core/mlx5_main.c ============================================================================== --- stable/11/sys/dev/mlx5/mlx5_core/mlx5_main.c Thu May 16 18:20:47 2019 (r347870) +++ stable/11/sys/dev/mlx5/mlx5_core/mlx5_main.c Thu May 16 18:22:02 2019 (r347871) @@ -1590,13 +1590,13 @@ static int __init init(void) if (err) goto err_debug; - err = mlx5_fwdump_init(); + err = mlx5_ctl_init(); if (err) - goto err_fwdump; + goto err_ctl; return 0; -err_fwdump: +err_ctl: pci_unregister_driver(&mlx5_core_driver); err_debug: @@ -1605,7 +1605,7 @@ err_debug: static void __exit cleanup(void) { - mlx5_fwdump_fini(); + mlx5_ctl_fini(); pci_unregister_driver(&mlx5_core_driver); } From owner-svn-src-stable@freebsd.org Thu May 16 18:22:47 2019 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id C86B915A39EF; Thu, 16 May 2019 18:22:47 +0000 (UTC) (envelope-from hselasky@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 6C7136E510; Thu, 16 May 2019 18:22:47 +0000 (UTC) (envelope-from hselasky@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 45F4B24A0C; Thu, 16 May 2019 18:22:47 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x4GIMluG040167; Thu, 16 May 2019 18:22:47 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x4GIMki6040164; Thu, 16 May 2019 18:22:46 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201905161822.x4GIMki6040164@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Thu, 16 May 2019 18:22:46 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r347872 - stable/11/sys/dev/mlx5/mlx5_en X-SVN-Group: stable-11 X-SVN-Commit-Author: hselasky X-SVN-Commit-Paths: stable/11/sys/dev/mlx5/mlx5_en X-SVN-Commit-Revision: 347872 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 6C7136E510 X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.97 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.998,0]; NEURAL_HAM_SHORT(-0.97)[-0.974,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US]; NEURAL_HAM_LONG(-1.00)[-1.000,0] X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 16 May 2019 18:22:48 -0000 Author: hselasky Date: Thu May 16 18:22:46 2019 New Revision: 347872 URL: https://svnweb.freebsd.org/changeset/base/347872 Log: MFC r347316: Fix for compilation warning in mlx5en(4). Function 'mlx5e_alloc_rx_wqe' can never be inlined because it uses alloca (override using the always_inline attribute) Sponsored by: Mellanox Technologies Modified: stable/11/sys/dev/mlx5/mlx5_en/en.h stable/11/sys/dev/mlx5/mlx5_en/mlx5_en_main.c stable/11/sys/dev/mlx5/mlx5_en/mlx5_en_rx.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/dev/mlx5/mlx5_en/en.h ============================================================================== --- stable/11/sys/dev/mlx5/mlx5_en/en.h Thu May 16 18:22:02 2019 (r347871) +++ stable/11/sys/dev/mlx5/mlx5_en/en.h Thu May 16 18:22:46 2019 (r347872) @@ -85,6 +85,8 @@ #define MLX5E_PARAMS_DEFAULT_LOG_RQ_SIZE 0xa #define MLX5E_PARAMS_MAXIMUM_LOG_RQ_SIZE 0xe +#define MLX5E_MAX_BUSDMA_RX_SEGS 15 + #define MLX5E_MAX_RX_SEGS 7 #ifndef MLX5E_MAX_RX_BYTES Modified: stable/11/sys/dev/mlx5/mlx5_en/mlx5_en_main.c ============================================================================== --- stable/11/sys/dev/mlx5/mlx5_en/mlx5_en_main.c Thu May 16 18:22:02 2019 (r347871) +++ stable/11/sys/dev/mlx5/mlx5_en/mlx5_en_main.c Thu May 16 18:22:46 2019 (r347872) @@ -2134,6 +2134,9 @@ mlx5e_get_wqe_sz(struct mlx5e_priv *priv, u32 *wqe_sz, for (n = howmany(r, MLX5E_MAX_RX_BYTES); !powerof2(n + 1); n++) ; + if (n > MLX5E_MAX_BUSDMA_RX_SEGS) + return (-ENOMEM); + *wqe_sz = r; *nsegs = n; return (0); Modified: stable/11/sys/dev/mlx5/mlx5_en/mlx5_en_rx.c ============================================================================== --- stable/11/sys/dev/mlx5/mlx5_en/mlx5_en_rx.c Thu May 16 18:22:02 2019 (r347871) +++ stable/11/sys/dev/mlx5/mlx5_en/mlx5_en_rx.c Thu May 16 18:22:46 2019 (r347872) @@ -32,7 +32,7 @@ static inline int mlx5e_alloc_rx_wqe(struct mlx5e_rq *rq, struct mlx5e_rx_wqe *wqe, u16 ix) { - bus_dma_segment_t segs[rq->nsegs]; + bus_dma_segment_t segs[MLX5E_MAX_BUSDMA_RX_SEGS]; struct mbuf *mb; int nsegs; int err; From owner-svn-src-stable@freebsd.org Thu May 16 18:23:30 2019 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 11D0015A3ABE; Thu, 16 May 2019 18:23:30 +0000 (UTC) (envelope-from hselasky@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 AABA56E766; Thu, 16 May 2019 18:23:29 +0000 (UTC) (envelope-from hselasky@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 8648324A0F; Thu, 16 May 2019 18:23:29 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x4GINTxx040395; Thu, 16 May 2019 18:23:29 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x4GINTkI040393; Thu, 16 May 2019 18:23:29 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201905161823.x4GINTkI040393@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Thu, 16 May 2019 18:23:29 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r347873 - stable/11/sys/dev/mlx5/mlx5_en X-SVN-Group: stable-11 X-SVN-Commit-Author: hselasky X-SVN-Commit-Paths: stable/11/sys/dev/mlx5/mlx5_en X-SVN-Commit-Revision: 347873 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: AABA56E766 X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.97 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.998,0]; NEURAL_HAM_SHORT(-0.98)[-0.975,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US]; NEURAL_HAM_LONG(-1.00)[-1.000,0] X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 16 May 2019 18:23:30 -0000 Author: hselasky Date: Thu May 16 18:23:28 2019 New Revision: 347873 URL: https://svnweb.freebsd.org/changeset/base/347873 Log: MFC r347317: Remove non-functional MLX5E_MAX_RX_SEGS macro in mlx5en(4). Sponsored by: Mellanox Technologies Modified: stable/11/sys/dev/mlx5/mlx5_en/en.h stable/11/sys/dev/mlx5/mlx5_en/mlx5_en_main.c stable/11/sys/dev/mlx5/mlx5_en/mlx5_en_rx.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/dev/mlx5/mlx5_en/en.h ============================================================================== --- stable/11/sys/dev/mlx5/mlx5_en/en.h Thu May 16 18:22:46 2019 (r347872) +++ stable/11/sys/dev/mlx5/mlx5_en/en.h Thu May 16 18:23:28 2019 (r347873) @@ -87,19 +87,13 @@ #define MLX5E_MAX_BUSDMA_RX_SEGS 15 -#define MLX5E_MAX_RX_SEGS 7 - #ifndef MLX5E_MAX_RX_BYTES #define MLX5E_MAX_RX_BYTES MCLBYTES #endif -#if (MLX5E_MAX_RX_SEGS == 1) -/* FreeBSD HW LRO is limited by 16KB - the size of max mbuf */ -#define MLX5E_PARAMS_DEFAULT_LRO_WQE_SZ MJUM16BYTES -#else #define MLX5E_PARAMS_DEFAULT_LRO_WQE_SZ \ - MIN(65535, MLX5E_MAX_RX_SEGS * MLX5E_MAX_RX_BYTES) -#endif + MIN(65535, 7 * MLX5E_MAX_RX_BYTES) + #define MLX5E_DIM_DEFAULT_PROFILE 3 #define MLX5E_DIM_MAX_RX_CQ_MODERATION_PKTS_WITH_LRO 16 #define MLX5E_PARAMS_DEFAULT_RX_CQ_MODERATION_USEC 0x10 Modified: stable/11/sys/dev/mlx5/mlx5_en/mlx5_en_main.c ============================================================================== --- stable/11/sys/dev/mlx5/mlx5_en/mlx5_en_main.c Thu May 16 18:22:46 2019 (r347872) +++ stable/11/sys/dev/mlx5/mlx5_en/mlx5_en_main.c Thu May 16 18:23:28 2019 (r347873) @@ -1146,11 +1146,7 @@ mlx5e_create_rq(struct mlx5e_channel *c, rq->mbuf = malloc(wq_sz * sizeof(rq->mbuf[0]), M_MLX5EN, M_WAITOK | M_ZERO); for (i = 0; i != wq_sz; i++) { struct mlx5e_rx_wqe *wqe = mlx5_wq_ll_get_wqe(&rq->wq, i); -#if (MLX5E_MAX_RX_SEGS == 1) - uint32_t byte_count = rq->wqe_sz - MLX5E_NET_IP_ALIGN; -#else int j; -#endif err = -bus_dmamap_create(rq->dma_tag, 0, &rq->mbuf[i].dma_map); if (err != 0) { @@ -1160,13 +1156,8 @@ mlx5e_create_rq(struct mlx5e_channel *c, } /* set value for constant fields */ -#if (MLX5E_MAX_RX_SEGS == 1) - wqe->data[0].lkey = c->mkey_be; - wqe->data[0].byte_count = cpu_to_be32(byte_count | MLX5_HW_START_PADDING); -#else for (j = 0; j < rq->nsegs; j++) wqe->data[j].lkey = c->mkey_be; -#endif } INIT_WORK(&rq->dim.work, mlx5e_dim_work); Modified: stable/11/sys/dev/mlx5/mlx5_en/mlx5_en_rx.c ============================================================================== --- stable/11/sys/dev/mlx5/mlx5_en/mlx5_en_rx.c Thu May 16 18:22:46 2019 (r347872) +++ stable/11/sys/dev/mlx5/mlx5_en/mlx5_en_rx.c Thu May 16 18:23:28 2019 (r347873) @@ -36,20 +36,12 @@ mlx5e_alloc_rx_wqe(struct mlx5e_rq *rq, struct mbuf *mb; int nsegs; int err; -#if (MLX5E_MAX_RX_SEGS != 1) struct mbuf *mb_head; int i; -#endif + if (rq->mbuf[ix].mbuf != NULL) return (0); -#if (MLX5E_MAX_RX_SEGS == 1) - mb = m_getjcl(M_NOWAIT, MT_DATA, M_PKTHDR, rq->wqe_sz); - if (unlikely(!mb)) - return (-ENOMEM); - - mb->m_pkthdr.len = mb->m_len = rq->wqe_sz; -#else mb_head = mb = m_getjcl(M_NOWAIT, MT_DATA, M_PKTHDR, MLX5E_MAX_RX_BYTES); if (unlikely(mb == NULL)) @@ -72,7 +64,7 @@ mlx5e_alloc_rx_wqe(struct mlx5e_rq *rq, } /* rewind to first mbuf in chain */ mb = mb_head; -#endif + /* get IP header aligned */ m_adj(mb, MLX5E_NET_IP_ALIGN); @@ -85,10 +77,7 @@ mlx5e_alloc_rx_wqe(struct mlx5e_rq *rq, err = -ENOMEM; goto err_free_mbuf; } -#if (MLX5E_MAX_RX_SEGS == 1) wqe->data[0].addr = cpu_to_be64(segs[0].ds_addr); -#else - wqe->data[0].addr = cpu_to_be64(segs[0].ds_addr); wqe->data[0].byte_count = cpu_to_be32(segs[0].ds_len | MLX5_HW_START_PADDING); for (i = 1; i != nsegs; i++) { @@ -99,7 +88,6 @@ mlx5e_alloc_rx_wqe(struct mlx5e_rq *rq, wqe->data[i].addr = 0; wqe->data[i].byte_count = 0; } -#endif rq->mbuf[ix].mbuf = mb; rq->mbuf[ix].data = mb->m_data; @@ -225,9 +213,7 @@ mlx5e_build_rx_mbuf(struct mlx5_cqe64 *cqe, u32 cqe_bcnt) { struct ifnet *ifp = rq->ifp; -#if (MLX5E_MAX_RX_SEGS != 1) struct mbuf *mb_head; -#endif int lro_num_seg; /* HW LRO session aggregated packets counter */ lro_num_seg = be32_to_cpu(cqe->srqn) >> 24; @@ -237,9 +223,6 @@ mlx5e_build_rx_mbuf(struct mlx5_cqe64 *cqe, rq->stats.lro_bytes += cqe_bcnt; } -#if (MLX5E_MAX_RX_SEGS == 1) - mb->m_pkthdr.len = mb->m_len = cqe_bcnt; -#else mb->m_pkthdr.len = cqe_bcnt; for (mb_head = mb; mb != NULL; mb = mb->m_next) { if (mb->m_len > cqe_bcnt) @@ -256,7 +239,7 @@ mlx5e_build_rx_mbuf(struct mlx5_cqe64 *cqe, } /* rewind to first mbuf in chain */ mb = mb_head; -#endif + /* check if a Toeplitz hash was computed */ if (cqe->rss_hash_type != 0) { mb->m_pkthdr.flowid = be32_to_cpu(cqe->rss_hash_result); @@ -424,10 +407,8 @@ mlx5e_poll_rx_cq(struct mlx5e_rq *rq, int budget) } if ((MHLEN - MLX5E_NET_IP_ALIGN) >= byte_cnt && (mb = m_gethdr(M_NOWAIT, MT_DATA)) != NULL) { -#if (MLX5E_MAX_RX_SEGS != 1) /* set maximum mbuf length */ mb->m_len = MHLEN - MLX5E_NET_IP_ALIGN; -#endif /* get IP header aligned */ mb->m_data += MLX5E_NET_IP_ALIGN; From owner-svn-src-stable@freebsd.org Thu May 16 18:24:06 2019 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id A712B15A3B71; Thu, 16 May 2019 18:24:06 +0000 (UTC) (envelope-from hselasky@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 4ED686E8BB; Thu, 16 May 2019 18:24:06 +0000 (UTC) (envelope-from hselasky@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 1917B24A14; Thu, 16 May 2019 18:24:06 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x4GIO5kd040489; Thu, 16 May 2019 18:24:05 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x4GIO5Pa040488; Thu, 16 May 2019 18:24:05 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201905161824.x4GIO5Pa040488@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Thu, 16 May 2019 18:24:05 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r347874 - stable/11/sys/dev/mlx5 X-SVN-Group: stable-11 X-SVN-Commit-Author: hselasky X-SVN-Commit-Paths: stable/11/sys/dev/mlx5 X-SVN-Commit-Revision: 347874 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 4ED686E8BB X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.97 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.998,0]; NEURAL_HAM_SHORT(-0.97)[-0.974,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US]; NEURAL_HAM_LONG(-1.00)[-1.000,0] X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 16 May 2019 18:24:06 -0000 Author: hselasky Date: Thu May 16 18:24:05 2019 New Revision: 347874 URL: https://svnweb.freebsd.org/changeset/base/347874 Log: MFC r347318: Make command timeout way shorter in mlx5core. The command timeout is terribly long, whole two hours. Make it 60s so if things do go wrong, the user gets feedback in relatively short time, so they can take corrective actions and/or investigate using tools and such. Linux commit: 6b6c07bdcdc97ccac2596063bfc32a5faddfe884 Sponsored by: Mellanox Technologies Modified: stable/11/sys/dev/mlx5/driver.h Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/dev/mlx5/driver.h ============================================================================== --- stable/11/sys/dev/mlx5/driver.h Thu May 16 18:23:28 2019 (r347873) +++ stable/11/sys/dev/mlx5/driver.h Thu May 16 18:24:05 2019 (r347874) @@ -53,7 +53,7 @@ enum { }; enum { - MLX5_CMD_TIMEOUT_MSEC = 8 * 60 * 1000, + MLX5_CMD_TIMEOUT_MSEC = 60 * 1000, MLX5_CMD_WQ_MAX_NAME = 32, }; From owner-svn-src-stable@freebsd.org Thu May 16 18:24:52 2019 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 5221515A3C2E; Thu, 16 May 2019 18:24:52 +0000 (UTC) (envelope-from hselasky@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 EC7536EA1A; Thu, 16 May 2019 18:24:51 +0000 (UTC) (envelope-from hselasky@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 C50B024A15; Thu, 16 May 2019 18:24:51 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x4GIOpW8040583; Thu, 16 May 2019 18:24:51 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x4GIOpEZ040581; Thu, 16 May 2019 18:24:51 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201905161824.x4GIOpEZ040581@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Thu, 16 May 2019 18:24:51 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r347875 - in stable/11/sys/dev/mlx5: . mlx5_core X-SVN-Group: stable-11 X-SVN-Commit-Author: hselasky X-SVN-Commit-Paths: in stable/11/sys/dev/mlx5: . mlx5_core X-SVN-Commit-Revision: 347875 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: EC7536EA1A X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.97 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.998,0]; NEURAL_HAM_SHORT(-0.98)[-0.975,0]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US] X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 16 May 2019 18:24:52 -0000 Author: hselasky Date: Thu May 16 18:24:51 2019 New Revision: 347875 URL: https://svnweb.freebsd.org/changeset/base/347875 Log: MFC r347319: Flush command workqueue when command completion is triggered in mlx5core. Avoid race for command completion when triggering a command completions event. Serialize operation by queueing all commands on the same work queue. This can happen when healthcare triggers. Sponsored by: Mellanox Technologies Modified: stable/11/sys/dev/mlx5/driver.h stable/11/sys/dev/mlx5/mlx5_core/mlx5_health.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/dev/mlx5/driver.h ============================================================================== --- stable/11/sys/dev/mlx5/driver.h Thu May 16 18:24:05 2019 (r347874) +++ stable/11/sys/dev/mlx5/driver.h Thu May 16 18:24:51 2019 (r347875) @@ -513,6 +513,7 @@ struct mlx5_core_health { struct work_struct work; struct delayed_work recover_work; unsigned int last_reset_req; + struct work_struct work_cmd_completion; }; #define MLX5_CQ_LINEAR_ARRAY_SIZE 1024 Modified: stable/11/sys/dev/mlx5/mlx5_core/mlx5_health.c ============================================================================== --- stable/11/sys/dev/mlx5/mlx5_core/mlx5_health.c Thu May 16 18:24:05 2019 (r347874) +++ stable/11/sys/dev/mlx5/mlx5_core/mlx5_health.c Thu May 16 18:24:51 2019 (r347875) @@ -135,8 +135,10 @@ static bool sensor_fw_synd_rfr(struct mlx5_core_dev *d return rfr && synd; } -static void mlx5_trigger_cmd_completions(struct mlx5_core_dev *dev) +static void mlx5_trigger_cmd_completions(struct work_struct *work) { + struct mlx5_core_dev *dev = + container_of(work, struct mlx5_core_dev, priv.health.work_cmd_completion); unsigned long flags; u64 vector; @@ -271,7 +273,15 @@ void mlx5_enter_error_state(struct mlx5_core_dev *dev, return; if (!force) mlx5_core_err(dev, "internal state error detected\n"); - mlx5_trigger_cmd_completions(dev); + + /* + * Queue the command completion handler on the command + * work queue to avoid racing with the real command + * completion handler and then wait for it to + * complete: + */ + queue_work(dev->cmd.wq, &dev->priv.health.work_cmd_completion); + flush_workqueue(dev->cmd.wq); } mutex_lock(&dev->intf_state_mutex); @@ -693,6 +703,7 @@ int mlx5_health_init(struct mlx5_core_dev *dev) spin_lock_init(&health->wq_lock); INIT_WORK(&health->work, health_care); INIT_WORK(&health->work_watchdog, health_watchdog); + INIT_WORK(&health->work_cmd_completion, mlx5_trigger_cmd_completions); INIT_DELAYED_WORK(&health->recover_work, health_recover); return 0; From owner-svn-src-stable@freebsd.org Thu May 16 18:25:27 2019 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 7048115A3CA2; Thu, 16 May 2019 18:25:27 +0000 (UTC) (envelope-from hselasky@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 131876EB4B; Thu, 16 May 2019 18:25:27 +0000 (UTC) (envelope-from hselasky@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 D669F24A16; Thu, 16 May 2019 18:25:26 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x4GIPQgs040683; Thu, 16 May 2019 18:25:26 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x4GIPQRx040682; Thu, 16 May 2019 18:25:26 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201905161825.x4GIPQRx040682@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Thu, 16 May 2019 18:25:26 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r347876 - stable/11/sys/dev/mlx5/mlx5_en X-SVN-Group: stable-11 X-SVN-Commit-Author: hselasky X-SVN-Commit-Paths: stable/11/sys/dev/mlx5/mlx5_en X-SVN-Commit-Revision: 347876 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 131876EB4B X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.99 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.998,0]; NEURAL_HAM_SHORT(-0.99)[-0.988,0]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US] X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 16 May 2019 18:25:27 -0000 Author: hselasky Date: Thu May 16 18:25:26 2019 New Revision: 347876 URL: https://svnweb.freebsd.org/changeset/base/347876 Log: MFC r347320: Make sure the flow destination structure does not use values off the stack in mlx5en(4). Sponsored by: Mellanox Technologies Modified: stable/11/sys/dev/mlx5/mlx5_en/mlx5_en_flow_table.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/dev/mlx5/mlx5_en/mlx5_en_flow_table.c ============================================================================== --- stable/11/sys/dev/mlx5/mlx5_en/mlx5_en_flow_table.c Thu May 16 18:24:51 2019 (r347875) +++ stable/11/sys/dev/mlx5/mlx5_en/mlx5_en_flow_table.c Thu May 16 18:25:26 2019 (r347876) @@ -227,7 +227,7 @@ mlx5e_add_eth_addr_rule_sub(struct mlx5e_priv *priv, struct mlx5e_eth_addr_info *ai, int type, u32 *mc, u32 *mv) { - struct mlx5_flow_destination dest; + struct mlx5_flow_destination dest = {}; u8 mc_enable = 0; struct mlx5_flow_rule **rule_p; struct mlx5_flow_table *ft = priv->fts.main.t; @@ -507,7 +507,7 @@ mlx5e_add_vlan_rule_sub(struct mlx5e_priv *priv, u32 *mc, u32 *mv) { struct mlx5_flow_table *ft = priv->fts.vlan.t; - struct mlx5_flow_destination dest; + struct mlx5_flow_destination dest = {}; u8 mc_enable = 0; struct mlx5_flow_rule **rule_p; int err = 0; From owner-svn-src-stable@freebsd.org Thu May 16 18:26:15 2019 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 57BD315A3D41; Thu, 16 May 2019 18:26:15 +0000 (UTC) (envelope-from hselasky@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 F21EC6EC9D; Thu, 16 May 2019 18:26:14 +0000 (UTC) (envelope-from hselasky@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 C75A324A17; Thu, 16 May 2019 18:26:14 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x4GIQEDa040782; Thu, 16 May 2019 18:26:14 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x4GIQE1S040781; Thu, 16 May 2019 18:26:14 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201905161826.x4GIQE1S040781@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Thu, 16 May 2019 18:26:14 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r347877 - stable/11/sys/dev/mlx5/mlx5_en X-SVN-Group: stable-11 X-SVN-Commit-Author: hselasky X-SVN-Commit-Paths: stable/11/sys/dev/mlx5/mlx5_en X-SVN-Commit-Revision: 347877 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: F21EC6EC9D X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.99 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.998,0]; NEURAL_HAM_SHORT(-0.99)[-0.988,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US]; NEURAL_HAM_LONG(-1.00)[-1.000,0] X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 16 May 2019 18:26:15 -0000 Author: hselasky Date: Thu May 16 18:26:14 2019 New Revision: 347877 URL: https://svnweb.freebsd.org/changeset/base/347877 Log: MFC r347321: Undo previous steps upon returning failure in mlx5en(4). Else flowtable resources may not be properly freed. Sponsored by: Mellanox Technologies Modified: stable/11/sys/dev/mlx5/mlx5_en/mlx5_en_flow_table.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/dev/mlx5/mlx5_en/mlx5_en_flow_table.c ============================================================================== --- stable/11/sys/dev/mlx5/mlx5_en/mlx5_en_flow_table.c Thu May 16 18:25:26 2019 (r347876) +++ stable/11/sys/dev/mlx5/mlx5_en/mlx5_en_flow_table.c Thu May 16 18:26:14 2019 (r347877) @@ -633,7 +633,11 @@ mlx5e_add_any_vid_rules(struct mlx5e_priv *priv) if (err) return (err); - return (mlx5e_add_vlan_rule(priv, MLX5E_VLAN_RULE_TYPE_ANY_STAG_VID, 0)); + err = mlx5e_add_vlan_rule(priv, MLX5E_VLAN_RULE_TYPE_ANY_STAG_VID, 0); + if (err) + mlx5e_del_vlan_rule(priv, MLX5E_VLAN_RULE_TYPE_ANY_CTAG_VID, 0); + + return (err); } void @@ -701,19 +705,22 @@ mlx5e_add_all_vlan_rules(struct mlx5e_priv *priv) err = mlx5e_add_vlan_rule(priv, MLX5E_VLAN_RULE_TYPE_MATCH_VID, i); if (err) - return (err); + goto error; } err = mlx5e_add_vlan_rule(priv, MLX5E_VLAN_RULE_TYPE_UNTAGGED, 0); if (err) - return (err); + goto error; if (priv->vlan.filter_disabled) { err = mlx5e_add_any_vid_rules(priv); if (err) - return (err); + goto error; } return (0); +error: + mlx5e_del_all_vlan_rules(priv); + return (err); } void From owner-svn-src-stable@freebsd.org Thu May 16 18:26:43 2019 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id C79F715A3DA2; Thu, 16 May 2019 18:26:43 +0000 (UTC) (envelope-from tuexen@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 65AE66EDED; Thu, 16 May 2019 18:26:43 +0000 (UTC) (envelope-from tuexen@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 36ED024A1A; Thu, 16 May 2019 18:26:43 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x4GIQhEE040883; Thu, 16 May 2019 18:26:43 GMT (envelope-from tuexen@FreeBSD.org) Received: (from tuexen@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x4GIQg9S040881; Thu, 16 May 2019 18:26:42 GMT (envelope-from tuexen@FreeBSD.org) Message-Id: <201905161826.x4GIQg9S040881@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: tuexen set sender to tuexen@FreeBSD.org using -f From: Michael Tuexen Date: Thu, 16 May 2019 18:26:42 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r347878 - stable/11/sys/dev/virtio/network X-SVN-Group: stable-11 X-SVN-Commit-Author: tuexen X-SVN-Commit-Paths: stable/11/sys/dev/virtio/network X-SVN-Commit-Revision: 347878 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 65AE66EDED X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.99 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.998,0]; NEURAL_HAM_SHORT(-0.99)[-0.988,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US]; NEURAL_HAM_LONG(-1.00)[-1.000,0] X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 16 May 2019 18:26:44 -0000 Author: tuexen Date: Thu May 16 18:26:42 2019 New Revision: 347878 URL: https://svnweb.freebsd.org/changeset/base/347878 Log: MFC r347233: Remove non-functional SCTP checksum offload support for virtio. Checksum offloading for SCTP is not currently specified for virtio. If the hypervisor announces checksum offloading support, it means TCP and UDP checksum offload. If an SCTP packet is sent and the host announced checksum offload support, the hypervisor inserts the IP checksum (16-bit) at the correct offset, but this is not the right checksum, which is a CRC32c. This results in all outgoing packets having the wrong checksum and therefore breaking SCTP based communications. This patch removes SCTP checksum offloading support from the virtio network interface. Thanks to Felix Weinrank for making me aware of the issue. Modified: stable/11/sys/dev/virtio/network/if_vtnet.c stable/11/sys/dev/virtio/network/if_vtnetvar.h Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/dev/virtio/network/if_vtnet.c ============================================================================== --- stable/11/sys/dev/virtio/network/if_vtnet.c Thu May 16 18:26:14 2019 (r347877) +++ stable/11/sys/dev/virtio/network/if_vtnet.c Thu May 16 18:26:42 2019 (r347878) @@ -67,7 +67,6 @@ __FBSDID("$FreeBSD$"); #include #include #include -#include #include #include @@ -1519,9 +1518,6 @@ vtnet_rxq_csum_by_offset(struct vtnet_rxq *rxq, struct m->m_pkthdr.csum_flags |= CSUM_DATA_VALID | CSUM_PSEUDO_HDR; m->m_pkthdr.csum_data = 0xFFFF; break; - case offsetof(struct sctphdr, checksum): - m->m_pkthdr.csum_flags |= CSUM_SCTP_VALID; - break; default: sc->vtnet_stats.rx_csum_bad_offset++; return (1); @@ -1578,11 +1574,6 @@ vtnet_rxq_csum_by_parse(struct vtnet_rxq *rxq, struct return (1); m->m_pkthdr.csum_flags |= CSUM_DATA_VALID | CSUM_PSEUDO_HDR; m->m_pkthdr.csum_data = 0xFFFF; - break; - case IPPROTO_SCTP: - if (__predict_false(m->m_len < offset + sizeof(struct sctphdr))) - return (1); - m->m_pkthdr.csum_flags |= CSUM_SCTP_VALID; break; default: /* Modified: stable/11/sys/dev/virtio/network/if_vtnetvar.h ============================================================================== --- stable/11/sys/dev/virtio/network/if_vtnetvar.h Thu May 16 18:26:14 2019 (r347877) +++ stable/11/sys/dev/virtio/network/if_vtnetvar.h Thu May 16 18:26:42 2019 (r347878) @@ -266,8 +266,8 @@ struct vtnet_mac_filter { CTASSERT(sizeof(struct vtnet_mac_filter) <= PAGE_SIZE); #define VTNET_TX_TIMEOUT 5 -#define VTNET_CSUM_OFFLOAD (CSUM_TCP | CSUM_UDP | CSUM_SCTP) -#define VTNET_CSUM_OFFLOAD_IPV6 (CSUM_TCP_IPV6 | CSUM_UDP_IPV6 | CSUM_SCTP_IPV6) +#define VTNET_CSUM_OFFLOAD (CSUM_TCP | CSUM_UDP) +#define VTNET_CSUM_OFFLOAD_IPV6 (CSUM_TCP_IPV6 | CSUM_UDP_IPV6) #define VTNET_CSUM_ALL_OFFLOAD \ (VTNET_CSUM_OFFLOAD | VTNET_CSUM_OFFLOAD_IPV6 | CSUM_TSO) From owner-svn-src-stable@freebsd.org Thu May 16 18:27:28 2019 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 5CF9615A3E63; Thu, 16 May 2019 18:27:28 +0000 (UTC) (envelope-from hselasky@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 014446EF50; Thu, 16 May 2019 18:27:28 +0000 (UTC) (envelope-from hselasky@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 E2A2424A20; Thu, 16 May 2019 18:27:27 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x4GIRRMV040985; Thu, 16 May 2019 18:27:27 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x4GIRRPC040984; Thu, 16 May 2019 18:27:27 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201905161827.x4GIRRPC040984@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Thu, 16 May 2019 18:27:27 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r347879 - stable/11/sys/dev/mlx5/mlx5_en X-SVN-Group: stable-11 X-SVN-Commit-Author: hselasky X-SVN-Commit-Paths: stable/11/sys/dev/mlx5/mlx5_en X-SVN-Commit-Revision: 347879 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 014446EF50 X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.99 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.998,0]; NEURAL_HAM_SHORT(-0.99)[-0.988,0]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US] X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 16 May 2019 18:27:28 -0000 Author: hselasky Date: Thu May 16 18:27:27 2019 New Revision: 347879 URL: https://svnweb.freebsd.org/changeset/base/347879 Log: MFC r347322: Ensure the flowtable rules are not freed twice in mlx5en(4). This can happen when re-loading the driver. Sponsored by: Mellanox Technologies Modified: stable/11/sys/dev/mlx5/mlx5_en/mlx5_en_flow_table.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/dev/mlx5/mlx5_en/mlx5_en_flow_table.c ============================================================================== --- stable/11/sys/dev/mlx5/mlx5_en/mlx5_en_flow_table.c Thu May 16 18:26:42 2019 (r347878) +++ stable/11/sys/dev/mlx5/mlx5_en/mlx5_en_flow_table.c Thu May 16 18:27:27 2019 (r347879) @@ -131,6 +131,9 @@ mlx5e_del_eth_addr_from_flow_table(struct mlx5e_priv * if (ai->tt_vec & (1 << MLX5E_TT_ANY)) mlx5_del_flow_rule(ai->ft_rule[MLX5E_TT_ANY]); + + /* ensure the rules are not freed again */ + ai->tt_vec = 0; } static int From owner-svn-src-stable@freebsd.org Thu May 16 18:28:14 2019 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id D6D6C15A3F02; Thu, 16 May 2019 18:28:13 +0000 (UTC) (envelope-from hselasky@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 9BEC06F090; Thu, 16 May 2019 18:28:13 +0000 (UTC) (envelope-from hselasky@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 841DF24A21; Thu, 16 May 2019 18:28:13 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x4GISDN3041086; Thu, 16 May 2019 18:28:13 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x4GISDGZ041083; Thu, 16 May 2019 18:28:13 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201905161828.x4GISDGZ041083@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Thu, 16 May 2019 18:28:13 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r347880 - in stable/11/sys/dev/mlx5: . mlx5_core X-SVN-Group: stable-11 X-SVN-Commit-Author: hselasky X-SVN-Commit-Paths: in stable/11/sys/dev/mlx5: . mlx5_core X-SVN-Commit-Revision: 347880 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 9BEC06F090 X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.99 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.998,0]; NEURAL_HAM_SHORT(-0.99)[-0.989,0]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US] X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 16 May 2019 18:28:14 -0000 Author: hselasky Date: Thu May 16 18:28:12 2019 New Revision: 347880 URL: https://svnweb.freebsd.org/changeset/base/347880 Log: MFC r347323: Fix race between driver unload and dumping firmware in mlx5core. Present code uses lock-less accesses to the dump data to prevent top level ioctls from blocking bottom-level call to dump. Unfortunately, this depends on the type stability of the dump data structure, which makes it non-functional during driver teardown. Switch to the mutex locking scheme where top levels use the mutex in the bound regions, while copyouts and drain for completion utilize condvars. The mutex lifetime is guaranteed to be strictly larger than the time interval where driver can initiate dump, and most of the control fields of the old struct mlx5_dump_data are directly embedded into struct mlx5_core_dev. Submitted by: kib@ Sponsored by: Mellanox Technologies Modified: stable/11/sys/dev/mlx5/driver.h stable/11/sys/dev/mlx5/mlx5_core/mlx5_fwdump.c stable/11/sys/dev/mlx5/mlx5_core/mlx5_main.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/dev/mlx5/driver.h ============================================================================== --- stable/11/sys/dev/mlx5/driver.h Thu May 16 18:27:27 2019 (r347879) +++ stable/11/sys/dev/mlx5/driver.h Thu May 16 18:28:12 2019 (r347880) @@ -638,7 +638,6 @@ struct mlx5_special_contexts { }; struct mlx5_flow_root_namespace; -struct mlx5_dump_data; struct mlx5_core_dev { struct pci_dev *pdev; /* sync pci state */ @@ -678,7 +677,12 @@ struct mlx5_core_dev { struct mlx5_flow_root_namespace *sniffer_rx_root_ns; struct mlx5_flow_root_namespace *sniffer_tx_root_ns; u32 num_q_counter_allocated[MLX5_INTERFACE_NUMBER]; - struct mlx5_dump_data *dump_data; + const struct mlx5_crspace_regmap *dump_rege; + uint32_t *dump_data; + unsigned dump_size; + bool dump_valid; + bool dump_copyout; + struct mtx dump_lock; struct sysctl_ctx_list sysctl_ctx; int msix_eqvec; Modified: stable/11/sys/dev/mlx5/mlx5_core/mlx5_fwdump.c ============================================================================== --- stable/11/sys/dev/mlx5/mlx5_core/mlx5_fwdump.c Thu May 16 18:27:27 2019 (r347879) +++ stable/11/sys/dev/mlx5/mlx5_core/mlx5_fwdump.c Thu May 16 18:28:12 2019 (r347880) @@ -39,14 +39,6 @@ extern const struct mlx5_crspace_regmap mlx5_crspace_r extern const struct mlx5_crspace_regmap mlx5_crspace_regmap_mt4115[]; extern const struct mlx5_crspace_regmap mlx5_crspace_regmap_connectx5[]; -struct mlx5_dump_data { - const struct mlx5_crspace_regmap *rege; - uint32_t *dump; - unsigned dump_size; - int dump_valid; - struct mtx dump_lock; -}; - static MALLOC_DEFINE(M_MLX5_DUMP, "MLX5DUMP", "MLX5 Firmware dump"); static unsigned @@ -61,20 +53,20 @@ mlx5_fwdump_getsize(const struct mlx5_crspace_regmap * } static void -mlx5_fwdump_destroy_dd(struct mlx5_dump_data *dd) +mlx5_fwdump_destroy_dd(struct mlx5_core_dev *mdev) { - mtx_destroy(&dd->dump_lock); - free(dd->dump, M_MLX5_DUMP); - free(dd, M_MLX5_DUMP); + mtx_assert(&mdev->dump_lock, MA_OWNED); + free(mdev->dump_data, M_MLX5_DUMP); + mdev->dump_data = NULL; } void mlx5_fwdump_prep(struct mlx5_core_dev *mdev) { - struct mlx5_dump_data *dd; int error; + mdev->dump_data = NULL; error = mlx5_vsc_find_cap(mdev); if (error != 0) { /* Inability to create a firmware dump is not fatal. */ @@ -82,47 +74,39 @@ mlx5_fwdump_prep(struct mlx5_core_dev *mdev) "mlx5_fwdump_prep failed %d\n", error); return; } - dd = malloc(sizeof(struct mlx5_dump_data), M_MLX5_DUMP, M_WAITOK); switch (pci_get_device(mdev->pdev->dev.bsddev)) { case 0x1013: - dd->rege = mlx5_crspace_regmap_mt4115; + mdev->dump_rege = mlx5_crspace_regmap_mt4115; break; case 0x1015: - dd->rege = mlx5_crspace_regmap_mt4117; + mdev->dump_rege = mlx5_crspace_regmap_mt4117; break; case 0x1017: case 0x1019: - dd->rege = mlx5_crspace_regmap_connectx5; + mdev->dump_rege = mlx5_crspace_regmap_connectx5; break; default: - free(dd, M_MLX5_DUMP); return; /* silently fail, do not prevent driver attach */ } - dd->dump_size = mlx5_fwdump_getsize(dd->rege); - dd->dump = malloc(dd->dump_size * sizeof(uint32_t), M_MLX5_DUMP, - M_WAITOK | M_ZERO); - dd->dump_valid = 0; - mtx_init(&dd->dump_lock, "mlx5dmp", NULL, MTX_DEF | MTX_NEW); - if (atomic_cmpset_rel_ptr((uintptr_t *)&mdev->dump_data, 0, - (uintptr_t)dd) == 0) - mlx5_fwdump_destroy_dd(dd); + mdev->dump_size = mlx5_fwdump_getsize(mdev->dump_rege); + mdev->dump_data = malloc(mdev->dump_size * sizeof(uint32_t), + M_MLX5_DUMP, M_WAITOK | M_ZERO); + mdev->dump_valid = false; + mdev->dump_copyout = false; } void mlx5_fwdump(struct mlx5_core_dev *mdev) { - struct mlx5_dump_data *dd; const struct mlx5_crspace_regmap *r; uint32_t i, ri; int error; dev_info(&mdev->pdev->dev, "Issuing FW dump\n"); - dd = (struct mlx5_dump_data *)atomic_load_acq_ptr((uintptr_t *) - &mdev->dump_data); - if (dd == NULL) - return; - mtx_lock(&dd->dump_lock); - if (dd->dump_valid) { + mtx_lock(&mdev->dump_lock); + if (mdev->dump_data == NULL) + goto failed; + if (mdev->dump_valid) { /* only one dump */ dev_warn(&mdev->pdev->dev, "Only one FW dump can be captured aborting FW dump\n"); @@ -136,37 +120,51 @@ mlx5_fwdump(struct mlx5_core_dev *mdev) error = mlx5_vsc_set_space(mdev, MLX5_VSC_DOMAIN_PROTECTED_CRSPACE); if (error != 0) goto unlock_vsc; - for (i = 0, r = dd->rege; r->cnt != 0; r++) { + for (i = 0, r = mdev->dump_rege; r->cnt != 0; r++) { for (ri = 0; ri < r->cnt; ri++) { error = mlx5_vsc_read(mdev, r->addr + ri * 4, - &dd->dump[i]); + &mdev->dump_data[i]); if (error != 0) goto unlock_vsc; i++; } } - atomic_store_rel_int(&dd->dump_valid, 1); + mdev->dump_valid = true; unlock_vsc: mlx5_vsc_unlock(mdev); failed: - mtx_unlock(&dd->dump_lock); + mtx_unlock(&mdev->dump_lock); } void mlx5_fwdump_clean(struct mlx5_core_dev *mdev) { - struct mlx5_dump_data *dd; - for (;;) { - dd = mdev->dump_data; - if (dd == NULL) - return; - if (atomic_cmpset_ptr((uintptr_t *)&mdev->dump_data, - (uintptr_t)dd, 0) == 1) { - mlx5_fwdump_destroy_dd(dd); - return; + mtx_lock(&mdev->dump_lock); + while (mdev->dump_copyout) + msleep(&mdev->dump_copyout, &mdev->dump_lock, 0, "mlx5fwc", 0); + mlx5_fwdump_destroy_dd(mdev); + mtx_unlock(&mdev->dump_lock); +} + +static int +mlx5_fwdump_reset(struct mlx5_core_dev *mdev) +{ + int error; + + error = 0; + mtx_lock(&mdev->dump_lock); + if (mdev->dump_data != NULL) { + while (mdev->dump_copyout) { + msleep(&mdev->dump_copyout, &mdev->dump_lock, + 0, "mlx5fwr", 0); } + mdev->dump_valid = false; + } else { + error = ENOENT; } + mtx_unlock(&mdev->dump_lock); + return (error); } static int @@ -190,29 +188,37 @@ mlx5_dbsf_to_core(const struct mlx5_tool_addr *devaddr } static int -mlx5_fwdump_copyout(struct mlx5_dump_data *dd, struct mlx5_fwdump_get *fwg) +mlx5_fwdump_copyout(struct mlx5_core_dev *mdev, struct mlx5_fwdump_get *fwg) { const struct mlx5_crspace_regmap *r; struct mlx5_fwdump_reg rv, *urv; uint32_t i, ri; int error; - if (dd == NULL) + mtx_lock(&mdev->dump_lock); + if (mdev->dump_data == NULL) { + mtx_unlock(&mdev->dump_lock); return (ENOENT); + } if (fwg->buf == NULL) { - fwg->reg_filled = dd->dump_size; + fwg->reg_filled = mdev->dump_size; + mtx_unlock(&mdev->dump_lock); return (0); } - if (atomic_load_acq_int(&dd->dump_valid) == 0) + if (!mdev->dump_valid) { + mtx_unlock(&mdev->dump_lock); return (ENOENT); + } + mdev->dump_copyout = true; + mtx_unlock(&mdev->dump_lock); urv = fwg->buf; - for (i = 0, r = dd->rege; r->cnt != 0; r++) { + for (i = 0, r = mdev->dump_rege; r->cnt != 0; r++) { for (ri = 0; ri < r->cnt; ri++) { if (i >= fwg->reg_cnt) goto out; rv.addr = r->addr + ri * 4; - rv.val = dd->dump[i]; + rv.val = mdev->dump_data[i]; error = copyout(&rv, urv, sizeof(rv)); if (error != 0) return (error); @@ -222,6 +228,10 @@ mlx5_fwdump_copyout(struct mlx5_dump_data *dd, struct } out: fwg->reg_filled = i; + mtx_lock(&mdev->dump_lock); + mdev->dump_copyout = false; + wakeup(&mdev->dump_copyout); + mtx_unlock(&mdev->dump_lock); return (0); } @@ -250,7 +260,6 @@ mlx5_ctl_ioctl(struct cdev *dev, u_long cmd, caddr_t d struct mlx5_core_dev *mdev; struct mlx5_fwdump_get *fwg; struct mlx5_tool_addr *devaddr; - struct mlx5_dump_data *dd; struct mlx5_fw_update *fu; struct firmware fake_fw; int error; @@ -267,7 +276,7 @@ mlx5_ctl_ioctl(struct cdev *dev, u_long cmd, caddr_t d error = mlx5_dbsf_to_core(devaddr, &mdev); if (error != 0) break; - error = mlx5_fwdump_copyout(mdev->dump_data, fwg); + error = mlx5_fwdump_copyout(mdev, fwg); break; case MLX5_FWDUMP_RESET: if ((fflag & FWRITE) == 0) { @@ -276,13 +285,8 @@ mlx5_ctl_ioctl(struct cdev *dev, u_long cmd, caddr_t d } devaddr = (struct mlx5_tool_addr *)data; error = mlx5_dbsf_to_core(devaddr, &mdev); - if (error != 0) - break; - dd = mdev->dump_data; - if (dd != NULL) - atomic_store_rel_int(&dd->dump_valid, 0); - else - error = ENOENT; + if (error == 0) + error = mlx5_fwdump_reset(mdev); break; case MLX5_FWDUMP_FORCE: if ((fflag & FWRITE) == 0) { Modified: stable/11/sys/dev/mlx5/mlx5_core/mlx5_main.c ============================================================================== --- stable/11/sys/dev/mlx5/mlx5_core/mlx5_main.c Thu May 16 18:27:27 2019 (r347879) +++ stable/11/sys/dev/mlx5/mlx5_core/mlx5_main.c Thu May 16 18:28:12 2019 (r347880) @@ -1283,6 +1283,7 @@ static int init_one(struct pci_dev *pdev, spin_lock_init(&priv->ctx_lock); mutex_init(&dev->pci_status_mutex); mutex_init(&dev->intf_state_mutex); + mtx_init(&dev->dump_lock, "mlx5dmp", NULL, MTX_DEF | MTX_NEW); err = mlx5_pci_init(dev, priv); if (err) { device_printf(bsddev, "ERR: mlx5_pci_init failed %d\n", err); @@ -1317,6 +1318,7 @@ close_pci: mlx5_pci_close(dev, priv); clean_dev: sysctl_ctx_free(&dev->sysctl_ctx); + mtx_destroy(&dev->dump_lock); kfree(dev); return err; } @@ -1332,10 +1334,11 @@ static void remove_one(struct pci_dev *pdev) return; } - mlx5_fwdump_clean(dev); mlx5_pagealloc_cleanup(dev); mlx5_health_cleanup(dev); + mlx5_fwdump_clean(dev); mlx5_pci_close(dev, priv); + mtx_destroy(&dev->dump_lock); pci_set_drvdata(pdev, NULL); sysctl_ctx_free(&dev->sysctl_ctx); kfree(dev); From owner-svn-src-stable@freebsd.org Thu May 16 18:29:01 2019 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 5679F15A3F9F; Thu, 16 May 2019 18:29:01 +0000 (UTC) (envelope-from hselasky@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 EC2316F1CF; Thu, 16 May 2019 18:29:00 +0000 (UTC) (envelope-from hselasky@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 D49D524A22; Thu, 16 May 2019 18:29:00 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x4GIT0Rj041191; Thu, 16 May 2019 18:29:00 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x4GIT0Ks041186; Thu, 16 May 2019 18:29:00 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201905161829.x4GIT0Ks041186@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Thu, 16 May 2019 18:29:00 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r347881 - in stable/11/sys/dev/mlx5: . mlx5_core X-SVN-Group: stable-11 X-SVN-Commit-Author: hselasky X-SVN-Commit-Paths: in stable/11/sys/dev/mlx5: . mlx5_core X-SVN-Commit-Revision: 347881 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: EC2316F1CF X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.99 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.998,0]; NEURAL_HAM_SHORT(-0.99)[-0.988,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US]; NEURAL_HAM_LONG(-1.00)[-1.000,0] X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 16 May 2019 18:29:01 -0000 Author: hselasky Date: Thu May 16 18:28:59 2019 New Revision: 347881 URL: https://svnweb.freebsd.org/changeset/base/347881 Log: MFC r347324: Make command workqueue persistant in mlx5core. There is no reason to re-create the command workqueue during healthcare. This also fixes an issue where a previous work struct may refer to a destroyed workqueue. Sponsored by: Mellanox Technologies Modified: stable/11/sys/dev/mlx5/driver.h stable/11/sys/dev/mlx5/mlx5_core/mlx5_cmd.c stable/11/sys/dev/mlx5/mlx5_core/mlx5_health.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/dev/mlx5/driver.h ============================================================================== --- stable/11/sys/dev/mlx5/driver.h Thu May 16 18:28:12 2019 (r347880) +++ stable/11/sys/dev/mlx5/driver.h Thu May 16 18:28:59 2019 (r347881) @@ -54,7 +54,6 @@ enum { enum { MLX5_CMD_TIMEOUT_MSEC = 60 * 1000, - MLX5_CMD_WQ_MAX_NAME = 32, }; enum { @@ -351,8 +350,6 @@ struct mlx5_cmd { spinlock_t token_lock; u8 token; unsigned long bitmask; - char wq_name[MLX5_CMD_WQ_MAX_NAME]; - struct workqueue_struct *wq; struct semaphore sem; struct semaphore pages_sem; enum mlx5_cmd_mode mode; @@ -514,6 +511,7 @@ struct mlx5_core_health { struct delayed_work recover_work; unsigned int last_reset_req; struct work_struct work_cmd_completion; + struct workqueue_struct *wq_cmd; }; #define MLX5_CQ_LINEAR_ARRAY_SIZE 1024 Modified: stable/11/sys/dev/mlx5/mlx5_core/mlx5_cmd.c ============================================================================== --- stable/11/sys/dev/mlx5/mlx5_core/mlx5_cmd.c Thu May 16 18:28:12 2019 (r347880) +++ stable/11/sys/dev/mlx5/mlx5_core/mlx5_cmd.c Thu May 16 18:28:59 2019 (r347881) @@ -1,5 +1,5 @@ /*- - * Copyright (c) 2013-2017, Mellanox Technologies, Ltd. All rights reserved. + * Copyright (c) 2013-2019, Mellanox Technologies, Ltd. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -997,7 +997,7 @@ static int mlx5_cmd_invoke(struct mlx5_core_dev *dev, INIT_WORK(&ent->work, cmd_work_handler); if (page_queue) { cmd_work_handler(&ent->work); - } else if (!queue_work(cmd->wq, &ent->work)) { + } else if (!queue_work(dev->priv.health.wq_cmd, &ent->work)) { mlx5_core_warn(dev, "failed to queue work\n"); err = -ENOMEM; goto out_free; @@ -1127,14 +1127,6 @@ mlx5_free_cmd_msg(struct mlx5_core_dev *dev, struct ml mlx5_fwp_free(msg); } -static void set_wqname(struct mlx5_core_dev *dev) -{ - struct mlx5_cmd *cmd = &dev->cmd; - - snprintf(cmd->wq_name, sizeof(cmd->wq_name), "mlx5_cmd_%s", - dev_name(&dev->pdev->dev)); -} - static void clean_debug_files(struct mlx5_core_dev *dev) { } @@ -1562,20 +1554,8 @@ int mlx5_cmd_init(struct mlx5_core_dev *dev) device_printf((&dev->pdev->dev)->bsddev, "ERR: ""failed to create command cache\n"); goto err_free_page; } - - set_wqname(dev); - cmd->wq = create_singlethread_workqueue(cmd->wq_name); - if (!cmd->wq) { - device_printf((&dev->pdev->dev)->bsddev, "ERR: ""failed to create command workqueue\n"); - err = -ENOMEM; - goto err_cache; - } - return 0; -err_cache: - destroy_msg_cache(dev); - err_free_page: free_cmd_page(dev, cmd); @@ -1589,7 +1569,7 @@ void mlx5_cmd_cleanup(struct mlx5_core_dev *dev) struct mlx5_cmd *cmd = &dev->cmd; clean_debug_files(dev); - destroy_workqueue(cmd->wq); + flush_workqueue(dev->priv.health.wq_cmd); destroy_msg_cache(dev); free_cmd_page(dev, cmd); } Modified: stable/11/sys/dev/mlx5/mlx5_core/mlx5_health.c ============================================================================== --- stable/11/sys/dev/mlx5/mlx5_core/mlx5_health.c Thu May 16 18:28:12 2019 (r347880) +++ stable/11/sys/dev/mlx5/mlx5_core/mlx5_health.c Thu May 16 18:28:59 2019 (r347881) @@ -1,5 +1,5 @@ /*- - * Copyright (c) 2013-2017, Mellanox Technologies, Ltd. All rights reserved. + * Copyright (c) 2013-2019, Mellanox Technologies, Ltd. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -280,8 +280,8 @@ void mlx5_enter_error_state(struct mlx5_core_dev *dev, * completion handler and then wait for it to * complete: */ - queue_work(dev->cmd.wq, &dev->priv.health.work_cmd_completion); - flush_workqueue(dev->cmd.wq); + queue_work(dev->priv.health.wq_cmd, &dev->priv.health.work_cmd_completion); + flush_workqueue(dev->priv.health.wq_cmd); } mutex_lock(&dev->intf_state_mutex); @@ -679,6 +679,7 @@ void mlx5_health_cleanup(struct mlx5_core_dev *dev) destroy_workqueue(health->wq); destroy_workqueue(health->wq_watchdog); + destroy_workqueue(health->wq_cmd); } int mlx5_health_init(struct mlx5_core_dev *dev) @@ -691,15 +692,18 @@ int mlx5_health_init(struct mlx5_core_dev *dev) snprintf(name, sizeof(name), "%s-rec", dev_name(&dev->pdev->dev)); health->wq = create_singlethread_workqueue(name); if (!health->wq) - return -ENOMEM; + goto err_recovery; snprintf(name, sizeof(name), "%s-wdg", dev_name(&dev->pdev->dev)); health->wq_watchdog = create_singlethread_workqueue(name); - if (!health->wq_watchdog) { - destroy_workqueue(health->wq); - return -ENOMEM; - } + if (!health->wq_watchdog) + goto err_watchdog; + snprintf(name, sizeof(name), "%s-cmd", dev_name(&dev->pdev->dev)); + health->wq_cmd = create_singlethread_workqueue(name); + if (!health->wq_cmd) + goto err_cmd; + spin_lock_init(&health->wq_lock); INIT_WORK(&health->work, health_care); INIT_WORK(&health->work_watchdog, health_watchdog); @@ -707,4 +711,11 @@ int mlx5_health_init(struct mlx5_core_dev *dev) INIT_DELAYED_WORK(&health->recover_work, health_recover); return 0; + +err_cmd: + destroy_workqueue(health->wq_watchdog); +err_watchdog: + destroy_workqueue(health->wq); +err_recovery: + return -ENOMEM; } From owner-svn-src-stable@freebsd.org Thu May 16 18:29:28 2019 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 3A57415A4025; Thu, 16 May 2019 18:29:28 +0000 (UTC) (envelope-from tuexen@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 D10146F38A; Thu, 16 May 2019 18:29:27 +0000 (UTC) (envelope-from tuexen@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 5050724A24; Thu, 16 May 2019 18:29:26 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x4GITQuf041395; Thu, 16 May 2019 18:29:26 GMT (envelope-from tuexen@FreeBSD.org) Received: (from tuexen@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x4GITPp2041393; Thu, 16 May 2019 18:29:25 GMT (envelope-from tuexen@FreeBSD.org) Message-Id: <201905161829.x4GITPp2041393@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: tuexen set sender to tuexen@FreeBSD.org using -f From: Michael Tuexen Date: Thu, 16 May 2019 18:29:25 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r347882 - stable/11/sys/netinet/cc X-SVN-Group: stable-11 X-SVN-Commit-Author: tuexen X-SVN-Commit-Paths: stable/11/sys/netinet/cc X-SVN-Commit-Revision: 347882 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: D10146F38A X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.99 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.998,0]; NEURAL_HAM_SHORT(-0.99)[-0.988,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US]; NEURAL_HAM_LONG(-1.00)[-1.000,0] X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 16 May 2019 18:29:28 -0000 Author: tuexen Date: Thu May 16 18:29:25 2019 New Revision: 347882 URL: https://svnweb.freebsd.org/changeset/base/347882 Log: MFC r347381: Prevent cwnd to collapse down to 1 MSS after exiting recovery. This is descrined in RFC 6582, which updates RFC 3782. Modified: stable/11/sys/netinet/cc/cc_cubic.c stable/11/sys/netinet/cc/cc_htcp.c stable/11/sys/netinet/cc/cc_newreno.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/netinet/cc/cc_cubic.c ============================================================================== --- stable/11/sys/netinet/cc/cc_cubic.c Thu May 16 18:28:59 2019 (r347881) +++ stable/11/sys/netinet/cc/cc_cubic.c Thu May 16 18:29:25 2019 (r347882) @@ -324,7 +324,12 @@ cubic_post_recovery(struct cc_var *ccv) pipe = CCV(ccv, snd_max) - ccv->curack; if (pipe < CCV(ccv, snd_ssthresh)) - CCV(ccv, snd_cwnd) = pipe + CCV(ccv, t_maxseg); + /* + * Ensure that cwnd does not collapse to 1 MSS under + * adverse conditions. Implements RFC6582 + */ + CCV(ccv, snd_cwnd) = max(pipe, CCV(ccv, t_maxseg)) + + CCV(ccv, t_maxseg); else /* Update cwnd based on beta and adjusted max_cwnd. */ CCV(ccv, snd_cwnd) = max(1, ((CUBIC_BETA * Modified: stable/11/sys/netinet/cc/cc_htcp.c ============================================================================== --- stable/11/sys/netinet/cc/cc_htcp.c Thu May 16 18:28:59 2019 (r347881) +++ stable/11/sys/netinet/cc/cc_htcp.c Thu May 16 18:29:25 2019 (r347882) @@ -366,7 +366,12 @@ htcp_post_recovery(struct cc_var *ccv) pipe = CCV(ccv, snd_max) - ccv->curack; if (pipe < CCV(ccv, snd_ssthresh)) - CCV(ccv, snd_cwnd) = pipe + CCV(ccv, t_maxseg); + /* + * Ensure that cwnd down not collape to 1 MSS under + * adverse conditions. Implements RFC6582 + */ + CCV(ccv, snd_cwnd) = max(pipe, CCV(ccv, t_maxseg)) + + CCV(ccv, t_maxseg); else CCV(ccv, snd_cwnd) = max(1, ((htcp_data->beta * htcp_data->prev_cwnd / CCV(ccv, t_maxseg)) Modified: stable/11/sys/netinet/cc/cc_newreno.c ============================================================================== --- stable/11/sys/netinet/cc/cc_newreno.c Thu May 16 18:28:59 2019 (r347881) +++ stable/11/sys/netinet/cc/cc_newreno.c Thu May 16 18:29:25 2019 (r347882) @@ -233,7 +233,12 @@ newreno_post_recovery(struct cc_var *ccv) pipe = CCV(ccv, snd_max) - ccv->curack; if (pipe < CCV(ccv, snd_ssthresh)) - CCV(ccv, snd_cwnd) = pipe + CCV(ccv, t_maxseg); + /* + * Ensure that cwnd does not collapse to 1 MSS under + * adverse conditons. Implements RFC6582 + */ + CCV(ccv, snd_cwnd) = max(pipe, CCV(ccv, t_maxseg)) + + CCV(ccv, t_maxseg); else CCV(ccv, snd_cwnd) = CCV(ccv, snd_ssthresh); } From owner-svn-src-stable@freebsd.org Thu May 16 18:33:32 2019 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 61EB615A430A; Thu, 16 May 2019 18:33:32 +0000 (UTC) (envelope-from hselasky@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 004816F8E7; Thu, 16 May 2019 18:33:32 +0000 (UTC) (envelope-from hselasky@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 CB84824BC8; Thu, 16 May 2019 18:33:31 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x4GIXVNn046296; Thu, 16 May 2019 18:33:31 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x4GIXUH8046291; Thu, 16 May 2019 18:33:30 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201905161833.x4GIXUH8046291@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Thu, 16 May 2019 18:33:30 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r347883 - in stable/11/sys: dev/mlx4/mlx4_core dev/mlx4/mlx4_ib dev/mlx5/mlx5_core dev/mlx5/mlx5_en dev/mlx5/mlx5_ib sys X-SVN-Group: stable-11 X-SVN-Commit-Author: hselasky X-SVN-Commit-Paths: in stable/11/sys: dev/mlx4/mlx4_core dev/mlx4/mlx4_ib dev/mlx5/mlx5_core dev/mlx5/mlx5_en dev/mlx5/mlx5_ib sys X-SVN-Commit-Revision: 347883 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 004816F8E7 X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.99 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.998,0]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; NEURAL_HAM_SHORT(-0.99)[-0.988,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US] X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 16 May 2019 18:33:32 -0000 Author: hselasky Date: Thu May 16 18:33:30 2019 New Revision: 347883 URL: https://svnweb.freebsd.org/changeset/base/347883 Log: MFC r347325: Bump the Mellanox driver version numbers and the FreeBSD version number. Sponsored by: Mellanox Technologies Modified: stable/11/sys/dev/mlx4/mlx4_core/mlx4.h stable/11/sys/dev/mlx4/mlx4_ib/mlx4_ib_main.c stable/11/sys/dev/mlx5/mlx5_core/mlx5_core.h stable/11/sys/dev/mlx5/mlx5_en/mlx5_en_main.c stable/11/sys/dev/mlx5/mlx5_ib/mlx5_ib_main.c stable/11/sys/sys/param.h Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/dev/mlx4/mlx4_core/mlx4.h ============================================================================== --- stable/11/sys/dev/mlx4/mlx4_core/mlx4.h Thu May 16 18:29:25 2019 (r347882) +++ stable/11/sys/dev/mlx4/mlx4_core/mlx4.h Thu May 16 18:33:30 2019 (r347883) @@ -53,8 +53,8 @@ #define DRV_NAME "mlx4_core" #define PFX DRV_NAME ": " -#define DRV_VERSION "3.5.0" -#define DRV_RELDATE "November 2018" +#define DRV_VERSION "3.5.1" +#define DRV_RELDATE "April 2019" #define MLX4_FS_UDP_UC_EN (1 << 1) #define MLX4_FS_TCP_UC_EN (1 << 2) Modified: stable/11/sys/dev/mlx4/mlx4_ib/mlx4_ib_main.c ============================================================================== --- stable/11/sys/dev/mlx4/mlx4_ib/mlx4_ib_main.c Thu May 16 18:29:25 2019 (r347882) +++ stable/11/sys/dev/mlx4/mlx4_ib/mlx4_ib_main.c Thu May 16 18:33:30 2019 (r347883) @@ -64,9 +64,9 @@ #define DRV_NAME MLX4_IB_DRV_NAME #ifndef DRV_VERSION -#define DRV_VERSION "3.5.0" +#define DRV_VERSION "3.5.1" #endif -#define DRV_RELDATE "November 2018" +#define DRV_RELDATE "April 2019" #define MLX4_IB_FLOW_MAX_PRIO 0xFFF #define MLX4_IB_FLOW_QPN_MASK 0xFFFFFF Modified: stable/11/sys/dev/mlx5/mlx5_core/mlx5_core.h ============================================================================== --- stable/11/sys/dev/mlx5/mlx5_core/mlx5_core.h Thu May 16 18:29:25 2019 (r347882) +++ stable/11/sys/dev/mlx5/mlx5_core/mlx5_core.h Thu May 16 18:33:30 2019 (r347883) @@ -36,9 +36,9 @@ #define DRIVER_NAME "mlx5_core" #ifndef DRIVER_VERSION -#define DRIVER_VERSION "3.5.0" +#define DRIVER_VERSION "3.5.1" #endif -#define DRIVER_RELDATE "November 2018" +#define DRIVER_RELDATE "April 2019" extern int mlx5_core_debug_mask; Modified: stable/11/sys/dev/mlx5/mlx5_en/mlx5_en_main.c ============================================================================== --- stable/11/sys/dev/mlx5/mlx5_en/mlx5_en_main.c Thu May 16 18:29:25 2019 (r347882) +++ stable/11/sys/dev/mlx5/mlx5_en/mlx5_en_main.c Thu May 16 18:33:30 2019 (r347883) @@ -31,9 +31,9 @@ #include #ifndef ETH_DRIVER_VERSION -#define ETH_DRIVER_VERSION "3.5.0" +#define ETH_DRIVER_VERSION "3.5.1" #endif -#define DRIVER_RELDATE "November 2018" +#define DRIVER_RELDATE "April 2019" static const char mlx5e_version[] = "mlx5en: Mellanox Ethernet driver " ETH_DRIVER_VERSION " (" DRIVER_RELDATE ")\n"; Modified: stable/11/sys/dev/mlx5/mlx5_ib/mlx5_ib_main.c ============================================================================== --- stable/11/sys/dev/mlx5/mlx5_ib/mlx5_ib_main.c Thu May 16 18:29:25 2019 (r347882) +++ stable/11/sys/dev/mlx5/mlx5_ib/mlx5_ib_main.c Thu May 16 18:33:30 2019 (r347883) @@ -52,9 +52,9 @@ #define DRIVER_NAME "mlx5ib" #ifndef DRIVER_VERSION -#define DRIVER_VERSION "3.5.0" +#define DRIVER_VERSION "3.5.1" #endif -#define DRIVER_RELDATE "November 2018" +#define DRIVER_RELDATE "April 2019" MODULE_DESCRIPTION("Mellanox Connect-IB HCA IB driver"); MODULE_LICENSE("Dual BSD/GPL"); Modified: stable/11/sys/sys/param.h ============================================================================== --- stable/11/sys/sys/param.h Thu May 16 18:29:25 2019 (r347882) +++ stable/11/sys/sys/param.h Thu May 16 18:33:30 2019 (r347883) @@ -58,7 +58,7 @@ * in the range 5 to 9. */ #undef __FreeBSD_version -#define __FreeBSD_version 1102509 /* Master, propagated to newvers */ +#define __FreeBSD_version 1102510 /* Master, propagated to newvers */ /* * __FreeBSD_kernel__ indicates that this system uses the kernel of FreeBSD, From owner-svn-src-stable@freebsd.org Thu May 16 18:42:29 2019 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id C6C9615A46FB; Thu, 16 May 2019 18:42:28 +0000 (UTC) (envelope-from ken@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 6E2646FEBB; Thu, 16 May 2019 18:42:28 +0000 (UTC) (envelope-from ken@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 5DED624D9B; Thu, 16 May 2019 18:42:28 +0000 (UTC) (envelope-from ken@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x4GIgSk5051565; Thu, 16 May 2019 18:42:28 GMT (envelope-from ken@FreeBSD.org) Received: (from ken@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x4GIgS07051563; Thu, 16 May 2019 18:42:28 GMT (envelope-from ken@FreeBSD.org) Message-Id: <201905161842.x4GIgS07051563@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ken set sender to ken@FreeBSD.org using -f From: "Kenneth D. Merry" Date: Thu, 16 May 2019 18:42:28 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r347884 - in stable/11: lib/libmt usr.bin/mt X-SVN-Group: stable-11 X-SVN-Commit-Author: ken X-SVN-Commit-Paths: in stable/11: lib/libmt usr.bin/mt X-SVN-Commit-Revision: 347884 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 6E2646FEBB X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.99 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.998,0]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; NEURAL_HAM_SHORT(-0.99)[-0.988,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US] X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 16 May 2019 18:42:29 -0000 Author: ken Date: Thu May 16 18:42:27 2019 New Revision: 347884 URL: https://svnweb.freebsd.org/changeset/base/347884 Log: MFC 344761: ------------------------------------------------------------------------ r344761 | ken | 2019-03-04 09:30:37 -0500 (Mon, 04 Mar 2019) | 18 lines Add IBM TS1160 density codes to libmt and the mt(1) man page. These are taken directly from the density report from a TS1160 tape drive. (Using mt getdensity) A TS1160 drive stores 20TB raw (60TB with compression) on a JE tape. lib/libmt/mtlib.c: Add 3592A6 encrypted/unencrypted density codes, and bpmm/bpi values. usr.bin/mt/mt.1: Add 3592B5 encrypted/unencrypted density codes, bpmm/bpi values and number of tracks. Bump the man page date. Sponsored by: Spectra Logic ------------------------------------------------------------------------ Modified: stable/11/lib/libmt/mtlib.c stable/11/usr.bin/mt/mt.1 Directory Properties: stable/11/ (props changed) Modified: stable/11/lib/libmt/mtlib.c ============================================================================== --- stable/11/lib/libmt/mtlib.c Thu May 16 18:33:30 2019 (r347883) +++ stable/11/lib/libmt/mtlib.c Thu May 16 18:42:27 2019 (r347884) @@ -642,6 +642,7 @@ static struct densities { { 0x54, 19686, 500024, "3592A4 (unencrypted)" }, { 0x55, 20670, 525018, "3592A5 (unencrypted)" }, { 0x56, 20670, 525018, "3592B5 (unencrypted)" }, + { 0x57, 21850, 554990, "3592A6 (unencrypted)" }, { 0x58, 15142, 384607, "LTO-5" }, { 0x5A, 15142, 384607, "LTO-6" }, { 0x5C, 19107, 485318, "LTO-7" }, @@ -653,6 +654,7 @@ static struct densities { { 0x74, 19686, 500024, "3592A4 (encrypted)" }, { 0x75, 20670, 525018, "3592A5 (encrypted)" }, { 0x76, 20670, 525018, "3592B5 (encrypted)" }, + { 0x77, 21850, 554990, "3592A6 (encrypted)" }, { 0x8c, 1789, 45434, "EXB-8500c" }, { 0x90, 1703, 43245, "EXB-8200c" }, { 0, 0, 0, NULL } Modified: stable/11/usr.bin/mt/mt.1 ============================================================================== --- stable/11/usr.bin/mt/mt.1 Thu May 16 18:33:30 2019 (r347883) +++ stable/11/usr.bin/mt/mt.1 Thu May 16 18:42:27 2019 (r347884) @@ -29,7 +29,7 @@ .\" @(#)mt.1 8.1 (Berkeley) 6/6/93 .\" $FreeBSD$ .\" -.Dd November 3, 2017 +.Dd March 4, 2019 .Dt MT 1 .Os .Sh NAME @@ -519,6 +519,7 @@ Value Width Tracks Density Code Typ 0x54 12.7 (0.5) 2560 19,686 (500,024) C 3592A4 (unencrypted) 0x55 12.7 (0.5) 5120 20,670 (525,018) C 3592A5 (unencrypted) 0x56 12.7 (0.5) 7680 20,670 (525,018) C 3592B5 (unencrypted) +0x57 12.7 (0.5) 8704 21,850 (554,990) C 3592A6 (unencrypted) 0x58 12.7 (0.5) 1280 15,142 (384,607) C LTO-5 0x5A 12.7 (0.5) 2176 15,142 (384,607) C LTO-6 0x5C 12.7 (0.5) 3584 19,107 (485,318) C LTO-7 @@ -530,6 +531,7 @@ Value Width Tracks Density Code Typ 0x74 12.7 (0.5) 2560 19,686 (500,024) C 3592A4 (encrypted) 0x75 12.7 (0.5) 5120 20,670 (525,018) C 3592A5 (encrypted) 0x76 12.7 (0.5) 7680 20,670 (525,018) C 3592B5 (encrypted) +0x77 12.7 (0.5) 8704 21,850 (554,990) C 3592A6 (encrypted) 0x8c 8.0 (0.315) 1 1,789 (45,434) RLL CS EXB-8500c 5,9 0x90 8.0 (0.315) 1 1,703 (43,245) RLL CS EXB-8200c 5,9 .Ed From owner-svn-src-stable@freebsd.org Thu May 16 18:50:19 2019 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 8087715A48F4; Thu, 16 May 2019 18:50:19 +0000 (UTC) (envelope-from ken@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 25446701C8; Thu, 16 May 2019 18:50:19 +0000 (UTC) (envelope-from ken@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 00A7A24DAA; Thu, 16 May 2019 18:50:19 +0000 (UTC) (envelope-from ken@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x4GIoIxU052094; Thu, 16 May 2019 18:50:18 GMT (envelope-from ken@FreeBSD.org) Received: (from ken@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x4GIoITl052092; Thu, 16 May 2019 18:50:18 GMT (envelope-from ken@FreeBSD.org) Message-Id: <201905161850.x4GIoITl052092@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ken set sender to ken@FreeBSD.org using -f From: "Kenneth D. Merry" Date: Thu, 16 May 2019 18:50:18 +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: r347885 - in stable/12: lib/libmt usr.bin/mt X-SVN-Group: stable-12 X-SVN-Commit-Author: ken X-SVN-Commit-Paths: in stable/12: lib/libmt usr.bin/mt X-SVN-Commit-Revision: 347885 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 25446701C8 X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.99 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.998,0]; NEURAL_HAM_SHORT(-0.99)[-0.988,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US]; NEURAL_HAM_LONG(-1.00)[-1.000,0] X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 16 May 2019 18:50:19 -0000 Author: ken Date: Thu May 16 18:50:18 2019 New Revision: 347885 URL: https://svnweb.freebsd.org/changeset/base/347885 Log: MFC 344761: ------------------------------------------------------------------------ r344761 | ken | 2019-03-04 09:30:37 -0500 (Mon, 04 Mar 2019) | 18 lines Add IBM TS1160 density codes to libmt and the mt(1) man page. These are taken directly from the density report from a TS1160 tape drive. (Using mt getdensity) A TS1160 drive stores 20TB raw (60TB with compression) on a JE tape. lib/libmt/mtlib.c: Add 3592A6 encrypted/unencrypted density codes, and bpmm/bpi values. usr.bin/mt/mt.1: Add 3592B5 encrypted/unencrypted density codes, bpmm/bpi values and number of tracks. Bump the man page date. Sponsored by: Spectra Logic ------------------------------------------------------------------------ Modified: stable/12/lib/libmt/mtlib.c stable/12/usr.bin/mt/mt.1 Modified: stable/12/lib/libmt/mtlib.c ============================================================================== --- stable/12/lib/libmt/mtlib.c Thu May 16 18:42:27 2019 (r347884) +++ stable/12/lib/libmt/mtlib.c Thu May 16 18:50:18 2019 (r347885) @@ -642,6 +642,7 @@ static struct densities { { 0x54, 19686, 500024, "3592A4 (unencrypted)" }, { 0x55, 20670, 525018, "3592A5 (unencrypted)" }, { 0x56, 20670, 525018, "3592B5 (unencrypted)" }, + { 0x57, 21850, 554990, "3592A6 (unencrypted)" }, { 0x58, 15142, 384607, "LTO-5" }, { 0x5A, 15142, 384607, "LTO-6" }, { 0x5C, 19107, 485318, "LTO-7" }, @@ -653,6 +654,7 @@ static struct densities { { 0x74, 19686, 500024, "3592A4 (encrypted)" }, { 0x75, 20670, 525018, "3592A5 (encrypted)" }, { 0x76, 20670, 525018, "3592B5 (encrypted)" }, + { 0x77, 21850, 554990, "3592A6 (encrypted)" }, { 0x8c, 1789, 45434, "EXB-8500c" }, { 0x90, 1703, 43245, "EXB-8200c" }, { 0, 0, 0, NULL } Modified: stable/12/usr.bin/mt/mt.1 ============================================================================== --- stable/12/usr.bin/mt/mt.1 Thu May 16 18:42:27 2019 (r347884) +++ stable/12/usr.bin/mt/mt.1 Thu May 16 18:50:18 2019 (r347885) @@ -29,7 +29,7 @@ .\" @(#)mt.1 8.1 (Berkeley) 6/6/93 .\" $FreeBSD$ .\" -.Dd November 3, 2017 +.Dd March 4, 2019 .Dt MT 1 .Os .Sh NAME @@ -519,6 +519,7 @@ Value Width Tracks Density Code Typ 0x54 12.7 (0.5) 2560 19,686 (500,024) C 3592A4 (unencrypted) 0x55 12.7 (0.5) 5120 20,670 (525,018) C 3592A5 (unencrypted) 0x56 12.7 (0.5) 7680 20,670 (525,018) C 3592B5 (unencrypted) +0x57 12.7 (0.5) 8704 21,850 (554,990) C 3592A6 (unencrypted) 0x58 12.7 (0.5) 1280 15,142 (384,607) C LTO-5 0x5A 12.7 (0.5) 2176 15,142 (384,607) C LTO-6 0x5C 12.7 (0.5) 3584 19,107 (485,318) C LTO-7 @@ -530,6 +531,7 @@ Value Width Tracks Density Code Typ 0x74 12.7 (0.5) 2560 19,686 (500,024) C 3592A4 (encrypted) 0x75 12.7 (0.5) 5120 20,670 (525,018) C 3592A5 (encrypted) 0x76 12.7 (0.5) 7680 20,670 (525,018) C 3592B5 (encrypted) +0x77 12.7 (0.5) 8704 21,850 (554,990) C 3592A6 (encrypted) 0x8c 8.0 (0.315) 1 1,789 (45,434) RLL CS EXB-8500c 5,9 0x90 8.0 (0.315) 1 1,703 (43,245) RLL CS EXB-8200c 5,9 .Ed From owner-svn-src-stable@freebsd.org Thu May 16 22:03:27 2019 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 676FD15A86F4; Thu, 16 May 2019 22:03:27 +0000 (UTC) (envelope-from ken@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 0DD0C7681A; Thu, 16 May 2019 22:03:27 +0000 (UTC) (envelope-from ken@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 D989726F9D; Thu, 16 May 2019 22:03:26 +0000 (UTC) (envelope-from ken@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x4GM3QCF055895; Thu, 16 May 2019 22:03:26 GMT (envelope-from ken@FreeBSD.org) Received: (from ken@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x4GM3Pd6055890; Thu, 16 May 2019 22:03:25 GMT (envelope-from ken@FreeBSD.org) Message-Id: <201905162203.x4GM3Pd6055890@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ken set sender to ken@FreeBSD.org using -f From: "Kenneth D. Merry" Date: Thu, 16 May 2019 22:03:25 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r347894 - stable/11/sys/dev/isp X-SVN-Group: stable-11 X-SVN-Commit-Author: ken X-SVN-Commit-Paths: stable/11/sys/dev/isp X-SVN-Commit-Revision: 347894 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 0DD0C7681A X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.95 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.998,0]; NEURAL_HAM_SHORT(-0.96)[-0.956,0]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US] X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 16 May 2019 22:03:27 -0000 Author: ken Date: Thu May 16 22:03:25 2019 New Revision: 347894 URL: https://svnweb.freebsd.org/changeset/base/347894 Log: MFC r345008: ------------------------------------------------------------------------ r345008 | ken | 2019-03-11 10:21:14 -0400 (Mon, 11 Mar 2019) | 59 lines Fix CRN resets in the isp(4) driver in certain situations. The Command Reference Number (CRN) is part of the FC-Tape features that we enable when talking to tape drives. It starts at 1, and goes to 255 and wraps around to 1. There are a number of reset type conditions that result in the CRN getting reset to 1. These are detailed in section 4.10 (table 8) of the FCP-4r02b specification. One of the conditions is when a PRLI (Process Login) is sent by the initiator, and the Establish Image Pair bit is set in Word 0 of the PRLI. Previously, the isp(4) driver core sent a notification via isp_async() that the target had changed or stayed in place, but there was no indication of whether a PRLI was sent and whether the Establish Image Pair bit was set. The result of this was that in some situations, notably switching back and forth between a direct connection and a switch connection to a tape drive, the isp(4) driver would fail to reset the CRN in situations that require it according to the spec. When the CRN isn't reset in a situation that requires it, the tape drive then rejects every subsequent command that is sent to the drive. It is assuming that the commands are being sent out of order. So, modify the isp(4) driver to include Word 0 of the PRLI command when it sends isp_async() notifications of target changes. Look at the Establish Image Pair bit, and reset the CRN if that bit is set. With this change, I am able to switch a tape drive back and forth between a direct connection and a switch connection, and the isp(4) driver resets the CRN when it should. sys/dev/isp_stds.h: Add bit definitions for PRLI Word 0. sys/dev/ispmbox.h: Add PRLI Word 0 to the port database type, isp_pdb_t. sys/dev/ispvar.h Add PRLI Word 0 to fcportdb_t. sys/dev/isp.c: Populate the new prli_word0 parameter in the port database. In isp_pdb_add_update(), add a check to see if the Establish Image Pair bit is set in PRLI Word 0. If it is, then that is an additional reason to create a change notification. sys/dev/isp_freebsd.c: In isp_async(), if the device changed or stayed, look at PRLI Word 0 to see if the Establish Image Pair bit is set. If it is, reset the CRN if we haven't already. Sponsored by: Spectra Logic Differential Revision: https://reviews.freebsd.org/D19472 ------------------------------------------------------------------------ Modified: stable/11/sys/dev/isp/isp.c stable/11/sys/dev/isp/isp_freebsd.c stable/11/sys/dev/isp/isp_stds.h stable/11/sys/dev/isp/ispmbox.h stable/11/sys/dev/isp/ispvar.h Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/dev/isp/isp.c ============================================================================== --- stable/11/sys/dev/isp/isp.c Thu May 16 21:50:12 2019 (r347893) +++ stable/11/sys/dev/isp/isp.c Thu May 16 22:03:25 2019 (r347894) @@ -2789,6 +2789,7 @@ isp_getpdb(ispsoftc_t *isp, int chan, uint16_t id, isp if (IS_24XX(isp)) { isp_get_pdb_24xx(isp, isp->isp_iocb, &un.bill); pdb->handle = un.bill.pdb_handle; + pdb->prli_word0 = un.bill.pdb_prli_svc0; pdb->prli_word3 = un.bill.pdb_prli_svc3; pdb->portid = BITS2WORD_24XX(un.bill.pdb_portid_bits); ISP_MEMCPY(pdb->portname, un.bill.pdb_portname, 8); @@ -2805,6 +2806,7 @@ isp_getpdb(ispsoftc_t *isp, int chan, uint16_t id, isp } else { isp_get_pdb_21xx(isp, isp->isp_iocb, &un.fred); pdb->handle = un.fred.pdb_loopid; + pdb->prli_word0 = un.fred.pdb_prli_svc0; pdb->prli_word3 = un.fred.pdb_prli_svc3; pdb->portid = BITS2WORD(un.fred.pdb_portid_bits); ISP_MEMCPY(pdb->portname, un.fred.pdb_portname, 8); @@ -3194,6 +3196,7 @@ isp_pdb_sync(ispsoftc_t *isp, int chan) lp->state = FC_PORTDB_STATE_VALID; isp_async(isp, ISPASYNC_DEV_CHANGED, chan, lp); lp->portid = lp->new_portid; + lp->prli_word0 = lp->new_prli_word0; lp->prli_word3 = lp->new_prli_word3; break; case FC_PORTDB_STATE_VALID: @@ -3245,7 +3248,8 @@ isp_pdb_add_update(ispsoftc_t *isp, int chan, isp_pdb_ /* Old device, nothing new. */ if (lp->portid == pdb->portid && lp->handle == pdb->handle && - lp->prli_word3 == pdb->prli_word3) { + lp->prli_word3 == pdb->prli_word3 && + ((pdb->prli_word0 & PRLI_WD0_EST_IMAGE_PAIR) == 0)) { if (lp->state != FC_PORTDB_STATE_NEW) lp->state = FC_PORTDB_STATE_VALID; isp_prt(isp, ISP_LOG_SANCFG, @@ -3258,6 +3262,7 @@ isp_pdb_add_update(ispsoftc_t *isp, int chan, isp_pdb_ lp->state = FC_PORTDB_STATE_CHANGED; lp->handle = pdb->handle; lp->new_portid = pdb->portid; + lp->new_prli_word0 = pdb->prli_word0; lp->new_prli_word3 = pdb->prli_word3; isp_prt(isp, ISP_LOG_SANCFG, "Chan %d Port 0x%06x@0x%04x is changed", Modified: stable/11/sys/dev/isp/isp_freebsd.c ============================================================================== --- stable/11/sys/dev/isp/isp_freebsd.c Thu May 16 21:50:12 2019 (r347893) +++ stable/11/sys/dev/isp/isp_freebsd.c Thu May 16 22:03:25 2019 (r347894) @@ -3740,6 +3740,10 @@ isp_async(ispsoftc_t *isp, ispasync_t cmd, ...) break; case ISPASYNC_DEV_CHANGED: case ISPASYNC_DEV_STAYED: + { + int crn_reset_done; + + crn_reset_done = 0; va_start(ap, cmd); bus = va_arg(ap, int); lp = va_arg(ap, fcportdb_t *); @@ -3757,13 +3761,17 @@ isp_async(ispsoftc_t *isp, ispasync_t cmd, ...) (lp->new_prli_word3 & PRLI_WD3_TARGET_FUNCTION))) { lp->is_target = !lp->is_target; if (lp->is_target) { - if (cmd == ISPASYNC_DEV_CHANGED) + if (cmd == ISPASYNC_DEV_CHANGED) { isp_fcp_reset_crn(isp, bus, tgt, /*tgt_set*/ 1); + crn_reset_done = 1; + } isp_make_here(isp, lp, bus, tgt); } else { isp_make_gone(isp, lp, bus, tgt); - if (cmd == ISPASYNC_DEV_CHANGED) + if (cmd == ISPASYNC_DEV_CHANGED) { isp_fcp_reset_crn(isp, bus, tgt, /*tgt_set*/ 1); + crn_reset_done = 1; + } } } if (lp->is_initiator != @@ -3778,7 +3786,13 @@ isp_async(ispsoftc_t *isp, ispasync_t cmd, ...) adc->arrived = lp->is_initiator; xpt_async(AC_CONTRACT, fc->path, &ac); } + + if ((lp->new_prli_word0 & PRLI_WD0_EST_IMAGE_PAIR) && + (crn_reset_done == 0)) + isp_fcp_reset_crn(isp, bus, tgt, /*tgt_set*/ 1); + break; + } case ISPASYNC_DEV_GONE: va_start(ap, cmd); bus = va_arg(ap, int); Modified: stable/11/sys/dev/isp/isp_stds.h ============================================================================== --- stable/11/sys/dev/isp/isp_stds.h Thu May 16 21:50:12 2019 (r347893) +++ stable/11/sys/dev/isp/isp_stds.h Thu May 16 22:03:25 2019 (r347894) @@ -282,6 +282,14 @@ typedef struct { #define RNC 0x53 /* + * PRLI Word 0 definitions + * FPC4-r02b January, 2011 + */ +#define PRLI_WD0_TYPE_MASK 0xff000000 +#define PRLI_WD0_TC_EXT_MASK 0x00ff0000 +#define PRLI_WD0_EST_IMAGE_PAIR (1 << 13) + +/* * PRLI Word 3 definitions * FPC4-r02b January, 2011 */ Modified: stable/11/sys/dev/isp/ispmbox.h ============================================================================== --- stable/11/sys/dev/isp/ispmbox.h Thu May 16 21:50:12 2019 (r347893) +++ stable/11/sys/dev/isp/ispmbox.h Thu May 16 22:03:25 2019 (r347894) @@ -1382,6 +1382,7 @@ typedef struct { */ typedef struct { uint16_t handle; + uint16_t prli_word0; uint16_t prli_word3; uint32_t : 8, portid : 24; Modified: stable/11/sys/dev/isp/ispvar.h ============================================================================== --- stable/11/sys/dev/isp/ispvar.h Thu May 16 21:50:12 2019 (r347893) +++ stable/11/sys/dev/isp/ispvar.h Thu May 16 22:03:25 2019 (r347894) @@ -379,6 +379,9 @@ typedef struct { uint16_t handle; /* + * PRLI word 0 contains the Establish Image Pair bit, which is + * important for knowing when to reset the CRN. + * * PRLI word 3 parameters contains role as well as other things. * * The state is the current state of this entry. @@ -390,7 +393,9 @@ typedef struct { * Portid is obvious, as are node && port WWNs. The new_role and * new_portid is for when we are pending a change. */ + uint16_t prli_word0; /* PRLI parameters */ uint16_t prli_word3; /* PRLI parameters */ + uint16_t new_prli_word0; /* Incoming new PRLI parameters */ uint16_t new_prli_word3; /* Incoming new PRLI parameters */ uint16_t : 12, probational : 1, From owner-svn-src-stable@freebsd.org Fri May 17 08:19:45 2019 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 0C6A8158B432; Fri, 17 May 2019 08:19:45 +0000 (UTC) (envelope-from tuexen@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 72D0F8FC4D; Fri, 17 May 2019 08:19:44 +0000 (UTC) (envelope-from tuexen@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 2DE6159AB; Fri, 17 May 2019 08:19:44 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x4H8JiHZ076450; Fri, 17 May 2019 08:19:44 GMT (envelope-from tuexen@FreeBSD.org) Received: (from tuexen@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x4H8Jhhv076449; Fri, 17 May 2019 08:19:43 GMT (envelope-from tuexen@FreeBSD.org) Message-Id: <201905170819.x4H8Jhhv076449@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: tuexen set sender to tuexen@FreeBSD.org using -f From: Michael Tuexen Date: Fri, 17 May 2019 08:19:43 +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: r347900 - stable/12/sys/dev/virtio/network X-SVN-Group: stable-12 X-SVN-Commit-Author: tuexen X-SVN-Commit-Paths: stable/12/sys/dev/virtio/network X-SVN-Commit-Revision: 347900 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 72D0F8FC4D X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.97 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.998,0]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; NEURAL_HAM_SHORT(-0.97)[-0.968,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US] X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 17 May 2019 08:19:45 -0000 Author: tuexen Date: Fri May 17 08:19:43 2019 New Revision: 347900 URL: https://svnweb.freebsd.org/changeset/base/347900 Log: MFC r347233: Remove non-functional SCTP checksum offload support for virtio. Checksum offloading for SCTP is not currently specified for virtio. If the hypervisor announces checksum offloading support, it means TCP and UDP checksum offload. If an SCTP packet is sent and the host announced checksum offload support, the hypervisor inserts the IP checksum (16-bit) at the correct offset, but this is not the right checksum, which is a CRC32c. This results in all outgoing packets having the wrong checksum and therefore breaking SCTP based communications. This patch removes SCTP checksum offloading support from the virtio network interface. Thanks to Felix Weinrank for making me aware of the issue. Modified: stable/12/sys/dev/virtio/network/if_vtnet.c stable/12/sys/dev/virtio/network/if_vtnetvar.h Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/dev/virtio/network/if_vtnet.c ============================================================================== --- stable/12/sys/dev/virtio/network/if_vtnet.c Fri May 17 00:02:35 2019 (r347899) +++ stable/12/sys/dev/virtio/network/if_vtnet.c Fri May 17 08:19:43 2019 (r347900) @@ -69,7 +69,6 @@ __FBSDID("$FreeBSD$"); #include #include #include -#include #include #include @@ -1525,9 +1524,6 @@ vtnet_rxq_csum_by_offset(struct vtnet_rxq *rxq, struct m->m_pkthdr.csum_flags |= CSUM_DATA_VALID | CSUM_PSEUDO_HDR; m->m_pkthdr.csum_data = 0xFFFF; break; - case offsetof(struct sctphdr, checksum): - m->m_pkthdr.csum_flags |= CSUM_SCTP_VALID; - break; default: sc->vtnet_stats.rx_csum_bad_offset++; return (1); @@ -1584,11 +1580,6 @@ vtnet_rxq_csum_by_parse(struct vtnet_rxq *rxq, struct return (1); m->m_pkthdr.csum_flags |= CSUM_DATA_VALID | CSUM_PSEUDO_HDR; m->m_pkthdr.csum_data = 0xFFFF; - break; - case IPPROTO_SCTP: - if (__predict_false(m->m_len < offset + sizeof(struct sctphdr))) - return (1); - m->m_pkthdr.csum_flags |= CSUM_SCTP_VALID; break; default: /* Modified: stable/12/sys/dev/virtio/network/if_vtnetvar.h ============================================================================== --- stable/12/sys/dev/virtio/network/if_vtnetvar.h Fri May 17 00:02:35 2019 (r347899) +++ stable/12/sys/dev/virtio/network/if_vtnetvar.h Fri May 17 08:19:43 2019 (r347900) @@ -268,8 +268,8 @@ struct vtnet_mac_filter { CTASSERT(sizeof(struct vtnet_mac_filter) <= PAGE_SIZE); #define VTNET_TX_TIMEOUT 5 -#define VTNET_CSUM_OFFLOAD (CSUM_TCP | CSUM_UDP | CSUM_SCTP) -#define VTNET_CSUM_OFFLOAD_IPV6 (CSUM_TCP_IPV6 | CSUM_UDP_IPV6 | CSUM_SCTP_IPV6) +#define VTNET_CSUM_OFFLOAD (CSUM_TCP | CSUM_UDP) +#define VTNET_CSUM_OFFLOAD_IPV6 (CSUM_TCP_IPV6 | CSUM_UDP_IPV6) #define VTNET_CSUM_ALL_OFFLOAD \ (VTNET_CSUM_OFFLOAD | VTNET_CSUM_OFFLOAD_IPV6 | CSUM_TSO) From owner-svn-src-stable@freebsd.org Fri May 17 08:21:28 2019 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 880EE158B741; Fri, 17 May 2019 08:21:28 +0000 (UTC) (envelope-from tuexen@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 2B6E48FECC; Fri, 17 May 2019 08:21:28 +0000 (UTC) (envelope-from tuexen@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 E057859ED; Fri, 17 May 2019 08:21:27 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x4H8LRLD079669; Fri, 17 May 2019 08:21:27 GMT (envelope-from tuexen@FreeBSD.org) Received: (from tuexen@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x4H8LRXg079666; Fri, 17 May 2019 08:21:27 GMT (envelope-from tuexen@FreeBSD.org) Message-Id: <201905170821.x4H8LRXg079666@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: tuexen set sender to tuexen@FreeBSD.org using -f From: Michael Tuexen Date: Fri, 17 May 2019 08:21:27 +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: r347901 - stable/12/sys/netinet/cc X-SVN-Group: stable-12 X-SVN-Commit-Author: tuexen X-SVN-Commit-Paths: stable/12/sys/netinet/cc X-SVN-Commit-Revision: 347901 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 2B6E48FECC X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.97 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.998,0]; NEURAL_HAM_SHORT(-0.97)[-0.968,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US]; NEURAL_HAM_LONG(-1.00)[-1.000,0] X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 17 May 2019 08:21:28 -0000 Author: tuexen Date: Fri May 17 08:21:27 2019 New Revision: 347901 URL: https://svnweb.freebsd.org/changeset/base/347901 Log: MFC r347381: Prevent cwnd to collapse down to 1 MSS after exiting recovery. This is descrined in RFC 6582, which updates RFC 3782. Modified: stable/12/sys/netinet/cc/cc_cubic.c stable/12/sys/netinet/cc/cc_htcp.c stable/12/sys/netinet/cc/cc_newreno.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/netinet/cc/cc_cubic.c ============================================================================== --- stable/12/sys/netinet/cc/cc_cubic.c Fri May 17 08:19:43 2019 (r347900) +++ stable/12/sys/netinet/cc/cc_cubic.c Fri May 17 08:21:27 2019 (r347901) @@ -324,7 +324,12 @@ cubic_post_recovery(struct cc_var *ccv) pipe = CCV(ccv, snd_max) - ccv->curack; if (pipe < CCV(ccv, snd_ssthresh)) - CCV(ccv, snd_cwnd) = pipe + CCV(ccv, t_maxseg); + /* + * Ensure that cwnd does not collapse to 1 MSS under + * adverse conditions. Implements RFC6582 + */ + CCV(ccv, snd_cwnd) = max(pipe, CCV(ccv, t_maxseg)) + + CCV(ccv, t_maxseg); else /* Update cwnd based on beta and adjusted max_cwnd. */ CCV(ccv, snd_cwnd) = max(1, ((CUBIC_BETA * Modified: stable/12/sys/netinet/cc/cc_htcp.c ============================================================================== --- stable/12/sys/netinet/cc/cc_htcp.c Fri May 17 08:19:43 2019 (r347900) +++ stable/12/sys/netinet/cc/cc_htcp.c Fri May 17 08:21:27 2019 (r347901) @@ -366,7 +366,12 @@ htcp_post_recovery(struct cc_var *ccv) pipe = CCV(ccv, snd_max) - ccv->curack; if (pipe < CCV(ccv, snd_ssthresh)) - CCV(ccv, snd_cwnd) = pipe + CCV(ccv, t_maxseg); + /* + * Ensure that cwnd down not collape to 1 MSS under + * adverse conditions. Implements RFC6582 + */ + CCV(ccv, snd_cwnd) = max(pipe, CCV(ccv, t_maxseg)) + + CCV(ccv, t_maxseg); else CCV(ccv, snd_cwnd) = max(1, ((htcp_data->beta * htcp_data->prev_cwnd / CCV(ccv, t_maxseg)) Modified: stable/12/sys/netinet/cc/cc_newreno.c ============================================================================== --- stable/12/sys/netinet/cc/cc_newreno.c Fri May 17 08:19:43 2019 (r347900) +++ stable/12/sys/netinet/cc/cc_newreno.c Fri May 17 08:21:27 2019 (r347901) @@ -299,7 +299,12 @@ newreno_post_recovery(struct cc_var *ccv) pipe = CCV(ccv, snd_max) - ccv->curack; if (pipe < CCV(ccv, snd_ssthresh)) - CCV(ccv, snd_cwnd) = pipe + CCV(ccv, t_maxseg); + /* + * Ensure that cwnd does not collapse to 1 MSS under + * adverse conditons. Implements RFC6582 + */ + CCV(ccv, snd_cwnd) = max(pipe, CCV(ccv, t_maxseg)) + + CCV(ccv, t_maxseg); else CCV(ccv, snd_cwnd) = CCV(ccv, snd_ssthresh); } From owner-svn-src-stable@freebsd.org Fri May 17 08:25:32 2019 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id B7764158BBC0; Fri, 17 May 2019 08:25:32 +0000 (UTC) (envelope-from tuexen@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 5DEAD68550; Fri, 17 May 2019 08:25:32 +0000 (UTC) (envelope-from tuexen@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 0DDDC5B65; Fri, 17 May 2019 08:25:32 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x4H8PVt3082107; Fri, 17 May 2019 08:25:31 GMT (envelope-from tuexen@FreeBSD.org) Received: (from tuexen@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x4H8PVoo082105; Fri, 17 May 2019 08:25:31 GMT (envelope-from tuexen@FreeBSD.org) Message-Id: <201905170825.x4H8PVoo082105@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: tuexen set sender to tuexen@FreeBSD.org using -f From: Michael Tuexen Date: Fri, 17 May 2019 08:25:31 +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: r347902 - stable/12/sys/netinet X-SVN-Group: stable-12 X-SVN-Commit-Author: tuexen X-SVN-Commit-Paths: stable/12/sys/netinet X-SVN-Commit-Revision: 347902 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 5DEAD68550 X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.97 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.998,0]; NEURAL_HAM_SHORT(-0.97)[-0.968,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US]; NEURAL_HAM_LONG(-1.00)[-1.000,0] X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 17 May 2019 08:25:33 -0000 Author: tuexen Date: Fri May 17 08:25:31 2019 New Revision: 347902 URL: https://svnweb.freebsd.org/changeset/base/347902 Log: MFC r347382: Receiver side DSACK implemenation. This adds initial support for RFC 2883. This was submitted by Richard Scheffeneffer. MFC r347407: Don't use C++ style comments. Thanks to ngie@ for reporting the issue. Modified: stable/12/sys/netinet/tcp_input.c stable/12/sys/netinet/tcp_sack.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/netinet/tcp_input.c ============================================================================== --- stable/12/sys/netinet/tcp_input.c Fri May 17 08:21:27 2019 (r347901) +++ stable/12/sys/netinet/tcp_input.c Fri May 17 08:25:31 2019 (r347902) @@ -2278,6 +2278,17 @@ tcp_do_segment(struct mbuf *m, struct tcphdr *th, stru TCPSTAT_INC(tcps_rcvpartduppack); TCPSTAT_ADD(tcps_rcvpartdupbyte, todrop); } + /* + * DSACK - add SACK block for dropped range + */ + if (tp->t_flags & TF_SACK_PERMIT) { + tcp_update_sack_list(tp, th->th_seq, th->th_seq+tlen); + /* + * ACK now, as the next in-sequence segment + * will clear the DSACK block again + */ + tp->t_flags |= TF_ACKNOW; + } drop_hdrlen += todrop; /* drop from the top afterwards */ th->th_seq += todrop; tlen -= todrop; @@ -3006,6 +3017,8 @@ dodata: /* XXX */ if ((tlen || (thflags & TH_FIN) || tfo_syn) && TCPS_HAVERCVDFIN(tp->t_state) == 0) { tcp_seq save_start = th->th_seq; + tcp_seq save_rnxt = tp->rcv_nxt; + int save_tlen = tlen; m_adj(m, drop_hdrlen); /* delayed header drop */ /* * Insert segment which includes th into TCP reassembly queue @@ -3045,11 +3058,34 @@ dodata: /* XXX */ * m_adj() doesn't actually frees any mbufs * when trimming from the head. */ - thflags = tcp_reass(tp, th, &save_start, &tlen, m); + tcp_seq temp = save_start; + thflags = tcp_reass(tp, th, &temp, &tlen, m); tp->t_flags |= TF_ACKNOW; } - if (tlen > 0 && (tp->t_flags & TF_SACK_PERMIT)) - tcp_update_sack_list(tp, save_start, save_start + tlen); + if (tp->t_flags & TF_SACK_PERMIT) { + if (((tlen == 0) && (save_tlen > 0) && + (SEQ_LT(save_start, save_rnxt)))) { + /* + * DSACK actually handled in the fastpath + * above. + */ + tcp_update_sack_list(tp, save_start, save_start + save_tlen); + } else + if ((tlen > 0) && SEQ_GT(tp->rcv_nxt, save_rnxt)) { + /* + * Cleaning sackblks by using zero length + * update. + */ + tcp_update_sack_list(tp, save_start, save_start); + } else + if ((tlen > 0) && (tlen >= save_tlen)) { + /* Update of sackblks. */ + tcp_update_sack_list(tp, save_start, save_start + save_tlen); + } else + if (tlen > 0) { + tcp_update_sack_list(tp, save_start, save_start+tlen); + } + } #if 0 /* * Note the amount of data that peer has sent into Modified: stable/12/sys/netinet/tcp_sack.c ============================================================================== --- stable/12/sys/netinet/tcp_sack.c Fri May 17 08:21:27 2019 (r347901) +++ stable/12/sys/netinet/tcp_sack.c Fri May 17 08:25:31 2019 (r347902) @@ -168,7 +168,7 @@ tcp_update_sack_list(struct tcpcb *tp, tcp_seq rcv_sta INP_WLOCK_ASSERT(tp->t_inpcb); /* Check arguments. */ - KASSERT(SEQ_LT(rcv_start, rcv_end), ("rcv_start < rcv_end")); + KASSERT(SEQ_LEQ(rcv_start, rcv_end), ("rcv_start <= rcv_end")); /* SACK block for the received segment. */ head_blk.start = rcv_start; @@ -193,12 +193,54 @@ tcp_update_sack_list(struct tcpcb *tp, tcp_seq rcv_sta * Merge this SACK block into head_blk. This SACK * block itself will be discarded. */ - if (SEQ_GT(head_blk.start, start)) + /* + * |-| + * |---| merge + * + * |-| + * |---| merge + * + * |-----| + * |-| DSACK smaller + * + * |-| + * |-----| DSACK smaller + */ + if (head_blk.start == end) head_blk.start = start; - if (SEQ_LT(head_blk.end, end)) + else if (head_blk.end == start) head_blk.end = end; + else { + if (SEQ_LT(head_blk.start, start)) { + tcp_seq temp = start; + start = head_blk.start; + head_blk.start = temp; + } + if (SEQ_GT(head_blk.end, end)) { + tcp_seq temp = end; + end = head_blk.end; + head_blk.end = temp; + } + if ((head_blk.start != start) || + (head_blk.end != end)) { + if ((num_saved >= 1) && + SEQ_GEQ(saved_blks[num_saved-1].start, start) && + SEQ_LEQ(saved_blks[num_saved-1].end, end)) + num_saved--; + saved_blks[num_saved].start = start; + saved_blks[num_saved].end = end; + num_saved++; + } + } } else { /* + * This block supercedes the prior block + */ + if ((num_saved >= 1) && + SEQ_GEQ(saved_blks[num_saved-1].start, start) && + SEQ_LEQ(saved_blks[num_saved-1].end, end)) + num_saved--; + /* * Save this SACK block. */ saved_blks[num_saved].start = start; @@ -211,7 +253,7 @@ tcp_update_sack_list(struct tcpcb *tp, tcp_seq rcv_sta * Update SACK list in tp->sackblks[]. */ num_head = 0; - if (SEQ_GT(head_blk.start, tp->rcv_nxt)) { + if (SEQ_LT(rcv_start, rcv_end)) { /* * The received data segment is an out-of-order segment. Put * head_blk at the top of SACK list. From owner-svn-src-stable@freebsd.org Fri May 17 14:08:59 2019 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 77D61159622F; Fri, 17 May 2019 14:08:59 +0000 (UTC) (envelope-from markj@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 1A2CA74F36; Fri, 17 May 2019 14:08:59 +0000 (UTC) (envelope-from markj@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 E7EF8942F; Fri, 17 May 2019 14:08:58 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x4HE8wsx063733; Fri, 17 May 2019 14:08:58 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x4HE8wk6063732; Fri, 17 May 2019 14:08:58 GMT (envelope-from markj@FreeBSD.org) Message-Id: <201905171408.x4HE8wk6063732@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Fri, 17 May 2019 14:08:58 +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: r347904 - stable/12/sys/amd64/amd64 X-SVN-Group: stable-12 X-SVN-Commit-Author: markj X-SVN-Commit-Paths: stable/12/sys/amd64/amd64 X-SVN-Commit-Revision: 347904 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 1A2CA74F36 X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.96 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.998,0]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; NEURAL_HAM_SHORT(-0.96)[-0.963,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US] X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 17 May 2019 14:08:59 -0000 Author: markj Date: Fri May 17 14:08:58 2019 New Revision: 347904 URL: https://svnweb.freebsd.org/changeset/base/347904 Log: MFC r347564: Fix formatting. Modified: stable/12/sys/amd64/amd64/trap.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/amd64/amd64/trap.c ============================================================================== --- stable/12/sys/amd64/amd64/trap.c Fri May 17 13:08:12 2019 (r347903) +++ stable/12/sys/amd64/amd64/trap.c Fri May 17 14:08:58 2019 (r347904) @@ -904,8 +904,8 @@ trap_fatal(frame, eva) code & PGEX_U ? "user" : "supervisor", code & PGEX_W ? "write" : "read", code & PGEX_I ? "instruction" : "data", - code & PGEX_PK ? " prot key" : " ", - code & PGEX_SGX ? " SGX" : " ", + code & PGEX_PK ? " prot key" : "", + code & PGEX_SGX ? " SGX" : "", code & PGEX_RSV ? "reserved bits in PTE" : code & PGEX_P ? "protection violation" : "page not present"); } From owner-svn-src-stable@freebsd.org Fri May 17 14:09:35 2019 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 07249159627F; Fri, 17 May 2019 14:09:35 +0000 (UTC) (envelope-from markj@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 A14167504E; Fri, 17 May 2019 14:09:34 +0000 (UTC) (envelope-from markj@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 7AEAB9430; Fri, 17 May 2019 14:09:34 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x4HE9Ysx063802; Fri, 17 May 2019 14:09:34 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x4HE9Y0s063800; Fri, 17 May 2019 14:09:34 GMT (envelope-from markj@FreeBSD.org) Message-Id: <201905171409.x4HE9Y0s063800@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Fri, 17 May 2019 14:09:34 +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: r347905 - stable/12/sys/conf X-SVN-Group: stable-12 X-SVN-Commit-Author: markj X-SVN-Commit-Paths: stable/12/sys/conf X-SVN-Commit-Revision: 347905 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: A14167504E X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.96 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.998,0]; NEURAL_HAM_SHORT(-0.96)[-0.963,0]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US] X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 17 May 2019 14:09:35 -0000 Author: markj Date: Fri May 17 14:09:33 2019 New Revision: 347905 URL: https://svnweb.freebsd.org/changeset/base/347905 Log: MFC r347569: Remove redundant -Wl uses from the kernel's LDFLAGS. Modified: stable/12/sys/conf/kern.pre.mk stable/12/sys/conf/kmod.mk Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/conf/kern.pre.mk ============================================================================== --- stable/12/sys/conf/kern.pre.mk Fri May 17 14:08:58 2019 (r347904) +++ stable/12/sys/conf/kern.pre.mk Fri May 17 14:09:33 2019 (r347905) @@ -118,7 +118,7 @@ DEFINED_PROF= ${PROF} CFLAGS+= ${CONF_CFLAGS} .if defined(LINKER_FEATURES) && ${LINKER_FEATURES:Mbuild-id} -LDFLAGS+= -Wl,--build-id=sha1 +LDFLAGS+= --build-id=sha1 .endif .if (${MACHINE_CPUARCH} == "aarch64" || ${MACHINE_CPUARCH} == "amd64" || \ @@ -127,11 +127,11 @@ LDFLAGS+= -Wl,--build-id=sha1 .error amd64/arm64/i386 kernel requires linker ifunc support .endif .if ${MACHINE_CPUARCH} == "amd64" -LDFLAGS+= -Wl,-z max-page-size=2097152 +LDFLAGS+= -z max-page-size=2097152 .if ${LINKER_TYPE} != "lld" -LDFLAGS+= -Wl,-z common-page-size=4096 +LDFLAGS+= -z common-page-size=4096 .else -LDFLAGS+= -Wl,-z -Wl,ifunc-noplt +LDFLAGS+= -z ifunc-noplt .endif .endif Modified: stable/12/sys/conf/kmod.mk ============================================================================== --- stable/12/sys/conf/kmod.mk Fri May 17 14:08:58 2019 (r347904) +++ stable/12/sys/conf/kmod.mk Fri May 17 14:09:33 2019 (r347905) @@ -138,7 +138,7 @@ CFLAGS+= -fno-common LDFLAGS+= -d -warn-common .if defined(LINKER_FEATURES) && ${LINKER_FEATURES:Mbuild-id} -LDFLAGS+= -Wl,--build-id=sha1 +LDFLAGS+= --build-id=sha1 .endif CFLAGS+= ${DEBUG_FLAGS} From owner-svn-src-stable@freebsd.org Fri May 17 14:29:58 2019 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 182101596B07; Fri, 17 May 2019 14:29:58 +0000 (UTC) (envelope-from ken@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 AEF7D75B63; Fri, 17 May 2019 14:29:57 +0000 (UTC) (envelope-from ken@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 7D35897B6; Fri, 17 May 2019 14:29:57 +0000 (UTC) (envelope-from ken@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x4HETv2G074060; Fri, 17 May 2019 14:29:57 GMT (envelope-from ken@FreeBSD.org) Received: (from ken@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x4HETuLc074054; Fri, 17 May 2019 14:29:56 GMT (envelope-from ken@FreeBSD.org) Message-Id: <201905171429.x4HETuLc074054@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ken set sender to ken@FreeBSD.org using -f From: "Kenneth D. Merry" Date: Fri, 17 May 2019 14:29:56 +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: r347906 - stable/12/sys/dev/isp X-SVN-Group: stable-12 X-SVN-Commit-Author: ken X-SVN-Commit-Paths: stable/12/sys/dev/isp X-SVN-Commit-Revision: 347906 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: AEF7D75B63 X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.98 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.998,0]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; NEURAL_HAM_SHORT(-0.98)[-0.982,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US] X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 17 May 2019 14:29:58 -0000 Author: ken Date: Fri May 17 14:29:56 2019 New Revision: 347906 URL: https://svnweb.freebsd.org/changeset/base/347906 Log: MFC r345008: ------------------------------------------------------------------------ r345008 | ken | 2019-03-11 10:21:14 -0400 (Mon, 11 Mar 2019) | 59 lines Fix CRN resets in the isp(4) driver in certain situations. The Command Reference Number (CRN) is part of the FC-Tape features that we enable when talking to tape drives. It starts at 1, and goes to 255 and wraps around to 1. There are a number of reset type conditions that result in the CRN getting reset to 1. These are detailed in section 4.10 (table 8) of the FCP-4r02b specification. One of the conditions is when a PRLI (Process Login) is sent by the initiator, and the Establish Image Pair bit is set in Word 0 of the PRLI. Previously, the isp(4) driver core sent a notification via isp_async() that the target had changed or stayed in place, but there was no indication of whether a PRLI was sent and whether the Establish Image Pair bit was set. The result of this was that in some situations, notably switching back and forth between a direct connection and a switch connection to a tape drive, the isp(4) driver would fail to reset the CRN in situations that require it according to the spec. When the CRN isn't reset in a situation that requires it, the tape drive then rejects every subsequent command that is sent to the drive. It is assuming that the commands are being sent out of order. So, modify the isp(4) driver to include Word 0 of the PRLI command when it sends isp_async() notifications of target changes. Look at the Establish Image Pair bit, and reset the CRN if that bit is set. With this change, I am able to switch a tape drive back and forth between a direct connection and a switch connection, and the isp(4) driver resets the CRN when it should. sys/dev/isp_stds.h: Add bit definitions for PRLI Word 0. sys/dev/ispmbox.h: Add PRLI Word 0 to the port database type, isp_pdb_t. sys/dev/ispvar.h Add PRLI Word 0 to fcportdb_t. sys/dev/isp.c: Populate the new prli_word0 parameter in the port database. In isp_pdb_add_update(), add a check to see if the Establish Image Pair bit is set in PRLI Word 0. If it is, then that is an additional reason to create a change notification. sys/dev/isp_freebsd.c: In isp_async(), if the device changed or stayed, look at PRLI Word 0 to see if the Establish Image Pair bit is set. If it is, reset the CRN if we haven't already. Sponsored by: Spectra Logic ------------------------------------------------------------------------ Differential Revision: https://reviews.freebsd.org/D19472 Modified: stable/12/sys/dev/isp/isp.c stable/12/sys/dev/isp/isp_freebsd.c stable/12/sys/dev/isp/isp_stds.h stable/12/sys/dev/isp/ispmbox.h stable/12/sys/dev/isp/ispvar.h Modified: stable/12/sys/dev/isp/isp.c ============================================================================== --- stable/12/sys/dev/isp/isp.c Fri May 17 14:09:33 2019 (r347905) +++ stable/12/sys/dev/isp/isp.c Fri May 17 14:29:56 2019 (r347906) @@ -2791,6 +2791,7 @@ isp_getpdb(ispsoftc_t *isp, int chan, uint16_t id, isp if (IS_24XX(isp)) { isp_get_pdb_24xx(isp, isp->isp_iocb, &un.bill); pdb->handle = un.bill.pdb_handle; + pdb->prli_word0 = un.bill.pdb_prli_svc0; pdb->prli_word3 = un.bill.pdb_prli_svc3; pdb->portid = BITS2WORD_24XX(un.bill.pdb_portid_bits); ISP_MEMCPY(pdb->portname, un.bill.pdb_portname, 8); @@ -2807,6 +2808,7 @@ isp_getpdb(ispsoftc_t *isp, int chan, uint16_t id, isp } else { isp_get_pdb_21xx(isp, isp->isp_iocb, &un.fred); pdb->handle = un.fred.pdb_loopid; + pdb->prli_word0 = un.fred.pdb_prli_svc0; pdb->prli_word3 = un.fred.pdb_prli_svc3; pdb->portid = BITS2WORD(un.fred.pdb_portid_bits); ISP_MEMCPY(pdb->portname, un.fred.pdb_portname, 8); @@ -3196,6 +3198,7 @@ isp_pdb_sync(ispsoftc_t *isp, int chan) lp->state = FC_PORTDB_STATE_VALID; isp_async(isp, ISPASYNC_DEV_CHANGED, chan, lp); lp->portid = lp->new_portid; + lp->prli_word0 = lp->new_prli_word0; lp->prli_word3 = lp->new_prli_word3; break; case FC_PORTDB_STATE_VALID: @@ -3247,7 +3250,8 @@ isp_pdb_add_update(ispsoftc_t *isp, int chan, isp_pdb_ /* Old device, nothing new. */ if (lp->portid == pdb->portid && lp->handle == pdb->handle && - lp->prli_word3 == pdb->prli_word3) { + lp->prli_word3 == pdb->prli_word3 && + ((pdb->prli_word0 & PRLI_WD0_EST_IMAGE_PAIR) == 0)) { if (lp->state != FC_PORTDB_STATE_NEW) lp->state = FC_PORTDB_STATE_VALID; isp_prt(isp, ISP_LOG_SANCFG, @@ -3260,6 +3264,7 @@ isp_pdb_add_update(ispsoftc_t *isp, int chan, isp_pdb_ lp->state = FC_PORTDB_STATE_CHANGED; lp->handle = pdb->handle; lp->new_portid = pdb->portid; + lp->new_prli_word0 = pdb->prli_word0; lp->new_prli_word3 = pdb->prli_word3; isp_prt(isp, ISP_LOG_SANCFG, "Chan %d Port 0x%06x@0x%04x is changed", Modified: stable/12/sys/dev/isp/isp_freebsd.c ============================================================================== --- stable/12/sys/dev/isp/isp_freebsd.c Fri May 17 14:09:33 2019 (r347905) +++ stable/12/sys/dev/isp/isp_freebsd.c Fri May 17 14:29:56 2019 (r347906) @@ -3742,6 +3742,10 @@ isp_async(ispsoftc_t *isp, ispasync_t cmd, ...) break; case ISPASYNC_DEV_CHANGED: case ISPASYNC_DEV_STAYED: + { + int crn_reset_done; + + crn_reset_done = 0; va_start(ap, cmd); bus = va_arg(ap, int); lp = va_arg(ap, fcportdb_t *); @@ -3759,13 +3763,17 @@ isp_async(ispsoftc_t *isp, ispasync_t cmd, ...) (lp->new_prli_word3 & PRLI_WD3_TARGET_FUNCTION))) { lp->is_target = !lp->is_target; if (lp->is_target) { - if (cmd == ISPASYNC_DEV_CHANGED) + if (cmd == ISPASYNC_DEV_CHANGED) { isp_fcp_reset_crn(isp, bus, tgt, /*tgt_set*/ 1); + crn_reset_done = 1; + } isp_make_here(isp, lp, bus, tgt); } else { isp_make_gone(isp, lp, bus, tgt); - if (cmd == ISPASYNC_DEV_CHANGED) + if (cmd == ISPASYNC_DEV_CHANGED) { isp_fcp_reset_crn(isp, bus, tgt, /*tgt_set*/ 1); + crn_reset_done = 1; + } } } if (lp->is_initiator != @@ -3780,7 +3788,13 @@ isp_async(ispsoftc_t *isp, ispasync_t cmd, ...) adc->arrived = lp->is_initiator; xpt_async(AC_CONTRACT, fc->path, &ac); } + + if ((lp->new_prli_word0 & PRLI_WD0_EST_IMAGE_PAIR) && + (crn_reset_done == 0)) + isp_fcp_reset_crn(isp, bus, tgt, /*tgt_set*/ 1); + break; + } case ISPASYNC_DEV_GONE: va_start(ap, cmd); bus = va_arg(ap, int); Modified: stable/12/sys/dev/isp/isp_stds.h ============================================================================== --- stable/12/sys/dev/isp/isp_stds.h Fri May 17 14:09:33 2019 (r347905) +++ stable/12/sys/dev/isp/isp_stds.h Fri May 17 14:29:56 2019 (r347906) @@ -284,6 +284,14 @@ typedef struct { #define RNC 0x53 /* + * PRLI Word 0 definitions + * FPC4-r02b January, 2011 + */ +#define PRLI_WD0_TYPE_MASK 0xff000000 +#define PRLI_WD0_TC_EXT_MASK 0x00ff0000 +#define PRLI_WD0_EST_IMAGE_PAIR (1 << 13) + +/* * PRLI Word 3 definitions * FPC4-r02b January, 2011 */ Modified: stable/12/sys/dev/isp/ispmbox.h ============================================================================== --- stable/12/sys/dev/isp/ispmbox.h Fri May 17 14:09:33 2019 (r347905) +++ stable/12/sys/dev/isp/ispmbox.h Fri May 17 14:29:56 2019 (r347906) @@ -1384,6 +1384,7 @@ typedef struct { */ typedef struct { uint16_t handle; + uint16_t prli_word0; uint16_t prli_word3; uint32_t : 8, portid : 24; Modified: stable/12/sys/dev/isp/ispvar.h ============================================================================== --- stable/12/sys/dev/isp/ispvar.h Fri May 17 14:09:33 2019 (r347905) +++ stable/12/sys/dev/isp/ispvar.h Fri May 17 14:29:56 2019 (r347906) @@ -381,6 +381,9 @@ typedef struct { uint16_t handle; /* + * PRLI word 0 contains the Establish Image Pair bit, which is + * important for knowing when to reset the CRN. + * * PRLI word 3 parameters contains role as well as other things. * * The state is the current state of this entry. @@ -392,7 +395,9 @@ typedef struct { * Portid is obvious, as are node && port WWNs. The new_role and * new_portid is for when we are pending a change. */ + uint16_t prli_word0; /* PRLI parameters */ uint16_t prli_word3; /* PRLI parameters */ + uint16_t new_prli_word0; /* Incoming new PRLI parameters */ uint16_t new_prli_word3; /* Incoming new PRLI parameters */ uint16_t : 12, probational : 1, From owner-svn-src-stable@freebsd.org Fri May 17 16:41:19 2019 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 57F841599CE4; Fri, 17 May 2019 16:41:19 +0000 (UTC) (envelope-from mav@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 ECEFA8323A; Fri, 17 May 2019 16:41:18 +0000 (UTC) (envelope-from mav@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 C8A73AF79; Fri, 17 May 2019 16:41:18 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x4HGfIt3044181; Fri, 17 May 2019 16:41:18 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x4HGfIPk044152; Fri, 17 May 2019 16:41:18 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201905171641.x4HGfIPk044152@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Fri, 17 May 2019 16:41:18 +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: r347928 - stable/12/sys/cddl/contrib/opensolaris/uts/common/fs/zfs X-SVN-Group: stable-12 X-SVN-Commit-Author: mav X-SVN-Commit-Paths: stable/12/sys/cddl/contrib/opensolaris/uts/common/fs/zfs X-SVN-Commit-Revision: 347928 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: ECEFA8323A X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.96 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.998,0]; NEURAL_HAM_SHORT(-0.96)[-0.964,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US]; NEURAL_HAM_LONG(-1.00)[-1.000,0] X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 17 May 2019 16:41:19 -0000 Author: mav Date: Fri May 17 16:41:18 2019 New Revision: 347928 URL: https://svnweb.freebsd.org/changeset/base/347928 Log: MFC r346390: Change the way FreeBSD GID inheritance is hacked. I believe previous ifdef caused NULL dereference in later zfs_log_create() on attempt to create file inside directory belonging to ephemeral group created on illumos, trying to write to log information about GID domain of the newly created file, inheriting the ephemeral GID. This patch reuses original illumos SGID code with exception that due to lack of ID mapping code on FreeBSD ephemeral GID will turn into GID_NOBODY by another ifdef inside zfs_fuid_map_id(). Sponsored by: iXsystems, Inc. Modified: stable/12/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_acl.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_acl.c ============================================================================== --- stable/12/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_acl.c Fri May 17 15:52:17 2019 (r347927) +++ stable/12/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_acl.c Fri May 17 16:41:18 2019 (r347928) @@ -1655,7 +1655,9 @@ zfs_acl_ids_create(znode_t *dzp, int flag, vattr_t *va acl_ids->z_fgid = 0; } if (acl_ids->z_fgid == 0) { +#ifndef __FreeBSD_kernel__ if (dzp->z_mode & S_ISGID) { +#endif char *domain; uint32_t rid; @@ -1674,15 +1676,13 @@ zfs_acl_ids_create(znode_t *dzp, int flag, vattr_t *va FUID_INDEX(acl_ids->z_fgid), acl_ids->z_fgid, ZFS_GROUP); } +#ifndef __FreeBSD_kernel__ } else { acl_ids->z_fgid = zfs_fuid_create_cred(zfsvfs, ZFS_GROUP, cr, &acl_ids->z_fuidp); -#ifdef __FreeBSD_kernel__ - gid = acl_ids->z_fgid = dzp->z_gid; -#else gid = crgetgid(cr); -#endif } +#endif } } From owner-svn-src-stable@freebsd.org Fri May 17 18:10:12 2019 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 2DE2D159C488; Fri, 17 May 2019 18:10:12 +0000 (UTC) (envelope-from markj@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 C3C468676F; Fri, 17 May 2019 18:10:11 +0000 (UTC) (envelope-from markj@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 9E4E4BF42; Fri, 17 May 2019 18:10:11 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x4HIABqk091441; Fri, 17 May 2019 18:10:11 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x4HIAB4I091440; Fri, 17 May 2019 18:10:11 GMT (envelope-from markj@FreeBSD.org) Message-Id: <201905171810.x4HIAB4I091440@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Fri, 17 May 2019 18:10:11 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r347937 - stable/11/stand/defaults X-SVN-Group: stable-11 X-SVN-Commit-Author: markj X-SVN-Commit-Paths: stable/11/stand/defaults X-SVN-Commit-Revision: 347937 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: C3C468676F X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.94 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.998,0]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; NEURAL_HAM_SHORT(-0.94)[-0.944,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US] X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 17 May 2019 18:10:12 -0000 Author: markj Date: Fri May 17 18:10:11 2019 New Revision: 347937 URL: https://svnweb.freebsd.org/changeset/base/347937 Log: MFC r337716: Add microcode update configuration to the default loader.conf. Approved by: re (kib) Modified: stable/11/stand/defaults/loader.conf Directory Properties: stable/11/ (props changed) Modified: stable/11/stand/defaults/loader.conf ============================================================================== --- stable/11/stand/defaults/loader.conf Fri May 17 18:09:48 2019 (r347936) +++ stable/11/stand/defaults/loader.conf Fri May 17 18:10:11 2019 (r347937) @@ -52,6 +52,14 @@ ram_blacklist_name="/boot/blacklist.txt" # Set this to ram_blacklist_type="ram_blacklist" # Required for the kernel to find # the blacklist module +### Microcode loading configuration ######################## +cpu_microcode_load="NO" # Set this to YES to load and apply a + # microcode update file during boot. +cpu_microcode_name="/boot/firmware/ucode.bin" # Set this to the microcode + # update file path. +cpu_microcode_type="cpu_microcode" # Required for the kernel to find + # the microcode update file. + ### ACPI settings ########################################## acpi_dsdt_load="NO" # DSDT Overriding acpi_dsdt_type="acpi_dsdt" # Don't change this From owner-svn-src-stable@freebsd.org Fri May 17 21:00:00 2019 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 7D9BC159FE13; Fri, 17 May 2019 21:00:00 +0000 (UTC) (envelope-from kib@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 145DB8BBDD; Fri, 17 May 2019 21:00:00 +0000 (UTC) (envelope-from kib@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 E8F0ADBC1; Fri, 17 May 2019 20:59:59 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x4HKxxPu081090; Fri, 17 May 2019 20:59:59 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x4HKxxOO081089; Fri, 17 May 2019 20:59:59 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201905172059.x4HKxxOO081089@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Fri, 17 May 2019 20:59:59 +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: r347945 - stable/12/sys/x86/x86 X-SVN-Group: stable-12 X-SVN-Commit-Author: kib X-SVN-Commit-Paths: stable/12/sys/x86/x86 X-SVN-Commit-Revision: 347945 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 145DB8BBDD X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.96 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.998,0]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; NEURAL_HAM_SHORT(-0.96)[-0.962,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US] X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 17 May 2019 21:00:00 -0000 Author: kib Date: Fri May 17 20:59:59 2019 New Revision: 347945 URL: https://svnweb.freebsd.org/changeset/base/347945 Log: MFC r347625: Properly announce MD_CLEAR. Modified: stable/12/sys/x86/x86/identcpu.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/x86/x86/identcpu.c ============================================================================== --- stable/12/sys/x86/x86/identcpu.c Fri May 17 20:29:31 2019 (r347944) +++ stable/12/sys/x86/x86/identcpu.c Fri May 17 20:59:59 2019 (r347945) @@ -992,6 +992,7 @@ printcpuinfo(void) printf("\n Structured Extended Features3=0x%b", cpu_stdext_feature3, "\020" + "\013MD_CLEAR" "\016TSXFA" "\033IBPB" "\034STIBP" From owner-svn-src-stable@freebsd.org Fri May 17 22:14:31 2019 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 9661615A1467; Fri, 17 May 2019 22:14:31 +0000 (UTC) (envelope-from kib@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 2C2778DC54; Fri, 17 May 2019 22:14:31 +0000 (UTC) (envelope-from kib@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 F2C40E91D; Fri, 17 May 2019 22:14:30 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x4HMEUvE022618; Fri, 17 May 2019 22:14:30 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x4HMEUqd022617; Fri, 17 May 2019 22:14:30 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201905172214.x4HMEUqd022617@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Fri, 17 May 2019 22:14:30 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r347947 - stable/11/sys/x86/x86 X-SVN-Group: stable-11 X-SVN-Commit-Author: kib X-SVN-Commit-Paths: stable/11/sys/x86/x86 X-SVN-Commit-Revision: 347947 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 2C2778DC54 X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.98 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_SHORT(-0.98)[-0.983,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US]; NEURAL_HAM_MEDIUM(-1.00)[-0.998,0]; NEURAL_HAM_LONG(-1.00)[-1.000,0] X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 17 May 2019 22:14:31 -0000 Author: kib Date: Fri May 17 22:14:30 2019 New Revision: 347947 URL: https://svnweb.freebsd.org/changeset/base/347947 Log: MFC r347625: Properly announce MD_CLEAR. Approved by: re (gjb) Modified: stable/11/sys/x86/x86/identcpu.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/x86/x86/identcpu.c ============================================================================== --- stable/11/sys/x86/x86/identcpu.c Fri May 17 21:18:11 2019 (r347946) +++ stable/11/sys/x86/x86/identcpu.c Fri May 17 22:14:30 2019 (r347947) @@ -991,6 +991,7 @@ printcpuinfo(void) printf("\n Structured Extended Features3=0x%b", cpu_stdext_feature3, "\020" + "\013MD_CLEAR" "\016TSXFA" "\033IBPB" "\034STIBP" From owner-svn-src-stable@freebsd.org Sat May 18 03:15:09 2019 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id D678C15A659E; Sat, 18 May 2019 03:15:08 +0000 (UTC) (envelope-from bcr@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 703C0952C3; Sat, 18 May 2019 03:15:08 +0000 (UTC) (envelope-from bcr@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 4584819C23; Sat, 18 May 2019 03:15:08 +0000 (UTC) (envelope-from bcr@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x4I3F86i080554; Sat, 18 May 2019 03:15:08 GMT (envelope-from bcr@FreeBSD.org) Received: (from bcr@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x4I3F8g2080553; Sat, 18 May 2019 03:15:08 GMT (envelope-from bcr@FreeBSD.org) Message-Id: <201905180315.x4I3F8g2080553@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: bcr set sender to bcr@FreeBSD.org using -f From: Benedict Reuschling Date: Sat, 18 May 2019 03:15:08 +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: r347951 - stable/12/lib/libc/stdlib X-SVN-Group: stable-12 X-SVN-Commit-Author: bcr X-SVN-Commit-Paths: stable/12/lib/libc/stdlib X-SVN-Commit-Revision: 347951 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 703C0952C3 X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.95 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.999,0]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; NEURAL_HAM_SHORT(-0.95)[-0.954,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US] X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 18 May 2019 03:15:09 -0000 Author: bcr (doc committer) Date: Sat May 18 03:15:07 2019 New Revision: 347951 URL: https://svnweb.freebsd.org/changeset/base/347951 Log: MFC r347617: Add small EXAMPLE section to bsearch.3. Submitted by: fernape (via Phabricator) Reviewed by: bcr, jilles, dab Approved by: bcr (man pages), jilles (src) Differential Revision: https://reviews.freebsd.org/D19902 Modified: stable/12/lib/libc/stdlib/bsearch.3 Directory Properties: stable/12/ (props changed) Modified: stable/12/lib/libc/stdlib/bsearch.3 ============================================================================== --- stable/12/lib/libc/stdlib/bsearch.3 Sat May 18 02:02:14 2019 (r347950) +++ stable/12/lib/libc/stdlib/bsearch.3 Sat May 18 03:15:07 2019 (r347951) @@ -32,7 +32,7 @@ .\" @(#)bsearch.3 8.3 (Berkeley) 4/19/94 .\" $FreeBSD$ .\" -.Dd February 22, 2013 +.Dd May 15, 2019 .Dt BSEARCH 3 .Os .Sh NAME @@ -83,6 +83,61 @@ The function returns a pointer to a matching member of the array, or a null pointer if no match is found. If two members compare as equal, which member is matched is unspecified. +.Sh EXAMPLES +A sample program that searches people by age in a sorted array: +.Bd -literal +#include +#include +#include +#include +#include + +struct person { + char name[5]; + int age; +}; + +int +compare(const void *key, const void *array_member) +{ + int age = (intptr_t) key; + struct person person = *(struct person *) array_member; + + return (age - person.age); +} + +int +main() +{ + struct person *friend; + + /* Sorted array */ + struct person friends[6] = { + { "paul", 22 }, + { "anne", 25 }, + { "fred", 25 }, + { "mary", 27 }, + { "mark", 35 }, + { "bill", 50 } + }; + + size_t array_size = sizeof(friends) / sizeof(struct person); + + friend = bsearch((void *)22, &friends, array_size, sizeof(struct person), compare); + assert(strcmp(friend->name, "paul") == 0); + printf("name: %s\enage: %d\en", friend->name, friend->age); + + friend = bsearch((void *)25, &friends, array_size, sizeof(struct person), compare); + assert(strcmp(friend->name, "fred") == 0 || strcmp(friend->name, "anne") == 0); + printf("name: %s\enage: %d\en", friend->name, friend->age); + + friend = bsearch((void *)30, &friends, array_size, sizeof(struct person), compare); + assert(friend == NULL); + printf("friend aged 30 not found\en"); + + return (EXIT_SUCCESS); +} +.Ed .Sh SEE ALSO .Xr db 3 , .Xr lsearch 3 , From owner-svn-src-stable@freebsd.org Sat May 18 08:28:52 2019 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 7C24815ABFB3; Sat, 18 May 2019 08:28:52 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from kib.kiev.ua (kib.kiev.ua [IPv6:2001:470:d5e7:1::1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id AC3506EE59; Sat, 18 May 2019 08:28:51 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from tom.home (kib@localhost [127.0.0.1]) by kib.kiev.ua (8.15.2/8.15.2) with ESMTPS id x4I8ScTM039608 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NO); Sat, 18 May 2019 11:28:41 +0300 (EEST) (envelope-from kostikbel@gmail.com) DKIM-Filter: OpenDKIM Filter v2.10.3 kib.kiev.ua x4I8ScTM039608 Received: (from kostik@localhost) by tom.home (8.15.2/8.15.2/Submit) id x4I8ScNg039607; Sat, 18 May 2019 11:28:38 +0300 (EEST) (envelope-from kostikbel@gmail.com) X-Authentication-Warning: tom.home: kostik set sender to kostikbel@gmail.com using -f Date: Sat, 18 May 2019 11:28:38 +0300 From: Konstantin Belousov To: Benedict Reuschling Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: Re: svn commit: r347951 - stable/12/lib/libc/stdlib Message-ID: <20190518082838.GW2748@kib.kiev.ua> References: <201905180315.x4I3F8g2080553@repo.freebsd.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <201905180315.x4I3F8g2080553@repo.freebsd.org> User-Agent: Mutt/1.11.4 (2019-03-13) X-Spam-Status: No, score=-1.0 required=5.0 tests=ALL_TRUSTED,BAYES_00, DKIM_ADSP_CUSTOM_MED,FORGED_GMAIL_RCVD,FREEMAIL_FROM, NML_ADSP_CUSTOM_MED autolearn=no autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on tom.home X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 18 May 2019 08:28:52 -0000 On Sat, May 18, 2019 at 03:15:08AM +0000, Benedict Reuschling wrote: > Author: bcr (doc committer) > Date: Sat May 18 03:15:07 2019 > New Revision: 347951 > URL: https://svnweb.freebsd.org/changeset/base/347951 > > Log: > MFC r347617: > Add small EXAMPLE section to bsearch.3. > > Submitted by: fernape (via Phabricator) > Reviewed by: bcr, jilles, dab > Approved by: bcr (man pages), jilles (src) > Differential Revision: https://reviews.freebsd.org/D19902 > > Modified: > stable/12/lib/libc/stdlib/bsearch.3 > Directory Properties: > stable/12/ (props changed) > > Modified: stable/12/lib/libc/stdlib/bsearch.3 > ============================================================================== > --- stable/12/lib/libc/stdlib/bsearch.3 Sat May 18 02:02:14 2019 (r347950) > +++ stable/12/lib/libc/stdlib/bsearch.3 Sat May 18 03:15:07 2019 (r347951) > @@ -32,7 +32,7 @@ > .\" @(#)bsearch.3 8.3 (Berkeley) 4/19/94 > .\" $FreeBSD$ > .\" > -.Dd February 22, 2013 > +.Dd May 15, 2019 > .Dt BSEARCH 3 > .Os > .Sh NAME > @@ -83,6 +83,61 @@ The > function returns a pointer to a matching member of the array, or a null > pointer if no match is found. > If two members compare as equal, which member is matched is unspecified. > +.Sh EXAMPLES > +A sample program that searches people by age in a sorted array: > +.Bd -literal > +#include > +#include > +#include > +#include > +#include > + > +struct person { > + char name[5]; > + int age; > +}; > + > +int > +compare(const void *key, const void *array_member) > +{ > + int age = (intptr_t) key; > + struct person person = *(struct person *) array_member; These two lines contain at least three style(9) bugs, and at least one warning at higher warning level. > + > + return (age - person.age); > +} > + > +int > +main() Why use K&R definition ? > +{ > + struct person *friend; > + > + /* Sorted array */ > + struct person friends[6] = { > + { "paul", 22 }, > + { "anne", 25 }, > + { "fred", 25 }, > + { "mary", 27 }, > + { "mark", 35 }, > + { "bill", 50 } > + }; > + > + size_t array_size = sizeof(friends) / sizeof(struct person); Since you used const elsewere, why did not you used it there ? > + > + friend = bsearch((void *)22, &friends, array_size, sizeof(struct person), compare); Taking address of an array is weird. Line is too long. > + assert(strcmp(friend->name, "paul") == 0); > + printf("name: %s\enage: %d\en", friend->name, friend->age); > + > + friend = bsearch((void *)25, &friends, array_size, sizeof(struct person), compare); > + assert(strcmp(friend->name, "fred") == 0 || strcmp(friend->name, "anne") == 0); > + printf("name: %s\enage: %d\en", friend->name, friend->age); > + > + friend = bsearch((void *)30, &friends, array_size, sizeof(struct person), compare); > + assert(friend == NULL); > + printf("friend aged 30 not found\en"); > + > + return (EXIT_SUCCESS); > +} > +.Ed > .Sh SEE ALSO > .Xr db 3 , > .Xr lsearch 3 , From owner-svn-src-stable@freebsd.org Sat May 18 11:45:37 2019 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id CB3E115AFE58; Sat, 18 May 2019 11:45:36 +0000 (UTC) (envelope-from brde@optusnet.com.au) Received: from mail106.syd.optusnet.com.au (mail106.syd.optusnet.com.au [211.29.132.42]) by mx1.freebsd.org (Postfix) with ESMTP id 1FABC7627C; Sat, 18 May 2019 11:45:34 +0000 (UTC) (envelope-from brde@optusnet.com.au) Received: from [192.168.0.102] (c110-21-101-228.carlnfd1.nsw.optusnet.com.au [110.21.101.228]) by mail106.syd.optusnet.com.au (Postfix) with ESMTPS id 5DE593DC531; Sat, 18 May 2019 21:45:20 +1000 (AEST) Date: Sat, 18 May 2019 21:45:19 +1000 (EST) From: Bruce Evans X-X-Sender: bde@besplex.bde.org To: Konstantin Belousov cc: Benedict Reuschling , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: Re: svn commit: r347951 - stable/12/lib/libc/stdlib In-Reply-To: <20190518082838.GW2748@kib.kiev.ua> Message-ID: <20190518210514.V913@besplex.bde.org> References: <201905180315.x4I3F8g2080553@repo.freebsd.org> <20190518082838.GW2748@kib.kiev.ua> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed X-Optus-CM-Score: 0 X-Optus-CM-Analysis: v=2.2 cv=FNpr/6gs c=1 sm=1 tr=0 cx=a_idp_d a=PalzARQSbocsUSjMRkwAPg==:117 a=PalzARQSbocsUSjMRkwAPg==:17 a=jpOVt7BSZ2e4Z31A5e1TngXxSK0=:19 a=kj9zAlcOel0A:10 a=6I5d2MoRAAAA:8 a=sVDMQsUGGj2q3MpuiyMA:9 a=CjuIK1q_8ugA:10 a=IjZwj45LgO3ly-622nXo:22 X-Rspamd-Queue-Id: 1FABC7627C X-Spamd-Bar: ------ Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-7.00 / 15.00]; NEURAL_HAM_MEDIUM(-1.00)[-0.999,0]; NEURAL_HAM_SHORT(-1.00)[-0.997,0]; REPLY(-4.00)[]; NEURAL_HAM_LONG(-1.00)[-1.000,0] X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 18 May 2019 11:45:37 -0000 On Sat, 18 May 2019, Konstantin Belousov wrote: > On Sat, May 18, 2019 at 03:15:08AM +0000, Benedict Reuschling wrote: >> Author: bcr (doc committer) >> Date: Sat May 18 03:15:07 2019 >> New Revision: 347951 >> URL: https://svnweb.freebsd.org/changeset/base/347951 >> >> Log: >> MFC r347617: >> Add small EXAMPLE section to bsearch.3. >> >> Submitted by: fernape (via Phabricator) >> Reviewed by: bcr, jilles, dab >> Approved by: bcr (man pages), jilles (src) >> Differential Revision: https://reviews.freebsd.org/D19902 >> >> Modified: >> stable/12/lib/libc/stdlib/bsearch.3 >> Directory Properties: >> stable/12/ (props changed) >> >> Modified: stable/12/lib/libc/stdlib/bsearch.3 >> ============================================================================== >> --- stable/12/lib/libc/stdlib/bsearch.3 Sat May 18 02:02:14 2019 (r347950) >> +++ stable/12/lib/libc/stdlib/bsearch.3 Sat May 18 03:15:07 2019 (r347951) >> @@ -32,7 +32,7 @@ >> .\" @(#)bsearch.3 8.3 (Berkeley) 4/19/94 >> .\" $FreeBSD$ >> .\" >> -.Dd February 22, 2013 >> +.Dd May 15, 2019 >> .Dt BSEARCH 3 >> .Os >> .Sh NAME >> @@ -83,6 +83,61 @@ The >> function returns a pointer to a matching member of the array, or a null >> pointer if no match is found. >> If two members compare as equal, which member is matched is unspecified. >> +.Sh EXAMPLES >> +A sample program that searches people by age in a sorted array: >> +.Bd -literal >> +#include >> +#include >> +#include >> +#include >> +#include >> + >> +struct person { >> + char name[5]; >> + int age; >> +}; This example has a high density of style bugs. kib pointed out some. Some of the others are: (1) Not sorting the struct members on alignment. (style(9) says to sort on use, then size, but means alignment). (2) Not indenting the struct member names. (3) Not use a prefix for struct member names. This is not important for small programs. >> + >> +int >> +compare(const void *key, const void *array_member) >> +{ >> + int age = (intptr_t) key; >> + struct person person = *(struct person *) array_member; > These two lines contain at least three style(9) bugs, and at least one > warning at higher warning level. > >> + >> + return (age - person.age); >> +} >> + >> +int >> +main() > Why use K&R definition ? > >> +{ >> + struct person *friend; >> + >> + /* Sorted array */ >> + struct person friends[6] = { >> + { "paul", 22 }, >> + { "anne", 25 }, >> + { "fred", 25 }, >> + { "mary", 27 }, >> + { "mark", 35 }, >> + { "bill", 50 } >> + }; >> + >> + size_t array_size = sizeof(friends) / sizeof(struct person); > Since you used const elsewere, why did not you used it there ? (4) The size expression is obfuscated by spelling the element size as sizeof(struct person) instead of sizeof(friends[0]). (5?) FreeBSD now spells this size expression as nitems(friends). I don't like the unportability of this, especially in an example. > >> + >> + friend = bsearch((void *)22, &friends, array_size, sizeof(struct person), compare); > Taking address of an array is weird. > Line is too long. (6) C99 specifies that the search is for a member of the array that matches the object pointed to by 'key'. Here the key of (void *)22 is a not a pointer to an object. It is a cookie which points to garbage. The cookie is unique enough to work in practice. Perhaps you can prove it to always work if the option type intptr_t is supported. But this is a bad example. (4a) same obfuscation of the element size. > >> + assert(strcmp(friend->name, "paul") == 0); >> + printf("name: %s\enage: %d\en", friend->name, friend->age); >> + (7) Extra blank line. This is not too bad, but is not done consistently. >> + friend = bsearch((void *)25, &friends, array_size, sizeof(struct person), compare); (8) More too-long lines. (4b) More sizeof(person)'s. >> + assert(strcmp(friend->name, "fred") == 0 || strcmp(friend->name, "anne") == 0); (7a) No extra blank line for "fred". >> + printf("name: %s\enage: %d\en", friend->name, friend->age); >> + >> + friend = bsearch((void *)30, &friends, array_size, sizeof(struct person), compare); >> + assert(friend == NULL); >> + printf("friend aged 30 not found\en"); I didn't notice before that the key cookie was an encoding of the age. The key is not unique (there are 2 25's). This gives an example of low quality data and the example has minimal error handling handling for this without describing what it is doing (it asserts uniqueness for age 22 and it asserts one of the 2 possibilities for age 25. It can only do this because it knows too much about the data). It is more than a style bug to handle errors in data by assert() or otherwise killing the program, except possibly when the data is supposed to be good. >> + >> + return (EXIT_SUCCESS); >> +} >> +.Ed >> .Sh SEE ALSO >> .Xr db 3 , >> .Xr lsearch 3 , Bruce From owner-svn-src-stable@freebsd.org Sat May 18 12:39:11 2019 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 7C7D615B1AF3; Sat, 18 May 2019 12:39:11 +0000 (UTC) (envelope-from bcr@FreeBSD.org) Received: from mxout1bln1.prossl.de (mxout1bln1.prossl.de [91.233.87.26]) (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 DEBA8802E9; Sat, 18 May 2019 12:39:10 +0000 (UTC) (envelope-from bcr@FreeBSD.org) Received: from Voyager-109.local ([207.107.70.114]) (authenticated bits=0) by mx1bln1.prossl.de (8.15.2/8.14.9) with ESMTPSA id x4ICd5sn053472 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Sat, 18 May 2019 14:39:06 +0200 To: Bruce Evans , Konstantin Belousov Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org References: <201905180315.x4I3F8g2080553@repo.freebsd.org> <20190518082838.GW2748@kib.kiev.ua> <20190518210514.V913@besplex.bde.org> From: Benedict Reuschling Openpgp: preference=signencrypt Autocrypt: addr=bcr@FreeBSD.org; prefer-encrypt=mutual; keydata= mQENBFr4feYBCACdrnRpuvW/d/PeKuFu54ifaGhG+yFf3wnWaQX8hTCvySbv6A24Owot6cyU vhjdsifZ9iRQ82Likl+6OxI9qBXR9N+WCv1ut46q+mL50YLnYRejRCz8vEmVunlyVDKjsBY5 DtjsaRXMJ/D56wh3ROd9VYjrDHWobu+bg9D7RIv0kCyoPd0JsYRFXISgt4IocWVLT8ciWqiT Pp3m37BPrtXhR3EDOnHmGWPf6SuolvveqyOlpdguD3LAkFJDLeq3isnMaLXUhcsTqBTBLdOT 6EJHBYCcq39izNVC88JsVBmEuByhpb0LaXrBFQWhUG5RyecROAqrx+DWhcZnxayCtr3NABEB AAG0N0JlbmVkaWN0IFJldXNjaGxpbmcgKHd3dy5mcmVlYnNkLm9yZykgPGJjckBGcmVlQlNE Lm9yZz6JAVQEEwEKAD4CGwMFCwkIBwMFFQoJCAsFFgIDAQACHgECF4AWIQRTQnZtbeuE5dPj 3Pah0MHTBYXRWAUCWviOpwUJA8J3wQAKCRCh0MHTBYXRWJfJB/9qxBylB2KlA5EkdhyOp9cO O8kGpx301Rg6I/IUDACmDRvZckthpaUlNJ/RBYtid12o9A9kIhabdEaZfoBcV+ehyq3iSnff 9U+YlXkQ0iOflujWfgyMKNmaseWAPl6aCYc4gUsRH6YTVJFANPdofAIghEFLeY4jPsfkCIPP SAzUK1kQDtsHc5zwTYltqiKRBxQe1Y8WftitRp4LkTkR2wxWggp5oS6yKzh0kRir+U+5pFWZ 9g4ZQGxqodp8fKHI1IsJvs921UArjbmtLmDbrd28SK96i5ck4xga6mPf7ShhE9haYy1A+cbK fDhwizaJUl/H3jjXXbPv1MuIsvo+qEKVuQENBFr4f7wBCACxULIM5UFaEyZwAojYMXwIF/QW zq20MXaQXjn2JxJp04VaQHCL794ZrNtvkTvyqxYVFCKjvJHPXsT4zKuglMSTi83choejs7DJ 4YNmBBJKDHbugAcb5OgdTaT+ztUGl1VL4S3iEvWJwBAOUuzd9TTC/4GhYnUJR7A0CeEZnPfF av2K+d8BZ8x/XryFgQo3Wi5FnOekwls4v1wzzJE4ssaW4p357fmXRG2Czzytzf/W3I2/VWFm 2J8P8TIzSoJq+girktqhH+dYwbDeWkldWj6egcMdpVzJ89ottXARQYeu6YFSHnmHHnBhX2hV z+K2WkVLqYwj7XdBQAtPxIk8VlMBABEBAAGJAnIEGAEKACYCGwIWIQRTQnZtbeuE5dPj3Pah 0MHTBYXRWAUCWviOsgUJA8J19gFAwHQgBBkBCgAdFiEEwXonQDvNfP/33IoBVXQ7/QHhjTUF Alr4f7wACgkQVXQ7/QHhjTWg7Qf/WzBvcfskO8HBHfmLEE5zJRIOgogl6kVwvwR6PjihhMFC iBeH2fGz8nTtkouSttcbMnLnmV0qVv/r5FgIohTlEimaQUh7LgQKiql2SdYVpF1ha/3NHerR 1Rc0OGW+eliseI9b9/OKkY1AOaRM98HGJZB6TO2iKf2wiJDjr1RdlN2VcCST+ksG2Ehc3RvZ UTY1Kw5i9BOKsTsiQkrpCsrZ2/0tqvwv7efYJ0FOHfm0WbmvAlfdpxqsWmtgdsa0m/ItBtpo zIhlZs8/BlOmDK5571bAmWOV0apXSgp6OTmeQkpIsJKjwj/JwOhzvfkxZv03Js4+51xKjotT ma8XGjnJKgkQodDB0wWF0Vj+Wwf/f5cEjvLmq+Xw0KYjPA8oqk9L5a4Z9J/BdeH630koZ2wP YUwUsF/rFfdZf7jHvJJas1I0ctsutvhlgu4Elb7kJrfNRMSXUXe8ucdPS/cH9M/y9e7flW3i c/Ik14rV1Z1E9ME0CtDzfUtS3BfhyxpgmHbQmgPv/NkCE8Zu+nU/1QInpi7ZrDWWyJOCndcm R4kZpP0MJ0OCTWGDkDtJG4zIRQKeJKscqolWo7yu3GiG/Fr9W5cfr3IIo9xp8UQ06idbjjSV jItrSmL/HoZYQ7DSGCsQObC6snbkdeWRSaz/TCzEth5O0NGgA37apNaF3TZTbxRWcMG9uICc oGpDIZeCe7kBDQRa+IBQAQgA2EV0IFUgcJEpznzSxRhKajgLUmP/CJkUrXRipRrR0PqeXEH2 dF1+T8JObDVBN33oXwbXfIvBUhEw2uWsAHDW8OqzUsCTUxdy3ehVHkxHw1deXfvYf5VTtSli QsVIEJ0LZtD3V0idDnfGAhWqbMubBtF2tj1I6P2Py+RlU1pMD4B4g8zcWU+H4H39tpLkd9c/ kTemaX6QwRNW42L8+tDjL4pUogf8/tweMOj9LDOWVTqE2lipWxCH0uTEj8G8kSMLCyGgjxni MFDpjJLu3ETBZMevA+HNWS80RGbT2byu0FbeqXdRV3/+PL3MUY3mOs91bVgxpULG3aDcEmWd IJzNgQARAQABiQE8BBgBCgAmAhsMFiEEU0J2bW3rhOXT49z2odDB0wWF0VgFAlr4jsAFCQPC dXAACgkQodDB0wWF0VgnUQf/T1Z0SBj8YdepF91TTQnvH21USuyEsWCIX8d2xrUqGdVnwlIS fllS3SKTZQJdFhqQtEEYrKRhUDHrPt5Sm0NBisiD+lLcRajv7si4Xj8/ZY/gFjt7RrraYv5D Yb1BjSzsY4YEtq55jDknGufmBpannhnLFFlltt12Sa+xVgZMOl3g8zMjQkiPMtesw1DMDy9N lPB2WlbBVQlkzNHMifpIEiqc+ckZJavYabl/Nsv/kbMFGTizdIllN2EML6l9/KUC3Iw0OWB9 pnge7j3cX7+6sv4ypu65B/XMb4h/4HvXs4D2NW0HIIWtPA50fjjPSJs2JHJt9qVkI7/rNNNL byRcKQ== Organization: The FreeBSD Project Subject: Re: svn commit: r347951 - stable/12/lib/libc/stdlib Message-ID: Date: Sat, 18 May 2019 08:39:03 -0400 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.14; rv:60.0) Gecko/20100101 Thunderbird/60.6.1 MIME-Version: 1.0 In-Reply-To: <20190518210514.V913@besplex.bde.org> Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="fsnKyQeONjPYq8m4rld7XVtjUBPd0qtcy" X-Null-Tag: bfeeb3f8352a17fade0e257ec4538b82 X-Rspamd-Queue-Id: DEBA8802E9 X-Spamd-Bar: ------ Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-6.95 / 15.00]; NEURAL_HAM_MEDIUM(-1.00)[-0.999,0]; NEURAL_HAM_SHORT(-0.95)[-0.952,0]; REPLY(-4.00)[]; NEURAL_HAM_LONG(-1.00)[-1.000,0] X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 18 May 2019 12:39:11 -0000 This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --fsnKyQeONjPYq8m4rld7XVtjUBPd0qtcy Content-Type: multipart/mixed; boundary="oeHFM0qpQfkuo6aBheASaIKnW8bbYUcrc"; protected-headers="v1" From: Benedict Reuschling To: Bruce Evans , Konstantin Belousov Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Message-ID: Subject: Re: svn commit: r347951 - stable/12/lib/libc/stdlib References: <201905180315.x4I3F8g2080553@repo.freebsd.org> <20190518082838.GW2748@kib.kiev.ua> <20190518210514.V913@besplex.bde.org> In-Reply-To: <20190518210514.V913@besplex.bde.org> --oeHFM0qpQfkuo6aBheASaIKnW8bbYUcrc Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Hello Konstantin and Bruce, thank you for your comments. Clearly, this should have been addressed in the review and checked by a second pair of eyes. I mostly did the man page changes and can't comment much on the actual coding example. Two people (dab and jilles) approved the revision in the Phabricator review. There was plenty of time to review it between April 16 and May 15 when then the original submitter asked if there was anything else that needs to be done. Now, having said that and the the change is now both in HEAD and stable/12, how do we proceed? Revert them both or patch those issues as follow-ups? Note that a src committer should do that and not me trying to add more EXAMPLE sections to man pages with my doc commit bit. Regards, Benedict Am 18.05.19 um 07:45 schrieb Bruce Evans: > On Sat, 18 May 2019, Konstantin Belousov wrote: >=20 >> On Sat, May 18, 2019 at 03:15:08AM +0000, Benedict Reuschling wrote: >>> Author: bcr (doc committer) >>> Date: Sat May 18 03:15:07 2019 >>> New Revision: 347951 >>> URL: https://svnweb.freebsd.org/changeset/base/347951 >>> >>> Log: >>> =C2=A0 MFC r347617: >>> =C2=A0 Add small EXAMPLE section to bsearch.3. >>> >>> =C2=A0 Submitted by:=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0 fernape (via Phabricator) >>> =C2=A0 Reviewed by:=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0 bcr, jilles, dab >>> =C2=A0 Approved by:=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0 bcr (man pages), jilles (src) >>> =C2=A0 Differential Revision:=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= https://reviews.freebsd.org/D19902 >>> >>> Modified: >>> =C2=A0 stable/12/lib/libc/stdlib/bsearch.3 >>> Directory Properties: >>> =C2=A0 stable/12/=C2=A0=C2=A0 (props changed) >>> >>> Modified: stable/12/lib/libc/stdlib/bsearch.3 >>> =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D >>> >>> --- stable/12/lib/libc/stdlib/bsearch.3=C2=A0=C2=A0=C2=A0 Sat May 18 = 02:02:14 >>> 2019=C2=A0=C2=A0=C2=A0 (r347950) >>> +++ stable/12/lib/libc/stdlib/bsearch.3=C2=A0=C2=A0=C2=A0 Sat May 18 = 03:15:07 >>> 2019=C2=A0=C2=A0=C2=A0 (r347951) >>> @@ -32,7 +32,7 @@ >>> =C2=A0.\"=C2=A0=C2=A0=C2=A0=C2=A0 @(#)bsearch.3=C2=A0=C2=A0=C2=A0 8.3= (Berkeley) 4/19/94 >>> =C2=A0.\" $FreeBSD$ >>> =C2=A0.\" >>> -.Dd February 22, 2013 >>> +.Dd May 15, 2019 >>> =C2=A0.Dt BSEARCH 3 >>> =C2=A0.Os >>> =C2=A0.Sh NAME >>> @@ -83,6 +83,61 @@ The >>> =C2=A0function returns a pointer to a matching member of the array, o= r a null >>> =C2=A0pointer if no match is found. >>> =C2=A0If two members compare as equal, which member is matched is >>> unspecified. >>> +.Sh EXAMPLES >>> +A sample program that searches people by age in a sorted array: >>> +.Bd -literal >>> +#include >>> +#include >>> +#include >>> +#include >>> +#include >>> + >>> +struct person { >>> +=C2=A0=C2=A0=C2=A0 char name[5]; >>> +=C2=A0=C2=A0=C2=A0 int age; >>> +}; >=20 > This example has a high density of style bugs.=C2=A0 kib pointed out so= me. > Some of the others are: >=20 > (1) Not sorting the struct members on alignment.=C2=A0 (style(9) says t= o sort > =C2=A0=C2=A0=C2=A0 on use, then size, but means alignment). > (2) Not indenting the struct member names. > (3) Not use a prefix for struct member names.=C2=A0 This is not importa= nt for > =C2=A0=C2=A0=C2=A0 small programs. >=20 >>> + >>> +int >>> +compare(const void *key, const void *array_member) >>> +{ >>> +=C2=A0=C2=A0=C2=A0 int age =3D (intptr_t) key; >>> +=C2=A0=C2=A0=C2=A0 struct person person =3D *(struct person *) array= _member; >> These two lines contain at least three style(9) bugs, and at least one= >> warning at higher warning level. >> >>> + >>> +=C2=A0=C2=A0=C2=A0 return (age - person.age); >>> +} >>> + >>> +int >>> +main() >> Why use K&R definition ? >> >>> +{ >>> +=C2=A0=C2=A0=C2=A0 struct person *friend; >>> + >>> +=C2=A0=C2=A0=C2=A0 /* Sorted array */ >>> +=C2=A0=C2=A0=C2=A0 struct person friends[6] =3D { >>> +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 { "paul", 22 }, >>> +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 { "anne", 25 }, >>> +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 { "fred", 25 }, >>> +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 { "mary", 27 }, >>> +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 { "mark", 35 }, >>> +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 { "bill", 50 } >>> +=C2=A0=C2=A0=C2=A0 }; >>> + >>> +=C2=A0=C2=A0=C2=A0 size_t array_size =3D sizeof(friends) / sizeof(st= ruct person); >> Since you used const elsewere, why did not you used it there ? >=20 > (4) The size expression is obfuscated by spelling the element size as > =C2=A0=C2=A0=C2=A0 sizeof(struct person) instead of sizeof(friends[0]).= > (5?) FreeBSD now spells this size expression as nitems(friends).=C2=A0 = I don't > =C2=A0=C2=A0=C2=A0 like the unportability of this, especially in an exa= mple. >=20 >> >>> + >>> +=C2=A0=C2=A0=C2=A0 friend =3D bsearch((void *)22, &friends, array_si= ze, sizeof(struct >>> person), compare); >> Taking address of an array is weird. >> Line is too long. >=20 > (6) C99 specifies that the search is for a member of the array that mat= ches > =C2=A0=C2=A0=C2=A0 the object pointed to by 'key'.=C2=A0 Here the key o= f (void *)22 is a > =C2=A0=C2=A0=C2=A0 not a pointer to an object.=C2=A0 It is a cookie whi= ch points to garbage. > =C2=A0=C2=A0=C2=A0 The cookie is unique enough to work in practice.=C2=A0= Perhaps you can > =C2=A0=C2=A0=C2=A0 prove it to always work if the option type intptr_t = is supported. > =C2=A0=C2=A0=C2=A0 But this is a bad example. > (4a) same obfuscation of the element size. >=20 >> >>> +=C2=A0=C2=A0=C2=A0 assert(strcmp(friend->name, "paul") =3D=3D 0); >>> +=C2=A0=C2=A0=C2=A0 printf("name: %s\enage: %d\en", friend->name, fri= end->age); >>> + >=20 > (7) Extra blank line.=C2=A0 This is not too bad, but is not done consis= tently. >=20 >>> +=C2=A0=C2=A0=C2=A0 friend =3D bsearch((void *)25, &friends, array_si= ze, sizeof(struct >>> person), compare); >=20 > (8) More too-long lines. > (4b) More sizeof(person)'s. >=20 >>> +=C2=A0=C2=A0=C2=A0 assert(strcmp(friend->name, "fred") =3D=3D 0 || s= trcmp(friend->name, >>> "anne") =3D=3D 0); >=20 > (7a) No extra blank line for "fred". >=20 >>> +=C2=A0=C2=A0=C2=A0 printf("name: %s\enage: %d\en", friend->name, fri= end->age); >>> + >>> +=C2=A0=C2=A0=C2=A0 friend =3D bsearch((void *)30, &friends, array_si= ze, sizeof(struct >>> person), compare); >>> +=C2=A0=C2=A0=C2=A0 assert(friend =3D=3D NULL); >>> +=C2=A0=C2=A0=C2=A0 printf("friend aged 30 not found\en"); >=20 > I didn't notice before that the key cookie was an encoding of the age. >=20 > The key is not unique (there are 2 25's).=C2=A0 This gives an example o= f low > quality data and the example has minimal error handling handling for th= is > without describing what it is doing (it asserts uniqueness for age 22 a= nd > it asserts one of the 2 possibilities for age 25.=C2=A0 It can only do = this > because it knows too much about the data). >=20 > It is more than a style bug to handle errors in data by assert() or > otherwise killing the program, except possibly when the data is suppose= d > to be good. >=20 >>> + >>> +=C2=A0=C2=A0=C2=A0 return (EXIT_SUCCESS); >>> +} >>> +.Ed >>> =C2=A0.Sh SEE ALSO >>> =C2=A0.Xr db 3 , >>> =C2=A0.Xr lsearch 3 , >=20 > Bruce --oeHFM0qpQfkuo6aBheASaIKnW8bbYUcrc-- --fsnKyQeONjPYq8m4rld7XVtjUBPd0qtcy Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- iQEzBAEBCgAdFiEEwXonQDvNfP/33IoBVXQ7/QHhjTUFAlzf/OgACgkQVXQ7/QHh jTWulwf/Uyhskg3eKPZTWC7AmQ8KUm1K4wA3COyTChvmqgBgFtiXIOsQvxksq6rn 8lwQBY7zCI+xk6Bz0TSaCwrNRvttDsCbSWkoFLQNP/yh+ZupgM6Br5cGXNLdBN2U 64gkswvSJVwc//1VuOS87qC18msb6h5e1YNmsoh9E+08xPPu5QRx3TpR8ej0xQ8h ArAMB/BLG8/7zDbnjrwsTowRPmpZOUZ1RsSJ7P1Ps96KXun1nzYnVJoCPN+lAfLD UZgyKE6McWhCtEQniHGc0B0cpjhcILJoQ0wVtASZGsgMj12vk9ShccBcRXJj8zDK YzmhGsLDhq6BDUnObz3VMbgh9JKrJQ== =7Q1n -----END PGP SIGNATURE----- --fsnKyQeONjPYq8m4rld7XVtjUBPd0qtcy-- From owner-svn-src-stable@freebsd.org Sat May 18 12:50:04 2019 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 568F515B1F59; Sat, 18 May 2019 12:50:04 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from kib.kiev.ua (kib.kiev.ua [IPv6:2001:470:d5e7:1::1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 90CC080BC2; Sat, 18 May 2019 12:50:03 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from tom.home (kib@localhost [127.0.0.1]) by kib.kiev.ua (8.15.2/8.15.2) with ESMTPS id x4ICnp0Q008809 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NO); Sat, 18 May 2019 15:49:54 +0300 (EEST) (envelope-from kostikbel@gmail.com) DKIM-Filter: OpenDKIM Filter v2.10.3 kib.kiev.ua x4ICnp0Q008809 Received: (from kostik@localhost) by tom.home (8.15.2/8.15.2/Submit) id x4ICnnS5008808; Sat, 18 May 2019 15:49:49 +0300 (EEST) (envelope-from kostikbel@gmail.com) X-Authentication-Warning: tom.home: kostik set sender to kostikbel@gmail.com using -f Date: Sat, 18 May 2019 15:49:49 +0300 From: Konstantin Belousov To: Benedict Reuschling Cc: Bruce Evans , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: Re: svn commit: r347951 - stable/12/lib/libc/stdlib Message-ID: <20190518124949.GB2748@kib.kiev.ua> References: <201905180315.x4I3F8g2080553@repo.freebsd.org> <20190518082838.GW2748@kib.kiev.ua> <20190518210514.V913@besplex.bde.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.11.4 (2019-03-13) X-Spam-Status: No, score=-1.0 required=5.0 tests=ALL_TRUSTED,BAYES_00, DKIM_ADSP_CUSTOM_MED,FORGED_GMAIL_RCVD,FREEMAIL_FROM, NML_ADSP_CUSTOM_MED autolearn=no autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on tom.home X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 18 May 2019 12:50:04 -0000 On Sat, May 18, 2019 at 08:39:03AM -0400, Benedict Reuschling wrote: > Hello Konstantin and Bruce, > > thank you for your comments. Clearly, this should have been addressed in > the review and checked by a second pair of eyes. I mostly did the man > page changes and can't comment much on the actual coding example. Two > people (dab and jilles) approved the revision in the Phabricator review. > There was plenty of time to review it between April 16 and May 15 when > then the original submitter asked if there was anything else that needs > to be done. > > Now, having said that and the the change is now both in HEAD and > stable/12, how do we proceed? Revert them both or patch those issues as > follow-ups? Note that a src committer should do that and not me trying > to add more EXAMPLE sections to man pages with my doc commit bit. > Try to improve it. I think there is some value in having a good and non-buggy example for the function(s), but we are not there yet. You have a lot of comments with direct actions. From owner-svn-src-stable@freebsd.org Sat May 18 13:06:56 2019 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 7C94A158A7D7; Sat, 18 May 2019 13:06:56 +0000 (UTC) (envelope-from freebsd@gndrsh.dnsmgr.net) Received: from gndrsh.dnsmgr.net (br1.CN84in.dnsmgr.net [69.59.192.140]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id D2A3B81877; Sat, 18 May 2019 13:06:55 +0000 (UTC) (envelope-from freebsd@gndrsh.dnsmgr.net) Received: from gndrsh.dnsmgr.net (localhost [127.0.0.1]) by gndrsh.dnsmgr.net (8.13.3/8.13.3) with ESMTP id x4ID6p7N064983; Sat, 18 May 2019 06:06:51 -0700 (PDT) (envelope-from freebsd@gndrsh.dnsmgr.net) Received: (from freebsd@localhost) by gndrsh.dnsmgr.net (8.13.3/8.13.3/Submit) id x4ID6piX064982; Sat, 18 May 2019 06:06:51 -0700 (PDT) (envelope-from freebsd) From: "Rodney W. Grimes" Message-Id: <201905181306.x4ID6piX064982@gndrsh.dnsmgr.net> Subject: Re: svn commit: r347951 - stable/12/lib/libc/stdlib In-Reply-To: To: Benedict Reuschling Date: Sat, 18 May 2019 06:06:51 -0700 (PDT) CC: Bruce Evans , Konstantin Belousov , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Reply-To: rgrimes@freebsd.org X-Mailer: ELM [version 2.4ME+ PL121h (25)] MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset=US-ASCII X-Rspamd-Queue-Id: D2A3B81877 X-Spamd-Bar: ------ Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-6.92 / 15.00]; NEURAL_HAM_MEDIUM(-1.00)[-1.000,0]; NEURAL_HAM_SHORT(-0.92)[-0.919,0]; REPLY(-4.00)[]; NEURAL_HAM_LONG(-1.00)[-1.000,0] X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 18 May 2019 13:06:56 -0000 > Hello Konstantin and Bruce, > > thank you for your comments. Clearly, this should have been addressed in > the review and checked by a second pair of eyes. I mostly did the man > page changes and can't comment much on the actual coding example. Two > people (dab and jilles) approved the revision in the Phabricator review. > There was plenty of time to review it between April 16 and May 15 when > then the original submitter asked if there was anything else that needs > to be done. The quality of a code review is highly dependent on who is invited to do the reviewing, and how much participation and care those invited have with respect to the process. Man pages that contain code samples need to have more reviewers, you need man page experts, you need subject mater experts, and you need coding experts. This review could of used more reviewers (hind sight is 20/20) but if they had not been the right reviewers the low quality commit would of probably still occurred. The amount of time in review is not a good measure of review completness, that falls more onto the quality of the workmanship of those actually commented on a review. I myself consider a LGTM, or a accept by a reviewer who makes 0 comments on my code in phab as if that reviewer probably just rubber stamped my change, UNLESS I have extremly high trust in that person. If bde, imp, or kib stamp an approve on something of mine my confidence level is very high and I do consider that code well reviewed, if I get a rubber stamp from some others I am not so confident. Now we have the problem in that note every code review can be done by such high quality engineers due to time and work load constraints, so we need to raise the level of others closer to these shinning stars and offset this lack of avaliable resources by other means (more reviewers, long review cycles, automations, etc.) > > Now, having said that and the the change is now both in HEAD and > stable/12, how do we proceed? Revert them both or patch those issues as > follow-ups? Note that a src committer should do that and not me trying > to add more EXAMPLE sections to man pages with my doc commit bit. There is another option, a revert is actually a local operation to your checked out code, ou can check out head, revert this commit, but do not commit, make the corrections, and then commit. When MFC's this single commit does the right thing. You could also revert in head, commit and later fix these issues, commit, and then MFC both of those commits. All of your proposed solutions, and my additions are workable, and I really have no preference on a single file change like this. Good Day, Rod > Regards, > Benedict > > > > Am 18.05.19 um 07:45 schrieb Bruce Evans: > > On Sat, 18 May 2019, Konstantin Belousov wrote: > > > >> On Sat, May 18, 2019 at 03:15:08AM +0000, Benedict Reuschling wrote: > >>> Author: bcr (doc committer) > >>> Date: Sat May 18 03:15:07 2019 > >>> New Revision: 347951 > >>> URL: https://svnweb.freebsd.org/changeset/base/347951 > >>> > >>> Log: > >>> ? MFC r347617: > >>> ? Add small EXAMPLE section to bsearch.3. > >>> > >>> ? Submitted by:??????????? fernape (via Phabricator) > >>> ? Reviewed by:??????????? bcr, jilles, dab > >>> ? Approved by:??????????? bcr (man pages), jilles (src) > >>> ? Differential Revision:??????? https://reviews.freebsd.org/D19902 > >>> > >>> Modified: > >>> ? stable/12/lib/libc/stdlib/bsearch.3 > >>> Directory Properties: > >>> ? stable/12/?? (props changed) > >>> > >>> Modified: stable/12/lib/libc/stdlib/bsearch.3 > >>> ============================================================================== > >>> > >>> --- stable/12/lib/libc/stdlib/bsearch.3??? Sat May 18 02:02:14 > >>> 2019??? (r347950) > >>> +++ stable/12/lib/libc/stdlib/bsearch.3??? Sat May 18 03:15:07 > >>> 2019??? (r347951) > >>> @@ -32,7 +32,7 @@ > >>> ?.\"???? @(#)bsearch.3??? 8.3 (Berkeley) 4/19/94 > >>> ?.\" $FreeBSD$ > >>> ?.\" > >>> -.Dd February 22, 2013 > >>> +.Dd May 15, 2019 > >>> ?.Dt BSEARCH 3 > >>> ?.Os > >>> ?.Sh NAME > >>> @@ -83,6 +83,61 @@ The > >>> ?function returns a pointer to a matching member of the array, or a null > >>> ?pointer if no match is found. > >>> ?If two members compare as equal, which member is matched is > >>> unspecified. > >>> +.Sh EXAMPLES > >>> +A sample program that searches people by age in a sorted array: > >>> +.Bd -literal > >>> +#include > >>> +#include > >>> +#include > >>> +#include > >>> +#include > >>> + > >>> +struct person { > >>> +??? char name[5]; > >>> +??? int age; > >>> +}; > > > > This example has a high density of style bugs.? kib pointed out some. > > Some of the others are: > > > > (1) Not sorting the struct members on alignment.? (style(9) says to sort > > ??? on use, then size, but means alignment). > > (2) Not indenting the struct member names. > > (3) Not use a prefix for struct member names.? This is not important for > > ??? small programs. > > > >>> + > >>> +int > >>> +compare(const void *key, const void *array_member) > >>> +{ > >>> +??? int age = (intptr_t) key; > >>> +??? struct person person = *(struct person *) array_member; > >> These two lines contain at least three style(9) bugs, and at least one > >> warning at higher warning level. > >> > >>> + > >>> +??? return (age - person.age); > >>> +} > >>> + > >>> +int > >>> +main() > >> Why use K&R definition ? > >> > >>> +{ > >>> +??? struct person *friend; > >>> + > >>> +??? /* Sorted array */ > >>> +??? struct person friends[6] = { > >>> +??????? { "paul", 22 }, > >>> +??????? { "anne", 25 }, > >>> +??????? { "fred", 25 }, > >>> +??????? { "mary", 27 }, > >>> +??????? { "mark", 35 }, > >>> +??????? { "bill", 50 } > >>> +??? }; > >>> + > >>> +??? size_t array_size = sizeof(friends) / sizeof(struct person); > >> Since you used const elsewere, why did not you used it there ? > > > > (4) The size expression is obfuscated by spelling the element size as > > ??? sizeof(struct person) instead of sizeof(friends[0]). > > (5?) FreeBSD now spells this size expression as nitems(friends).? I don't > > ??? like the unportability of this, especially in an example. > > > >> > >>> + > >>> +??? friend = bsearch((void *)22, &friends, array_size, sizeof(struct > >>> person), compare); > >> Taking address of an array is weird. > >> Line is too long. > > > > (6) C99 specifies that the search is for a member of the array that matches > > ??? the object pointed to by 'key'.? Here the key of (void *)22 is a > > ??? not a pointer to an object.? It is a cookie which points to garbage. > > ??? The cookie is unique enough to work in practice.? Perhaps you can > > ??? prove it to always work if the option type intptr_t is supported. > > ??? But this is a bad example. > > (4a) same obfuscation of the element size. > > > >> > >>> +??? assert(strcmp(friend->name, "paul") == 0); > >>> +??? printf("name: %s\enage: %d\en", friend->name, friend->age); > >>> + > > > > (7) Extra blank line.? This is not too bad, but is not done consistently. > > > >>> +??? friend = bsearch((void *)25, &friends, array_size, sizeof(struct > >>> person), compare); > > > > (8) More too-long lines. > > (4b) More sizeof(person)'s. > > > >>> +??? assert(strcmp(friend->name, "fred") == 0 || strcmp(friend->name, > >>> "anne") == 0); > > > > (7a) No extra blank line for "fred". > > > >>> +??? printf("name: %s\enage: %d\en", friend->name, friend->age); > >>> + > >>> +??? friend = bsearch((void *)30, &friends, array_size, sizeof(struct > >>> person), compare); > >>> +??? assert(friend == NULL); > >>> +??? printf("friend aged 30 not found\en"); > > > > I didn't notice before that the key cookie was an encoding of the age. > > > > The key is not unique (there are 2 25's).? This gives an example of low > > quality data and the example has minimal error handling handling for this > > without describing what it is doing (it asserts uniqueness for age 22 and > > it asserts one of the 2 possibilities for age 25.? It can only do this > > because it knows too much about the data). > > > > It is more than a style bug to handle errors in data by assert() or > > otherwise killing the program, except possibly when the data is supposed > > to be good. > > > >>> + > >>> +??? return (EXIT_SUCCESS); > >>> +} > >>> +.Ed > >>> ?.Sh SEE ALSO > >>> ?.Xr db 3 , > >>> ?.Xr lsearch 3 , > > > > Bruce > > -- Rod Grimes rgrimes@freebsd.org From owner-svn-src-stable@freebsd.org Sat May 18 13:27:10 2019 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 8F001158AFF1; Sat, 18 May 2019 13:27:10 +0000 (UTC) (envelope-from johalun@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 2ED9D82678; Sat, 18 May 2019 13:27:10 +0000 (UTC) (envelope-from johalun@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 049792030C; Sat, 18 May 2019 13:27:10 +0000 (UTC) (envelope-from johalun@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x4IDR9qV005866; Sat, 18 May 2019 13:27:09 GMT (envelope-from johalun@FreeBSD.org) Received: (from johalun@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x4IDR9EK005864; Sat, 18 May 2019 13:27:09 GMT (envelope-from johalun@FreeBSD.org) Message-Id: <201905181327.x4IDR9EK005864@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: johalun set sender to johalun@FreeBSD.org using -f From: Johannes Lundberg Date: Sat, 18 May 2019 13:27:09 +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: r347954 - in stable/12/sys/compat/linuxkpi/common: include/linux src X-SVN-Group: stable-12 X-SVN-Commit-Author: johalun X-SVN-Commit-Paths: in stable/12/sys/compat/linuxkpi/common: include/linux src X-SVN-Commit-Revision: 347954 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 2ED9D82678 X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.97 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.999,0]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; NEURAL_HAM_SHORT(-0.97)[-0.972,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US] X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 18 May 2019 13:27:10 -0000 Author: johalun Date: Sat May 18 13:27:09 2019 New Revision: 347954 URL: https://svnweb.freebsd.org/changeset/base/347954 Log: MFC ------------------------------------------------------------------------ r347470 | johalun | 2019-05-10 16:10:22 -0700 (Fri, 10 May 2019) | 9 lines Implement linux_pci_unregister_drm_driver in linuxkpi so that drm drivers can be unloaded. This patch is a part of D19565. Reviewed by: hps Approved by: imp (mentor), hps MFC after: 1 week ------------------------------------------------------------------------ Modified: stable/12/sys/compat/linuxkpi/common/include/linux/pci.h stable/12/sys/compat/linuxkpi/common/src/linux_pci.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/compat/linuxkpi/common/include/linux/pci.h ============================================================================== --- stable/12/sys/compat/linuxkpi/common/include/linux/pci.h Sat May 18 12:27:22 2019 (r347953) +++ stable/12/sys/compat/linuxkpi/common/include/linux/pci.h Sat May 18 13:27:09 2019 (r347954) @@ -521,6 +521,7 @@ pci_write_config_dword(struct pci_dev *pdev, int where int linux_pci_register_driver(struct pci_driver *pdrv); int linux_pci_register_drm_driver(struct pci_driver *pdrv); void linux_pci_unregister_driver(struct pci_driver *pdrv); +void linux_pci_unregister_drm_driver(struct pci_driver *pdrv); #define pci_register_driver(pdrv) linux_pci_register_driver(pdrv) #define pci_unregister_driver(pdrv) linux_pci_unregister_driver(pdrv) Modified: stable/12/sys/compat/linuxkpi/common/src/linux_pci.c ============================================================================== --- stable/12/sys/compat/linuxkpi/common/src/linux_pci.c Sat May 18 12:27:22 2019 (r347953) +++ stable/12/sys/compat/linuxkpi/common/src/linux_pci.c Sat May 18 13:27:09 2019 (r347954) @@ -330,3 +330,19 @@ linux_pci_unregister_driver(struct pci_driver *pdrv) devclass_delete_driver(bus, &pdrv->bsddriver); mtx_unlock(&Giant); } + +void +linux_pci_unregister_drm_driver(struct pci_driver *pdrv) +{ + devclass_t bus; + + bus = devclass_find("vgapci"); + + spin_lock(&pci_lock); + list_del(&pdrv->links); + spin_unlock(&pci_lock); + mtx_lock(&Giant); + if (bus != NULL) + devclass_delete_driver(bus, &pdrv->bsddriver); + mtx_unlock(&Giant); +} From owner-svn-src-stable@freebsd.org Sat May 18 13:39:55 2019 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 71C2F158B6E1; Sat, 18 May 2019 13:39:55 +0000 (UTC) (envelope-from hps@selasky.org) Received: from mail.turbocat.net (turbocat.net [IPv6:2a01:4f8:c17:6c4b::2]) (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 E9FC982C8F; Sat, 18 May 2019 13:39:54 +0000 (UTC) (envelope-from hps@selasky.org) Received: from hps2016.home.selasky.org (unknown [176.74.212.121]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.turbocat.net (Postfix) with ESMTPSA id 86FA52601B1; Sat, 18 May 2019 15:39:52 +0200 (CEST) Subject: Re: svn commit: r347954 - in stable/12/sys/compat/linuxkpi/common: include/linux src To: Johannes Lundberg , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org References: <201905181327.x4IDR9EK005864@repo.freebsd.org> From: Hans Petter Selasky Message-ID: Date: Sat, 18 May 2019 15:39:23 +0200 User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:60.0) Gecko/20100101 Thunderbird/60.6.1 MIME-Version: 1.0 In-Reply-To: <201905181327.x4IDR9EK005864@repo.freebsd.org> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit X-Rspamd-Queue-Id: E9FC982C8F X-Spamd-Bar: ------ Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-6.99 / 15.00]; NEURAL_HAM_MEDIUM(-1.00)[-0.999,0]; NEURAL_HAM_SHORT(-0.99)[-0.989,0]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; REPLY(-4.00)[] X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 18 May 2019 13:39:55 -0000 On 2019-05-18 15:27, Johannes Lundberg wrote: > Author: johalun > Date: Sat May 18 13:27:09 2019 > New Revision: 347954 > URL: https://svnweb.freebsd.org/changeset/base/347954 > > Log: > MFC > ------------------------------------------------------------------------ > r347470 | johalun | 2019-05-10 16:10:22 -0700 (Fri, 10 May 2019) | 9 lines > > Implement linux_pci_unregister_drm_driver in linuxkpi so that drm drivers > can be unloaded. > > This patch is a part of D19565. > > Reviewed by: hps > Approved by: imp (mentor), hps > MFC after: 1 week > > ------------------------------------------------------------------------ > > Modified: > stable/12/sys/compat/linuxkpi/common/include/linux/pci.h > stable/12/sys/compat/linuxkpi/common/src/linux_pci.c > Directory Properties: > stable/12/ (props changed) > > Modified: stable/12/sys/compat/linuxkpi/common/include/linux/pci.h > ============================================================================== > --- stable/12/sys/compat/linuxkpi/common/include/linux/pci.h Sat May 18 12:27:22 2019 (r347953) > +++ stable/12/sys/compat/linuxkpi/common/include/linux/pci.h Sat May 18 13:27:09 2019 (r347954) > @@ -521,6 +521,7 @@ pci_write_config_dword(struct pci_dev *pdev, int where > int linux_pci_register_driver(struct pci_driver *pdrv); > int linux_pci_register_drm_driver(struct pci_driver *pdrv); > void linux_pci_unregister_driver(struct pci_driver *pdrv); > +void linux_pci_unregister_drm_driver(struct pci_driver *pdrv); > > #define pci_register_driver(pdrv) linux_pci_register_driver(pdrv) > #define pci_unregister_driver(pdrv) linux_pci_unregister_driver(pdrv) > > Modified: stable/12/sys/compat/linuxkpi/common/src/linux_pci.c > ============================================================================== > --- stable/12/sys/compat/linuxkpi/common/src/linux_pci.c Sat May 18 12:27:22 2019 (r347953) > +++ stable/12/sys/compat/linuxkpi/common/src/linux_pci.c Sat May 18 13:27:09 2019 (r347954) > @@ -330,3 +330,19 @@ linux_pci_unregister_driver(struct pci_driver *pdrv) > devclass_delete_driver(bus, &pdrv->bsddriver); > mtx_unlock(&Giant); > } > + > +void > +linux_pci_unregister_drm_driver(struct pci_driver *pdrv) > +{ > + devclass_t bus; > + > + bus = devclass_find("vgapci"); > + > + spin_lock(&pci_lock); > + list_del(&pdrv->links); > + spin_unlock(&pci_lock); > + mtx_lock(&Giant); > + if (bus != NULL) > + devclass_delete_driver(bus, &pdrv->bsddriver); > + mtx_unlock(&Giant); > +} > > Please also MFC to 11-stable. --HPS From owner-svn-src-stable@freebsd.org Sat May 18 17:30:04 2019 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 50AAE159318D; Sat, 18 May 2019 17:30:04 +0000 (UTC) (envelope-from brooks@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 E67978A426; Sat, 18 May 2019 17:30:03 +0000 (UTC) (envelope-from brooks@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 B8B1E22AEB; Sat, 18 May 2019 17:30:03 +0000 (UTC) (envelope-from brooks@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x4IHU3oR032171; Sat, 18 May 2019 17:30:03 GMT (envelope-from brooks@FreeBSD.org) Received: (from brooks@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x4IHU3Yg032170; Sat, 18 May 2019 17:30:03 GMT (envelope-from brooks@FreeBSD.org) Message-Id: <201905181730.x4IHU3Yg032170@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: brooks set sender to brooks@FreeBSD.org using -f From: Brooks Davis Date: Sat, 18 May 2019 17:30:03 +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: r347959 - stable/12/share/man/man4 X-SVN-Group: stable-12 X-SVN-Commit-Author: brooks X-SVN-Commit-Paths: stable/12/share/man/man4 X-SVN-Commit-Revision: 347959 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: E67978A426 X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.98 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.999,0]; NEURAL_HAM_SHORT(-0.98)[-0.977,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US]; NEURAL_HAM_LONG(-1.00)[-1.000,0] X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 18 May 2019 17:30:04 -0000 Author: brooks Date: Sat May 18 17:30:03 2019 New Revision: 347959 URL: https://svnweb.freebsd.org/changeset/base/347959 Log: MFC r347940 Remove the notice that ae(4) will be removed in FreeBSD 13. Modified: stable/12/share/man/man4/ae.4 Directory Properties: stable/12/ (props changed) Modified: stable/12/share/man/man4/ae.4 ============================================================================== --- stable/12/share/man/man4/ae.4 Sat May 18 17:13:08 2019 (r347958) +++ stable/12/share/man/man4/ae.4 Sat May 18 17:30:03 2019 (r347959) @@ -24,7 +24,7 @@ .\" .\" $FreeBSD$ .\" -.Dd October 24, 2018 +.Dd May 17, 2019 .Dt AE 4 .Os .Sh NAME @@ -44,14 +44,6 @@ module at boot time, place the following line in .Bd -literal -offset indent if_ae_load="YES" .Ed -.Sh DEPRECATION NOTICE -The -.Nm -driver is not present in -.Fx 13.0 -and later. -See https://github.com/freebsd/fcp/blob/master/fcp-0101.md for more -information. .Sh DESCRIPTION The .Nm From owner-svn-src-stable@freebsd.org Sat May 18 20:43:21 2019 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 11F561597D1D; Sat, 18 May 2019 20:43:21 +0000 (UTC) (envelope-from brooks@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 9EDD18FFC8; Sat, 18 May 2019 20:43:20 +0000 (UTC) (envelope-from brooks@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 724B024E46; Sat, 18 May 2019 20:43:20 +0000 (UTC) (envelope-from brooks@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x4IKhKQW038276; Sat, 18 May 2019 20:43:20 GMT (envelope-from brooks@FreeBSD.org) Received: (from brooks@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x4IKhDdD038241; Sat, 18 May 2019 20:43:13 GMT (envelope-from brooks@FreeBSD.org) Message-Id: <201905182043.x4IKhDdD038241@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: brooks set sender to brooks@FreeBSD.org using -f From: Brooks Davis Date: Sat, 18 May 2019 20:43:13 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r347962 - in stable/11: share/man/man4 share/man/man4/man4.i386 share/man/man4/man4.powerpc sys/dev/bm sys/dev/cs sys/dev/de sys/dev/ed sys/dev/ep sys/dev/ex sys/dev/fe sys/dev/pcn sys/... X-SVN-Group: stable-11 X-SVN-Commit-Author: brooks X-SVN-Commit-Paths: in stable/11: share/man/man4 share/man/man4/man4.i386 share/man/man4/man4.powerpc sys/dev/bm sys/dev/cs sys/dev/de sys/dev/ed sys/dev/ep sys/dev/ex sys/dev/fe sys/dev/pcn sys/dev/sf sys/dev/sn sys/dev... X-SVN-Commit-Revision: 347962 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 9EDD18FFC8 X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.95 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.998,0]; NEURAL_HAM_SHORT(-0.96)[-0.955,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US]; NEURAL_HAM_LONG(-1.00)[-1.000,0] X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 18 May 2019 20:43:21 -0000 Author: brooks Date: Sat May 18 20:43:13 2019 New Revision: 347962 URL: https://svnweb.freebsd.org/changeset/base/347962 Log: MFC r339703, r347365, r347703, r347940 r339703: Deprecate a number of less used 10 and 10/100 Ethernet devices. The current deprecated list is: ae, bm, cs, de, dme, ed, ep, ex, fe, pcn, sf, sn, tl, tx, txp, vx, wb, xe The list as refined as part of FCP-0101. Per the FCP, devices may be removed from the deprecation list if enough users are found or they are converted to iflib. FCP: https://github.com/freebsd/fcp/blob/master/fcp-0101.md r347365: Update dme(4) to reflect that it will not be removed due to FCP-101. dme(4) is the built-in NIC on a couple non-expandable mips platforms and thus should remain. The FCP has been updated to reflect this fact. Discussed with: imp r347703: FCP-101: ae(4) is sufficently popular to be moved to the keep list. r347940: Remove the notice that ae(4) will be removed in FreeBSD 13. MFC requested by: rgrimes Approved by: re (kib) Modified: stable/11/share/man/man4/de.4 stable/11/share/man/man4/ed.4 stable/11/share/man/man4/man4.i386/cs.4 stable/11/share/man/man4/man4.i386/ep.4 stable/11/share/man/man4/man4.i386/ex.4 stable/11/share/man/man4/man4.i386/fe.4 stable/11/share/man/man4/man4.i386/vx.4 stable/11/share/man/man4/man4.powerpc/bm.4 stable/11/share/man/man4/pcn.4 stable/11/share/man/man4/sf.4 stable/11/share/man/man4/sn.4 stable/11/share/man/man4/tl.4 stable/11/share/man/man4/tx.4 stable/11/share/man/man4/txp.4 stable/11/share/man/man4/wb.4 stable/11/share/man/man4/xe.4 stable/11/sys/dev/bm/if_bm.c stable/11/sys/dev/cs/if_cs.c stable/11/sys/dev/de/if_de.c stable/11/sys/dev/ed/if_ed.c stable/11/sys/dev/ep/if_ep.c stable/11/sys/dev/ex/if_ex.c stable/11/sys/dev/fe/if_fe.c stable/11/sys/dev/pcn/if_pcn.c stable/11/sys/dev/sf/if_sf.c stable/11/sys/dev/sn/if_sn.c stable/11/sys/dev/tl/if_tl.c stable/11/sys/dev/tx/if_tx.c stable/11/sys/dev/txp/if_txp.c stable/11/sys/dev/vx/if_vx.c stable/11/sys/dev/wb/if_wb.c stable/11/sys/dev/xe/if_xe.c stable/11/sys/sys/systm.h Directory Properties: stable/11/ (props changed) Modified: stable/11/share/man/man4/de.4 ============================================================================== --- stable/11/share/man/man4/de.4 Sat May 18 19:36:23 2019 (r347961) +++ stable/11/share/man/man4/de.4 Sat May 18 20:43:13 2019 (r347962) @@ -25,7 +25,7 @@ .\" .\" $FreeBSD$ .\" -.Dd July 16, 2005 +.Dd October 24, 2018 .Dt DE 4 .Os .Sh NAME @@ -45,6 +45,14 @@ module at boot time, place the following line in .Bd -literal -offset indent if_de_load="YES" .Ed +.Sh DEPRECATION NOTICE +The +.Nm +driver is not present in +.Fx 13.0 +and later. +See https://github.com/freebsd/fcp/blob/master/fcp-0101.md for more +information. .Sh DESCRIPTION The .Nm Modified: stable/11/share/man/man4/ed.4 ============================================================================== --- stable/11/share/man/man4/ed.4 Sat May 18 19:36:23 2019 (r347961) +++ stable/11/share/man/man4/ed.4 Sat May 18 20:43:13 2019 (r347962) @@ -30,7 +30,7 @@ .\" .\" $FreeBSD$ .\" -.Dd February 25, 2012 +.Dd October 24, 2018 .Dt ED 4 .Os .Sh NAME @@ -51,6 +51,14 @@ module at boot time, place the following line in .Bd -literal -offset indent if_ed_load="YES" .Ed +.Sh DEPRECATION NOTICE +The +.Nm +driver is not present in +.Fx 13.0 +and later. +See https://github.com/freebsd/fcp/blob/master/fcp-0101.md for more +information. .Sh DESCRIPTION The .Nm Modified: stable/11/share/man/man4/man4.i386/cs.4 ============================================================================== --- stable/11/share/man/man4/man4.i386/cs.4 Sat May 18 19:36:23 2019 (r347961) +++ stable/11/share/man/man4/man4.i386/cs.4 Sat May 18 20:43:13 2019 (r347962) @@ -25,7 +25,7 @@ .\" .\" $FreeBSD$ .\" -.Dd July 16, 2005 +.Dd October 24 2018 .Dt CS 4 i386 .Os .Sh NAME @@ -52,6 +52,14 @@ In .Cd hint.cs.0.port="0x300" .Cd hint.cs.0.irq="10" .Cd hint.cs.0.maddr="0xd000" +.Sh DEPRECATION NOTICE +The +.Nm +driver is not present in +.Fx 13.0 +and later. +See https://github.com/freebsd/fcp/blob/master/fcp-0101.md for more +information. .Sh DESCRIPTION The .Nm Modified: stable/11/share/man/man4/man4.i386/ep.4 ============================================================================== --- stable/11/share/man/man4/man4.i386/ep.4 Sat May 18 19:36:23 2019 (r347961) +++ stable/11/share/man/man4/man4.i386/ep.4 Sat May 18 20:43:13 2019 (r347962) @@ -29,7 +29,7 @@ .\" .\" $FreeBSD$ .\" -.Dd April 1, 2011 +.Dd October 24, 2018 .Dt EP 4 i386 .Os .Sh NAME @@ -49,6 +49,14 @@ module at boot time, place the following line in .Bd -literal -offset indent if_ep_load="YES" .Ed +.Sh DEPRECATION NOTICE +The +.Nm +driver is not present in +.Fx 13.0 +and later. +See https://github.com/freebsd/fcp/blob/master/fcp-0101.md for more +information. .Sh DESCRIPTION The .Nm Modified: stable/11/share/man/man4/man4.i386/ex.4 ============================================================================== --- stable/11/share/man/man4/man4.i386/ex.4 Sat May 18 19:36:23 2019 (r347961) +++ stable/11/share/man/man4/man4.i386/ex.4 Sat May 18 20:43:13 2019 (r347962) @@ -25,7 +25,7 @@ .\" .\" $FreeBSD$ .\" -.Dd July 16, 2005 +.Dd October 24, 2018 .Dt EX 4 i386 .Os .Sh NAME @@ -45,6 +45,14 @@ module at boot time, place the following line in .Bd -literal -offset indent if_ex_load="YES" .Ed +.Sh DEPRECATION NOTICE +The +.Nm +driver is not present in +.Fx 13.0 +and later. +See https://github.com/freebsd/fcp/blob/master/fcp-0101.md for more +information. .Sh DESCRIPTION The .Nm Modified: stable/11/share/man/man4/man4.i386/fe.4 ============================================================================== --- stable/11/share/man/man4/man4.i386/fe.4 Sat May 18 19:36:23 2019 (r347961) +++ stable/11/share/man/man4/man4.i386/fe.4 Sat May 18 20:43:13 2019 (r347962) @@ -22,7 +22,7 @@ .\" for fe driver. .\" .\" $FreeBSD$ -.Dd July 16, 2005 +.Dd October 24, 2018 .Dt FE 4 i386 .Os .Sh NAME @@ -48,6 +48,14 @@ In .Cd hint.fe.0.at="isa" .Cd hint.fe.0.port="0x300" .Cd hint.fe.0.flags="0x0" +.Sh DEPRECATION NOTICE +The +.Nm +driver is not present in +.Fx 13.0 +and later. +See https://github.com/freebsd/fcp/blob/master/fcp-0101.md for more +information. .Sh DESCRIPTION The .Nm Modified: stable/11/share/man/man4/man4.i386/vx.4 ============================================================================== --- stable/11/share/man/man4/man4.i386/vx.4 Sat May 18 19:36:23 2019 (r347961) +++ stable/11/share/man/man4/man4.i386/vx.4 Sat May 18 20:43:13 2019 (r347962) @@ -30,7 +30,7 @@ .\" .\" $FreeBSD$ .\" -.Dd July 16, 2005 +.Dd October 24, 2018 .Dt VX 4 i386 .Os .Sh NAME @@ -50,6 +50,14 @@ module at boot time, place the following line in .Bd -literal -offset indent if_vx_load="YES" .Ed +.Sh DEPRECATION NOTICE +The +.Nm +driver is not present in +.Fx 13.0 +and later. +See https://github.com/freebsd/fcp/blob/master/fcp-0101.md for more +information. .Sh DESCRIPTION The .Nm Modified: stable/11/share/man/man4/man4.powerpc/bm.4 ============================================================================== --- stable/11/share/man/man4/man4.powerpc/bm.4 Sat May 18 19:36:23 2019 (r347961) +++ stable/11/share/man/man4/man4.powerpc/bm.4 Sat May 18 20:43:13 2019 (r347962) @@ -25,7 +25,7 @@ .\" .\" $FreeBSD$ .\" -.Dd July 3, 2008 +.Dd October 24, 2018 .Dt BM 4 .Os .Sh NAME @@ -46,6 +46,14 @@ module at boot time, place the following line in .Bd -literal -offset indent if_bm_load="YES" .Ed +.Sh DEPRECATION NOTICE +The +.Nm +driver is not present in +.Fx 13.0 +and later. +See https://github.com/freebsd/fcp/blob/master/fcp-0101.md for more +information. .Sh DESCRIPTION The .Nm Modified: stable/11/share/man/man4/pcn.4 ============================================================================== --- stable/11/share/man/man4/pcn.4 Sat May 18 19:36:23 2019 (r347961) +++ stable/11/share/man/man4/pcn.4 Sat May 18 20:43:13 2019 (r347962) @@ -31,7 +31,7 @@ .\" .\" $FreeBSD$ .\" -.Dd January 31, 2006 +.Dd October 24, 2018 .Dt PCN 4 .Os .Sh NAME @@ -52,6 +52,14 @@ module at boot time, place the following line in .Bd -literal -offset indent if_pcn_load="YES" .Ed +.Sh DEPRECATION NOTICE +The +.Nm +driver is not present in +.Fx 13.0 +and later. +See https://github.com/freebsd/fcp/blob/master/fcp-0101.md for more +information. .Sh DESCRIPTION The .Nm Modified: stable/11/share/man/man4/sf.4 ============================================================================== --- stable/11/share/man/man4/sf.4 Sat May 18 19:36:23 2019 (r347961) +++ stable/11/share/man/man4/sf.4 Sat May 18 20:43:13 2019 (r347962) @@ -30,7 +30,7 @@ .\" .\" $FreeBSD$ .\" -.Dd January 21, 2008 +.Dd October 24, 2018 .Dt SF 4 .Os .Sh NAME @@ -53,6 +53,14 @@ module at boot time, place the following line in .Bd -literal -offset indent if_sf_load="YES" .Ed +.Sh DEPRECATION NOTICE +The +.Nm +driver is not present in +.Fx 13.0 +and later. +See https://github.com/freebsd/fcp/blob/master/fcp-0101.md for more +information. .Sh DESCRIPTION The .Nm Modified: stable/11/share/man/man4/sn.4 ============================================================================== --- stable/11/share/man/man4/sn.4 Sat May 18 19:36:23 2019 (r347961) +++ stable/11/share/man/man4/sn.4 Sat May 18 20:43:13 2019 (r347962) @@ -24,7 +24,7 @@ .\" .\" $FreeBSD$ .\" -.Dd July 16, 2005 +.Dd October 24, 2018 .Dt SN 4 .Os .Sh NAME @@ -44,6 +44,14 @@ module at boot time, place the following line in .Bd -literal -offset indent if_sn_load="YES" .Ed +.Sh DEPRECATION NOTICE +The +.Nm +driver is not present in +.Fx 13.0 +and later. +See https://github.com/freebsd/fcp/blob/master/fcp-0101.md for more +information. .Sh DESCRIPTION The .Nm Modified: stable/11/share/man/man4/tl.4 ============================================================================== --- stable/11/share/man/man4/tl.4 Sat May 18 19:36:23 2019 (r347961) +++ stable/11/share/man/man4/tl.4 Sat May 18 20:43:13 2019 (r347962) @@ -30,7 +30,7 @@ .\" .\" $FreeBSD$ .\" -.Dd July 16, 2005 +.Dd October 24, 2018 .Dt TL 4 .Os .Sh NAME @@ -51,6 +51,14 @@ module at boot time, place the following line in .Bd -literal -offset indent if_tl_load="YES" .Ed +.Sh DEPRECATION NOTICE +The +.Nm +driver is not present in +.Fx 13.0 +and later. +See https://github.com/freebsd/fcp/blob/master/fcp-0101.md for more +information. .Sh DESCRIPTION The .Nm Modified: stable/11/share/man/man4/tx.4 ============================================================================== --- stable/11/share/man/man4/tx.4 Sat May 18 19:36:23 2019 (r347961) +++ stable/11/share/man/man4/tx.4 Sat May 18 20:43:13 2019 (r347962) @@ -25,7 +25,7 @@ .\" .\" $FreeBSD$ .\" -.Dd July 16, 2005 +.Dd October 24, 2018 .Dt TX 4 .Os .Sh NAME @@ -46,6 +46,14 @@ module at boot time, place the following line in .Bd -literal -offset indent if_tx_load="YES" .Ed +.Sh DEPRECATION NOTICE +The +.Nm +driver is not present in +.Fx 13.0 +and later. +See https://github.com/freebsd/fcp/blob/master/fcp-0101.md for more +information. .Sh DESCRIPTION The .Nm Modified: stable/11/share/man/man4/txp.4 ============================================================================== --- stable/11/share/man/man4/txp.4 Sat May 18 19:36:23 2019 (r347961) +++ stable/11/share/man/man4/txp.4 Sat May 18 20:43:13 2019 (r347962) @@ -26,7 +26,7 @@ .\" .\" $FreeBSD$ .\" -.Dd January 26, 2012 +.Dd October 24, 2018 .Dt TXP 4 .Os .Sh NAME @@ -46,6 +46,14 @@ module at boot time, place the following line in .Bd -literal -offset indent if_txp_load="YES" .Ed +.Sh DEPRECATION NOTICE +The +.Nm +driver is not present in +.Fx 13.0 +and later. +See https://github.com/freebsd/fcp/blob/master/fcp-0101.md for more +information. .Sh DESCRIPTION The .Nm Modified: stable/11/share/man/man4/wb.4 ============================================================================== --- stable/11/share/man/man4/wb.4 Sat May 18 19:36:23 2019 (r347961) +++ stable/11/share/man/man4/wb.4 Sat May 18 20:43:13 2019 (r347962) @@ -30,7 +30,7 @@ .\" .\" $FreeBSD$ .\" -.Dd July 16, 2005 +.Dd October 24, 2018 .Dt WB 4 .Os .Sh NAME @@ -51,6 +51,14 @@ module at boot time, place the following line in .Bd -literal -offset indent if_wb_load="YES" .Ed +.Sh DEPRECATION NOTICE +The +.Nm +driver is not present in +.Fx 13.0 +and later. +See https://github.com/freebsd/fcp/blob/master/fcp-0101.md for more +information. .Sh DESCRIPTION The .Nm Modified: stable/11/share/man/man4/xe.4 ============================================================================== --- stable/11/share/man/man4/xe.4 Sat May 18 19:36:23 2019 (r347961) +++ stable/11/share/man/man4/xe.4 Sat May 18 20:43:13 2019 (r347962) @@ -25,7 +25,7 @@ .\" .\" $FreeBSD$ .\" -.Dd July 16, 2005 +.Dd October 24 2018 .Dt XE 4 .Os .Sh NAME @@ -45,6 +45,14 @@ module at boot time, place the following line in .Bd -literal -offset indent if_xe_load="YES" .Ed +.Sh DEPRECATION NOTICE +The +.Nm +driver is not present in +.Fx 13.0 +and later. +See https://github.com/freebsd/fcp/blob/master/fcp-0101.md for more +information. .Sh DESCRIPTION The .Nm Modified: stable/11/sys/dev/bm/if_bm.c ============================================================================== --- stable/11/sys/dev/bm/if_bm.c Sat May 18 19:36:23 2019 (r347961) +++ stable/11/sys/dev/bm/if_bm.c Sat May 18 20:43:13 2019 (r347962) @@ -481,6 +481,8 @@ bm_attach(device_t dev) ether_ifattach(ifp, sc->sc_enaddr); ifp->if_hwassist = 0; + gone_by_fcp101_dev(dev); + return (0); } Modified: stable/11/sys/dev/cs/if_cs.c ============================================================================== --- stable/11/sys/dev/cs/if_cs.c Sat May 18 19:36:23 2019 (r347961) +++ stable/11/sys/dev/cs/if_cs.c Sat May 18 20:43:13 2019 (r347962) @@ -572,6 +572,8 @@ cs_attach(device_t dev) return (error); } + gone_by_fcp101_dev(dev); + return (0); } Modified: stable/11/sys/dev/de/if_de.c ============================================================================== --- stable/11/sys/dev/de/if_de.c Sat May 18 19:36:23 2019 (r347961) +++ stable/11/sys/dev/de/if_de.c Sat May 18 20:43:13 2019 (r347962) @@ -4430,6 +4430,8 @@ tulip_attach(tulip_softc_t * const sc) TULIP_LOCK(sc); sc->tulip_flags &= ~TULIP_DEVICEPROBE; TULIP_UNLOCK(sc); + + gone_by_fcp101_dev(sc->tulip_dev); } /* Release memory for a single descriptor ring. */ Modified: stable/11/sys/dev/ed/if_ed.c ============================================================================== --- stable/11/sys/dev/ed/if_ed.c Sat May 18 19:36:23 2019 (r347961) +++ stable/11/sys/dev/ed/if_ed.c Sat May 18 20:43:13 2019 (r347962) @@ -363,6 +363,9 @@ ed_attach(device_t dev) #endif printf("\n"); } + + gone_by_fcp101_dev(dev); + return (0); } Modified: stable/11/sys/dev/ep/if_ep.c ============================================================================== --- stable/11/sys/dev/ep/if_ep.c Sat May 18 19:36:23 2019 (r347961) +++ stable/11/sys/dev/ep/if_ep.c Sat May 18 20:43:13 2019 (r347962) @@ -348,6 +348,8 @@ ep_attach(struct ep_softc *sc) epstop(sc); EP_UNLOCK(sc); + gone_by_fcp101_dev(sc->dev); + return (0); } Modified: stable/11/sys/dev/ex/if_ex.c ============================================================================== --- stable/11/sys/dev/ex/if_ex.c Sat May 18 19:36:23 2019 (r347961) +++ stable/11/sys/dev/ex/if_ex.c Sat May 18 20:43:13 2019 (r347962) @@ -274,6 +274,8 @@ ex_attach(device_t dev) return (error); } + gone_by_fcp101_dev(dev); + return(0); } Modified: stable/11/sys/dev/fe/if_fe.c ============================================================================== --- stable/11/sys/dev/fe/if_fe.c Sat May 18 19:36:23 2019 (r347961) +++ stable/11/sys/dev/fe/if_fe.c Sat May 18 20:43:13 2019 (r347962) @@ -870,6 +870,8 @@ fe_attach (device_t dev) if (sc->stability & UNSTABLE_TYPE) device_printf(dev, "warning: hardware type was not validated\n"); + gone_by_fcp101_dev(dev); + return 0; } Modified: stable/11/sys/dev/pcn/if_pcn.c ============================================================================== --- stable/11/sys/dev/pcn/if_pcn.c Sat May 18 19:36:23 2019 (r347961) +++ stable/11/sys/dev/pcn/if_pcn.c Sat May 18 20:43:13 2019 (r347962) @@ -680,6 +680,8 @@ fail: if (error) pcn_detach(dev); + gone_by_fcp101_dev(dev); + return(error); } Modified: stable/11/sys/dev/sf/if_sf.c ============================================================================== --- stable/11/sys/dev/sf/if_sf.c Sat May 18 19:36:23 2019 (r347961) +++ stable/11/sys/dev/sf/if_sf.c Sat May 18 20:43:13 2019 (r347962) @@ -914,6 +914,8 @@ sf_attach(device_t dev) goto fail; } + gone_by_fcp101_dev(dev); + fail: if (error) sf_detach(dev); Modified: stable/11/sys/dev/sn/if_sn.c ============================================================================== --- stable/11/sys/dev/sn/if_sn.c Sat May 18 19:36:23 2019 (r347961) +++ stable/11/sys/dev/sn/if_sn.c Sat May 18 20:43:13 2019 (r347962) @@ -225,6 +225,9 @@ sn_attach(device_t dev) sn_detach(dev); return err; } + + gone_by_fcp101_dev(dev); + return 0; } Modified: stable/11/sys/dev/tl/if_tl.c ============================================================================== --- stable/11/sys/dev/tl/if_tl.c Sat May 18 19:36:23 2019 (r347961) +++ stable/11/sys/dev/tl/if_tl.c Sat May 18 20:43:13 2019 (r347962) @@ -1239,6 +1239,8 @@ tl_attach(dev) goto fail; } + gone_by_fcp101_dev(dev); + fail: if (error) tl_detach(dev); Modified: stable/11/sys/dev/tx/if_tx.c ============================================================================== --- stable/11/sys/dev/tx/if_tx.c Sat May 18 19:36:23 2019 (r347961) +++ stable/11/sys/dev/tx/if_tx.c Sat May 18 20:43:13 2019 (r347962) @@ -426,6 +426,8 @@ epic_attach(device_t dev) goto fail; } + gone_by_fcp101_dev(dev); + return (0); fail: epic_release(sc); Modified: stable/11/sys/dev/txp/if_txp.c ============================================================================== --- stable/11/sys/dev/txp/if_txp.c Sat May 18 19:36:23 2019 (r347961) +++ stable/11/sys/dev/txp/if_txp.c Sat May 18 20:43:13 2019 (r347962) @@ -471,6 +471,8 @@ txp_attach(device_t dev) goto fail; } + gone_by_fcp101_dev(dev); + return (0); fail: Modified: stable/11/sys/dev/vx/if_vx.c ============================================================================== --- stable/11/sys/dev/vx/if_vx.c Sat May 18 19:36:23 2019 (r347961) +++ stable/11/sys/dev/vx/if_vx.c Sat May 18 20:43:13 2019 (r347962) @@ -204,6 +204,8 @@ vx_attach(device_t dev) vx_stop(sc); VX_UNLOCK(sc); + gone_by_fcp101_dev(dev); + return 1; } Modified: stable/11/sys/dev/wb/if_wb.c ============================================================================== --- stable/11/sys/dev/wb/if_wb.c Sat May 18 19:36:23 2019 (r347961) +++ stable/11/sys/dev/wb/if_wb.c Sat May 18 20:43:13 2019 (r347962) @@ -692,6 +692,8 @@ wb_attach(dev) goto fail; } + gone_by_fcp101_dev(dev); + fail: if (error) wb_detach(dev); Modified: stable/11/sys/dev/xe/if_xe.c ============================================================================== --- stable/11/sys/dev/xe/if_xe.c Sat May 18 19:36:23 2019 (r347961) +++ stable/11/sys/dev/xe/if_xe.c Sat May 18 20:43:13 2019 (r347962) @@ -315,6 +315,8 @@ xe_attach(device_t dev) return (err); } + gone_by_fcp101_dev(dev); + /* Done */ return (0); } Modified: stable/11/sys/sys/systm.h ============================================================================== --- stable/11/sys/sys/systm.h Sat May 18 19:36:23 2019 (r347961) +++ stable/11/sys/sys/systm.h Sat May 18 20:43:13 2019 (r347962) @@ -482,6 +482,9 @@ void _gone_in_dev(struct device *dev, int major, const #endif #define gone_in(major, msg) __gone_ok(major, msg) _gone_in(major, msg) #define gone_in_dev(dev, major, msg) __gone_ok(major, msg) _gone_in_dev(dev, major, msg) +#define gone_by_fcp101_dev(dev) \ + gone_in_dev((dev), 13, \ + "see https://github.com/freebsd/fcp/blob/master/fcp-0101.md") __NULLABILITY_PRAGMA_POP